Open svenka3 opened 3 years ago
Will probably take the option 2 route.
I think we've intentionally avoided dvsim having a list of known simulators. But we could probably do something like check for a file that should exist for a supported simulator, and give a helpful error message if it doesn't. Here, it would be something like hw/dv/tools/dvsim/{tool}.hjson
.
I've taken another look, and a tidier error message would be quite difficult. As things stand, dvsim's Python code doesn't know anything about known tools. In fact, the tools/dvsim/{tool}.hjson
file gets included by common_sim_cfg.hjson
, so the Python code itself doesn't even know the directory where it expects the file to exist.
The current behaviour looks like this:
$ util/dvsim/dvsim.py hw/top_earlgrey/dv/chip_sim_cfg.hjson --tool=foo
INFO: [dvsim] [proj_root]: /home/rjs/work/opentitan
CRITICAL: [utils] Failed to parse "/home/rjs/work/opentitan/hw/dv/tools/dvsim/foo.hjson" possibly due to bad path or syntax error.
[Errno 2] No such file or directory: '/home/rjs/work/opentitan/hw/dv/tools/dvsim/foo.hjson'
and I'm not so sure there's something cleaner that we can do, without somehow encoding a "blessed" list of tools in the Python code itself.
Thanks. To an external user such as me, maintaining a "blessed" list of tools in a large project such as OT makes perfect sense, I would understand if your team does not buy-in to that, however.
How about adding an extra line as:
util/dvsim/dvsim.py hw/top_earlgrey/dv/chip_sim_cfg.hjson --tool=foo
INFO: [dvsim] [proj_root]: /home/srini/proj/OpenTitan_Git/ot_rpro/opentitan
CRITICAL: [utils] Maybe an unsupported/incorrect tool option is specified as -t
Failed to parse /home/srini/proj/OpenTitan_Git/ot_rpro/opentitan/hw/dv/tools/dvsim/foo.hjson possibly due to bad path or syntax error.
[Errno 2] No such file or directory: '/home/srini/proj/OpenTitan_Git/ot_rpro/opentitan/hw/dv/tools/dvsim/foo.hjson'
I tweaked/hacked utils.py to be:
except Exception as e:
msg = "Maybe an unsupported/incorrect tool option is specified as -t \n"
msg += "Failed to parse " + hjson_file + " possibly due to bad path or syntax error.\n" + str(e)
log.fatal(msg)
Today I tried running OT on a different laptop with Cadence XLM tool. I made small mistakes (call it rusted due to out of touch with OT flow) and one of them is:
I was sure that -t was wrong, but wanted to see what happens and I got:
How about 2 enhancements:
Thanks