[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.
There was a problem hiding this comment.
Why did you move this file?
There was a problem hiding this comment.
The .hjson file is relocated now because I found counter intuitive to store the "source" file for IP generation in the generated folder.
There was a problem hiding this comment.
I think it is better not to have this code churn right now. You can do this in a separate PR after this if you feel strongly about it.
There was a problem hiding this comment.
Reverted.
| {from: "hw/ip/rom_ctrl", to: "ip/rom_ctrl", patch_dir: "rom_ctrl"}, // ROM Control. | ||
| {from: "hw/ip/kmac", to: "ip/kmac", patch_dir: "kmac"}, // kmac. |
There was a problem hiding this comment.
Adding the patch directories should be in the same commit as where you add them to the vendor.hjson file.
There was a problem hiding this comment.
Fixed. IPs and vendoring script committed at the same time
There was a problem hiding this comment.
This is still not fixed. You reference the rom_ctrl and kmac patch directories before they are created.
There was a problem hiding this comment.
There are no rom_ctrl and kmac patch files/directories. Shall I remove them from the lowrisc_ip.vendor.hjson file?
There was a problem hiding this comment.
If there is no patch needed for kmac and rom_ctrl, you can remove the patch_dir option for them in lowrisc_ip.vendor.hjson
There was a problem hiding this comment.
patch_dirs removed
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.
There was a problem hiding this comment.
Can you please change this back? It would be good not to have this code churn.
There was a problem hiding this comment.
Reverted
There was a problem hiding this comment.
I think it is better not to have this code churn right now. You can do this in a separate PR after this if you feel strongly about it.
| {from: "hw/ip/rom_ctrl", to: "ip/rom_ctrl", patch_dir: "rom_ctrl"}, // ROM Control. | ||
| {from: "hw/ip/kmac", to: "ip/kmac", patch_dir: "kmac"}, // kmac. |
There was a problem hiding this comment.
This is still not fixed. You reference the rom_ctrl and kmac patch directories before they are created.
There was a problem hiding this comment.
These changes are not currently tested in CI, have you tested these changes?
| .BootRomInitFile ( RomInitFile ), | ||
| .AlertAsyncOn ( 1'b1 ), | ||
| .AlertSkewCycles ( 1 ), | ||
| .FlopToKmac ( 1'b0 ), | ||
| .RndCnstScrNonce ( '0 ), | ||
| .RndCnstScrKey ( '0 ), | ||
| .SecDisableScrambling ( 1'b1 ), | ||
| .MemSizeRom ( 32768 ) |
There was a problem hiding this comment.
Nit: Align the closing parentheses for parameters.
There was a problem hiding this comment.
Aligned
| .RndCnstScrNonce ( '0 ), | ||
| .RndCnstScrKey ( '0 ), | ||
| .SecDisableScrambling ( 1'b1 ), | ||
| .MemSizeRom ( 32768 ) |
There was a problem hiding this comment.
This should be calculated based on the length defined in top_pkg
There was a problem hiding this comment.
fixed: top_pkg::RomCtrlMemLength used
| .kmac_data_o (kmac_app_req[0]), | ||
| .kmac_data_i (kmac_app_rsp[0]), |
There was a problem hiding this comment.
I'd rather leave these unconnected until we integrate KMAC
| mocha_add_test(NAME timer_smoketest SOURCES timer/smoketest.c LIBRARIES ${LIBS} FPGA) | ||
| mocha_add_test(NAME timer_interrupt_test SOURCES timer/interrupt.c LIBRARIES ${LIBS}) | ||
| mocha_add_test(NAME uart_smoketest SOURCES uart/smoketest.c LIBRARIES ${LIBS}) | ||
|
|
There was a problem hiding this comment.
Don't remove this newline.
| timeout 5m $ROOT_DIR/build/lowrisc_mocha_top_chip_verilator_0/sim-verilator/Vtop_chip_verilator \ | ||
| $@ > /dev/null 2>&1 | ||
| --rominit $ROOT_DIR/sw/device/tests/rom_ctrl/mem_init_file.vmem \ | ||
| -E $@ > /dev/null 2>&1 |
There was a problem hiding this comment.
This looks wrong to me. You should make this change in tests.cmake I believe: 9affb1c
marnovandermaas
left a comment
There was a problem hiding this comment.
Some more comments on the software side.
| //uint8_t address_length = 3; | ||
| //uint8_t data_length = 4; |
There was a problem hiding this comment.
Can we remove these comments?
There was a problem hiding this comment.
Comented out code removed
| const uint32_t addresses[3] = { 0x00000000, 0x00004000, 0x00007FF0 }; | ||
|
|
||
| // ROM Init values | ||
| const uint32_t expected_data[3][4] = { { 0xDEADBEEF, 0xCAFEBABE, 0x00000001, 0xEEEEEEEE }, |
There was a problem hiding this comment.
Since the [3] must be the same for both can we make a define for this value?
There was a problem hiding this comment.
defines used instead of numbers
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
* 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
d7fc6d6 to
9e41b05
Compare