diff --git a/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td b/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td index 9e909ff4ce81..dd27f84ad2f5 100644 --- a/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td +++ b/include/circt/Dialect/FIRRTL/FIRRTLAttributes.td @@ -101,44 +101,6 @@ def AugmentedGroundType : AugmentedType<"AugmentedGroundType"> { 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 `>`"; -} - - def ParamDeclAttr : AttrDef { let summary = "Module or instance parameter definition"; let description = [{ diff --git a/lib/Dialect/FIRRTL/Transforms/GrandCentral.cpp b/lib/Dialect/FIRRTL/Transforms/GrandCentral.cpp index a0bf599a1d86..9a83e7bc31f8 100644 --- a/lib/Dialect/FIRRTL/Transforms/GrandCentral.cpp +++ b/lib/Dialect/FIRRTL/Transforms/GrandCentral.cpp @@ -489,8 +489,7 @@ struct VerbatimBuilder { /// A wrapper around a string that is used to encode a type which cannot be /// represented by an mlir::Type for some reason. This is currently used to -/// represent either an interface, a n-dimensional vector of interfaces, or a -/// tombstone for an actually unsupported type (e.g., an AugmentedBooleanType). +/// represent either an interface or an n-dimensional vector of interfaces. struct VerbatimType { /// The textual representation of the type. std::string str; @@ -1140,28 +1139,6 @@ parseAugmentedType(ApplyState &state, DictionaryAttr augmentedType, return DictionaryAttr::getWithSorted(context, attrs); } - // Any of the following are known and expected, but are legacy AugmentedTypes - // do not have a target: - // - AugmentedStringType - // - AugmentedBooleanType - // - AugmentedIntegerType - // - AugmentedDoubleType - bool isIgnorable = - llvm::StringSwitch(classBase) - .Cases("StringType", "BooleanType", "IntegerType", "DoubleType", true) - .Default(false); - if (isIgnorable) { - NamedAttrList attrs; - attrs.append("class", classAttr); - attrs.append("name", name); - auto value = - tryGetAs(augmentedType, root, "value", loc, clazz, path); - if (!value) - return std::nullopt; - attrs.append("value", value); - return DictionaryAttr::getWithSorted(context, attrs); - } - // Anything else is unexpected or a user error if they manually wrote // annotations. Print an error and error out. mlir::emitError(loc, "found unknown AugmentedType '" + classAttr.getValue() + @@ -1256,24 +1233,6 @@ std::optional GrandCentralPass::fromAttr(Attribute attr) { << "' that does not have a scattered leaf to connect " "to in the circuit " "(was the leaf deleted or constant prop'd away?)"; - } else if (classBase == "StringType") { - if (auto name = dict.getAs("name")) - return AugmentedStringTypeAttr::get(&getContext(), dict); - } else if (classBase == "BooleanType") { - if (auto name = dict.getAs("name")) - return AugmentedBooleanTypeAttr::get(&getContext(), dict); - } else if (classBase == "IntegerType") { - if (auto name = dict.getAs("name")) - return AugmentedIntegerTypeAttr::get(&getContext(), dict); - } else if (classBase == "DoubleType") { - if (auto name = dict.getAs("name")) - return AugmentedDoubleTypeAttr::get(&getContext(), dict); - } else if (classBase == "LiteralType") { - if (auto name = dict.getAs("name")) - return AugmentedLiteralTypeAttr::get(&getContext(), dict); - } else if (classBase == "DeletedType") { - if (auto name = dict.getAs("name")) - return AugmentedDeletedTypeAttr::get(&getContext(), dict); } else { emitCircuitError() << "has an invalid AugmentedType"; } @@ -1413,12 +1372,6 @@ bool GrandCentralPass::traverseField( return anyFailed; }) - .Case([&](auto a) { return false; }) - .Case([&](auto a) { return false; }) - .Case([&](auto a) { return false; }) - .Case([&](auto a) { return false; }) - .Case([&](auto a) { return false; }) - .Case([&](auto a) { return false; }) .Default([](auto a) { return true; }); } @@ -1426,11 +1379,6 @@ std::optional GrandCentralPass::computeField( Attribute field, IntegerAttr id, StringAttr prefix, VerbatimBuilder &path, SmallVector &xmrElems, SmallVector &interfaceBuilder) { - - auto unsupported = [&](StringRef name, StringRef kind) { - return VerbatimType({("// ").str(), false}); - }; - return TypeSwitch>(field) .Case( [&](AugmentedGroundTypeAttr ground) -> std::optional { @@ -1491,25 +1439,7 @@ std::optional GrandCentralPass::computeField( interfaceBuilder); assert(ifaceName && *ifaceName); return VerbatimType({ifaceName->str(), true}); - }) - .Case([&](auto field) -> TypeSum { - return unsupported(field.getName().getValue(), "string"); - }) - .Case([&](auto field) -> TypeSum { - return unsupported(field.getName().getValue(), "boolean"); - }) - .Case([&](auto field) -> TypeSum { - return unsupported(field.getName().getValue(), "integer"); - }) - .Case([&](auto field) -> TypeSum { - return unsupported(field.getName().getValue(), "double"); - }) - .Case([&](auto field) -> TypeSum { - return unsupported(field.getName().getValue(), "literal"); - }) - .Case([&](auto field) -> TypeSum { - return unsupported(field.getName().getValue(), "deleted"); - }); + }); } /// Traverse an Annotation that is an AugmentedBundleType. During traversal, diff --git a/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir b/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir index 0114515cff67..196331388fda 100644 --- a/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir +++ b/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir @@ -368,10 +368,6 @@ circuit Top : ; CHECK-NEXT: Sub_vecOfBundle sub_vecOfBundle[2](); ; CHECK-NEXT: // The second element of an external port ; CHECK-NEXT: logic ext_port_1; - ; CHECK-NEXT: // foo_string; - ; CHECK-NEXT: // foo_integer; - ; CHECK-NEXT: // foo_double; - ; CHECK-NEXT: // foo_boolean; ; CHECK-NEXT: endinterface ; EXTRACT: FILE "Wire{{[/\]}}firrtl{{[/\]}}gct{{[/\]}}VecOfBundle.sv" diff --git a/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir.anno.json b/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir.anno.json index 50fe534b3db0..d9baa42182da 100644 --- a/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir.anno.json +++ b/test/Dialect/FIRRTL/SFCTests/GrandCentralInterfaces/Wire.fir.anno.json @@ -705,34 +705,6 @@ "class": "sifive.enterprise.grandcentral.GrandCentralView$UnknownGroundType$" } } - }, - { - "name": "foo_string", - "tpe": { - "class": "sifive.enterprise.grandcentral.AugmentedStringType", - "value": "FOO" - } - }, - { - "name": "foo_integer", - "tpe": { - "class": "sifive.enterprise.grandcentral.AugmentedIntegerType", - "value": 123 - } - }, - { - "name": "foo_double", - "tpe": { - "class": "sifive.enterprise.grandcentral.AugmentedDoubleType", - "value": 123.456 - } - }, - { - "name": "foo_boolean", - "tpe": { - "class": "sifive.enterprise.grandcentral.AugmentedBooleanType", - "value": true - } } ] } diff --git a/test/Dialect/FIRRTL/annotations.mlir b/test/Dialect/FIRRTL/annotations.mlir index d753d1905bf0..0f3e6cbe2059 100644 --- a/test/Dialect/FIRRTL/annotations.mlir +++ b/test/Dialect/FIRRTL/annotations.mlir @@ -1105,74 +1105,6 @@ firrtl.circuit "GCTInterface" attributes { // ----- -firrtl.circuit "Foo" attributes {rawAnnotations = [ - { - class = "sifive.enterprise.grandcentral.ViewAnnotation", - companion = "~Foo|Bar_companion", - name = "Bar", - parent = "~Foo|Foo", - view = - { - class = "sifive.enterprise.grandcentral.AugmentedBundleType", - defName = "View", - elements = [ - { - description = "a string", - name = "string", - tpe = - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - value = "hello" - } - }, - { - description = "a boolean", - name = "boolean", - tpe = - { - class = "sifive.enterprise.grandcentral.AugmentedBooleanType", - value = false - } - }, - { - description = "an integer", - name = "integer", - tpe = - { - class = "sifive.enterprise.grandcentral.AugmentedIntegerType", - value = 42 : i64 - } - }, - { - description = "a double", - name = "double", - tpe = - { - class = "sifive.enterprise.grandcentral.AugmentedDoubleType", - value = 3.140000e+00 : f64 - } - } - ] - } - } -]} { - firrtl.module private @Bar_companion() { - firrtl.skip - } - firrtl.module @Foo() { - firrtl.instance Bar_companion @Bar_companion() - } -} - -// CHECK-LABEL: firrtl.circuit "Foo" -// CHECK-SAME: annotations = [{class = "[[_:.+]]AugmentedBundleType", [[_:.+]] elements = [{ -// CHECK-SAME: "sifive.enterprise.grandcentral.AugmentedStringType" -// CHECK-SAME: "sifive.enterprise.grandcentral.AugmentedBooleanType" -// CHECK-SAME: "sifive.enterprise.grandcentral.AugmentedIntegerType" -// CHECK-SAME: "sifive.enterprise.grandcentral.AugmentedDoubleType" - -// ----- - // SiFive-custom annotations related to the GrandCentral utility. These // annotations do not conform to standard SingleTarget or NoTarget format and // need to be manually split up. diff --git a/test/Dialect/FIRRTL/grand-central.mlir b/test/Dialect/FIRRTL/grand-central.mlir index e6f5d7275082..66f45002b5bf 100644 --- a/test/Dialect/FIRRTL/grand-central.mlir +++ b/test/Dialect/FIRRTL/grand-central.mlir @@ -196,82 +196,6 @@ firrtl.circuit "InterfaceGroundType" attributes { id = 21 : i64, name = "ConstantView" }, - { - class = "sifive.enterprise.grandcentral.AugmentedBundleType", - defName = "UnsupportedView", - elements = [ - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - name = "string" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedBooleanType", - name = "boolean" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedIntegerType", - name = "integer" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedDoubleType", - name = "double" - } - ], - id = 24 : i64, - name = "UnsupporteView" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedBundleType", - defName = "VectorOfVerbatimView", - elements = [ - { - class = "sifive.enterprise.grandcentral.AugmentedVectorType", - elements = [ - { - class = "sifive.enterprise.grandcentral.AugmentedVectorType", - defName = "Vector4", - elements = [ - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - name = "baz" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - name = "baz" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - name = "baz" - } - ], - name = "vector4" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedVectorType", - defName = "Vector4", - elements = [ - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - name = "baz" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - name = "baz" - }, - { - class = "sifive.enterprise.grandcentral.AugmentedStringType", - name = "baz" - } - ], - name = "vector4" - } - ], - name = "vectorOfVerbatim" - } - ], - id = 25 : i64, - name = "VectorOfVerbatimView" - }, { class = "sifive.enterprise.grandcentral.ExtractGrandCentralAnnotation", directory = "gct-dir", @@ -326,18 +250,6 @@ firrtl.circuit "InterfaceGroundType" attributes { defName = "ConstantView", id = 21 : i64, name = "ConstantView" - }, - { - class = "sifive.enterprise.grandcentral.ViewAnnotation.companion", - defName = "UnsupportedView", - id = 24 : i64, - name = "UnsupportedView" - }, - { - class = "sifive.enterprise.grandcentral.ViewAnnotation.companion", - defName = "VectorOfVerbatimView", - id = 25 : i64, - name = "VectorOfVerbatimView" } ] } { @@ -537,12 +449,6 @@ firrtl.circuit "InterfaceGroundType" attributes { // CHECK-SAME: dimensions: [ ] // CHECK-SAME: width: 2 // CHECK-SAME: instances: [] -// CHECK-SAME: - name: UnsupportedView -// CHECK-SAME: fields: [] -// CHECK-SAME: instances: [] -// CHECK-SAME: - name: VectorOfVerbatimView -// CHECK-SAME: fields: [] -// CHECK-SAME: instances: [] // The shared companion contains all instantiated interfaces. // AugmentedGroundType annotations are removed. Interface is driven via XMRs @@ -551,8 +457,6 @@ firrtl.circuit "InterfaceGroundType" attributes { // CHECK: firrtl.module @Companion // CHECK-SAME: output_file = #hw.output_file<"gct-dir{{/|\\\\}}" // -// CHECK-NEXT: %VectorOfVerbatimView = sv.interface.instance sym @[[vectorOfVerbatim:[a-zA-Z0-9_]+]] : !sv.interface<@VectorOfVerbatimView> -// CHECK-NEXT: %UnsupportedView = sv.interface.instance sym @[[unsupportedSym:[a-zA-Z0-9_]+]] : !sv.interface<@UnsupportedView> // CHECK-NEXT: %ConstantView = sv.interface.instance sym @[[constantSym:[a-zA-Z0-9_]+]] : !sv.interface<@ConstantView> // CHECK-NEXT: %ZeroWidthView = sv.interface.instance sym @[[zeroWidthSym:[a-zA-Z0-9_]+]] : !sv.interface<@ZeroWidthView> // CHECK-NEXT: %VectorOfVectorView = sv.interface.instance sym @[[vectorOfVectorSym:[a-zA-Z0-9_]+]] : !sv.interface<@VectorOfVectorView> @@ -620,8 +524,8 @@ firrtl.circuit "InterfaceGroundType" attributes { // CHECK-SAME: (%c-1_si2) : !firrtl.sint<2> // CHECK-SAME: {symbols = [#hw.innerNameRef<@Companion::@[[constantSym]]>]} // -// There are no more verbatim assigns after this. The zero-width view and any -// "unsupported" types, e.g., AugmentedStringType, are not given XMRs. +// There are no more verbatim assigns after this. +// Zero-width views are not given XMR's. // // CHECK-NOT: sv.verbatim "assign @@ -670,15 +574,6 @@ firrtl.circuit "InterfaceGroundType" attributes { // CHECK: sv.interface @ConstantView // CHECK-NEXT: sv.interface.signal @foo : i1 // CHECK-NEXT: sv.interface.signal @bar : i2 -// -// CHECK: sv.interface @UnsupportedView -// CHECK-NEXT: sv.verbatim "// string;" -// CHECK-NEXT: sv.verbatim "// boolean;" -// CHECK-NEXT: sv.verbatim "// integer;" -// CHECK-NEXT: sv.verbatim "// double;" -// -// CHECK: sv.interface @VectorOfVerbatimView -// CHECK-NEXT: sv.verbatim "// vectorOfVerbatim[2][3];" // -----