-
Notifications
You must be signed in to change notification settings - Fork 846
[prim] Remove primgen and replace with virtual cores #23555
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
base: master
Are you sure you want to change the base?
Conversation
65eb0ec
to
19af483
Compare
458c9e4
to
4009fe6
Compare
Interesting, it looks like mixing with a newer fusesoc might require at least Python 3.9 to work with the other dependencies.
|
e7dd88c
to
b2b9aab
Compare
Newer fusesoc also has a different directory layout compared to the OT fork. This was the OT fork's layout:
But newer fusesoc has this directory layout:
Accommodating the new tree needed fixes to various paths, including CFLAGS definitions in hjson files. In the current example, {work-root} is set to dvsim's In addition, for ralgen, the Now, some simulations work, but there is still a gap... |
787aca8
to
5344016
Compare
This PR is way out of date now, but since @olofk has released fusesoc 2.4, I think we don't need my random development tag anymore. 2.4 should be able to handle virtual cores as needed. |
@a-will I think that depends on the OT requirements. If you are fine with pulling in cores from one vendor during a build, then virtual cores should do the trick. However, as I understand it, OT wants to be able to select implementation at compile-time, and in that case you still need something like primgen. With that said, I believe FuseSoC 2.4 should have all the functionality needed to implement what you need. I have done some experimenting implementing the equivalent to primgen as a FuseSoC filter instead of a generator and it looks promising. Happy to discuss this further. |
It's unclear to me if OT actually needs that, though. All of our in-tree top-level fusesoc cores end up binding a specific prim library, and an out-of-tree integrator would almost certainly do the same for their actual chip. The build recipes for synthesis often can't be reused across technologies, and across integrations for the same opentitan IP, the top-level generally uses different RTL, so we end up with independent top-level cores anyway. We'd end up with different YAML for each real target, so sharing that core file across implementations doesn't seem to provide a benefit. There may be a bit of a rub with gate-level simulation applications, though, especially if you just want to redo the existing block-level simulations with your own prim library. I'd guess that the full integration level still uses its own core file for GLS, but is doing block-level simulation with a different prim library a supported activity? I'm not sure. We'd probably achieve the original setup's capabilities if only we could provide fusesoc (as a parameter to its invocation) which implementations of virtual cores to include for the specified top-level core file. For example, it could be arguments to provide additional VLNVs to add to the build (using their default target). Then the top-level core file wouldn't need to explicitly pull them in. |
@olofk If that bit above is interesting, the specifying of additional VLNVs would be akin to how hierarchical synthesis flows work. The top-level (and other sub-cores) may have dangling references, but the missing netlists would get specified as additional sources, then linked in during the build. For fusesoc, |
980f9e1
to
90f83e5
Compare
Looks like fusesoc 2.4 isn't being used in the sim runs in CI, and something broke with the CI file changes. I guess the API is a bit different for github actions. Maybe |
27aac7f
to
679942b
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.
Amazing PR! Left a few comments from looking at the code.
# TODO: prim_pkg_legacy is deprecated | ||
- lowrisc:prim:prim_pkg_legacy |
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.
Maybe good to put this in a separate commit, just to separate it from the prepend changes.
hw/ip/otp_ctrl/otp_ctrl.core
Outdated
# TODO: prim_pkg is deprecated | ||
- lowrisc:prim:prim_pkg |
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.
Will we create an issue to track this?
# TODO: prim_pkg_legacy is deprecated | ||
- lowrisc:prim:prim_pkg_legacy |
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.
This change is similar to a change made in an earlier commit.
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.
Are these CDC waivers tested in CI? If not, have we tested this ourselves?
@@ -14,6 +14,8 @@ filesets: | |||
- "fileset_partner ? (partner:systems:scan_role_pkg)" | |||
- "!fileset_partner ? (lowrisc:systems:ast)" | |||
- "!fileset_partner ? (lowrisc:systems:scan_role_pkg)" | |||
- "!fileset_partner ? (lowrisc:prim:prim_pkg_legacy)" |
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.
Should this have a todo that this will be removed in 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.
Also true for other core files in top_earlgrey
@@ -12,6 +12,8 @@ filesets: | |||
- lowrisc:systems:ast | |||
- lowrisc:systems:topgen | |||
- lowrisc:systems:padring | |||
- lowrisc:prim:prim_pkg_legacy |
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.
Add todo?
Regarding paths, I haven't checked exactly what the problem is, but I would recommend using |
That is what I did in this PR: https://github.com/lowRISC/opentitan/pull/23555/files#diff-8ed9c1256f9282d31ab3a7f150e2e95eaae62a546151c7203117aaa70451129e |
Signed-off-by: Andreas Kurth <[email protected]>
Signed-off-by: Andreas Kurth <[email protected]>
Signed-off-by: Andreas Kurth <[email protected]>
This reverts commit 2c749f9. Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Some core old files were left after pulling otp out of the prims. Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
…tants Signed-off-by: Hugo McNally <[email protected]>
This allows a configuration to inject a FuseSoC argument before the name of the core to invoke. This is useful because argument placement matters with FuseSoC. Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
lowrisc:dv:chip_sim isn't being used anywhere and it is triggering a warning in FuseSoC. Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Providers of `lowrisc:prim:rom` should have the module name `prim_rom`. This primitive was missed in a previous commit. Signed-off-by: Hugo McNally <[email protected]>
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.
If I understand correctly, the "Replace primgen with virtual prim cores" commit has to appear at the same time as the "Update fusesoc to 2.4.3" commit (because it reflects the change to the build directory layout).
Is it easy to split the "virtual prim cores" commit so that the build directory layout change is separate? If so, that bit could be merged into the "update fusesoc" commit?
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.
Hi there!
This all looks rather sensible, but it looks like there are lots of changes that could land before switching tool version. The result would be that the "big switch" moment would be smaller.
Please feel free to tag me on the split versions!
@@ -23,7 +23,7 @@ interface prim_sparse_fsm_flop_if #( | |||
string msg_id = $sformatf("%m"); | |||
|
|||
string path = dv_utils_pkg::get_parent_hier($sformatf("%m")); | |||
string signal_forced = $sformatf("%s.u_state_flop.q_o", path); | |||
string signal_forced = $sformatf("%s.state_o", path); |
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.
To avoid having a "known broken state" in the history, should this commit be merged with the switch to virtual prim cores?
@@ -82,11 +82,21 @@ jobs: | |||
if: steps.strategy.outputs.bitstreamStrategy != 'cached' | |||
run: | | |||
. util/build_consts.sh | |||
|
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.
If I understand correctly, this commit is all to do with the change to the new FuseSoc version. Again, maybe we need to squash with that commit so that (we think) everything works at each commit?
@@ -109,14 +109,14 @@ | |||
{ | |||
name: hmac_test_sha384_vectors | |||
uvm_test_seq: hmac_test_vectors_sha_vseq | |||
run_opts: ["+is_nist_test=1 +test_vectors_dir={build_dir}/src/lowrisc_dv_test_vectors_0 +test_timeout_ns=750_000_000 +sha2_digest_size=SHA2_384"] | |||
run_opts: ["+is_nist_test=1 +test_vectors_dir={build_dir}/fusesoc-work/src/lowrisc_dv_test_vectors_0 +test_timeout_ns=750_000_000 +sha2_digest_size=SHA2_384"] |
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.
I think there are quite a lot of commits starting here that should probably be squashed with the fusesoc version bump?
hw/top_englishbreakfast/ip_autogen/flash_ctrl/rtl/flash_ctrl_top_specific_pkg.sv
Show resolved
Hide resolved
@@ -27,7 +27,7 @@ | |||
"--tool={tool}", | |||
"--work-root={build_dir}/fusesoc-work", | |||
"--mapping=lowrisc:prim_generic:all:0.1", | |||
"--mapping=lowrisc:systems:top_earlgrey:0.1", | |||
"{additional_fusesoc_argument}", |
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.
Hmm. I think this commit probably needs squashing with the next two?
@@ -4,7 +4,7 @@ | |||
|
|||
`include "prim_assert.sv" | |||
|
|||
module prim_xilinx_rom import prim_rom_pkg::*; #( | |||
module prim_rom import prim_rom_pkg::*; #( |
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.
I think this needs squashing with an earlier one? But I think the filename also needs changing to match the module name?
Add back prim_pkg enum for legacy support, and mention that it is deprecated. Some IPs reference the enums directly.