lowRISC / opentitan

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

[dv] Logging status_t (%r) in dv simulation #20139

Open engdoreis opened 1 year ago

engdoreis commented 1 year ago

Description

The software implementation of the log macros LOG can parse and print the struct status_t with the special format token %r. However, there's no equivalent implementation on the dv test bench, so we end up with the following useless error message:

       1: sw_log.format = $sformatf(sw_log.format, `_ADD_ARGS(1));
                                  |
xmsim: *E,SYSFMT (/root/git/opentitan/scratch/sival_rv_timer/chip_earlgrey_asic-sim-xcelium/default/src/lowrisc_dv_sw_logger_if_0/sw_logger_if.sv,438|34): $psprintf/$sformatf: Illegal format  %r.
UVM_ERROR @ 22550.774478 us: (sw_logger_if.sv:524) 

One possible solution is to allocate a buffer inside base_log_internal_dv and parse the log in software with the existing implementation, however this could make logging slower in simulation. The other option is to implement the %r parser in the sw_logger_if.sv, which I don't have enough experience to say what is the impact.

@timothytrippel @matutem @a-will @cfrantz @msfschaffner, could you let me know your thoughts?

timothytrippel commented 1 year ago

I think the answer is probably neither / or put another way, a combination of things. The current DV logging mechanism uses this python script to prepare the logs for sw_logger_if.sv to later print: so we would probably want to add support for %r here: https://cs.opensource.google/opentitan/opentitan/+/master:util/device_sw_utils/extract_sw_logs.py;drc=3c54b1eb225f685fe528a88992a1b8de3e30cd4b;l=95