-
Notifications
You must be signed in to change notification settings - Fork 404
[FIRRTL] DomainFieldAttr types are PropertyTypes #9094
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
seldridge
merged 2 commits into
main
from
dev/seldridge/firrtl-verify-domain-field-type-is-property-ods
Oct 15, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| //===- FIRRTLEnums.h - FIRRTL dialect enums ---------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This file contains custom FIRRTL Dialect enumerations. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef CIRCT_DIALECT_FIRRTL_FIRRTLENUMS_H | ||
| #define CIRCT_DIALECT_FIRRTL_FIRRTLENUMS_H | ||
|
|
||
| #include "circt/Dialect/FIRRTL/FIRRTLDialect.h" | ||
| #include "circt/Support/LLVM.h" | ||
|
|
||
| namespace circt { | ||
| namespace firrtl { | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // PortDirections | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| /// This represents the direction of a single port. | ||
| enum class Direction { In, Out }; | ||
|
|
||
| /// Prints the Direction to the stream as either "in" or "out". | ||
| llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Direction &dir); | ||
|
|
||
| namespace direction { | ||
|
|
||
| /// Return an output direction if \p isOutput is true, otherwise return an | ||
| /// input direction. | ||
| static inline Direction get(bool isOutput) { return (Direction)isOutput; } | ||
|
|
||
| /// Convert from Direction to bool. The opposite of get; | ||
| static inline bool unGet(Direction dir) { return (bool)dir; } | ||
|
|
||
| /// Flip a port direction. | ||
| Direction flip(Direction direction); | ||
|
|
||
| static inline StringRef toString(Direction direction) { | ||
| return direction == Direction::In ? "in" : "out"; | ||
| } | ||
|
|
||
| static inline StringRef toString(bool direction) { | ||
| return toString(get(direction)); | ||
| } | ||
|
|
||
| /// Return a \p DenseBoolArrayAttr containing the packed representation of an | ||
| /// array of directions. | ||
| mlir::DenseBoolArrayAttr packAttribute(MLIRContext *context, | ||
| ArrayRef<Direction> directions); | ||
|
|
||
| /// Return a \p DenseBoolArrayAttr containing the packed representation of an | ||
| /// array of directions. | ||
| mlir::DenseBoolArrayAttr packAttribute(MLIRContext *context, | ||
| ArrayRef<bool> directions); | ||
|
|
||
| /// Turn a packed representation of port attributes into a vector that can | ||
| /// be worked with. | ||
| SmallVector<Direction> unpackAttribute(mlir::DenseBoolArrayAttr directions); | ||
|
|
||
| } // namespace direction | ||
| } // namespace firrtl | ||
| } // namespace circt | ||
|
|
||
| #define GET_ATTRDEF_CLASSES | ||
| #include "circt/Dialect/FIRRTL/FIRRTLEnums.h.inc" | ||
|
|
||
| #endif // CIRCT_DIALECT_FIRRTL_FIRRTLENUMS_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Was including this a problem?
Looking at upstream MLIR dialect headers, they seem to.. do things differently.
I think requiring including FIRRTLEnums.h separately is reasonable to match how we've organized attributes/operations/types similarly.
Good call, thanks!
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.
It was a problem if this was included by
FIRRTLEnums.h(which the PR needed) as the.h.incdon't have any include guards. Some have theGET_<kind>_CLASSESguard which could help, but enums and attributes are totally unguarded. Hence, I needed to get this under something that we could include guard.I was following along with how SPIRV dialect was defined upstream and modeling it off of that.
Yes, we are doing things differently from upstream and that makes me want to go redo our dialects to align with upstream...