lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.57k stars 770 forks source link

[otp_ctrl] Make usable in different top-level designs (multi-top support) #25019

Open andreaskurth opened 22 hours ago

andreaskurth commented 22 hours ago

otp_ctrl is currently specific to Earlgrey on master and to Darjeeling on integrated_dev. Substantial differences between the two can be found in otp_ctrl_reg_top and otp_ctrl_part_pkg, though other RTL code also contains differences.

As a scalable, long-term solution, should otp_ctrl be generated through ipgen and topgen?

As a workable, near-term solution, would a second variant with a different name (e.g., otp_ctrl_darjeeling) be necessary and sufficient?

matutem commented 17 hours ago

Here is what I dug up so far about otp_ctrl. Between Aug and Sep 2023 Michael and I made a bunch of changes in opentitan-integrated to generate a bunch of otp_ctrl files based on hw/ip/otp_ctrl/data/otp_ctrl_mmap.hjson. This uses util/design/gen-otp-mmap.py, which is not a great name since it uses the hjson mmap file to generate other stuff.

Some PRs:

Then in Jan 2024 I made these (hopefully same) changes in master.

This not the typical generation flow: the typical ipgen flow starts from the top_level hjson, but in this case the "source of truth" is the /data/_mmap.hjson, and .hjson is generated. However, in theory topgen can use any file (or files) to extract the parameters used to generate its artifacts. In fact, I think we can use ipgen for this.