Skip to content

Commit 5478b88

Browse files
committed
test case
1 parent 75dddf2 commit 5478b88

File tree

6 files changed

+219
-1
lines changed

6 files changed

+219
-1
lines changed

flow/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,21 @@ cts: $(RESULTS_DIR)/4_cts.odb \
505505

506506
# Run TritonCTS
507507
# ------------------------------------------------------------------------------
508+
ifeq ($(MODE), two_phase_clk)
509+
$(eval $(call do-step,4_1_cts,$(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/3_place.sdc,cts_build_1))
510+
511+
$(eval $(call do-step,4_2_cts,$(RESULTS_DIR)/4_1_cts.odb $(RESULTS_DIR)/4_1_cts.sdc,cts_build_2))
512+
513+
$(eval $(call do-step,4_3_cts,$(RESULTS_DIR)/4_2_cts.odb $(RESULTS_DIR)/4_2_cts.sdc,cts_checks))
514+
515+
$(eval $(call do-copy,4_cts,4_3_cts.odb))
516+
517+
.PHONY: do-cts
518+
do-cts:
519+
$(UNSET_AND_MAKE) do-4_1_cts do-4_2_cts do-4_3_cts do-4_cts
520+
521+
else
522+
508523
$(eval $(call do-step,4_1_cts,$(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/3_place.sdc,cts))
509524

510525
$(RESULTS_DIR)/4_cts.sdc: $(RESULTS_DIR)/4_cts.odb
@@ -515,6 +530,10 @@ $(eval $(call do-copy,4_cts,4_1_cts.odb))
515530
do-cts:
516531
$(UNSET_AND_MAKE) do-4_1_cts do-4_cts
517532

533+
endif
534+
535+
$(RESULTS_DIR)/4_cts.sdc: $(RESULTS_DIR)/4_cts.odb
536+
518537
.PHONY: clean_cts
519538
clean_cts:
520539
rm -rf $(RESULTS_DIR)/4_*cts*.odb $(RESULTS_DIR)/4_cts.sdc $(RESULTS_DIR)/4_*.v $(RESULTS_DIR)/4_*.def

flow/designs/sky130hd/gcd/config.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ export ADDER_MAP_FILE :=
1111

1212
export CORE_UTILIZATION = 40
1313
export TNS_END_PERCENT = 100
14-
export EQUIVALENCE_CHECK ?= 1
14+
15+
# export EQUIVALENCE_CHECK ?= 1
16+
17+
# turn off eqy for this test case
18+
export EQUIVALENCE_CHECK ?= 0
19+
1520
export REMOVE_CELLS_FOR_EQY = sky130_fd_sc_hd__tapvpwrvgnd*
1621

1722
# This allows Yosys to print more details to the terminal during execution

flow/scripts/cts_build_1.tcl

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
utl::set_metrics_stage "cts__clk_1"
2+
source $::env(SCRIPTS_DIR)/load.tcl
3+
erase_non_stage_variables cts
4+
load_design 3_place.odb 3_place.sdc
5+
6+
puts "=========================================================================="
7+
puts "Two phase mode: Building clock tree for clk_1"
8+
puts "--------------------------------------------------------------------------"
9+
10+
repair_clock_inverters
11+
12+
set cts_args [list \
13+
-sink_clustering_enable \
14+
-repair_clock_nets \
15+
-balance_levels \
16+
-clk_nets clk_1
17+
]
18+
19+
append_env_var cts_args CTS_BUF_DISTANCE -distance_between_buffers 1
20+
append_env_var cts_args CTS_CLUSTER_SIZE -sink_clustering_size 1
21+
append_env_var cts_args CTS_CLUSTER_DIAMETER -sink_clustering_max_diameter 1
22+
append_env_var cts_args CTS_BUF_LIST -buf_list 1
23+
append_env_var cts_args CTS_LIB_NAME -library 1
24+
25+
if { [env_var_exists_and_non_empty CTS_ARGS] } {
26+
set cts_args $::env(CTS_ARGS)
27+
}
28+
29+
set_dont_use $::env(DONT_USE_CELLS)
30+
31+
log_cmd clock_tree_synthesis {*}$cts_args
32+
33+
detailed_placement
34+
35+
estimate_parasitics -placement
36+
37+
# report_two_phase_metrics 4 "cts clk_1 complete" "clk_1"
38+
39+
puts "report_clock_skew test"
40+
puts "===================="
41+
report_clock_skew
42+
43+
puts "\nreport_clock_skew -clock clk_1 test"
44+
puts "===================="
45+
report_clock_skew -clock clk_1
46+
47+
puts "\nreport_clock_skew -setup -clock clk_1 test"
48+
puts "===================="
49+
report_clock_skew -setup -clock clk_1
50+
51+
puts "\nreport_clock_skew -hold -clock clk_1"
52+
puts "===================="
53+
report_clock_skew -hold -clock clk_1
54+
55+
write_db $::env(RESULTS_DIR)/4_1_cts.odb
56+
write_sdc -no_timestamp $::env(RESULTS_DIR)/4_1_cts.sdc

flow/scripts/cts_build_2.tcl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
utl::set_metrics_stage "cts__clk_2"
2+
source $::env(SCRIPTS_DIR)/load.tcl
3+
erase_non_stage_variables cts
4+
load_design 4_1_cts.odb 4_1_cts.sdc
5+
6+
puts "=========================================================================="
7+
puts "Two phase mode: Building clock tree for clk_2"
8+
puts "--------------------------------------------------------------------------"
9+
10+
set cts_clk_2_args [list \
11+
-sink_clustering_enable \
12+
-balance_levels \
13+
-repair_clock_nets \
14+
-clk_nets clk_2 \
15+
-dont_use_dummy_load
16+
]
17+
18+
append_env_var cts_clk_2_args CTS_BUF_DISTANCE -distance_between_buffers 1
19+
append_env_var cts_clk_2_args CTS_CLUSTER_SIZE -sink_clustering_size 1
20+
append_env_var cts_clk_2_args CTS_CLUSTER_DIAMETER -sink_clustering_max_diameter 1
21+
append_env_var cts_clk_2_args CTS_BUF_LIST -buf_list 1
22+
append_env_var cts_clk_2_args CTS_LIB_NAME -library 1
23+
24+
if { [env_var_exists_and_non_empty CTS_ARGS] } {
25+
set cts_clk_2_args $::env(CTS_ARGS)
26+
}
27+
28+
set_dont_use $::env(DONT_USE_CELLS)
29+
30+
log_cmd clock_tree_synthesis {*}$cts_clk_2_args
31+
32+
detailed_placement
33+
34+
estimate_parasitics -placement
35+
36+
# report_two_phase_metrics 4 "cts clk_2 complete" "clk_2"
37+
38+
puts "report_clock_skew test"
39+
puts "===================="
40+
report_clock_skew
41+
42+
puts "\nreport_clock_skew -clock clk_2 test"
43+
puts "===================="
44+
report_clock_skew -clock clk_2
45+
46+
puts "\nreport_clock_skew -setup -clock clk_2 test"
47+
puts "===================="
48+
report_clock_skew -setup -clock clk_2
49+
50+
puts "\nreport_clock_skew -hold -clock clk_2"
51+
puts "===================="
52+
report_clock_skew -hold -clock clk_2
53+
54+
write_db $::env(RESULTS_DIR)/4_2_cts.odb
55+
write_sdc -no_timestamp $::env(RESULTS_DIR)/4_2_cts.sdc

flow/scripts/cts_checks.tcl

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
utl::set_metrics_stage "cts__checks"
2+
source $::env(SCRIPTS_DIR)/load.tcl
3+
erase_non_stage_variables cts
4+
load_design 4_2_cts.odb 4_2_cts.sdc
5+
6+
# load appropiate designs for final checking
7+
puts "=========================================================================="
8+
puts "Running CTS checks and repair for two-phase clocking"
9+
puts "--------------------------------------------------------------------------"
10+
11+
proc save_progress { stage } {
12+
puts "Run 'make gui_$stage.odb' to load progress snapshot"
13+
write_db $::env(RESULTS_DIR)/$stage.odb
14+
write_sdc -no_timestamp $::env(RESULTS_DIR)/$stage.sdc
15+
}
16+
17+
# pre-repair
18+
utl::push_metrics_stage "cts__{}__pre_repair_timing"
19+
estimate_parasitics -placement
20+
if { $::env(DETAILED_METRICS) } {
21+
report_metrics 4 "cts pre-repair-timing"
22+
}
23+
utl::pop_metrics_stage
24+
25+
# detailed placement variables
26+
set_placement_padding -global \
27+
-left $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT) \
28+
-right $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT)
29+
detailed_placement
30+
31+
estimate_parasitics -placement
32+
33+
if { [env_var_equals CTS_SNAPSHOTS 1] } {
34+
save_progress 4_pre_repair_hold_setup
35+
}
36+
37+
# Repair timing
38+
if { ![env_var_equals SKIP_CTS_REPAIR_TIMING 1] } {
39+
# equivalence check before repair
40+
if { $::env(EQUIVALENCE_CHECK) } {
41+
puts "\[INFO\] write_eqy_verilog 4_before_rsz.v"
42+
write_eqy_verilog 4_before_rsz.v
43+
}
44+
45+
repair_timing_helper -setup -setup_margin 1 -hold -hold_margin 0.0 -max_repairs_per_pass 1
46+
47+
# equivalence check after repair
48+
if { $::env(EQUIVALENCE_CHECK) } {
49+
puts "\[INFO\] run_equivalence_test"
50+
run_equivalence_test
51+
}
52+
53+
set result [catch { detailed_placement } msg]
54+
if { $result != 0 } {
55+
save_progress 4_error
56+
puts "Detailed placement failed in CTS: $msg"
57+
exit $result
58+
}
59+
60+
check_placement -verbose
61+
}
62+
63+
report_metrics 4 "cts final"
64+
65+
source_env_var_if_exists POST_CTS_TCL
66+
67+
write_db $::env(RESULTS_DIR)/4_3_cts.odb
68+
write_sdc -no_timestamp $::env(RESULTS_DIR)/4_cts.sdc

run.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
TAG="${1:-openroad/orfs:v3.0-4020-g93a69fb95}"
4+
5+
echo "Running OpenROAD flow with tag: ${TAG}"
6+
7+
docker run --rm -it \
8+
-u "$(id -u "${USER}")":"$(id -g "${USER}")" \
9+
-v "$(pwd)/flow:/OpenROAD-flow-scripts/flow" \
10+
-e DISPLAY="${DISPLAY}" \
11+
-v /tmp/.X11-unix:/tmp/.X11-unix \
12+
-v "${HOME}/.Xauthority:/.Xauthority" \
13+
--network host \
14+
--security-opt seccomp=unconfined \
15+
"${TAG}"

0 commit comments

Comments
 (0)