[sw,dv] Add SW-DV logging - #600
Conversation
7241605 to
b88ffc4
Compare
rswarbrick
left a comment
There was a problem hiding this comment.
A couple of nitty comments but this looks nice.
(And the review took me a while: I hadn't seen the clever variadic macro trick before!)
|
I've just rebased and fix the merge conflicts. There was also an issue for CHERI tests. Now Verilator tests pass and the UVM tests too (new tests And the log gives: |
rswarbrick
left a comment
There was a problem hiding this comment.
This looks really good to me.
Thanks for the updates (and for teaching me about variadic macros in C...)
marnovandermaas
left a comment
There was a problem hiding this comment.
Some comments from my end.
The upstream script assumes a 32-bit struct layout (5 x uint32, 20 B, LONG header). Mocha's rv64 log_fields_t uses 8-byte const char * pointer fields, giving a 32-byte struct and an 8-byte QUAD section-address header. Under CHERI those pointers are 16-byte capabilities, forcing 16-byte section alignment, a 16-byte header and 64-byte entries, with the file/format addresses held in __cap_relocs rather than the section. Add a patch that selects the layout from the ELF class and the .logs.fields alignment, and resolves capability pointer fields from __cap_relocs when present. Wire the script into build_sw_collateral_for_sim.py so each CMake install step produces the .logs.txt and .rodata.txt files that sw_logger_if needs at simulation start. Signed-off-by: martin-velay <mvelay@lowrisc.org>
Each call site places a log_fields_t entry in a new .logs.fields ELF section; extract_sw_logs.py produces the database consumed by sw_logger_if to decode printf-style messages at simulation start, with no UART overhead. Add a log field at offset 0x8 of the dv_window_memory_layout struct and route dv_log_write() through mocha_system_dv_window() for CHERI-safe access to the log write port (0x2002_0008). Add the .logs.fields section to the linker script after .rodata so string constants are resolved before log entries are laid out. Add dv_log.h/c implementing the DV_LOG_INFO/WARNING/ERROR/FATAL macros and the runtime dv_log_write() function. Add dv_log_smoketest to verify the end-to-end path. Signed-off-by: martin-velay <mvelay@lowrisc.org>
Signed-off-by: martin-velay <mvelay@lowrisc.org>
Signed-off-by: martin-velay <mvelay@lowrisc.org>
engdoreis
left a comment
There was a problem hiding this comment.
LGTM, but let's wait for Marno's approval before merging.
marnovandermaas
left a comment
There was a problem hiding this comment.
Happy for you to merge when you think it is ready.
|
Mentioned issues have been created and I ran again a UVM little regression and all looks good. Thank you all for you reviews! |
Related to this issue: #261