lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.57k stars 771 forks source link

[dv] dvsim -t xrun enhancement #4689

Open svenka3 opened 3 years ago

svenka3 commented 3 years ago

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:

 util/dvsim/dvsim.py -t xrun hw/ip/uart/dv/uart_sim_cfg.hjson -i uart_smoke -r 1

I was sure that -t was wrong, but wanted to see what happens and I got:

INFO: [dvsim] [proj_root]: /home/srini/proj/OpenTitan/Git_OT_Google/opentitan
CRITICAL: [utils] Failed to parse "/home/srini/proj/OpenTitan/Git_OT_Google/opentitan/hw/dv/tools/dvsim/xrun.hjson" possibly due to bad path or syntax error.
[Errno 2] No such file or directory: '/home/srini/proj/OpenTitan/Git_OT_Google/opentitan/hw/dv/tools/dvsim/xrun.hjson'

How about 2 enhancements:

  1. Add xrun as some sort of alias to xcelium - as more users are familiar with the term xrun (and is easier to type :-) )
  2. dvsim can give better error message here.

Thanks

sriyerg commented 3 years ago

Will probably take the option 2 route.

rswarbrick commented 3 years ago

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.

rswarbrick commented 1 year ago

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.

svenka3 commented 1 year ago

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)