-
Notifications
You must be signed in to change notification settings - Fork 813
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
[prim] Remove primgen and replace with virtual cores #23555
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.
@@ -73,6 +73,7 @@ generate: | |||
parameters: | |||
name: otbn | |||
ip_hjson: ../../../data/otbn.hjson | |||
position: prepend |
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 go in the previous commit?
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: 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]>
Signed-off-by: Hugo McNally <[email protected]>
Signed-off-by: Hugo McNally <[email protected]>
Switched ascent lint over to use FuseSoC's `--work-root` as oppose to `--build-root`. Signed-off-by: Hugo McNally <[email protected]>
Make many lint targets depend on the generic prims. Co-authored-by: Hugo McNally <[email protected]> Signed-off-by: Alexander Williams <[email protected]>
They were all missing prim_subreg_pkg in their dependencies. Signed-off-by: Alexander Williams <[email protected]>
The macros depend on ipgen outputs, so avoid pulling them in with the ordinary prims. Signed-off-by: Alexander Williams <[email protected]>
Signed-off-by: Alexander Williams <[email protected]>
Move the non-templated otp_ctrl_pkg out of the ipgen folder. Remove unnecessary virtual VLNVs exported by otp_ctrl ipgen outputs. Add direct dependencies to ipgen outputs, including pwrmgr_pkg from the same top. Signed-off-by: Alexander Williams <[email protected]>
9562083
to
b02b996
Compare
I have been working on a similar feature as olofk/fusesoc#727 for fusesoc under the guidance of @olofk. This feature adds a lock file to fusesoc, which guides the core selection during the fusesoc run. Guiding in selecting core version and virtual core implementations. I opened a draft pull request, olofk/fusesoc#728, for collaboration. We should collaborate on a guided virtual core selection feature. |
Lock files are a brilliant addition to FuseSoC that I'm very pleased to see. However, I don't think it solves the same problem as olofk/fusesoc#727 intends to. Currently we have to add the generic primitives explicitly to a huge number files (e.g. files_lint:
depend:
- lowrisc:prim_generic:all
# ...
filesets_append:
- files_lint @a-will 's solution is to allow VLNVs to be added in the CLI instead: fusesoc --add-vlnv lowrisc:prim_generic:all lint lowrisc:ip:csrng Another solution to this problem that would keep the cli cleaner would be to allow users to set default implementations for a given virtual core in the |
Yes! This was perhaps not expressed clearly enough, but the lock files have two purposes. The first is pinning versions, and the other one is exactly what you describe above. Locking down virtuals to a concrete implementation. We felt it was so close in scope with the first purpose of the lock files so we decided to put it in the same file rather than in fusesoc.conf This is very much developed with OpenTitan in mind, so let us know your thoughts. What we perhaps should consider adding is to allow expressing the virtual->concrete mapping on the command-line similar to what @a-will did with the --add-vlnv feature. |
This is exactly what, we as Rivos and also other integrators need. There is the public |
I suggest moving the discussion to olofk/fusesoc#728 so that we can work out what is best for everyone involved. |
Experiment with a fusesoc that includes the --add-vlnv arg. Signed-off-by: Alexander Williams <[email protected]>
Ensure all IPs use the generic prims by default when simulating. Signed-off-by: Alexander Williams <[email protected]>
This reverts commit 08b81a0. Signed-off-by: Alexander Williams <[email protected]>
… levels" This reverts commit 986c249. Signed-off-by: Alexander Williams <[email protected]>
This reverts commit 0a46360. Signed-off-by: Alexander Williams <[email protected]>
Add the choice of prims to the fusesoc call instead. Signed-off-by: Alexander Williams <[email protected]>
Use the --add-vlnv option to resolve fusesoc virtual core dependencies. Signed-off-by: Alexander Williams <[email protected]>
I've changed this PR to use a development release that includes the Changing to this method dropped the changed files down by ~120 files. |
Signed-off-by: Alexander Williams <[email protected]>
Signed-off-by: Alexander Williams <[email protected]>
TODOs (WIP):
|
Add back prim_pkg enum for legacy support, and mention that it is deprecated. Some IPs reference the enums directly.