Skip to content

Commit

Permalink
[FIRRTL] Emit Layer-associated Probes
Browse files Browse the repository at this point in the history
Add emitter support for layer-associated probes.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
  • Loading branch information
seldridge committed Jan 5, 2024
1 parent fad9d10 commit 9a0bbb1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions lib/Dialect/FIRRTL/Export/FIREmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,14 @@ void Emitter::emitType(Type type, bool includeConst) {
ps << "RW";
ps << "Probe<";
emitType(type.getType());
if (auto layer = type.getLayer()) {
ps << "," << PP::nbsp;
ps.addAsString(layer.getRootReference().getValue());
for (auto nested : layer.getNestedReferences()) {
ps << ".";
ps.addAsString(nested.getValue());
}
}
ps << ">";
})
.Case<AnyRefType>([&](AnyRefType type) { ps << "AnyRef"; })
Expand Down
9 changes: 7 additions & 2 deletions test/Dialect/FIRRTL/emit-basic.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,18 @@ firrtl.circuit "Foo" {
}
}
// CHECK: module ModuleWithGroups :
// CHECK-NEXT: layerblock GroupA :
// CHECK-NEXT: output a : Probe<UInt<1>, GroupA>
// CHECK-NEXT: output b : RWProbe<UInt<1>, GroupA.GroupB>
// CHECK: layerblock GroupA :
// CHECK-NEXT: layerblock GroupB :
// CHECK-NEXT: layerblock GroupC :
// CHECK-NEXT: layerblock GroupD :
// CHECK-NEXT: layerblock GroupE :
// CHECK-NEXT: layerblock GroupF :
firrtl.module @ModuleWithGroups() {
firrtl.module @ModuleWithGroups(
out %a: !firrtl.probe<uint<1>, @GroupA>,
out %b: !firrtl.rwprobe<uint<1>, @GroupA::@GroupB>
) {
firrtl.layerblock @GroupA {
firrtl.layerblock @GroupA::@GroupB {
firrtl.layerblock @GroupA::@GroupB::@GroupC {
Expand Down

0 comments on commit 9a0bbb1

Please sign in to comment.