Skip to content

Commit 8af3419

Browse files
authored
Merge pull request The-OpenROAD-Project#1980 from Pinata-Consulting/mock-sram-example
sram: add example of mocking SRAMs to asap7/riscv32i
2 parents 9020c2a + b738421 commit 8af3419

17 files changed

Lines changed: 1079 additions & 85 deletions

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

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -44,55 +44,3 @@ to be fitted into a higher level module where CTS creates a balanced clock tree
4444
that takes the mock-array and mock-array Element clock insertion
4545
latency into account. This means that the optimization target
4646
for mock-array and mock-array Element have zero skew.
47-
48-
constraint.sdc shared between mock-array and mock-array/Element
49-
---------------------------------------------------------------
50-
51-
From the following observations, all else follows: the only thing
52-
that can fail timing closure, is a register to register path. All
53-
other constraints give the flow an optimization target. Failure
54-
to meet the timing constraint of an optimization target constraint
55-
is not a timing closure failure.
56-
57-
Note that ORFS regression checks does not have the ability to distinguish
58-
between timing closure failures(register to register paths) and
59-
optimization constraints violations. Timing violations for optimization constraints
60-
in mock-array Element, such as maximum transit time for a combinational path
61-
through mock-array Element, may or may not cause timing
62-
violations later on higher up in mock-array on register to register paths.
63-
64-
For the Element constraint.sdc, the only register to register path
65-
are within the Element and no lower level macros are
66-
involved. Register to register paths within Element have to be checked
67-
at the Element level as they are invisible higher up in mock-array.
68-
69-
As for the remaining optimization constraints for Element, they
70-
should be for combinational through paths and from input pins to register and
71-
from register to output pins.
72-
73-
The constraints.sdc file is designed such that the clock latency & tree
74-
can be ignored as far constraints go;
75-
it is not part of the optimization constraints. The clock tree latency
76-
is accounted for in register to register paths within.
77-
78-
The timing closure for the register to register paths between
79-
Element macros is checked at the mock-array level.
80-
81-
With this in mind, the constraints.sdc file for the Element becomes
82-
quite general and simple. set_max_delay is used exclusively for
83-
optimization constraints and the clock period is used to check timing
84-
closure for register to register paths.
85-
86-
set_input/output_delay are not used and can't really be used
87-
with the requirement that the constraint.sdc file should be articulated
88-
without making assumptions on the clock tree insertion latency. The time specified
89-
for set_input/output_delay is relative to the clock insertion point, i.e.
90-
the time at the clock pin for the macro, which makes it impossible to articulate
91-
the number that is passed in to set_input/output_delay without taking
92-
clock network insertion latency into account.
93-
94-
Since set_input_delay is not used and set_max_delay is used instead, then
95-
no hold cells are inserted, which is what is desired here.
96-
97-
Beware of [path segmentation](https://docs.xilinx.com/r/2020.2-English/ug906-vivado-design-analysis/TIMING-13-Timing-Paths-Ignored-Due-to-Path-Segmentation), which
98-
can occur with OpenSTA.
Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
1-
# see README.md
2-
set sdc_version 2.0
3-
41
set clk_name clock
52
set clk_port_name clock
63
set clk_period 250
74

8-
set clk_port [get_ports $clk_port_name]
9-
create_clock -period $clk_period -waveform [list 0 [expr $clk_period / 2]] -name $clk_name $clk_port
10-
set_clock_uncertainty -setup 20.0 [get_clocks $clk_name]
11-
set_clock_uncertainty -hold 20.0 [get_clocks $clk_name]
12-
13-
set_max_transition 250 [current_design]
14-
set_max_transition 100 -clock_path [all_clocks]
15-
16-
set non_clk_inputs [lsearch -inline -all -not -exact [all_inputs] $clk_port]
17-
set all_register_outputs [get_pins -of_objects [all_registers] -filter {direction == output}]
18-
19-
# Optimization targets
20-
set max_delay 80
21-
set_max_delay $max_delay -from $non_clk_inputs -to [all_registers]
22-
set_max_delay $max_delay -from $all_register_outputs -to [all_outputs]
23-
set_max_delay $max_delay -from $non_clk_inputs -to [all_outputs]
24-
25-
# Set driving cell and load capacitance explicitly to ensure timing results are sufficiently pessimistic
26-
set_driving_cell [all_inputs] -lib_cell BUFx4_ASAP7_75t_R
27-
28-
# Assuming the load on each output is a BUFx2_ASAP7_75t_R, we pessimistically use 3 times the highest input
29-
# pin capacitance for this cell, which is 0.577042.
30-
# See platforms/asap7/lib/asap7sc7p5t_INVBUF_RVT_FF_nldm_220122.lib.gz, line 1223.
31-
#set_load -pin_load 2.731126 [all_outputs]
32-
set_load -pin_load 10 [all_outputs]
5+
source $env(PLATFORM_DIR)/constraints.sdc
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
mock sram example
2+
-----------------
3+
4+
To mock an SRAM means to take the behavioral Verilog and create a
5+
scaled down version while still using all the input/outputs. This can
6+
be useful when no fake sram is available from the PDK or the existing
7+
fake srams are not a great match for the SRAMs used in the design.
8+
9+
Typically this is done by reducing the number of rows, such as from 128
10+
to 4 in this case. The unused address bits are xor'ed together the
11+
unused address bits so that all input/outputs of the module are still in
12+
use.
13+
14+
This gives us a mock .lef and .lib file.
15+
16+
Mocking for non-SRAM purposes
17+
-----------------------------
18+
19+
The mocking technique illustrated here can also be used for other cases
20+
where hard macros are not immediately available or suitable, indeed it
21+
can be used for entire modules that are not currently fleshed out
22+
during early architectural exploration stages:
23+
24+
- register file, of pivotal importance for CPU performance and the design
25+
thereof is critical for performance. A register file's defining feature
26+
is that it has a very large number of ports and relatively few rows, so
27+
fake SRAMs are generally not suitable to model a register file.
28+
- multipliers, barrel shifters and other highly PDK specific and optimized
29+
macros.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export DESIGN_NICKNAME = riscv32i-mock-sram
2+
export BLOCKS=fakeram7_256x32
3+
4+
include designs/asap7/riscv32i/config.mk
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export DESIGN_NICKNAME = riscv32i-mock-sram_fakeram7_256x32
2+
export DESIGN_NAME = fakeram7_256x32
3+
export PLATFORM = asap7
4+
5+
export VERILOG_FILES = ./designs/asap7/riscv32i-mock-sram/fakeram7_256x32/*.v
6+
export SDC_FILE = ./designs/$(PLATFORM)/riscv32i-mock-sram/fakeram7_256x32/constraints.sdc
7+
8+
export CORE_UTILIZATION = 50
9+
export CORE_ASPECT_RATIO = 8
10+
export PLACE_DENSITY = 0.80
11+
export MAX_ROUTING_LAYER = M4
12+
13+
export PLACE_PINS_ARGS = -exclude left:* -exclude bottom:* -exclude top:* -min_distance 6 -min_distance_in_tracks
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set clk_name clk
2+
set clk_port_name clk
3+
set clk_period 1660
4+
5+
source $env(PLATFORM_DIR)/constraints.sdc

0 commit comments

Comments
 (0)