-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dv] Move sim_tops to {tool}.hjson #4366
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to discuss the escaping change a bit more carefully, but my sed
suggestion should decouple that from getting things working for Questa. Maybe split up the PR to get the Questa side fixed quickly?
util/dvsim/utils.py
Outdated
wildcard_re = re.compile(r"{([A-Za-z0-9\_]+)}") | ||
wildcard_re = re.compile(r"(?<!\$){([A-Za-z0-9\_]+)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, ok, but this is a bit magical. I wonder whether it would be better to have some sort of explicit escaping (like Python's format function). So shell code that absolutely needed the braces (unusual) would end up looking like ${{foo}}
.
hw/dv/tools/dvsim/dsim.hjson
Outdated
@@ -23,6 +23,8 @@ | |||
"-c-opts -I{DSIM_HOME}/include", | |||
"-timescale 1ns/1ps", | |||
"-f {sv_flist}", | |||
// List multiple tops for the simulation. Prepend each top level with `-top`. | |||
'''{eval_cmd} tops=(`echo {sim_tops}`); echo "${tops[@]/#/-top }"''', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we discuss the escaping in the previous commit, you could do this with sed (and no escaping required):
echo {sim_tops} | sed -E 's/(\w+)/-top \1/g'
Maybe split out the previous commit into a separate PR, and we can figure out the best approach for that separately from this change?
hw/dv/tools/dvsim/vcs.hjson
Outdated
// List multiple tops for the simulation. Prepend each top level with `-top`. | ||
'''{eval_cmd} tops=(`echo {sim_tops}`); echo "${tops[@]/#/-top }"''', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've got two {eval_cmd}
lines in this file that both compute the same thing. Maybe put it in a separate variable to avoid the unneeded extra subprocess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They operate on different variables. This one prefixes -top
to top level designs the the other one prefixes -dir
to coverage database directories. How would merging the two work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duh, I didn't read this carefully enough! You're completely right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Most simulators accept `-top top1 -top top2` switches at compile time for indicating top level designs that need to be elaborated. Questa unfortunately needs it to be a runtime switch as opposed to build time. Support for Questa is in the works. Signed-off-by: Srikrishna Iyer <sriyer@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I dropped the first commit and replaced the echo with sed.
hw/dv/tools/dvsim/vcs.hjson
Outdated
// List multiple tops for the simulation. Prepend each top level with `-top`. | ||
'''{eval_cmd} tops=(`echo {sim_tops}`); echo "${tops[@]/#/-top }"''', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They operate on different variables. This one prefixes -top
to top level designs the the other one prefixes -dir
to coverage database directories. How would merging the two work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
This removes the `-top` switch with the recent changes in lowRISC#4366. Signed-off-by: Srikrishna Iyer <sriyer@google.com>
This removes the `-top` switch with the recent changes in #4366. Signed-off-by: Srikrishna Iyer <sriyer@google.com>
Fixes #4340.
This change factors
sim_tops
out ofcommon_sim_cfg.hjson
in favor of being placed in{tool}.hjson
instead. This is done to support Questa (support for which will be added soon).The first commit fixes a bug in DVSim (prevent
${..}
constuct from being treated as a substitution var).The second moves
sim_tops
expansion out of the common hjson and moves it into individual tool-specific hjson. How tops are to be specified is also changed - there is no need to add-top
prefix to each top level. This is factored in the tool hjson already.