Skip to content

Commit

Permalink
makefile: add check-place and check-route
Browse files Browse the repository at this point in the history
Empty reports are generated if there are no errors.

This supports the Bazel use-case to create artifacts for inspection
in the case that detailed place, global place,
global route or detailed route fails.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
  • Loading branch information
oharboe committed Nov 6, 2023
1 parent a6c405e commit 8ca904e
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 17 deletions.
51 changes: 49 additions & 2 deletions flow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,41 @@ $(eval $(call do-copy,3_place,3_5_place_dp.odb,))

$(eval $(call do-copy,3_place,2_floorplan.sdc,,.sdc))

# This target does not produce a non-zero exit code if detailed or global
# placement fails. In this case $(RESULTS_DIR)/3_place.odb and $(RESULTS_DIR)/3_place.sdc
# are produced, such that an artifact can be created inspection purposes.
#
# The do-check-place target subsequently will fail if
# placement did not complete successfully, because $(RESULTS_DIR)/place.ok
# is only exists if placement succeeds.
#
# This means that build systems, such as Bazel, that require a non-zero
# exit code and the same artifacts to be produced every time or no artifacts
# are published for a step, can be built on top of ORFS.
.PHONY: do-place
do-place:
mkdir -p $(LOG_DIR) $(REPORTS_DIR)
$(UNSET_AND_MAKE) do-3_1_place_gp_skip_io do-3_2_place_iop do-3_3_place_gp do-3_4_place_resized do-3_5_place_dp do-3_place do-3_place.sdc
echo >$(RESULTS_DIR)/place.ok 0
$(UNSET_AND_MAKE) do-3_1_place_gp_skip_io do-3_2_place_iop
$(UNSET_AND_MAKE) WRITE_ON_FAIL=1 do-3_3_place_gp ; \
if [ $$? -ne 0 ]; then \
cp $(RESULTS_DIR)/3_3_place_gp.odb $(RESULTS_DIR)/3_place.odb ; \
$(UNSET_AND_MAKE) do-3_place.sdc ; \
exit 1 ; \
fi
$(UNSET_AND_MAKE) do-3_4_place_resized
$(UNSET_AND_MAKE) WRITE_ON_FAIL=1 do-3_5_place_dp
if [ $$? -ne 0 ]; then \
cp $(RESULTS_DIR)/3_5_place_dp.odb $(RESULTS_DIR)/3_place.odb ; \
$(UNSET_AND_MAKE) do-3_place.sdc ; \
exit 1 ; \
fi
$(UNSET_AND_MAKE) do-3_place do-3_place.sdc
echo >$(RESULTS_DIR)/place.ok 1

.PHONY: check-place
check-place:
grep -q 1 $(RESULTS_DIR)/place.ok

# Clean Targets
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -732,10 +763,26 @@ $(eval $(call do-copy,5_route,5_2_route.odb))

$(eval $(call do-copy,5_route,4_cts.sdc,,.sdc))

# Same as do-place, support for build systems that require a non-zero exit code
# and the same artifacts to be produced every time or no artifacts are published
.PHONY: do-route
do-route:
mkdir -p $(LOG_DIR) $(REPORTS_DIR)
$(UNSET_AND_MAKE) do-5_1_grt do-5_2_route do-5_route do-5_route.sdc
echo >$(RESULTS_DIR)/route.ok 0
touch $(REPORTS_DIR)/congestion.rpt
touch $(REPORTS_DIR)/5_route_drc.rpt
$(UNSET_AND_MAKE) WRITE_ON_FAIL=1 do-5_1_grt ; \
if [ $$? -ne 0 ]; then \
cp $(RESULTS_DIR)/5_1_grt.odb $(RESULTS_DIR)/5_route.odb ; \
$(UNSET_AND_MAKE) do-5_route.sdc ; \
exit 1 ; \
fi
$(UNSET_AND_MAKE) WRITE_ON_FAIL=1 do-5_2_route do-5_route.sdc do-5_route
echo >$(RESULTS_DIR)/route.ok 1

.PHONY: check-route
check-route:
grep -q 1 $(RESULTS_DIR)/route.ok

$(RESULTS_DIR)/5_route.v:
@export OR_DB=5_route ;\
Expand Down
10 changes: 9 additions & 1 deletion flow/scripts/detail_place.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ source $::env(PLATFORM_DIR)/setRC.tcl
set_placement_padding -global \
-left $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT) \
-right $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT)
detailed_placement
if {[info exists env(WRITE_ON_FAIL)] && $::env(WRITE_ON_FAIL)} {
set result [catch {detailed_placement} errMsg]
if {$result != 0} {
write_db $::env(RESULTS_DIR)/3_5_place_dp.odb
error $errMsg
}
} else {
detailed_placement
}

if {[info exists ::env(ENABLE_DPO)] && $::env(ENABLE_DPO)} {
if {[info exist ::env(DPO_MAX_DISPLACEMENT)]} {
Expand Down
31 changes: 21 additions & 10 deletions flow/scripts/global_place.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,29 @@ if {$::env(GPL_TIMING_DRIVEN)} {
append global_placement_args " -timing_driven"
}

proc do_placement {place_density global_placement_args} {
if { 0 != [llength [array get ::env GLOBAL_PLACEMENT_ARGS]] } {
global_placement -density $place_density \
-pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
-pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
{*}$global_placement_args \
{*}$::env(GLOBAL_PLACEMENT_ARGS)
} else {
global_placement -density $place_density \
-pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
-pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
{*}$global_placement_args
}
}

if { 0 != [llength [array get ::env GLOBAL_PLACEMENT_ARGS]] } {
global_placement -density $place_density \
-pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
-pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
{*}$global_placement_args \
{*}$::env(GLOBAL_PLACEMENT_ARGS)
if {[info exists ::env(WRITE_ON_FAIL)] && $::env(WRITE_ON_FAIL)} {
set result [catch {do_placement $place_density $global_placement_args} errMsg]
if {$result != 0} {
write_db $::env(RESULTS_DIR)/3_3_place_gp.odb
error $errMsg
}
} else {
global_placement -density $place_density \
-pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
-pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
{*}$global_placement_args
do_placement $place_density $global_placement_args
}

estimate_parasitics -placement
Expand Down
20 changes: 16 additions & 4 deletions flow/scripts/global_route.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,23 @@ if {[info exist env(FASTROUTE_TCL)]} {
#
# If GLOBAL_ROUTE_ARGS is specified, then we do only what the
# GLOBAL_ROUTE_ARGS specifies.
global_route -guide_file $env(RESULTS_DIR)/route.guide \
-congestion_report_file $env(REPORTS_DIR)/congestion.rpt \
{*}[expr {[info exists ::env(GLOBAL_ROUTE_ARGS)] ? $::env(GLOBAL_ROUTE_ARGS) : \
{-congestion_iterations 30 -congestion_report_iter_step 5 -verbose}}]

proc do_global_route {} {
global_route -guide_file $::env(RESULTS_DIR)/route.guide \
-congestion_report_file $::env(REPORTS_DIR)/congestion.rpt \
{*}[expr {[info exists ::env(GLOBAL_ROUTE_ARGS)] ? $::env(GLOBAL_ROUTE_ARGS) : \
{-congestion_iterations 30 -congestion_report_iter_step 5 -verbose}}]
}

if {[info exist env(WRITE_ON_FAIL)] && $::env(WRITE_ON_FAIL)} {
set result [catch {do_global_route} errMsg]
if {$result != 0} {
write_db $::env(RESULTS_DIR)/5_1_grt.odb
error $errMsg
}
} else {
do_global_route
}

set_propagated_clock [all_clocks]
estimate_parasitics -global_routing
Expand Down

0 comments on commit 8ca904e

Please sign in to comment.