Skip to content
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_dev] Topgen work #25512

Merged
merged 12 commits into from
Dec 6, 2024
Merged

Conversation

pamaury
Copy link
Contributor

@pamaury pamaury commented Dec 4, 2024

This PR changes topgen so that it can properly reload the top_X.gen.hjson file which is dumped. By properly reload here we mean reloading the classes and not just the content, so that it can be pass to e.g. TopgenC.

This PR then switch autogen tests to bazel so that they can handle multitop. Several fixes to dependencies and DIFs are necessary to make it work on Darjeeling.

@pamaury pamaury changed the title Multitop wip2 [multitop_dev] Topgen work Dec 4, 2024
@pamaury pamaury force-pushed the multitop_wip2 branch 8 times, most recently from 9191c9e to d9cceaf Compare December 5, 2024 13:55
At the moment, topgen simplies serialized the complete topcfg using
hjson.dumps() but this poses a few problems. The biggest one is that
it is a mix of manual conversion to dict (when calling as_dict()
in the various topgen functions) and automatic (when calling _asdict()
from hjson.dumps). Furthermore, it turns out that we are missing some
fields that probably were never added to _asdict().

This commit introduces a new class (CompleteTopCfg) whose sole purpose
is to take the produced Hjson and reconstruct an in-memory topcfg that
is *exactly* equivalent (in Pythonic types) to the ones that was dumped.
This requires to sometimes reconstruct some classes, sometimes not.
Classes that need to be reconstruct get a new method (fromdict) and
the CompleteTopCfg does as much automatic deserializing as possible,
then some manual fixing.

There is also a small tweak to how clock groups are handled: in
alert_lpgs, the clock groups are all elements of the clocks.groups
but because of the naive serializing, a full copy is made. This
commit introduces GroupProxy that behaves like a Group for all
purposes but serializes only to the group name. This makes the
resulting hjson clearer and the deserialization easier.

Since this process is quite fragile, when topgen is running it will
actually check that this works by dumping the Hjson, reloading it
with the CompleteTopCfg and then checking that the two are equivalent.

Signed-off-by: Amaury Pouly <[email protected]>
This functionality was previously implemented in topgen. This commit
splits this functinality out of it so that it can be implemented by
calling another binary. This will enable running this from bazel
instead of generating it with topgen.

Signed-off-by: Amaury Pouly <[email protected]>
This is necessary for IPs without DIFs.

Signed-off-by: Amaury Pouly <[email protected]>
The template was still using earlgrey types. This requires to pass
top information to the generator and templates.

Signed-off-by: Amaury Pouly <[email protected]>
There are now several places in the codebase that need to depend
on all DIFs. Unfortunately, not every IP has a DIF. This commit
introduces a new all_difs cc_library to capture. The list of IPs
without DIFs is consolidated in a single place.

Signed-off-by: Amaury Pouly <[email protected]>
It is important to properly track those, otherwise Bazel will
wrongly cache the output even if the templates change.

Signed-off-by: Amaury Pouly <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
@pamaury pamaury force-pushed the multitop_wip2 branch 2 times, most recently from 11dfa0a to e64584a Compare December 6, 2024 09:12
Darjeeling does not have the ALERT_EN register. The set_alert_en
function will do nothing when asked to enabled and error out if
asked to disable (on Darjeeling).

Signed-off-by: Amaury Pouly <[email protected]>
Thid DIF exports not function beyond the autogenerated one. It is
necessary to have it so that the isr_tstutils and the autogenerated
plic tests can compile on Darjeeling.

Signed-off-by: Amaury Pouly <[email protected]>
@pamaury pamaury marked this pull request as ready for review December 6, 2024 13:22
@pamaury pamaury requested review from msfschaffner, cfrantz and a team as code owners December 6, 2024 13:22
@pamaury pamaury requested review from timothytrippel and removed request for a team December 6, 2024 13:22
@pamaury pamaury merged commit 6b8823c into lowRISC:multitop_dev Dec 6, 2024
34 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant