|
1 | | -# fish out values from single source of truth: config.py |
2 | | -set vals [regexp -all -inline {\S+} [exec sh -c {cd designs/asap7/mock-array && python3 -c "import config;print(f'{config.rows} {config.cols} {config.pitch_x} {config.pitch_y} {config.array_offset_x} {config.array_offset_y} {config.placement_grid_x} {config.placement_grid_y}')"}]] |
3 | | -lassign $vals rows cols pitch_x pitch_y array_offset_x array_offset_y placement_grid_x placement_grid_y |
| 1 | +# Define the variables x and y for the offset |
4 | 2 |
|
5 | 3 | set block [ord::get_db_block] |
6 | | -set units [$block getDefUnits] |
| 4 | +set core [$block getCoreArea] |
7 | 5 |
|
8 | | -for {set row 0} {$row < $rows} {incr row} { |
9 | | - for {set col 0} {$col < $cols} {incr col} { |
10 | | - set inst [$block findInst [format "ces_%d_%d" $row $col]] |
| 6 | +set element [lindex [find_macros] 0] |
| 7 | +set bbox [$element getBBox] |
11 | 8 |
|
12 | | - set x [expr round((($array_offset_x + (($placement_grid_x * $pitch_x) * $col)) * $units))] |
13 | | - set y [expr round((($array_offset_y + (($placement_grid_y * $pitch_y) * $row)) * $units))] |
| 9 | +# Calculate the x and y pitch |
| 10 | +set x_pitch [$bbox getDX] |
| 11 | +set y_pitch [expr [$bbox getDY] + 4/[ord::dbu_to_microns 1]] |
14 | 12 |
|
15 | | - # belt and suspenders check... ASAP7 macro placement must be aligned to 0.048um |
16 | | - if {$x % 48 != 0} { |
17 | | - error "x=$x is not divisible by 48" |
18 | | - } |
19 | | - if {$y % 48 != 0} { |
20 | | - error "y=$y is not divisible by 48" |
21 | | - } |
| 13 | +# Define the base location |
| 14 | +set x_offset [expr [$core xMin] + ([$core dx] - (7 * $x_pitch) - [$bbox getDX])/2] |
| 15 | +set y_offset [expr [$core yMin] + ([$core dy] - (7 * $y_pitch) - [$bbox getDY])/2] |
22 | 16 |
|
23 | | - $inst setOrient R0 |
24 | | - $inst setOrigin $x $y |
25 | | - $inst setPlacementStatus FIRM |
26 | | - } |
| 17 | +# Loop through the 8x8 array, add the offset, and invoke place_macro |
| 18 | +for {set i 0} {$i < 8} {incr i} { |
| 19 | + for {set j 0} {$j < 8} {incr j} { |
| 20 | + set macro_name [format "ces_%d_%d" $i $j] |
| 21 | + set x_location [expr {$j * $x_pitch + $x_offset}] |
| 22 | + set y_location [expr {$i * $y_pitch + $y_offset}] |
| 23 | + place_macro -macro_name $macro_name -location [list [expr [ord::dbu_to_microns 1] * $x_location] [expr [ord::dbu_to_microns 1] * $y_location]] -orientation R0 |
| 24 | + } |
27 | 25 | } |
0 commit comments