I am modifying openlane/scripts/tcl_commands/all.t...
# openlane
m
I am modifying openlane/scripts/tcl_commands/all.tcl and just adding a puts or puts_info output in a function. This never gets shown during my run... I'm really confused why. If I look at the file in docker (using make mount) it is there. I'm sure that the code is being executed because it is the only function named save_state and outputs "Saving Runtime Environment". Neither of these exists anywhere in openlane. @User @User?
Copy code
proc save_state {args} {
    set ::env(INIT_ENV_VAR_ARRAY) [split [array names ::env] " "]
    puts_info "FOOSaving Runtime Environment"
and definitely gets called:
Copy code
[INFO]: Saving Runtime Environment
invalid command name "17"
    while executing
"17"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 ${cmd}"
    (procedure "set_log" line 3)
    invoked from within
"set_log ::env($index) $escaped_env_var $::env(GLB_CFG_FILE) 1"
    (procedure "save_state" line 9)
    invoked from within
"save_state"
    (procedure "flow_fail" line 6)
    invoked from within
"flow_fail"
    (procedure "try_catch" line 25)
    invoked from within
m
@Matthew Guthaus Don't know if this helps, but I have several OpenLane/openlane directories. Can you check that
OPENLANE_ROOT
is pointing to the directory hierarchy that you're modifying? I made changes to
save_state
and
prep
and they were reflected in the docker run. I guess if you're already in docker, you could check
/openLANE_flow/scripts/tcl_commands/all.tcl
to see if the changes are actually there.
m
@Mitch Bailey yeah, it definitely is. I logged into the docker image to confirm this
I see the changes in the /openLANE_flow directory even!
Actually, in docker it is now just /openlane
@Mitch Bailey do you still see /openLANE_flow and not /openlane?
Can confirm, mpw-two tag had /openLANE_flow, but mpw-3a has /openlane
m
Good point! I'm still mainly working with mpw-two. Maybe that's why I'm not seeing the same results. Let me switch to mpw-3a and see what I get.
@Matthew Guthaus I modified the
spm
to use a bus clock and was able to duplicate the problem. It'll I think what happens is that the
<design>/config.tcl
has the definition
set ::env(CLOCK_PORT) {clk[1]}
, however when then variable is written to
<design>/runs/<tag>/config.tcl
it's converted to ``set ::env(CLOCK_PORT) "clk[1]"` . Maybe you've already come up with a solution but it looks like If you change
scripts/utils/utils.tcl
like this
Copy code
proc set_log {var val filepath log_flag} {
-        set cmd "set ${var} \"${val}\""
+       if { [string first {[} "$val"] != -1 } {
+               set cmd "set ${var} \{${val}\}"
+       } else {
+               set cmd "set ${var} \"${val}\""
+       }
         uplevel #0 ${cmd}
         set global_cfg_file [open $filepath a+]
it works with
set ::env(CLOCK_PORT) {clk[1]}
. This will quote with
{}
only the variables that contain
[
. You can't quote all variable with
{}
because the python report program parses the
config.tcl
file and can't handle
{}
for the values that it needs. Shall I do a PR?
👍 1
Still don't know why your changes aren't reflected. Are you using
flow.tcl
or
caravel_user_project/Makefile
?
m
I checked my caravel_user_project Makefile (using
make -n xxxx
) and it seems to be mounting my openlane directory in the docker's`/openLANE_Flow`, but I guess it then uses the one in
/openlane
so it doesn't see the changes.
m
I'm using the Makefile to run the flow. I only see /openlane in the newer images as it replaces the older directory. It is my OpenLane installation mounted with the changes so I'm not sure how the changes aren't run. I'll play with it more today ..
d
All I can say is, like two weeks ago, the OpenLane Makefile has been updated to use just
/openlane
instead of
/openLANE_flow
. If the caravel makefile still tries to mount to
/openLANE_flow
, that’s a problem.
By a problem I mean a bug report
m
@Mitch Bailey Yeah, I think that should be a PR. I'm wondering if there are more cases that are missed though. What do you mean about the "python report program"?
m
[ERROR]: during executing: "openroad -python /openlane/scripts/generate_reports.py
It looks like it tries to calculate utilization or something from 2 of the variable in the saved config.tcl file. I guess, since it's python, it can convert
"
quoted strings, but not
{}
quoted strings.
m
This literally shows that my scripts don't match what is run:
Copy code
[INFO]: Saving Runtime Environment
invalid command name "17"
    while executing
"17"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 ${cmd}"
    (procedure "set_log" line 3)
    invoked from within
"set_log ::env($index) $escaped_env_var $::env(GLB_CFG_FILE) 1"
    (procedure "save_state" line 9)
    invoked from within
"save_state"
    (procedure "flow_fail" line 6)
    invoked from within
"flow_fail"
    (procedure "try_catch" line 25)
    invoked from within
"try_catch $::env(OPENROAD_BIN) -exit $::env(SCRIPTS_DIR)/openroad/or_opendp.tcl |& tee $::env(TERMINAL_OUTPUT) [index_file $::env(opendp_log_file_tag)..."
    (procedure "detailed_placement_or" line 6)
    invoked from within
"detailed_placement_or"
    (procedure "run_routing" line 32)
    invoked from within
"run_routing"
    (procedure "run_routing_step" line 10)
    invoked from within
"[lindex $step_exe 0] [lindex $step_exe 1] "
    (procedure "run_non_interactive_mode" line 43)
    invoked from within
"run_non_interactive_mode {*}$argv"
    invoked from within
"if { [info exists flags_map(-interactive)] || [info exists flags_map(-it)] } {
        puts_info "Running interactively"
        if { [info exists arg_values(-file)..."
    (file "/openlane/flow.tcl" line 356)
make[1]: *** [Makefile:43: user_project_wrapper] Error 1
make[1]: Leaving directory '/home/mrg/demo/openram_testchip/openlane'
make: *** [Makefile:70: user_project_wrapper] Error 2
mrg@diode ~/demo/openram_testchip (main)$ echo $OPENLANE_ROOT
/home/mrg/demo/openlane
mrg@diode ~/demo/openram_testchip (main)$ cd $OPENLANE_ROOT
mrg@diode ~/demo/openlane ((HEAD detached at mpw-3a))$ make mount
cd /home/mrg/demo/openlane && \
        docker run -it --rm -v /home/mrg/demo/openlane:/openlane -v /home/mrg/demo:/home/mrg/demo -e PDK_ROOT=/home/mrg/demo  --user 1000:1000 efabless/openlane:mpw-3a
bash-4.2$ grep FOO /openlane/scripts/tcl_commands/all.tcl
    puts_info "FOOSaving Runtime Environment"
Note: "Saving" vs "FOOSaving"
(I also had your patch which wasn't found either)
I can replicate this very quickly with this change. At line 330 of flow.tcl add:
puts_info {HIHIHI}
exit 1
It should exit before it runs the flow, but mine doesn't! Yet the change is shown in flow.tcl inside docker.
I've finally figured this out and it is an openlane/caravel bug. The mpw-3a docker image has a pre-installed copy of all the openlane scripts in /openlane. The caravel Makefile is supposed to mount the copy from $OPENLANE_ROOT in /openLANE_flow (this is with the mpw-3a caravel tag):
Copy code
docker run -it -v $(OPENLANE_ROOT):/openLANE_flow \
                -v $(PDK_ROOT):$(PDK_ROOT) \
                -v $(PWD)/..:/project \
                -v $(CARAVEL_ROOT):$(CARAVEL_ROOT) \
                -e PDK_ROOT=$(PDK_ROOT) \
                -e CARAVEL_ROOT=$(CARAVEL_ROOT) \
                -u $(shell id -u $(USER)):$(shell id -g $(USER)) \
                $(OPENLANE_IMAGE_NAME) sh -c $(OPENLANE_BASIC_COMMAND);\
So, there are TWO COPIES of the openlane scripts when running a design using the Caravel Makefile. One in /openlane and one in /openLANE_flow. The one that ships with the docker image is used according to the command line:
Copy code
OPENLANE_BASIC_COMMAND = "cd /project/openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite"
but that is a mistake! @User @User
@Jesse Cirimelli-Low @Hadir Khan ^^ FYI
m
Yes, I think the problem is that they didn't update the docker mounting point on caravel from openLANE_flow to openlane in the Makefiles. When you do that the openlane version inside the docker gets "overwritten" by yours
m
Argh, 1.5 days 😞
Can confirm. Fixing that mount fixes the problem as it over-rides with version that ships in the docker image.
@jeffdi This should be fixed in caravel as it may be screwing up a bunch of people... They aren't using the version they think they are.
I submitted a PR.
Actually, it's worse than that. It always use the relative copy of openlane at ../openlane since it also mounts "-v $(PWD)/..:/project"
and executes:
Copy code
OPENLANE_BASIC_COMMAND = "cd /project/openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite"
I should tag @Manar Abdelatty as well ^^
Ah, looks like /project/openlane is just the working directory. The $PATH means that flow.tcl resolves to /openlane/flow.tcl. However, the mount point for OPENLANE_ROOT should be to /openlane not /openLANE_flow to allow this to be set properly.