[multitop] Make the codebase more ready to support multiple tops - #31072
[multitop] Make the codebase more ready to support multiple tops#31072mfnch wants to merge 7 commits into
Conversation
| }, | ||
| [], | ||
| ), | ||
| "flash_ctrl": ["//sw/device/lib/testing:nvm_testutils"], |
There was a problem hiding this comment.
I need to have a look at how to handle nvm_testutils. I think this library should shield its users from having to check whether the hardware is supported... a bit like the ottf_console?
There was a problem hiding this comment.
One option would be to change nvm_testutils so that it always compiles, even when there is no hardware (flash/rram). The library would then fail only when trying to write or read to NVM. In practice, however, there aren't many users of nvm_testutils - apart from this one - that would benefit from this change (most users want to to actually write from or read to NVM rather than optionally initialize it).
However, the problem of how we pull a NVM library in as a dependency is a real one. It'd be nice to have an "alias" IP that just tells us whether a NVM IP is present in the current top. That would make handling dependencies to this library nicer.
c66618b to
0be4fbe
Compare
d79f37e to
60e96a4
Compare
Remove spurious header inclusion and dependencies which accidentally survived from previous refactorings. Signed-off-by: Matteo Franchin <matteo.franchin@lowrisc.org>
Some tests (aes_prng_reseed_test, aes_force_prng_reseed_test and aes_stall_test) were including the simple_serial.h header and declaring this library as a dependency, despite not using it. This had the effect of excluding these tests for execution on Darjeeling, as simple_serial was explicitly declared as requiring the Earlgrey top. This commit removes the unnecessary dependency on the simple_serial library and also removes these tests for execution on Darjeeling, as they are not declared in any of its DV test plans. Signed-off-by: Matteo Franchin <matteo.franchin@lowrisc.org>
Make sure the ottf console is usable even when no backends are available. Signed-off-by: Matteo Franchin <matteo.franchin@lowrisc.org>
Change functions that get/set whether a gateable/hintable clock is enabled so that they gracefully handle the case where there are no gateable/hintable clocks in the system. Signed-off-by: Matteo Franchin <matteo.franchin@lowrisc.org>
Improve the sanity checks (assertions) and make sure the right macros are used to calculate the CTRL_N and REGWEN register offsets depending on their multireg count. These changes make the code more suitable to work with different tops. Signed-off-by: Matteo Franchin <matteo.franchin@lowrisc.org>
Sub-registers names have two different forms depending on their number:
This breaks uniformity between the tops and forces C code to remedy
using preprocessor directives.
For example, the following code would be necessary to support tops where
a multi-register MRNAME has 1 or more sub-registers:
#if RSTMGR_SW_RST_REGWEN_MULTIREG_COUNT == 1
offset = MRNAME_REG_OFFSET;
#else
offset = MRNAME_0_REG_OFFSET;
#endif
This commit changes the register code generation to provide the _0
suffixed macros as well. This allows simplifying the C code while
keeping compatibility with the old behaviour of the tool.
Signed-off-by: Matteo Franchin <matteo.franchin@lowrisc.org>
Refactor test_rom.c to enable code (via #ifdefs) based on the supported IP (HAS_PINMUX, HAS_UART, ...) rather than on the active top (OPENTITAN_IS_EARLGREY, OPENTITAN_IS_DARJEELING, ...). This makes the implementation less likely to require changes when new tops are added. Group all code on the same #ifdef (the header inclusion as well as all code that uses it) by defining static functions that are called from the main initialization function, rom_test_main. This reduces the amount of preprocessor code in this function and hopefully makes it easier to read and maintain. Use top-independent names (kDtPinmuxFirst rather than kDtPinmux) with static assertions when we expect only one instance of the IP to exist. Signed-off-by: Matteo Franchin <matteo.franchin@lowrisc.org>
This PR includes changes that aim to make the OpenTitan codebase easier to work with when dealing with multiple tops:
NOTE: The first two commits ("Fix documentation" and "Add opentitan_for_ip") are expected to be merged as part of #31025. I am going to rebase this PR once the other PR gets merged.