Skip to content

Conversation

@Razer6
Copy link
Member

@Razer6 Razer6 commented Mar 6, 2025

This PR templifies the core files and then creates template dependencies to the SV files. This is needed to render AC ranges with different names. Otherwise it comes to fusesoc errors due to collisions and naming requirements.

@Razer6 Razer6 requested a review from a team as a code owner March 6, 2025 15:00
@Razer6 Razer6 requested review from a team, martin-velay and rswarbrick and removed request for a team March 6, 2025 15:00
Copy link
Contributor

@martin-velay martin-velay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I follow the logic correctly, I think some names should also be templated.

Why do we need to give a different name to it? This is making the code hard to write as the tools to parse the code and help to code are lost.

@Razer6
Copy link
Member Author

Razer6 commented Mar 12, 2025

I think in DV we can get away with only unquifying the core files, the tb.sv (for the module instantiation) and the bind target (which uses the DUT name) as well as cases where packages from the RTL are used. Let me change that.

@Razer6 Razer6 force-pushed the templify-ac-range-dv branch from eea55ea to bb2ffda Compare March 12, 2025 09:30
@Razer6
Copy link
Member Author

Razer6 commented Mar 12, 2025

@martin-velay I reworkd the templates. The only independent file where no templating is needed is ac_range_check_dut_cfg.sv. I left that for now. All others have templating requirements.

@rswarbrick
Copy link
Contributor

Hi @Razer6! Is this PR still relevant? (Is there anything to extract or should it just be closed?)

@rswarbrick rswarbrick removed their request for review October 30, 2025 22:53
@Razer6
Copy link
Member Author

Razer6 commented Oct 30, 2025

Hi @Razer6! Is this PR still relevant? (Is there anything to extract or should it just be closed?)

Yes it is. I am just about rebeasing. @davidschrammel is making some experiments internally.

@Razer6 Razer6 force-pushed the templify-ac-range-dv branch 2 times, most recently from 879906f to 3667050 Compare November 3, 2025 13:22
@Razer6 Razer6 requested a review from rswarbrick November 3, 2025 13:38
@Razer6
Copy link
Member Author

Razer6 commented Nov 3, 2025

@rswarbrick @martin-velay Can you please take a look? I properly templified the DV code now to deal with different module name instances. Code is tested downstream with different instances.

@Razer6 Razer6 requested a review from martin-velay November 3, 2025 13:39
rswarbrick
rswarbrick previously approved these changes Nov 3, 2025
Copy link
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sensible to me as an improvement. BUT it's a bit bonkers that we template most of this code! As a follow-up, I think it would probably be better to structure this like I did for racl_ctrl, where some non-templated DV code looks around at runtime to figure out what situation it is in.

That way, you only have to template a couple of files (tb.sv.tpl, for example) and everything else avoids getting duplicated.

@rswarbrick
Copy link
Contributor

Oh! But I notice that a test is failing in CI in a bound-in pwrmgr SVA interface.

@rswarbrick rswarbrick dismissed their stale review November 3, 2025 14:31

CI isn't actually passing (and I only noticed after approving the PR)

@Razer6
Copy link
Member Author

Razer6 commented Nov 3, 2025

Oh! But I notice that a test is failing in CI in a bound-in pwrmgr SVA interface.

Looking into it. That one seems to be related to the clkmgr change (and is also failing on master). So not related to this one.

Copy link
Contributor

@martin-velay martin-velay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some questions and remarks. But I guess nothing critical.

@Razer6 Razer6 force-pushed the templify-ac-range-dv branch from 3667050 to cff706b Compare November 4, 2025 10:31
@lowRISC lowRISC deleted a comment from Razer6 Nov 4, 2025
@martin-velay
Copy link
Contributor

This looks sensible to me as an improvement. BUT it's a bit bonkers that we template most of this code! As a follow-up, I think it would probably be better to structure this like I did for racl_ctrl, where some non-templated DV code looks around at runtime to figure out what situation it is in.

That way, you only have to template a couple of files (tb.sv.tpl, for example) and everything else avoids getting duplicated.

I agree with this comment, the templatization is something we should keep at its minimum. Why don't we do something similar as Rupert did for racl_ctrl?

@Razer6
Copy link
Member Author

Razer6 commented Nov 4, 2025

I agree with this comment, the templatization is something we should keep at its minimum. Why don't we do something similar as Rupert did for racl_ctrl?

I am very confused. Previously, in this comment, you suggested to templify every reference of ac_range_check?

Furthermore, upon reviewing the code, you will notice that the current implementation is the minimum required for the current structure of the testbench code. In racl_ctrl's DV code, there are some pieces that are not part of the ipgen core, thus there is no templating. Note that racl_ctrl's DV code is very basic at the moment. When expanding that for the full feature set, many of the non-templified code at the moment need become a template again.

@Razer6 Razer6 force-pushed the templify-ac-range-dv branch from cff706b to 0dfa836 Compare November 4, 2025 14:22
@Razer6
Copy link
Member Author

Razer6 commented Nov 5, 2025

I agree with this comment, the templatization is something we should keep at its minimum. Why don't we do something similar as Rupert did for racl_ctrl?

Actually, the approach that Rupert tried for racl_ctrl does not work. It uses module instance specifc types and packages in the common code. I opened #28648 to clean that up and make the code working with different module instance names.

@Razer6 Razer6 force-pushed the templify-ac-range-dv branch from 0dfa836 to 98bd36f Compare November 5, 2025 10:45
@rswarbrick
Copy link
Contributor

If that is the case, can you give some more detail about why that doesn't work? Hopefully we can get things working without needing to check in multiple copies of the same file :-)

@rswarbrick
Copy link
Contributor

Furthermore, upon reviewing the code, you will notice that the current implementation is the minimum required for the current structure of the testbench code. In racl_ctrl's DV code, there are some pieces that are not part of the ipgen core, thus there is no templating. Note that racl_ctrl's DV code is very basic at the moment. When expanding that for the full feature set, many of the non-templified code at the moment need become a template again.

Clearly not a discussion for this PR (so I'll shut up after this) but I really hope this is wrong. The whole point of the way I structured things was that the parameterisation can be done "at runtime" by the DV code.

@Razer6
Copy link
Member Author

Razer6 commented Nov 7, 2025

Let's continue the discussion in #28648 for that :)

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.

5 participants