[hw] rom_ctrl added to mocha#389
Conversation
KolosKoblasz-Semify
commented
Mar 27, 2026
- existing source files vendored in
- rom_ctrl integrated at topl level, AXI and TL busnetwork extended
- new smoketest written for reading rom init values
- xbar_peri regenerated include new rom_ctrl_regs TL interface
2affd6c to
499b597
Compare
marnovandermaas
left a comment
There was a problem hiding this comment.
Some initial comments from my end. Please also have a look at the CI failures.
71fd63b to
e3eebff
Compare
ziuziakowska
left a comment
There was a problem hiding this comment.
Just some nits on the software.
Something to consider might also be modelling the ROM as a const char * instead of a void * typedef, as that could prevent writing through the pointer (although I believe that should cause a fault anyway).
e3eebff to
6f80dee
Compare
raylau1
left a comment
There was a problem hiding this comment.
Thanks for adding this, I have added some comment.
e72eb24 to
555b922
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
555b922 to
8075c5c
Compare
33172ca to
4ee0a2b
Compare
4ee0a2b to
3090824
Compare
marnovandermaas
left a comment
There was a problem hiding this comment.
Great work! Some more comments from my end before we can merge this.
marnovandermaas
left a comment
There was a problem hiding this comment.
Some more comments on the software side.
3090824 to
6cf5ade
Compare
6cf5ade to
d7fc6d6
Compare
* rom_ctrl_regs if added to xbapr_peri cfg
* kmac vendored in * lowrisc_ip.vendor.hjson modified * Apply patch on prim_xilinx_rom.sv. Vivado synth failed due to string type parameter.
* axi bus network expanded to handle rom_ctrl data interface * xbar_peri module connected to rom_ctrl register interface * verilator rule exclusions added * Path to ROM init file added to tb.sv * clk and reset of the new axi bus and rom_ctrl fixed on top level * backdoor access for ROM config added
* new testcase implemented among top level sw tests * the new test reads the compile time initialized ROM values * if any comparision fails (expected values differs from read value) test is terminated with an error * sw test files reformated to complie with clang format * fixed issues highlighted during PR review
d7fc6d6 to
9e41b05
Compare
If we do these changes for rom_ctrl tests then it will be inconsistent with other sw tests like: spi_host, rstmgr, mailbox, etc.. |
* xbar_peri IP regenerated with new paths during CI/CD tests * ROM backdoor init command added to sw regression tests
* FPGA tests need ROM initialization to pass * RomInitFile argument and init file paths added to the nix/fpga.nix script
9e41b05 to
91b1f74
Compare
raylau1
left a comment
There was a problem hiding this comment.
Thanks for adding all the fixes! I found a few small issues with DV and software, otherwise should be ready to merge.
| name: rom_ctrl | ||
| tests: [ | ||
| "rom_ctrl_integrity_check" | ||
| "rom_ctrl_integrity_check", | ||
| "rom_ctrl_smoke" |
There was a problem hiding this comment.
rom_ctrl_smoke_cheri should be added to the rom_ctrl tests
| rom_t mocha_system_rom(void); | ||
| rom_ctrl_t mocha_system_rom_ctrl(void); |
There was a problem hiding this comment.
Since this is sorted in order of memory map, mocha_system_rom should be before mailbox and mocha_system_rom_ctrl between rstmgr and uart
| #include "hal/mocha.h" | ||
| #include <stdint.h> | ||
|
|
||
| /* Read specific word_idx-th word from ROM memory */ |
There was a problem hiding this comment.
This comment seems outdated, there is no word_idx argument and rel_addr specifies a byte offset
| bool test_main() | ||
| { | ||
| rom_t rom = mocha_system_rom(); | ||
| uart_t console = mocha_system_uart(); | ||
|
|
||
| uart_init(console); | ||
|
|
||
| return rom_read_test(rom, console); | ||
| } |
There was a problem hiding this comment.
There is no need to reinitialize UART, you can get the console handle with:
bool test_main(uart_t console)
{
...
}| "mailbox_smoke", | ||
| "mailbox_smoke_cheri", | ||
| "axi_sram_smoke", | ||
| "axi_sram_smoke_cheri", | ||
| "axi_sram_smoke_cheri" | ||
| ] | ||
| } |
There was a problem hiding this comment.
rom_ctrl_smoke and rom_ctrl_smoke_cheri should be added to the smoke regression tests. Also do not remove the comma if it is not necessary.
marnovandermaas
left a comment
There was a problem hiding this comment.
A few more comments from my end. Would you mind checking that all your lint rules are necessary? It looks like your disabling more than you need to still, which is undesirable.
| : _sram(sram_hier_path, sram_size_words, 8), | ||
| _dram(dram_hier_path, dram_size_words, 8) {} | ||
| _dram(dram_hier_path, dram_size_words, 8), | ||
| _rom("TOP.top_chip_verilator.u_top_chip_system.u_rom_ctrl.gen_rom_scramble_disabled.u_rom.u_prim_rom", 8192, 4) {} |
There was a problem hiding this comment.
We should add rom_hier_path and rom_size_words in here.
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*kmac_rom_last_outer*" | ||
| lint_off -rule UNDRIVEN -file "*/rom_ctrl.sv" -match "*kmac_rom_last_outer*" | ||
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*kmac_err*" | ||
| lint_off -rule UNDRIVEN -file "*/rom_ctrl.sv" -match "*kmac_err*" |
There was a problem hiding this comment.
Are you sure about this undriven?
mocha/hw/vendor/lowrisc_ip/ip/rom_ctrl/rtl/rom_ctrl.sv
Lines 150 to 154 in fac6f9b
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*kmac_rom_rdy*" | ||
| lint_off -rule UNDRIVEN -file "*/rom_ctrl.sv" -match "*kmac_rom_rdy*" | ||
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*kmac_rom_rdy_outer*" | ||
| lint_off -rule UNDRIVEN -file "*/rom_ctrl.sv" -match "*kmac_rom_rdy_outer*" |
There was a problem hiding this comment.
Are you sure about this undriven?
mocha/hw/vendor/lowrisc_ip/ip/rom_ctrl/rtl/rom_ctrl.sv
Lines 150 to 154 in fac6f9b
|
|
||
| // rom_ctrl.sv | ||
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*checker_rom_rdata*" | ||
| lint_off -rule UNDRIVEN -file "*/rom_ctrl.sv" -match "*checker_rom_rdata*" |
There was a problem hiding this comment.
Are you sure about this undriven?
| lint_off -rule UNDRIVEN -file "*/rom_ctrl.sv" -match "*checker_rom_rdata*" | ||
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*checker_rom_rdata_outer*" | ||
| lint_off -rule UNDRIVEN -file "*/rom_ctrl.sv" -match "*checker_rom_rdata_outer*" | ||
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*kmac_rom_rdy*" |
There was a problem hiding this comment.
Are you sure about this unused?
| lint_off -rule WIDTHTRUNC -file "*/lowrisc_prim_count_0/rtl/prim_count.sv" | ||
|
|
||
| // rom_ctrl.sv | ||
| lint_off -rule UNUSEDSIGNAL -file "*/rom_ctrl.sv" -match "*checker_rom_rdata*" |
There was a problem hiding this comment.
Do you mind changing all of these files to "*/rom_ctrl/src/rom_ctrl.sv"
