[hw,dv,sw] Add support for HW_ID for SW#584
Conversation
martin-velay
commented
May 26, 2026
- Related to issue [DV infra] Extend the dv_window register to support querying the platform #423
- This commit adds support for a HW_ID register that can be used by SW DV tests to identify the hardware they are running on. This is useful for SW DV tests that need to run on multiple hardware platforms and need a way to differentiate between them.
engdoreis
left a comment
There was a problem hiding this comment.
Thanks for working on this, can you read the HW_ID in the test_framework and print it as test?
marnovandermaas
left a comment
There was a problem hiding this comment.
We should also have an ID for the FPGA platform.
|
@marnovandermaas, about:
I am unsure how this can be implemented for the FPGA platform. Maybe I can add something similar as done for Verilator? |
|
I have tested, and indeed there was an issue. Now I can see this in the With this patch: diff_sw_dv_hw_id.patch |
cd48d60 to
af8e982
Compare
|
I have added similar thing for the FPGA via an "AXI sink". I have never done any FPGA, can I have guidance on how I can verify it works? |
|
I'm sorry for accidentally closing the PR, |
elliotb-lowrisc
left a comment
There was a problem hiding this comment.
I'm a bit concerned that the current changes are affecting the Mocha RTL despite this being for DV purposes. In particular, I think the strange range of the 'rest of chip' entry could make the AXI crossbar harder for the tool to implement (possibly affecting timing/area/performance). I'd like to see a before/after pair of FPGA bitstream builds to check if the impact is negligible or not.
|
@elliotb-lowrisc, your comment is fair (except that it's not DV purposes only 😄). Do you see another cleaner way of doing it? |
|
@martin-velay Nevermind, it seems I was mistaken in thinking that the Might be worth updating the tag in the PR title if this is not a DV-only change though. |
|
I have added a C check which should verify the FPGA logic will work too. I haven't verified on the board, but I rather rely on CI with this test. |
elliotb-lowrisc
left a comment
There was a problem hiding this comment.
Alright, I think this is ready to be merged
|
@ziuziakowska or maybe @marnovandermaas, as Douglas is on holidays, could you confirm that you are OK with these SW changes? |
|
I've just added the |
marnovandermaas
left a comment
There was a problem hiding this comment.
I think we shouldn't use the rest of chip crossbar for the DV window. Can we change this before merging this?
| "rv_timer_irq", | ||
| "rv_timer_irq_cheri", | ||
| "test_framework_test", | ||
| "test_framework_test_cheri", |
There was a problem hiding this comment.
You're adding these before the tests are added.
There was a problem hiding this comment.
I think the C test were already existing before this PR. Is that what you meant?
| localparam longint unsigned DebugMemLength = 64'h0000_1000; | ||
| localparam longint unsigned MailboxLength = 64'h0001_0000; | ||
| localparam longint unsigned RestOfChipLength = 64'h0000_8000; | ||
| localparam longint unsigned RestOfChipLength = 64'h0FFE_8000; // 0x2002_0000 to 0x3000_7FFF |
There was a problem hiding this comment.
You shouldn't add the DV window to the rest of chip bus. It should be a separate AXI port.
There was a problem hiding this comment.
I am not sure I understand, do you want a new dedicated AXI port on top_chip_system (e.g. sw_dv_req_o / sw_dv_resp_i) similar to how rest_of_chip_req_o is exposed today - so chip_mocha_genesys2 connects it directly to the axi_to_mem sink, and the UVM/Verilator tb ties it off? Or do you have a different topology in mind?
There was a problem hiding this comment.
Yes I think that's what Marno meant. sw_dv_req_o and sw_dv_resp_i should be connected as a new device on the AXI crossbar inside top_chip_system.
|
I have addressed the easy bits. There are still some pending comments though |
|
@ziuziakowska, as discussed by chat, the last pushed is an attempt to address this #584 (comment) |
There was a problem hiding this comment.
I think the HW_ID can be tested with separate binaries for each platform. For example hw_id_verilator_test.c expects the verilator HW_ID and hw_id_fpga_test.c expects the FPGA HW_ID. This way if reading the HW_ID on FPGA returns the verilator ID, the test will fail.
There was a problem hiding this comment.
I think this would be a lot of extra build system work for just testing the read value of a register, as long as it can be seen to work I think it is fine.
- Related to issue lowRISC#423 - This commit adds support for a HW_ID register that can be used by SW DV tests to identify the hardware they are running on. This is useful for SW DV tests that need to run on multiple hardware platforms and need a way to differentiate between them. - Add framework C test Signed-off-by: martin-velay <mvelay@lowrisc.org>
|
With @martin-velay's permission I've made some changes to the software side to make it in line with the rest of the HAL. |
- Extend RestOfChipBase/Length in top_pkg to encompass the SW-DV window (0x2002_0000), routing it through the rest_of_chip port without touching top_chip_system. - Add a second device to the rest-of-chip crossbar in chip_mocha_genesys2 backed by axi_to_mem; reads to offset +0x04 return the Genesys2 platform identifier (0x0000_000A), enabling SW tests to detect the platform at runtime consistently with the sim infrastructure. Signed-off-by: martin-velay <mvelay@lowrisc.org>
Co-authored-by: martin-velay <mvelay@lowrisc.org> Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
Update the test framework smoketest to read the HW_ID register, validate it against known values, and fail on an unrecognised ID. Co-authored-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org> Signed-off-by: martin-velay <mvelay@lowrisc.org>
5d42f6c to
4c81bf7
Compare