Skip to content

Commit 7b9e765

Browse files
committed
Time the 6_final endpoint slack with extracted parasitics
The 6_final snapshot was written by orfs_write_db before parasitic extraction, so it was timed with global routing estimates. Those overestimate short nets and were about 0.25 ns pessimistic on sky130hd/riscv32i compared with the extracted SPEF. Write the 6_final snapshot in final_outputs.tcl after extraction instead, using the loaded parasitics (rcx, or global_routing on platforms without RCX_RULES) so it matches 6_finish.rpt. write_endpoint_slack takes an optional parasitics name to skip its own estimation, and orfs_write_db can skip the snapshot. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent 4a6c608 commit 7b9e765

4 files changed

Lines changed: 33 additions & 20 deletions

File tree

‎docs/contrib/EndpointSlackTracking.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ reporting as in `open.tcl`, based on the step number:
3434
| --- | --- |
3535
| 1, 2 | none (cells are not placed) |
3636
| 3, 4 | `estimate_parasitics -placement` |
37-
| 5, 6 | `estimate_parasitics -global_routing` if global routes exist |
37+
| 5, `6_1_fill` | `estimate_parasitics -global_routing` if global routes exist |
38+
| `6_final` | `rcx`: the extracted `6_final.spef`, as in `6_finish.rpt` (`global_routing` on platforms without `RCX_RULES`) |
3839

3940
The parasitics model is recorded in each snapshot and shown by
4041
`endpointSlack.py`. Slack changes between steps with different models (e.g.
41-
`2_4_floorplan_pdn` to `3_1_place_gp_skip_io`, or `4_1_cts` to `5_1_grt`)
42-
include the change of model. Detailed routing is not extracted, so
43-
`5_2_route` and later steps show global routing estimates; `6_finish.rpt`,
44-
which uses the extracted SPEF, can differ.
42+
`2_4_floorplan_pdn` to `3_1_place_gp_skip_io`, `4_1_cts` to `5_1_grt`, or
43+
`6_1_fill` to `6_final`) include the change of model. Detailed routing is
44+
only extracted in `6_final`, so `5_2_route` to `6_1_fill` show global routing
45+
estimates.
4546

4647
Each file contains `design`, `step`, `parasitics`, `time_unit` (seconds per
4748
time unit of the values) and `endpoints`: a map from every endpoint pin

‎flow/scripts/final_outputs.tcl‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ if {
3535

3636
# Read Spef for OpenSTA
3737
read_spef $::env(RESULTS_DIR)/6_final.spef
38+
set final_parasitics rcx
3839

3940
# Static IR drop analysis
4041
if { [env_var_exists_and_non_empty PWR_NETS_VOLTAGES] } {
@@ -59,7 +60,9 @@ if {
5960
puts "OpenRCX is not enabled for this platform."
6061
puts "Falling back to global route-based estimates."
6162
log_cmd estimate_parasitics -global_routing
63+
set final_parasitics global_routing
6264
}
65+
write_endpoint_slack 6_final $final_parasitics
6366

6467
report_cell_usage
6568

‎flow/scripts/final_report.tcl‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# (scripts/flow.tcl) can source the parts and perform the write itself
33
# at the same point.
44
source $::env(SCRIPTS_DIR)/final_connect.tcl
5-
orfs_write_db $::env(RESULTS_DIR)/6_final.odb
5+
# final_outputs.tcl writes the endpoint slack after parasitic extraction
6+
orfs_write_db $::env(RESULTS_DIR)/6_final.odb 0
67
orfs_write_sdc $::env(RESULTS_DIR)/6_final.sdc
78
source $::env(SCRIPTS_DIR)/final_outputs.tcl

‎flow/scripts/util.tcl‎

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -309,25 +309,29 @@ proc endpoint_slack_file { step } {
309309
# Write the setup and hold slack of every endpoint at the end of a flow
310310
# step so they can be compared across steps with
311311
# flow/util/endpointSlack.py. Parasitics are estimated the same way as
312-
# open.tcl so that every step is timed consistently.
313-
proc write_endpoint_slack { step } {
312+
# open.tcl so that every step is timed consistently, unless the caller
313+
# has already loaded parasitics (e.g. extracted ones) and passes their
314+
# name as parasitics.
315+
proc write_endpoint_slack { step { parasitics "" } } {
314316
if { !$::env(REPORT_ENDPOINT_SLACK) || [string match "*-failed" $step] } {
315317
return
316318
}
317319
set filename [endpoint_slack_file $step]
318320
puts "Writing endpoint slack to $filename"
319321

320-
set design_stage [lindex [split $step _] 0]
321-
set parasitics none
322-
if { $design_stage >= 5 } {
323-
if { [grt::have_routes] } {
324-
set parasitics global_routing
322+
if { $parasitics == "" } {
323+
set design_stage [lindex [split $step _] 0]
324+
set parasitics none
325+
if { $design_stage >= 5 } {
326+
if { [grt::have_routes] } {
327+
set parasitics global_routing
328+
}
329+
} elseif { $design_stage >= 3 } {
330+
set parasitics placement
331+
}
332+
if { $parasitics != "none" } {
333+
estimate_parasitics -$parasitics
325334
}
326-
} elseif { $design_stage >= 3 } {
327-
set parasitics placement
328-
}
329-
if { $parasitics != "none" } {
330-
estimate_parasitics -$parasitics
331335
}
332336
# Update timing before sta::endpoints: the endpoint set is cached the
333337
# first time it is requested and misses gated clock enable checks if the
@@ -387,8 +391,12 @@ proc copy_endpoint_slack { input_file output_file } {
387391
close $fileId
388392
}
389393

390-
proc orfs_write_db { output_file } {
391-
write_endpoint_slack [file rootname [file tail $output_file]]
394+
# endpoint_slack 0 is for callers that write the endpoint slack snapshot
395+
# themselves, e.g. 6_final after parasitic extraction.
396+
proc orfs_write_db { output_file { endpoint_slack 1 } } {
397+
if { $endpoint_slack } {
398+
write_endpoint_slack [file rootname [file tail $output_file]]
399+
}
392400
if { !$::env(WRITE_ODB_AND_SDC_EACH_STAGE) } {
393401
return
394402
}

0 commit comments

Comments
 (0)