Skip to content

Commit

Permalink
[FIRRTL] Drop dead ScalaClassAnnotation. (#6981)
Browse files Browse the repository at this point in the history
We've rejected this during LowerAnnotations since we've had
LowerAnnotations, so it's safe to say this is thoroughly dead.

The internal source of this was removed in January.
  • Loading branch information
dtzSiFive authored May 2, 2024
1 parent de0425e commit 87d3b5d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 49 deletions.
20 changes: 0 additions & 20 deletions docs/Dialects/FIRRTL/FIRRTLAnnotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -838,26 +838,6 @@ Example:
}
```

### ScalaClassAnnotation

| Property | Type | Description |
| ---------- | ------ | ------------- |
| class | string | `sifive.enterprise.firrtl.ScalaClassAnnotation` |
| target | string | Reference target |
| className | string | The corresponding class name |

This annotation records the name of the Java or Scala class which corresponds
to the module.

Example:
```json
{
"class":"sifive.enterprise.firrtl.ScalaClassAnnotation",
"target":"Top.ClockGroupAggregator",
"className":"freechips.rocketchip.prci.ClockGroupAggregator"
}
```

### SitestBlackBoxAnnotation

| Property | Type | Description |
Expand Down
2 changes: 0 additions & 2 deletions include/circt/Dialect/FIRRTL/AnnotationDetails.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ constexpr const char *prefixModulesAnnoClass =
"sifive.enterprise.firrtl.NestedPrefixModulesAnnotation";
constexpr const char *dontObfuscateModuleAnnoClass =
"sifive.enterprise.firrtl.DontObfuscateModuleAnnotation";
constexpr const char *scalaClassAnnoClass =
"sifive.enterprise.firrtl.ScalaClassAnnotation";
constexpr const char *elaborationArtefactsDirectoryAnnoClass =
"sifive.enterprise.firrtl.ElaborationArtefactsDirectory";
constexpr const char *testHarnessPathAnnoClass =
Expand Down
2 changes: 1 addition & 1 deletion lib/Conversion/FIRRTLToHW/LowerToHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ void CircuitLoweringState::processRemainingAnnotations(
// The following are inspected (but not consumed) by FIRRTL/GCT
// passes that have all run by now. Since no one is responsible for
// consuming these, they will linger around and can be ignored.
scalaClassAnnoClass, dutAnnoClass, metadataDirectoryAttrName,
dutAnnoClass, metadataDirectoryAttrName,
elaborationArtefactsDirectoryAnnoClass, testBenchDirAnnoClass,
// This annotation is used to mark which external modules are
// imported blackboxes from the BlackBoxReader pass.
Expand Down
19 changes: 2 additions & 17 deletions lib/Dialect/FIRRTL/Transforms/CreateSiFiveMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,8 @@ CreateSiFiveMetadataPass::emitRetimeModulesMetadata(ObjectModelIR &omir) {
LogicalResult
CreateSiFiveMetadataPass::emitSitestBlackboxMetadata(ObjectModelIR &omir) {

// Any extmodule with these annotations or one of these ScalaClass classes
// should be excluded from the blackbox list.
std::array<StringRef, 3> classBlackList = {
"freechips.rocketchip.util.BlackBoxedROM",
"sifive.enterprise.grandcentral.MemTap"};
// Any extmodule with these annotations should be excluded from the blackbox
// list.
std::array<StringRef, 6> blackListedAnnos = {
blackBoxAnnoClass, blackBoxInlineAnnoClass, blackBoxPathAnnoClass,
dataTapsBlackboxClass, memTapBlackboxClass};
Expand Down Expand Up @@ -776,14 +773,6 @@ CreateSiFiveMetadataPass::emitSitestBlackboxMetadata(ObjectModelIR &omir) {
}))
continue;

// If its a blacklisted scala class, skip it.
if (auto scalaAnno = annos.getAnnotation(scalaClassAnnoClass)) {
auto scalaClass = scalaAnno.getMember<StringAttr>("className");
if (scalaClass &&
llvm::is_contained(classBlackList, scalaClass.getValue()))
continue;
}

// Record the defname of the module.
if (!dutMod || dutModuleSet.contains(extModule)) {
dutModules.push_back(*extModule.getDefname());
Expand Down Expand Up @@ -825,10 +814,6 @@ CreateSiFiveMetadataPass::emitSitestBlackboxMetadata(ObjectModelIR &omir) {
createOutput(testModules, testFilename);
createOutput(dutModules, dutFilename);

// Clean up all ScalaClassAnnotations, which are no longer needed.
for (auto op : circuitOp.getOps<FModuleLike>())
AnnotationSet::removeAnnotations(op, scalaClassAnnoClass);

return success();
}

Expand Down
1 change: 0 additions & 1 deletion test/Conversion/FIRRTLToHW/lower-to-hw-errors.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ firrtl.circuit "Foo" attributes {annotations = [
{class = "firrtl.transforms.NoDedupAnnotation"},
{class = "sifive.enterprise.firrtl.DontObfuscateModuleAnnotation"},
{class = "sifive.enterprise.firrtl.MarkDUTAnnotation"},
{class = "sifive.enterprise.firrtl.ScalaClassAnnotation"},
{class = "firrtl.transforms.BlackBox", circt.nonlocal = @nla_1}
]} {}
// Non-local annotations should not produce errors either.
Expand Down
11 changes: 3 additions & 8 deletions test/Dialect/FIRRTL/emit-metadata.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,9 @@ firrtl.circuit "BasicBlackboxes" attributes { annotations = [{
// These should all be ignored.
firrtl.extmodule @ignored0() attributes {annotations = [{class = "firrtl.transforms.BlackBoxInlineAnno"}], defname = "ignored0"}
firrtl.extmodule @ignored1() attributes {annotations = [{class = "firrtl.transforms.BlackBoxPathAnno"}], defname = "ignored1"}
firrtl.extmodule @ignored2() attributes {annotations = [{class = "sifive.enterprise.firrtl.ScalaClassAnnotation", className = "freechips.rocketchip.util.BlackBoxedROM"}], defname = "ignored2"}
firrtl.extmodule @ignored3() attributes {annotations = [{class = "sifive.enterprise.grandcentral.DataTapsAnnotation.blackbox"}], defname = "ignored3"}
firrtl.extmodule @ignored4() attributes {annotations = [{class = "sifive.enterprise.grandcentral.MemTapAnnotation.blackbox", id = 4 : i64}], defname = "ignored4"}
firrtl.extmodule @ignored5() attributes {annotations = [{class = "firrtl.transforms.BlackBox"}], defname = "ignored5"}

// ScalaClassAnnotation should be discarded after this pass.
// CHECK: firrtl.extmodule @ignored2()
// CHECK-NOT: sifive.enterprise.firrtl.ScalaClassAnnotation
firrtl.extmodule @ignored2() attributes {annotations = [{class = "sifive.enterprise.grandcentral.DataTapsAnnotation.blackbox"}], defname = "ignored2"}
firrtl.extmodule @ignored3() attributes {annotations = [{class = "sifive.enterprise.grandcentral.MemTapAnnotation.blackbox", id = 4 : i64}], defname = "ignored3"}
firrtl.extmodule @ignored4() attributes {annotations = [{class = "firrtl.transforms.BlackBox"}], defname = "ignored4"}

// CHECK: firrtl.class @SitestBlackBoxModulesSchema(in %[[moduleName_in:.+]]: !firrtl.string, out %moduleName: !firrtl.string) {
// CHECK: firrtl.propassign %moduleName, %[[moduleName_in]]
Expand Down

0 comments on commit 87d3b5d

Please sign in to comment.