Skip to content

Commit 7fc16c1

Browse files
committed
ram: adjusted tap distance calculation
Signed-off-by: braydenl9988 <[email protected]>
1 parent a9d47b4 commit 7fc16c1

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/ram/src/ram.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,14 @@ void RamGen::generate(const int bytes_per_word,
571571
auto tapcell_layout = generateTapColumn(word_count, 0);
572572
ram_grid.insertLayout(std::move(tapcell_layout), 0);
573573
} else {
574-
int nearest_tap = 0;
574+
// needed this calculation so first cells have right distance
575+
int nearest_tap = (max_tap_dist / ram_grid.getWidth()) * ram_grid.getLayoutWidth(0);
575576
int tapcell_count = 0;
577+
// x distance between transistor and tapcell means 2x distance between tapcells
578+
max_tap_dist *= 2;
576579
// iterates through each of the columns
577580
for (int col = 0; col < ram_grid.numLayouts(); ++col) {
578-
if (nearest_tap >= max_tap_dist) {
581+
if (nearest_tap + ram_grid.getLayoutWidth(col) >= max_tap_dist) {
579582
//if the nearest_tap is too far, generate tap column
580583
auto tapcell_layout = generateTapColumn(word_count, tapcell_count);
581584
ram_grid.insertLayout(std::move(tapcell_layout), col);
@@ -585,7 +588,13 @@ void RamGen::generate(const int bytes_per_word,
585588
}
586589
nearest_tap += ram_grid.getLayoutWidth(col);
587590
}
591+
// check for last column in the grid
592+
if (nearest_tap >= max_tap_dist / 2) {
593+
auto tapcell_layout = generateTapColumn(word_count, tapcell_count);
594+
ram_grid.addLayout(std::move(tapcell_layout));
595+
}
588596
}
597+
589598
}
590599

591600
ram_grid.gridInit();

src/ram/src/ram.tcl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ proc generate_ram_netlist { args } {
5252
if { [info exists keys(-tapcell)] } {
5353
if { [info exists keys(-max_tap_dist)] } {
5454
set max_tap_dist $keys(-max_tap_dist)
55-
set max_tap_dist [expr $max_tap_dist * 1000]
55+
set max_tap_dist [ord::microns_to_dbu $max_tap_dist]
5656
} else {
5757
utl::error RAM 21 "The -max_tap_dist argument must be specified with tapcell."
5858
}
5959
set tapcell $keys(-tapcell)
6060
} else {
61-
utl::info RAM 22 "No tapcell is specified. The generated layout may not pass Design Rule Checks."
61+
utl::info RAM 22 "No tapcell is specified.
62+
The generated layout may not pass Design Rule Checks."
6263
}
6364

6465
ram::generate_ram_netlist_cmd $bytes_per_word $word_count $storage_cell \

src/ram/test/make_8x8.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ generate_ram \
2020
-filler_cells {sky130_fd_sc_hd__fill_1 sky130_fd_sc_hd__fill_2 \
2121
sky130_fd_sc_hd__fill_4 sky130_fd_sc_hd__fill_8} \
2222
-tapcell sky130_fd_sc_hd__tap_1 \
23-
-max_tap_dist 30
23+
-max_tap_dist 15
2424

2525
set lef_file [make_result_file make_8x8.lef]
2626
write_abstract_lef $lef_file

0 commit comments

Comments
 (0)