diff --git a/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td b/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td index 093f93fc5c89..6316219e1e7a 100644 --- a/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td +++ b/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td @@ -82,41 +82,59 @@ def AugmentedBundleType : AugmentedType<"AugmentedBundleType"> { hasPrefix # [{ bool isRoot() { return getID() != nullptr; } }]; + let mnemonic = "augmentedBundle"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedVectorType : AugmentedType<"AugmentedVectorType"> { let summary = "GrandCentral AugmentedVectorType"; let extraClassDeclaration = defaultClassDeclaration # hasElements; + let mnemonic = "augmentedVector"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedGroundType : AugmentedType<"AugmentedGroundType"> { let summary = "GrandCentral AugmentedGroundType"; let extraClassDeclaration = hasID # hasName; + let mnemonic = "augmentedGround"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedStringType : AugmentedType<"AugmentedStringType"> { let summary = "GrandCentral AugmentedStringType"; let extraClassDeclaration = hasName; + let mnemonic = "augmentedString"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedBooleanType : AugmentedType<"AugmentedBooleanType"> { let summary = "GrandCentral AugmentedBooleanType"; let extraClassDeclaration = hasName; + let mnemonic = "augmentedBoolean"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedIntegerType : AugmentedType<"AugmentedIntegerType"> { let summary = "GrandCentral AugmentedIntegerType"; let extraClassDeclaration = hasName; + let mnemonic = "augmentedInteger"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedDoubleType : AugmentedType<"AugmentedDoubleType"> { let summary = "GrandCentral AugmentedDoubleType"; let extraClassDeclaration = hasName; + let mnemonic = "augmentedDouble"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedLiteralType : AugmentedType<"AugmentedLiteralType"> { let summary = "GrandCentral AugmentedLiteralType"; let extraClassDeclaration = hasName; + let mnemonic = "augmentedLiteral"; + let assemblyFormat = "`<` $underlying `>`"; } def AugmentedDeletedType : AugmentedType<"AugmentedDeletedType"> { let summary = "GrandCentral AugmentedDeletedType"; let extraClassDeclaration = hasName; + let mnemonic = "augmentedDeleted"; + let assemblyFormat = "`<` $underlying `>`"; } diff --git a/include/circt/Dialect/FIRRTL/FIRRTLTypesImpl.td b/include/circt/Dialect/FIRRTL/FIRRTLTypesImpl.td index 06c87ce6fbae..13362ae11296 100644 --- a/include/circt/Dialect/FIRRTL/FIRRTLTypesImpl.td +++ b/include/circt/Dialect/FIRRTL/FIRRTLTypesImpl.td @@ -47,6 +47,7 @@ def SIntImpl : FIRRTLImplType<"SInt", TypeBuilder<(ins)>, ]; let genVerifyDecl = true; + let typeName = "firrtl.sint"; let extraClassDeclaration = [{ using WidthQualifiedTypeTrait::getWidth; using WidthQualifiedTypeTrait::hasWidth; @@ -66,6 +67,7 @@ def UIntImpl : FIRRTLImplType<"UInt", TypeBuilder<(ins)>, ]; let genVerifyDecl = true; + let typeName = "firrtl.uint"; let extraClassDeclaration = [{ using WidthQualifiedTypeTrait::getWidth; using WidthQualifiedTypeTrait::hasWidth; @@ -78,6 +80,7 @@ def ClockTypeImpl : FIRRTLImplType<"Clock"> { let summary = "Clock signal"; let parameters = (ins "bool":$isConst); let storageClass = "FIRRTLBaseTypeStorage"; + let typeName = "firrtl.clock"; let builders = [ TypeBuilder<(ins), [{ return $_get($_ctxt, false); @@ -92,6 +95,7 @@ def ResetTypeImpl : FIRRTLImplType<"Reset"> { let summary = "Reset Signal"; let parameters = (ins "bool":$isConst); let storageClass = "FIRRTLBaseTypeStorage"; + let typeName = "firrtl.reset"; let builders = [ TypeBuilder<(ins), [{ return $_get($_ctxt, false); @@ -106,6 +110,7 @@ def AsyncResetTypeImpl : FIRRTLImplType<"AsyncReset"> { let summary = "AsyncReset signal"; let parameters = (ins "bool":$isConst); let storageClass = "FIRRTLBaseTypeStorage"; + let typeName = "firrtl.asyncreset"; let builders = [ TypeBuilder<(ins), [{ return $_get($_ctxt, false); @@ -121,6 +126,7 @@ def AnalogTypeImpl : FIRRTLImplType<"Analog", let summary = "Analog signal"; let parameters = (ins "int32_t":$widthOrSentinel, "bool":$isConst); let storageClass = "WidthTypeStorage"; + let typeName = "firrtl.analog"; let builders = [ TypeBuilder<(ins "std::optional":$width, CArg<"bool", "false">:$isConst)>, TypeBuilder<(ins)>, @@ -173,6 +179,7 @@ class BaseVectorTypeImpl traits = [ } def FVectorImpl : BaseVectorTypeImpl<"FVector","::circt::firrtl::FIRRTLBaseType"> { + let typeName = "firrtl.vector"; let firrtlExtraClassDeclaration = [{ /// Return this type with any flip types recursively removed from itself. FIRRTLBaseType getPassiveType(); @@ -187,6 +194,7 @@ def FVectorImpl : BaseVectorTypeImpl<"FVector","::circt::firrtl::FIRRTLBaseType" def OpenVectorImpl : BaseVectorTypeImpl<"OpenVector","::circt::firrtl::FIRRTLType"> { let genVerifyDecl = 1; + let typeName = "firrtl.openvector"; } class BaseBundleTypeImpl traits = [], string BaseType = ElementType> @@ -270,6 +278,7 @@ class BaseBundleTypeImpl traits = [ } def BundleImpl : BaseBundleTypeImpl<"Bundle","::circt::firrtl::FIRRTLBaseType"> { + let typeName = "firrtl.bundle"; let firrtlExtraClassDeclaration = [{ /// Return this type with any flip types recursively removed from itself. FIRRTLBaseType getPassiveType(); @@ -283,6 +292,7 @@ def BundleImpl : BaseBundleTypeImpl<"Bundle","::circt::firrtl::FIRRTLBaseType"> } def OpenBundleImpl : BaseBundleTypeImpl<"OpenBundle","::circt::firrtl::FIRRTLType"> { + let typeName = "firrtl.openbundle"; let genVerifyDecl = 1; } @@ -291,6 +301,7 @@ def FEnumImpl : FIRRTLImplType<"FEnum", [DeclareTypeInterfaceMethods":$elements, "bool":$isConst); let storageClass = "FEnumTypeStorage"; let genVerifyDecl = true; + let typeName = "firrtl.enum"; let skipDefaultBuilders = true; let builders = [ TypeBuilder<(ins "ArrayRef":$elements, CArg<"bool", "false">:$isConst)> @@ -384,6 +395,7 @@ def RefImpl : FIRRTLImplType<"Ref", let genAccessors = true; let genStorageClass = true; let genVerifyDecl = true; + let typeName = "firrtl.ref"; let skipDefaultBuilders = true; let builders = [ @@ -404,6 +416,7 @@ def BaseTypeAliasImpl : FIRRTLImplType<"BaseTypeAlias", [DeclareTypeInterfaceMet (ins "StringAttr":$name, TypeParameter<"::circt::firrtl::FIRRTLBaseType", "An inner type">:$innerType); let storageClass = "BaseTypeAliasStorage"; + let typeName = "firrtl.basetypealias"; let genAccessors = true; let skipDefaultBuilders = true; let extraClassDeclaration = [{ @@ -451,6 +464,7 @@ def ClassImpl : PropImplType<"Class", [ ArrayRefParameter<"ClassElement">:$elements ); let genStorageClass = false; + let typeName = "firrtl.propClass"; let genAccessors = false; let builders = [ TypeBuilderWithInferredContext<(ins @@ -490,18 +504,21 @@ def AnyRefImpl : PropImplType<"AnyRef"> { about the referred to object's fields, so subfield access, etc. is illegal. }]; let genStorageClass = true; + let typeName = "firrtl.propRef"; } def StringImpl : PropImplType<"String"> { let summary = "An unlimited length string type. Not representable in hardware."; let parameters = (ins); let genStorageClass = true; + let typeName = "firrtl.propString"; } def IntegerImpl : PropImplType<"FInteger"> { let summary = "An unlimited length signed integer type. Not representable in hardware."; let parameters = (ins); let genStorageClass = true; + let typeName = "firrtl.propInt"; } def ListImpl : PropImplType<"List"> { @@ -509,6 +526,7 @@ def ListImpl : PropImplType<"List"> { let parameters = (ins TypeParameter<"circt::firrtl::PropertyType", "element type">:$elementType); let genStorageClass = true; let genAccessors = true; + let typeName = "firrtl.propList"; } def PathImpl : PropImplType<"Path"> { @@ -516,18 +534,21 @@ def PathImpl : PropImplType<"Path"> { let parameters = (ins); let genStorageClass = true; let genAccessors = true; + let typeName = "firrtl.propPath"; } def BoolImpl : PropImplType<"Bool"> { let summary = "A boolean property. Not representable in hardware."; let parameters = (ins); let genStorageClass = true; + let typeName = "firrtl.propBool"; } def DoubleImpl : PropImplType<"Double"> { let summary = "A double property. Not representable in hardware."; let parameters = (ins); let genStorageClass = true; + let typeName = "firrtl.propDouble"; } #endif // CIRCT_DIALECT_FIRRTL_FIRRTLTYPESIMPL_TD diff --git a/include/circt/Dialect/Moore/MooreTypes.h b/include/circt/Dialect/Moore/MooreTypes.h index 125e47395f21..95c1bdbfa56b 100644 --- a/include/circt/Dialect/Moore/MooreTypes.h +++ b/include/circt/Dialect/Moore/MooreTypes.h @@ -460,6 +460,8 @@ class VoidType public: static VoidType get(MLIRContext *context); + static constexpr StringLiteral name = "moore.void"; + protected: using Base::Base; }; @@ -470,6 +472,8 @@ class StringType public: static StringType get(MLIRContext *context); + static constexpr StringLiteral name = "moore.string"; + protected: using Base::Base; }; @@ -480,6 +484,8 @@ class ChandleType public: static ChandleType get(MLIRContext *context); + static constexpr StringLiteral name = "moore.chandle"; + protected: using Base::Base; }; @@ -490,6 +496,8 @@ class EventType public: static EventType get(MLIRContext *context); + static constexpr StringLiteral name = "moore.event"; + protected: using Base::Base; }; @@ -574,6 +582,8 @@ class IntType /// to the user in diagnostics. void format(llvm::raw_ostream &os) const; + static constexpr StringLiteral name = "moore.int"; + protected: using Base::Base; }; @@ -612,6 +622,8 @@ class RealType /// Get the size of this type. unsigned getBitSize() const { return getBitSize(getKind()); } + static constexpr StringLiteral name = "moore.real"; + protected: using Base::Base; }; @@ -747,6 +759,9 @@ class UnpackedIndirectType : public IndirectTypeBase { /// A packed named type. See `NamedTypeBase` for details. class PackedNamedType : public NamedTypeBase { +public: + static constexpr StringLiteral name = "moore.packed_named"; + protected: using NamedBase::NamedBase; }; @@ -754,12 +769,18 @@ class PackedNamedType /// An unpacked named type. See `NamedTypeBase` for details. class UnpackedNamedType : public NamedTypeBase { +public: + static constexpr StringLiteral name = "moore.unpacked_named"; + protected: using NamedBase::NamedBase; }; /// A packed named type. See `NamedTypeBase` for details. class PackedRefType : public RefTypeBase { +public: + static constexpr StringLiteral name = "moore.packed_ref"; + protected: using RefBase::RefBase; }; @@ -767,6 +788,9 @@ class PackedRefType : public RefTypeBase { /// An unpacked named type. See `NamedTypeBase` for details. class UnpackedRefType : public RefTypeBase { +public: + static constexpr StringLiteral name = "moore.unpacked_ref"; + protected: using RefBase::RefBase; }; @@ -819,6 +843,8 @@ class PackedUnsizedDim : public Type::TypeBase getBound() const; + static constexpr StringLiteral name = "moore.unpacked_queue_dim"; + protected: using Base::Base; friend struct detail::DimStorage; @@ -1021,6 +1059,8 @@ class EnumType /// to the user in diagnostics. void format(llvm::raw_ostream &os) const; + static constexpr StringLiteral name = "moore.enum"; + protected: using Base::Base; }; @@ -1144,6 +1184,8 @@ class PackedStructType : public Type::TypeBase