Skip to content

Cloning and matching #614

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

Merged
merged 49 commits into from
Jul 31, 2025
Merged

Cloning and matching #614

merged 49 commits into from
Jul 31, 2025

Conversation

mkorbel1
Copy link
Contributor

@mkorbel1 mkorbel1 commented Jul 24, 2025

Description & Motivation

This PR introduces a couple ideas:

  • Requiring a clone to be included on Logics and Interfaces
  • Adding APIs to Module that take advantage of those capabilities

The addTyped* functions on Module are parameterized and return the same datatype as was received. Additionally, Module now supports LogicStructures of any type as ports, though the SV still packs them on the interface. These functions are also useful for creating ports when you want the widths/dimensions to match the original argument.

There's also some add*InterfacePorts functions for Interfaces, which basically just wrap the more common way to create interfaces by calling clone and connectIO. There's one for arbitrary Interfaces and one for PairInterfaces.

Also, this adds packed to base Logic as a no-op so that you can safely use addTyped* functions but force a simple logic as the input (rather than an arbitrary structure).

Also, this PR adjusts naming of (non-reserved) LogicStructure elements in generated SystemVerilog to prefix with the name of the structure, which makes the generated SV more readable.

Related Issue(s)

N/A

Partially addresses #609 by exposing original in BusSubset
Fix #578
Close #519 -- we're deprecating PairInterface.clone.

Testing

Added new testing for new functionality.

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

No, though there's new expectations for any implemented Interfaces and LogicStructures if they wish to properly handle these APIs.

Deprecated PairInterface.clone (the constructor, not the method)

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

Yes, API docs included and updated user guide.

@mkorbel1 mkorbel1 marked this pull request as ready for review July 24, 2025 17:28
Copy link
Contributor

@desmonddak desmonddak left a comment

Choose a reason for hiding this comment

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

Looks good and I tried it on FPConverter which dramatically simplified the IO handling of a LogicStructure. This will apply to FPAdder FPMultiplier, the two square root components, and the Fixed2Float, Float2Fixed.

@mkorbel1
Copy link
Contributor Author

Thank you for reviewing, @desmonddak !

@desmonddak
Copy link
Contributor

This looks like a major cleanup. I even see a LogicStructure naming change that will help SV output (I noticed with Fixed2Float, I think I can verify it and remove a named in the component).

@desmonddak
Copy link
Contributor

So I notice a change from addMatchedOutput to addTypedOutput in that the latter is unhappy with the passing in of a FixedPoint as second argument.

@desmonddak
Copy link
Contributor

Ahh. This is where a clone function is passed.

@mkorbel1 mkorbel1 linked an issue Jul 29, 2025 that may be closed by this pull request
@desmonddak
Copy link
Contributor

New changes look good.

@mkorbel1 mkorbel1 merged commit 76a39a2 into intel:main Jul 31, 2025
3 checks passed
@mkorbel1 mkorbel1 deleted the clone_and_match branch July 31, 2025 20:00
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.

LogicStructure Example in User Guide doesn't compile PairInterface cloning should include subInterfaces as well
2 participants