Skip to content

Commit e447283

Browse files
committed
[FIRRTL] Fix InstanceOp::getPortDomain
Fix a mistake in the `InstanceOp::getPortDomain` member function where this would always return a casted `ArrayAttr` for a port's domain information. This is not correct as the domain information can be _either_ an `ArrayAttr` (if a non-domain port) or a `FlatSymbolRefAttr` (if a domain port). Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent 2215d6c commit e447283

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/circt/Dialect/FIRRTL/FIRRTLDeclarations.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def InstanceOp : HardwareDeclOp<"instance", [
148148
void setAllPortAnnotations(ArrayRef<Attribute> annotations);
149149

150150
/// Hooks for domain information.
151-
ArrayAttr getPortDomain(unsigned portIdx);
151+
Attribute getPortDomain(unsigned portIdx);
152152

153153
/// Clone this instance with inserted ports.
154154
InstanceOp cloneWithInsertedPorts(

lib/Dialect/FIRRTL/FIRRTLOps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,10 +2658,10 @@ void InstanceOp::setAllPortAnnotations(ArrayRef<Attribute> annotations) {
26582658
ArrayAttr::get(getContext(), annotations));
26592659
}
26602660

2661-
ArrayAttr InstanceOp::getPortDomain(unsigned portIdx) {
2661+
Attribute InstanceOp::getPortDomain(unsigned portIdx) {
26622662
assert(portIdx < getNumResults() &&
26632663
"index should be smaller than result number");
2664-
return cast<ArrayAttr>(getDomainInfo()[portIdx]);
2664+
return getDomainInfo()[portIdx];
26652665
}
26662666

26672667
InstanceOp InstanceOp::cloneWithInsertedPorts(

0 commit comments

Comments
 (0)