Skip to content

Commit 433833c

Browse files
authored
[FIRRTL] Remove dead annotations relating to taps and blackboxes. (#9146)
1 parent dde772c commit 433833c

File tree

6 files changed

+6
-109
lines changed

6 files changed

+6
-109
lines changed

include/circt/Dialect/FIRRTL/AnnotationDetails.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,33 +102,12 @@ constexpr const char *augmentedVectorTypeClass =
102102
"sifive.enterprise.grandcentral.AugmentedVectorType"; // not an annotation
103103
constexpr const char *dataTapsClass =
104104
"sifive.enterprise.grandcentral.DataTapsAnnotation";
105-
constexpr const char *dataTapsBlackboxClass =
106-
"sifive.enterprise.grandcentral.DataTapsAnnotation.blackbox"; // not in SFC
107105
constexpr const char *memTapClass =
108106
"sifive.enterprise.grandcentral.MemTapAnnotation";
109-
constexpr const char *memTapBlackboxClass =
110-
"sifive.enterprise.grandcentral.MemTapAnnotation.blackbox"; // not in SFC
111-
constexpr const char *memTapPortClass =
112-
"sifive.enterprise.grandcentral.MemTapAnnotation.port"; // not in SFC
113-
constexpr const char *memTapSourceClass =
114-
"sifive.enterprise.grandcentral.MemTapAnnotation.source"; // not in SFC
115-
constexpr const char *deletedKeyClass =
116-
"sifive.enterprise.grandcentral.DeletedDataTapKey";
117-
constexpr const char *literalKeyClass =
118-
"sifive.enterprise.grandcentral.LiteralDataTapKey";
119107
constexpr const char *referenceKeyClass =
120108
"sifive.enterprise.grandcentral.ReferenceDataTapKey";
121-
constexpr const char *referenceKeyPortClass =
122-
"sifive.enterprise.grandcentral.ReferenceDataTapKey.port"; // not in SFC
123-
constexpr const char *referenceKeySourceClass =
124-
"sifive.enterprise.grandcentral.ReferenceDataTapKey.source"; // not in SFC
125109
constexpr const char *internalKeyClass =
126110
"sifive.enterprise.grandcentral.DataTapModuleSignalKey";
127-
constexpr const char *internalKeyPortClass =
128-
"sifive.enterprise.grandcentral.DataTapModuleSignalKey.port"; // not in SFC
129-
constexpr const char *internalKeySourceClass =
130-
"sifive.enterprise.grandcentral.DataTapModuleSignalKey.source"; // not in
131-
// SFC
132111
constexpr const char *extractGrandCentralClass =
133112
"sifive.enterprise.grandcentral.ExtractGrandCentralAnnotation";
134113
constexpr const char *grandCentralHierarchyFileAnnoClass =

lib/Dialect/FIRRTL/Transforms/CreateSiFiveMetadata.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,11 @@ CreateSiFiveMetadataPass::emitSitestBlackboxMetadata(ObjectModelIR &omir) {
836836

837837
// Any extmodule with these annotations should be excluded from the blackbox
838838
// list if it doesn't declare any additional libraries.
839-
std::array<StringRef, 6> blackListedAnnos = {
840-
blackBoxAnnoClass, blackBoxInlineAnnoClass, blackBoxPathAnnoClass,
841-
dataTapsBlackboxClass, memTapBlackboxClass};
839+
std::array<StringRef, 3> blackListedAnnos = {
840+
blackBoxAnnoClass,
841+
blackBoxInlineAnnoClass,
842+
blackBoxPathAnnoClass,
843+
};
842844

843845
auto *context = &getContext();
844846

lib/Dialect/FIRRTL/Transforms/LowerAnnotations.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,18 +605,8 @@ static llvm::StringMap<AnnoRecord> annotationRecords{{
605605
{augmentedGroundTypeClass, {stdResolve, applyWithoutTarget<true>}},
606606
// Grand Central Data Tap Annotations
607607
{dataTapsClass, {noResolve, applyGCTDataTaps}},
608-
{dataTapsBlackboxClass, {stdResolve, applyWithoutTarget<true>}},
609-
{referenceKeySourceClass, {stdResolve, applyWithoutTarget<true>}},
610-
{referenceKeyPortClass, {stdResolve, applyWithoutTarget<true>}},
611-
{internalKeySourceClass, {stdResolve, applyWithoutTarget<true>}},
612-
{internalKeyPortClass, {stdResolve, applyWithoutTarget<true>}},
613-
{deletedKeyClass, {stdResolve, applyWithoutTarget<true>}},
614-
{literalKeyClass, {stdResolve, applyWithoutTarget<true>}},
615608
// Grand Central Mem Tap Annotations
616609
{memTapClass, {noResolve, applyGCTMemTaps}},
617-
{memTapSourceClass, {stdResolve, applyWithoutTarget<true>}},
618-
{memTapPortClass, {stdResolve, applyWithoutTarget<true>}},
619-
{memTapBlackboxClass, {stdResolve, applyWithoutTarget<true>}},
620610
// Miscellaneous Annotations
621611
{conventionAnnoClass, {stdResolve, applyConventionAnno}},
622612
{typeLoweringAnnoClass, {stdResolve, applyBodyTypeLoweringAnno}},

lib/Dialect/FIRRTL/Transforms/MemToRegOfVec.cpp

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -337,35 +337,6 @@ struct MemToRegOfVecPass
337337
return false;
338338
}
339339

340-
void scatterMemTapAnno(RegOp op, ArrayAttr attr,
341-
ImplicitLocOpBuilder &builder) {
342-
AnnotationSet annos(attr);
343-
SmallVector<Attribute> regAnnotations;
344-
auto vecType = type_cast<FVectorType>(op.getResult().getType());
345-
for (auto anno : annos) {
346-
if (anno.isClass(memTapSourceClass)) {
347-
for (size_t i = 0, e = type_cast<FVectorType>(op.getResult().getType())
348-
.getNumElements();
349-
i != e; ++i) {
350-
NamedAttrList newAnno;
351-
newAnno.append("class", anno.getMember("class"));
352-
newAnno.append("circt.fieldID",
353-
builder.getI64IntegerAttr(vecType.getFieldID(i)));
354-
newAnno.append("id", anno.getMember("id"));
355-
if (auto nla = anno.getMember("circt.nonlocal"))
356-
newAnno.append("circt.nonlocal", nla);
357-
newAnno.append(
358-
"portID",
359-
IntegerAttr::get(IntegerType::get(builder.getContext(), 64), i));
360-
361-
regAnnotations.push_back(builder.getDictionaryAttr(newAnno));
362-
}
363-
} else
364-
regAnnotations.push_back(anno.getAttr());
365-
}
366-
op.setAnnotationsAttr(builder.getArrayAttr(regAnnotations));
367-
}
368-
369340
/// Generate the logic for implementing the memory using Registers.
370341
void generateMemory(MemOp memOp, FirMemory &firMem) {
371342
ImplicitLocOpBuilder builder(memOp.getLoc(), memOp);
@@ -404,7 +375,7 @@ struct MemToRegOfVecPass
404375

405376
// Copy all the memory annotations.
406377
if (!memOp.getAnnotationsAttr().empty())
407-
scatterMemTapAnno(regOfVec, memOp.getAnnotationsAttr(), builder);
378+
regOfVec.setAnnotationsAttr(memOp.getAnnotationsAttr());
408379
if (innerSym)
409380
regOfVec.setInnerSymAttr(memOp.getInnerSymAttr());
410381
}

test/Dialect/FIRRTL/emit-metadata.mlir

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -263,22 +263,6 @@ firrtl.circuit "BasicBlackboxes" attributes {
263263
],
264264
defname = "ignored1"
265265
}
266-
firrtl.extmodule @ignored2() attributes {
267-
annotations = [
268-
{
269-
class = "sifive.enterprise.grandcentral.DataTapsAnnotation.blackbox"
270-
}
271-
],
272-
defname = "ignored2"
273-
}
274-
firrtl.extmodule @ignored3() attributes {
275-
annotations = [
276-
{
277-
class = "sifive.enterprise.grandcentral.MemTapAnnotation.blackbox", id = 4 : i64
278-
}
279-
],
280-
defname = "ignored3"
281-
}
282266
firrtl.extmodule @ignored4() attributes {
283267
annotations = [
284268
{

test/Dialect/FIRRTL/mem-to-reg-of-vec.mlir

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -194,35 +194,6 @@ firrtl.circuit "WriteMask" attributes {annotations = [
194194
}
195195
}
196196

197-
firrtl.circuit "MemTap" attributes {annotations = [
198-
{class = "sifive.enterprise.firrtl.ConvertMemToRegOfVecAnnotation$"}
199-
]} {
200-
firrtl.module public @MemTap() attributes {annotations = [
201-
{class = "sifive.enterprise.firrtl.MarkDUTAnnotation"}
202-
]} {
203-
%rf_MPORT, %rf_io_rdata_0_MPORT, %rf_io_rdata_1_MPORT = firrtl.mem sym @rf Undefined {
204-
annotations = [
205-
{class = "sifive.enterprise.grandcentral.MemTapAnnotation.source", id = 11 : i64}
206-
],
207-
depth = 4 : i64,
208-
name = "rf",
209-
portNames = ["MPORT", "io_rdata_0_MPORT", "io_rdata_1_MPORT"],
210-
readLatency = 0 : i32,
211-
writeLatency = 1 : i32
212-
} : !firrtl.bundle<addr: uint<2>, en: uint<1>, clk: clock, data: uint<32>, mask: uint<1>>,
213-
!firrtl.bundle<addr: uint<2>, en: uint<1>, clk: clock, data flip: uint<32>>,
214-
!firrtl.bundle<addr: uint<2>, en: uint<1>, clk: clock, data flip: uint<32>>
215-
// CHECK-LABEL: firrtl.module public @MemTap()
216-
// CHECK: %rf = firrtl.reg sym @rf %2
217-
// CHECK-SAME: [{circt.fieldID = 1 : i64, class = "sifive.enterprise.grandcentral.MemTapAnnotation.source", id = 11 : i64, portID = 0 : i64}
218-
// CHECK-SAME: {circt.fieldID = 2 : i64, class = "sifive.enterprise.grandcentral.MemTapAnnotation.source", id = 11 : i64, portID = 1 : i64},
219-
// CHECK-SAME: {circt.fieldID = 3 : i64, class = "sifive.enterprise.grandcentral.MemTapAnnotation.source", id = 11 : i64, portID = 2 : i64},
220-
// CHECK-SAME: {circt.fieldID = 4 : i64, class = "sifive.enterprise.grandcentral.MemTapAnnotation.source", id = 11 : i64, portID = 3 : i64}]}
221-
// CHECK-SAME: : !firrtl.clock, !firrtl.vector<uint<32>, 4>
222-
}
223-
224-
}
225-
226197
// Test the behavior of non-local annotations using either the old or new
227198
// format work correctly.
228199
//

0 commit comments

Comments
 (0)