Skip to content

Commit b4f73d0

Browse files
Modify user options for addition flexibility (#1142)
* Modify - to allow user control over additional attributes MOCK_ARRAY_ELEMENT_SIZE (width height) MOCK_ARRAY_ELEMENT_PITCH (x y) MOCK_ARRAY_TABLE (rows cols) Signed-off-by: louiic <[email protected]> * Modify - change usage of MOCK_ARRAY_TABLE Signed-off-by: louiic <[email protected]> * Modify example to conform to MOCK_ARRAY_TABL usage Signed-off-by: louiic <[email protected]> * Modify - pgrid_? to placement_grid_? Signed-off-by: louiic <[email protected]> * Modify - usage of MOCK_ARRAY_TABLE and subsequent call Signed-off-by: louiic <[email protected]> * Modify - usage of MOCK_ARRAY_TABLE now it includs row, cols, width, height, pitch_x and pitch_y Signed-off-by: louiic <[email protected]> * Modify - change user configurable variable to MOCK_ARRAY_TABLE to include rows, cols, width, height, pitch_x and pitch_y Signed-off-by: louiic <[email protected]> * Modify - change pgrid_? to placment_grid_? Signed-off-by: louiic <[email protected]> * To resolve merge issue. Signed-off-by: louiic <[email protected]> * Update OK Signed-off-by: louiic <[email protected]> --------- Signed-off-by: louiic <[email protected]> Signed-off-by: Louii Chaiyakul <[email protected]> Co-authored-by: louiic <[email protected]> Co-authored-by: Louii Chaiyakul <[email protected]>
1 parent 44ed4c1 commit b4f73d0

File tree

10 files changed

+262
-284
lines changed

10 files changed

+262
-284
lines changed

flow/designs/asap7/mock-array/Element/config.mk

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
include designs/asap7/mock-array/defaults.mk
22

3-
export DESIGN_NAME = Element
4-
export DESIGN_NICKNAME = mock-array_Element
3+
export DESIGN_NAME = Element
4+
export DESIGN_NICKNAME = mock-array_Element
55

6-
export VERILOG_FILES = designs/src/mock-array/*.v
7-
export SDC_FILE = designs/asap7/mock-array/Element/constraints.sdc
6+
export VERILOG_FILES = designs/src/mock-array/*.v
7+
export SDC_FILE = designs/asap7/mock-array/Element/constraints.sdc
88

99
export PLATFORM = asap7
1010

@@ -13,30 +13,27 @@ export GPL_TIMING_DRIVEN = 0
1313
export GPL_ROUTABILITY_DRIVEN = 0
1414

1515
export CORE_AREA = $(shell \
16-
export MOCK_ARRAY_HEIGHT=$(MOCK_ARRAY_HEIGHT) && \
17-
export MOCK_ARRAY_WIDTH=$(MOCK_ARRAY_WIDTH) && \
18-
export MOCK_ARRAY_PITCH_SCALE=$(MOCK_ARRAY_PITCH_SCALE) && \
19-
cd designs/asap7/mock-array && \
20-
python3 -c "import config; print(f'{config.ce_margin_x} {config.ce_margin_y} {config.ce_width - config.ce_margin_x} {config.ce_height - config.ce_margin_y}')")
16+
export MOCK_ARRAY_TABLE="$(MOCK_ARRAY_TABLE)" && \
17+
cd $(dir $(DESIGN_CONFIG))/../ && \
18+
python3 -c "import config; print(f'{config.ce_margin_x} {config.ce_margin_y} {config.ce_width - config.ce_margin_x} {config.ce_height - config.ce_margin_y}')")
19+
2120
export DIE_AREA = $(shell \
22-
export MOCK_ARRAY_HEIGHT=$(MOCK_ARRAY_HEIGHT) && \
23-
export MOCK_ARRAY_WIDTH=$(MOCK_ARRAY_WIDTH) && \
24-
export MOCK_ARRAY_PITCH_SCALE=$(MOCK_ARRAY_PITCH_SCALE) && \
25-
cd designs/asap7/mock-array && \
26-
python3 -c "import config; print(f'0 0 {config.ce_width} {config.ce_height}')")
21+
export MOCK_ARRAY_TABLE="$(MOCK_ARRAY_TABLE)" && \
22+
cd $(dir $(DESIGN_CONFIG))/../ && \
23+
python3 -c "import config; print(f'0 0 {config.ce_width} {config.ce_height}')")
2724

28-
export IO_CONSTRAINTS = designs/asap7/mock-array/Element/io.tcl
25+
export IO_CONSTRAINTS = designs/asap7/mock-array/Element/io.tcl
2926

30-
export PDN_TCL = designs/asap7/mock-array/Element/pdn.tcl
27+
export PDN_TCL = designs/asap7/mock-array/Element/pdn.tcl
3128

32-
# max routing layer need to be set to M5, since M6 is needed for next level up to connect
33-
# to the ring and stipe
34-
#
3529
# If this design isn't quickly done in detailed routing, something is wrong.
3630
# At time of adding this option, only 3 iterations were needed for 0
3731
# violations.
3832
export DETAILED_ROUTE_ARGS=-bottom_routing_layer M2 -top_routing_layer M5 -save_guide_updates -verbose 1 -droute_end_iter 10
3933

34+
export MOCK_ARRAY_ROWS = $(word 1, $(MOCK_ARRAY_TABLE))
35+
export MOCK_ARRAY_COLS = $(word 2, $(MOCK_ARRAY_TABLE))
36+
4037
# since we are specifying DETAILED_ROUTE_ARGS, we need to communicate the
4138
# same information to other stages in the flow.
4239
export MIN_ROUTING_LAYER = M2

flow/designs/asap7/mock-array/Element/constraints.sdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set sdc_version 2.0
22

3-
set cols [expr {[info exists ::env(MOCK_ARRAY_WIDTH)] ? $::env(MOCK_ARRAY_WIDTH) : 8}]
3+
set cols [expr {[info exists ::env(MOCK_ARRAY_COLS)] ? $::env(MOCK_ARRAY_COLS) : 8}]
44

55
set clk_name clock
66
set clk_port_name clock

flow/designs/asap7/mock-array/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ Mock array big
44
A mock array that can be configured in different sizes to generate
55
interesting test-cases.
66

7-
By default, the array is 8x8 elements and has an 8 bit datapath.
7+
By default, the array is 8x8 elements, has an 8 bit datapath with
8+
Element size of 4x4 unit and Element placement pitch of 6,6 - x,y direction.
89

9-
To create a 4x4 element array with 4 bit datapath, first create a settings.mk file:
10+
export MOCK_ARRAY_TABLE ?= 8 8 4 4 6 6
11+
12+
# Element'd data width
13+
export MOCK_ARRAY_DATAWIDTH ?= 8
14+
15+
To create a 4x4 element array with 4 bit datapath with element size of 5x6 and
16+
placement pitch of 8x6, set the user control variable MOCK_ARRAY_TABLE
1017

1118
```
12-
export MOCK_ARRAY_WIDTH=4
13-
export MOCK_ARRAY_HEIGHT=4
19+
export MOCK_ARRAY_TABLE="4 4 5 6 8 6"
1420
export MOCK_ARRAY_DATAWIDTH=4
1521
export FLOW_VARIANT=small
16-
# use a different folder for each combination of parameters
17-
#export MOCK_ARRAY_WIDTH=16
18-
#export MOCK_ARRAY_HEIGHT=16
19-
#export MOCK_ARRAY_DATAWIDTH=64
20-
#export FLOW_VARIANT=giant
22+
2123
export DESIGN_CONFIG=designs/asap7/mock-array/config.mk
2224
```
2325

flow/designs/asap7/mock-array/config.mk

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,49 @@
11
include designs/asap7/mock-array/defaults.mk
22

3-
export DESIGN_NAME = MockArray
4-
export DESIGN_NICKNAME = mock-array
3+
export DESIGN_NAME = MockArray
4+
export DESIGN_NICKNAME = mock-array
55

66
export VERILOG_FILES_BLACKBOX = designs/src/mock-array/Element.v
7-
export VERILOG_FILES = designs/src/mock-array/*.v
7+
export VERILOG_FILES = designs/src/mock-array/*.v
88

9-
export SDC_FILE = designs/asap7/mock-array/constraints.sdc
9+
export SDC_FILE = designs/asap7/mock-array/constraints.sdc
1010

1111
export PLATFORM = asap7
1212

1313
export PLACE_DENSITY = 0.30
1414

1515
export CORE_AREA = $(shell \
16-
export MOCK_ARRAY_HEIGHT=$(MOCK_ARRAY_HEIGHT) && \
17-
export MOCK_ARRAY_WIDTH=$(MOCK_ARRAY_WIDTH) && \
18-
export MOCK_ARRAY_PITCH_SCALE=$(MOCK_ARRAY_PITCH_SCALE) && \
19-
cd designs/asap7/mock-array && \
20-
python3 -c "import config; print(f'{config.margin_x} {config.margin_y} {config.core_width + config.margin_x} {config.core_height + config.margin_y}')")
21-
export DIE_AREA = $(shell \
22-
export MOCK_ARRAY_HEIGHT=$(MOCK_ARRAY_HEIGHT) && \
23-
export MOCK_ARRAY_WIDTH=$(MOCK_ARRAY_WIDTH) && \
24-
export MOCK_ARRAY_PITCH_SCALE=$(MOCK_ARRAY_PITCH_SCALE) && \
25-
cd designs/asap7/mock-array && \
26-
python3 -c "import config; print(f'0 0 {config.die_width} {config.die_height}')")
16+
export MOCK_ARRAY_TABLE="$(MOCK_ARRAY_TABLE)" && \
17+
cd $(dir $(DESIGN_CONFIG)) && \
18+
python3 -c "import config ; print(f'{config.margin_x} {config.margin_y} {config.core_width + config.margin_x} {config.core_height + config.margin_y}')")
2719

28-
BLOCKS = Element
20+
export DIE_AREA = $(shell \
21+
export MOCK_ARRAY_TABLE="$(MOCK_ARRAY_TABLE)" && \
22+
cd $(dir $(DESIGN_CONFIG)) && \
23+
python3 -c "import config; print(f'{0} {0} {config.die_width} {config.die_height}')")
2924

30-
export GDS_ALLOW_EMPTY = Element
25+
BLOCKS = Element
3126

32-
export MACRO_PLACEMENT_TCL = ./designs/asap7/mock-array/macro-placement.tcl
27+
export GDS_ALLOW_EMPTY = Element
3328

34-
export IO_CONSTRAINTS = designs/asap7/mock-array/io.tcl
29+
export MACRO_PLACEMENT_TCL = ./designs/asap7/mock-array/macro-placement.tcl
30+
31+
export IO_CONSTRAINTS = designs/asap7/mock-array/io.tcl
32+
33+
export PDN_TCL = designs/asap7/mock-array/pdn.tcl
3534

36-
export PDN_TCL = designs/asap7/mock-array/pdn.tcl
3735
export TNS_END_PERCENT = 100
3836

39-
# Target to force generation of Verilog per user settings
40-
# MOCK_ARRAY_WIDTH and MOCK_ARRAY_HEIGHT
37+
# Target to force generation of Verilog per user settings MOCK_ARRAY_TABLE (rows, cols)
4138
verilog:
39+
export MOCK_ARRAY_ROWS=$(word 1, $(MOCK_ARRAY_TABLE)) ; \
40+
export MOCK_ARRAY_COLS=$(word 2, $(MOCK_ARRAY_TABLE)) ; \
4241
./designs/asap7/mock-array/verilog.sh
4342

4443
# If this design isn't quickly done in detailed routing, something is wrong.
4544
# At time of adding this option, only 12 iterations were needed for 0
4645
# violations.
47-
export DETAILED_ROUTE_ARGS=-bottom_routing_layer M2 -top_routing_layer M7 -save_guide_updates -verbose 1 -droute_end_iter 15
46+
export DETAILED_ROUTE_ARGS = -bottom_routing_layer M2 -top_routing_layer M7 -save_guide_updates -verbose 1 -droute_end_iter 15
4847

4948
# since we are specifying DETAILED_ROUTE_ARGS, we need to communicate the
5049
# same information to other stages in the flow.
Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,34 @@
11
import os
22

3-
# number of Elements in row and column, user can set via environment variable
4-
rows = int(os.environ.get("MOCK_ARRAY_HEIGHT"))
5-
cols = int(os.environ.get("MOCK_ARRAY_WIDTH"))
6-
7-
# Element placement pitch can be control by user
8-
pitch_scale = int(os.environ.get("MOCK_ARRAY_PITCH_SCALE"))
9-
10-
if pitch_scale < 1:
11-
raise Exception("Element placement pitch must be greater than 1")
12-
13-
# Routing pitches for relevant metal layers.
14-
# For x, this is M5; for y, this is M4.
15-
# Pitches are specified in OpenROAD-flow-scripts/flow/platforms/asap7/lef/asap7_tech_1x_201209.lef.
16-
# For asap7, x and y pitch is the same.
17-
#
18-
# make_tracks M5 -x_offset 0.012 -x_pitch 0.048 -y_offset 0.012 -y_pitch 0.048
19-
#
20-
# the macro needs to be on a multiple of the track pattern
21-
routing_pitch = 0.048
22-
23-
placement_grid_x = routing_pitch
24-
placement_grid_y = routing_pitch
25-
26-
# historically pitch_scale 2 was ca 13 um
27-
ce_width = int(3 * 2.16 / placement_grid_x) * placement_grid_x * pitch_scale
28-
ce_height = int(3 * 2.16 / placement_grid_y) * placement_grid_y * pitch_scale
29-
ce_margin_x = placement_grid_x * 8
30-
ce_margin_y = placement_grid_y * 8
3+
# routing pitch for M4, M5 and M6 tied to placement grid at 2.16
4+
# therefore, the optimal placement and Element size should be multiple of 2.16
5+
# set grid x and y
6+
placement_grid_x = 2.16
7+
placement_grid_y = 2.16
8+
9+
# number of Elements in row and column, can be control by user via environment variable
10+
# MOCK_ARRAY_TABLE (rows, cols, width, height, pitch_x, pitch_y)
11+
# rows, cols - number of Element in rows, cols
12+
# width, height - width and height of each Element
13+
# pitch_x, pitch_y - placement pitch for each Element, in x and y direction
14+
# specification are in unit of placement grid
15+
rows, cols, ce_x, ce_y, pitch_x, pitch_y = map(int, os.environ.get("MOCK_ARRAY_TABLE").split())
16+
17+
# Element size is set to multiple of placement grid above
18+
ce_width = ce_x * placement_grid_x
19+
ce_height = ce_y * placement_grid_y
3120

3221
# top level core offset
33-
margin_x = int(2.16 / placement_grid_x) * placement_grid_x
34-
margin_y = int(2.16 / placement_grid_y) * placement_grid_y
35-
36-
channel = 12 # int(os.environ.get("MACRO_PLACE_CHANNEL").split()[0])
22+
margin_x = placement_grid_x
23+
margin_y = placement_grid_y
3724

38-
# Element placement, can be controlled by user
39-
ce_pitch_x = ce_width + int((channel * 2) / placement_grid_x) * placement_grid_x
40-
ce_pitch_y = ce_height + int((channel * 2) / placement_grid_y) * placement_grid_y
25+
# Element core margin
26+
ce_margin_x = placement_grid_x * 0.5
27+
ce_margin_y = placement_grid_y * 0.5
4128

42-
# top level core size
43-
core_width = ce_pitch_x * cols + ce_width
44-
core_height = ce_pitch_y * rows + ce_height
29+
# top level core and die size
30+
core_width = ((placement_grid_x * pitch_x) * (cols + 1)) + (ce_width * cols)
31+
core_height = ((placement_grid_y * pitch_y) * (rows + 1)) + (ce_height * rows)
4532

46-
die_width = core_width + (2 * margin_x)
47-
die_height = core_height + (2 * margin_y)
33+
die_width = core_width + (margin_x * 2)
34+
die_height = core_height + (margin_y * 2)
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# single source of truth for defaults.
2-
export MOCK_ARRAY_WIDTH ?= 8
3-
export MOCK_ARRAY_HEIGHT ?= 8
4-
export MOCK_ARRAY_DATAWIDTH ?= 8
5-
export MOCK_ARRAY_PITCH_SCALE ?= 2
2+
# each number is a unit
3+
# current unit is configured as 2.16 which is on the routing grid for M5
4+
5+
# table of Elements - (rows cols width height pitch_x pitch_y)
6+
export MOCK_ARRAY_TABLE ?= 8 8 4 4 6 6
7+
8+
# Element'd data width
9+
export MOCK_ARRAY_DATAWIDTH ?= 8
10+

flow/designs/asap7/mock-array/macro-placement.tcl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# 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.ce_pitch_x} {config.ce_pitch_y} {config.margin_x} {config.margin_y} {config.placement_grid_x} {config.placement_grid_y}')"}]]
3-
lassign $vals rows cols ce_pitch_x ce_pitch_y margin_x margin_y placement_grid_x placement_grid_y
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.margin_x} {config.margin_y} {config.placement_grid_x} {config.placement_grid_y}')"}]]
3+
lassign $vals rows cols pitch_x pitch_y margin_x margin_y placement_grid_x placement_grid_y
44

55
set block [ord::get_db_block]
66
set units [$block getDefUnits]
77

88
for {set row 0} {$row < $rows} {incr row} {
99
for {set col 0} {$col < $cols} {incr col} {
1010
set inst [$block findInst [format "ces_%d_%d" $row $col]]
11+
set bbox [$inst getBBox]
1112

12-
set x [expr int(int(($margin_x + ($ce_pitch_x / 2) + ($ce_pitch_x * $col)) / $placement_grid_x) * $placement_grid_x * $units)]
13-
set y [expr int(int(($margin_y + ($ce_pitch_y / 2) + ($ce_pitch_y * $row)) / $placement_grid_y) * $placement_grid_y * $units)]
13+
set w [$bbox getDX]
14+
set h [$bbox getDY]
15+
16+
set x [expr int((($margin_x + (($placement_grid_x * $pitch_x) * ($col + 1.0))) * $units) + ($w * $col))]
17+
set y [expr int((($margin_y + (($placement_grid_y * $pitch_y) * ($row + 1.0))) * $units) + ($h * $row))]
1418

1519
$inst setOrient R0
1620
$inst setOrigin $x $y

0 commit comments

Comments
 (0)