OpenLane is an automated RTL to GDSII flow based on several components including OpenROAD, Yosys, Magic, Netgen and custom methodology scripts for design exploration and optimization.
I like OpenLane being a good reference flow for the use of OpenROAD etc.
But as OpenLane cannot fit all user purposes, sometimes files need individual changes that users may have to re-apply whenever new versions of OpenLane are available.
I would like to propose adding hooks into the OpenLane tcl scripts such that users do no longer need to locally patch OpenLane, but just need to provide their user scripts that OpenLane will source-in at pre-defined positions.
/cc @proppy
/cc @dhaentz1
Proposal
Please find attached example code that adds the following changes to the OpenROAD tcl files contained inside scripts/openroad:
An environment variable OPENROAD_USER_SCRIPTS points to a directory containing all user scripts. If the variable does not exist, or if the directory does not exist, no user scripts will be read in.
There are four classes of user scripts for the following phases:
setup: These files will be read during setup, right prior to reading-in the data base via read
pre: These files will be read-in right prior to the actual task of a script, i.e. right prior to detailed routing.
post: These scripts will be read-in after the actual task of a script, i.e. prior to reporting and saving results via write.
final: These scripts will be read-in at the very end.
Setup-scripts can be used to modify variables etc to change how data is read in.
Pre-scripts can be used to modify how the actual main task is performed.
Post-scripts can be used to modify or enhance the result of the main task.
Final-scripts can be used to modify the data written to disk or to add reporting etc.
For all four classes, there are two file names supported:
A generic one, i.e. user.setup.tcl, that will be executed in all steps, i.e. groute, droute, pdn etc
A specific one, i.e. user.pdn.setup.tcl, that will be executed only in a specific step, i.e. just pdn.
Import order is: non-specific script first, specific script afterwards
If user script are not available for a certain phase or step, execution continues w/o complaint.
The following code illustrates how user script hook could be added into the script droute.tcl:
source $::env(SCRIPTS_DIR)/openroad/common/io.tcl
execute_user_setup_hook "droute"
read
set_thread_count $::env(ROUTING_CORES)
set min_layer $::env(RT_MIN_LAYER)
if { [info exists ::env(DRT_MIN_LAYER)] } {
set min_layer $::env(DRT_MIN_LAYER)
}
set max_layer $::env(RT_MAX_LAYER)
if { [info exists ::env(DRT_MAX_LAYER)] } {
set max_layer $::env(DRT_MAX_LAYER)
}
read_guides $::env(CURRENT_GUIDE)
execute_user_pre_hook "droute"
detailed_route\
-bottom_routing_layer $min_layer\
-top_routing_layer $max_layer\
-output_maze $::env(_tmp_drt_file_prefix)_maze.log\
-output_drc $::env(_tmp_drt_rpt_prefix).drc\
-droute_end_iter $::env(DRT_OPT_ITERS)\
-or_seed 42\
-verbose 1
execute_user_post_hook "droute"
write
execute_user_final_hook "droute"
The procedures execute_user_*_hook have been defined inside io.tcl.
Description
I like OpenLane being a good reference flow for the use of OpenROAD etc. But as OpenLane cannot fit all user purposes, sometimes files need individual changes that users may have to re-apply whenever new versions of OpenLane are available. I would like to propose adding hooks into the OpenLane tcl scripts such that users do no longer need to locally patch OpenLane, but just need to provide their user scripts that OpenLane will source-in at pre-defined positions.
/cc @proppy /cc @dhaentz1
Proposal
Please find attached example code that adds the following changes to the OpenROAD tcl files contained inside scripts/openroad:
An environment variable
OPENROAD_USER_SCRIPTS
points to a directory containing all user scripts. If the variable does not exist, or if the directory does not exist, no user scripts will be read in.There are four classes of user scripts for the following phases: setup: These files will be read during setup, right prior to reading-in the data base via
read
pre: These files will be read-in right prior to the actual task of a script, i.e. right prior to detailed routing. post: These scripts will be read-in after the actual task of a script, i.e. prior to reporting and saving results viawrite
. final: These scripts will be read-in at the very end.Setup-scripts can be used to modify variables etc to change how data is read in. Pre-scripts can be used to modify how the actual main task is performed. Post-scripts can be used to modify or enhance the result of the main task. Final-scripts can be used to modify the data written to disk or to add reporting etc.
For all four classes, there are two file names supported:
user.setup.tcl
, that will be executed in all steps, i.e. groute, droute, pdn etcuser.pdn.setup.tcl
, that will be executed only in a specific step, i.e. just pdn.If user script are not available for a certain phase or step, execution continues w/o complaint.
The following code illustrates how user script hook could be added into the script
droute.tcl
:The procedures
execute_user_*_hook
have been defined insideio.tcl
.openroad_scripts_with_user_hooks.zip