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

[FIRRTL] Add VersionAttr, put on Circuit, use to parse FIRRTL 6 Annotations #8390

Closed
wants to merge 7 commits into from

Conversation

seldridge
Copy link
Member

@seldridge seldridge commented Apr 4, 2025

This adds a new VersionAttr which is made an optional attribute on FIRRTL circuits. This is used to determine which version of the annotation format should be used in the LowerAnnotations pass. This can additionally be used in the future if we ever get into a hard situation where we need to support a legacy behavior in the FIRRTL spec as opposed to just syntax differences or new features.

See individual commits for more information.

Add a `VersionAttr` which can be used to store the version of a specific
FIRRTL circuit.  While this was previously only necessary to be known
during parsing, due to planned changed in annotation handling, this
information will need to be put on the circuit and preserved through to
`LowerAnnotation`.  This is the first infrastructural piece necessary to
work towards this.

Signed-off-by: Schuyler Eldridge <[email protected]>
Add a new attribute to FIRRTL's `CircuitOp` that contains the version that
the FIRRTL circuit was parsed as.  This is intended to be static
information that will change compilation behavior.  At present, this is
only intended to be used to change how annotations are parsed.  However,
this is general infrastructure that could be used to make actual
breaking compilation changes if we ever needed it.

Signed-off-by: Schuyler Eldridge <[email protected]>
Migrate the parser to use VersionAttr instead of FIRVersion.  This allows
direct comparisons against the version reported by the circuit.

Signed-off-by: Schuyler Eldridge <[email protected]>
Add support for the new FIRRTL 6 Annotation format [[1]].  This drops the
circuit portion of the non-legacy annotation format.  It also drops
support for the legacy annotation format.  Upstream chisel has already
been modified to never emit the legacy annotation format.

For example, annotations that previously looked like:

    ~Foo|Bar>a

Now must look like:

    Bar>a

[1]: chipsalliance/firrtl-spec#290

Signed-off-by: Schuyler Eldridge <[email protected]>
@seldridge seldridge requested a review from darthscsi as a code owner April 4, 2025 03:36
@seldridge
Copy link
Member Author

After out-of-band discussion, this is not needed. Instead, we can augment the target syntax to optionally elide the circuit name (chipsalliance/firrtl-spec@160bafe). This is already accepted by CIRCT and we don't need to carry the version forward.

@seldridge seldridge closed this Apr 7, 2025
@seldridge seldridge deleted the dev/seldridge/firrtl-version-on-circuit branch April 7, 2025 22:44
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