-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[multitop] Port DIF to multitop, port two tests to multitop #25943
Conversation
c68ad03
to
cde0ac5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code LGTM.
It looks like the compiler did pick up on the enum = int + 1
problem from the previous PR. I think the other CI errors are casting problems. LGTM once these are fixed and it passes CI.
c7e03e0
to
090e969
Compare
The term peripheral I/O is the one used in the comportable IO spec so it's better to stay consistent. It's abbreviated as periph_io to make it shorter. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
Previously, the code was using specifially crafted values to indicate the I/O direction. This causes problems with the compiler since we were using values output of the enumeration range. This was also more of hack. This commit introduces properly an enum type for the peripheral I/O direction. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
e980564
to
52cab17
Compare
@@ -173,6 +177,7 @@ cc_library( | |||
deps = [ | |||
":base", | |||
"//hw/top:clkmgr_c_regs", | |||
"//hw/top:dt_clkmgr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll see if a single set of clkmgr DIFs can really hold up for multi-top. ipgen templated IPs may not all work with this sort of abstraction. For that matter, the OTP DIFs use named partitions in places, so that probably won't due...
Stuff to ponder for the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes future will tell if a single DIF can handle that but it's definitely not the job of this PR to change the current approach ;)
52cab17
to
c2bd418
Compare
Instead of exposing the structure, expose indices and make all API take indices as input. This produce the same result with LTO enabled since constants indices will propagate to load of compile-time known constants. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
c2bd418
to
7db1630
Compare
Hide the `dt_<ip>` type (which is a struct) and replace it by an enum of instance names. The APIs are changed to takes indices as input and the structure is made local to a new `dt_<ip>.c` file. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
This commit changes the generator as follows: - a new `dif_<ip>_init_from_dt` function to initialize from DT instead of from an IO region - the dif IRQ names and types are now defines/typedefs to the DT types: this ensures compatibility with existing code and an incremental transition Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
The DT commit changed the type `dif_rv_plic_irq_id_t` from `uint32_t` to an enumeration. This makes certain implicit casts in the C++ code invalid now. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
This is for documentation purposes, to make it clear that DT IRQ IDs are PLIC IRQ IDs. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
The compiler is not happy about a missing case for kDtI2cIrqCount which is obviously invalid. Add a default to please the compiler. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
This is necessary since the autogen part of DIFs now depends on DT. Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org> Co-authored-by: Alexander Williams <awill@opentitan.org>
Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
7db1630
to
7bdc34e
Compare
I have done a substantial overall of the PR:
/**
* List of instances.
*/
typedef enum dt_uart {
kDtUart0 = 0, /**< */
kDtUart1 = 1, /**< */
kDtUart2 = 2, /**< */
kDtUart3 = 3, /**< */
kDtUartCount = 4, /**< Number of instances */
} dt_uart_t; and all APIs functions take a
|
Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org> Co-authored-by: Alexander Williams <awill@opentitan.org>
bfa997c
to
43b9922
Compare
Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
43b9922
to
e784011
Compare
So this PR is going to break Earlgrey whatever I do because the patching replaces I suggest we disable temporarily the EB CI tests for the time being? @vogelpi |
SGTM, but let's make sure @a-will is in the loop as well as he used EB as a prototype, too. |
static dif_aon_timer_t aon_timer; | ||
static dt_aon_timer_t kAonTimerDt = kDtAonTimerAon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, these enums are still top-specific, since these are constructed from the instance names in the module section of the top hjson, right?
But we can adjust this whenever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The most logical thing to do is usually to go over all instances of this IP and test them one by one. In this case, test each aon_timer (even though it's almost sure that there is only one). Alternatively, we could just test the first one (set the index to 0).
/** | ||
* Description of instances. | ||
*/ | ||
${helper.inst_struct.render()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance, it doesn't look like this enum has a unique namespace. I'd wager that name collisions are unlikely, but we might want to adjust this at some point. The suffix is controlled by the user's hjson file, so it's less controlled. (We could choose to provide naming guidelines instead, though.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, it's named dt_<something>_desc_t
so technically could get a collision. We could alternatively name it dt_desc_<something>
, this should be enough to avoid collisions. Side node: this type is local to the file so we could technically give it a fixed name, ie dt_this_ip_desc_t
and it would also solve the problem.
Yes, this is fine. I hear @pamaury has already solved this in the multitop_dev branch, so it'll only be a temporary hiatus. 😄 |
Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
8642d14
to
594022d
Compare
Follow up PR on #25807, this handles the DIF and shows how to port two tests.
This PR also does one notable change to the DT which was discussed on #25807 and pushed to this PR: rename "signal" to "peripheral I/O" to match the CIP specification.