Skip to content

Commit 8fbe8bf

Browse files
committed
add squash pass in the pipeline
1 parent b5e8f4e commit 8fbe8bf

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

lib/Firtool/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ add_circt_library(CIRCTFirtool
1111
CIRCTOMTransforms
1212
CIRCTSeqToSV
1313
CIRCTSimToSV
14+
CIRCTSimTransforms
1415
CIRCTSeqTransforms
1516
CIRCTSVTransforms
1617
CIRCTTransforms

lib/Firtool/Firtool.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "circt/Dialect/OM/OMPasses.h"
1515
#include "circt/Dialect/SV/SVPasses.h"
1616
#include "circt/Dialect/Seq/SeqPasses.h"
17+
#include "circt/Dialect/Sim/SimPasses.h"
1718
#include "circt/Dialect/Verif/VerifPasses.h"
1819
#include "circt/Support/Passes.h"
1920
#include "circt/Transforms/Passes.h"
@@ -307,6 +308,9 @@ LogicalResult firtool::populateLowFIRRTLToHW(mlir::PassManager &pm,
307308
opt.getVerificationFlavor(),
308309
opt.shouldLowerToCore()));
309310

311+
if (opt.shouldLowerToCore())
312+
pm.addNestedPass<hw::HWModuleOp>(sim::createSquashSimTriggered());
313+
310314
if (!opt.shouldDisableOptimization()) {
311315
auto &modulePM = pm.nest<hw::HWModuleOp>();
312316
modulePM.addPass(mlir::createCSEPass());

test/firtool/lower-to-core.fir

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,16 @@ circuit LowerToCore:
2525
; CHECK-DAG: verif.clocked_assert %pred if %enable, posedge [[CLK]] : i1
2626
; CHECK-DAG: [[FMT:%.+]] = sim.fmt.dec %x signed : i4
2727
; CHECK: [[MSG:%.+]] = sim.fmt.concat ([[LIT]], [[FMT]], [[NL]])
28+
; CHECK: [[FMTFILE2:%.+]] = sim.fmt.concat ([[LITFILE1]], [[FMT]], [[LITFILE2]])
29+
; CHECK: [[STDERR:%.+]] = sim.stderr_stream
2830
; CHECK: sim.triggered %clock if %enable {
2931
; CHECK-NEXT: sim.proc.print [[MSG]]
30-
; CHECK-NEXT: }
31-
; CHECK: sim.triggered %clock if %enable {
3232
; CHECK-NEXT: [[FILE1:%.+]] = sim.get_file [[FMTFILE1]]
3333
; CHECK-NEXT: sim.proc.print [[MSG]] to [[FILE1]]
34-
; CHECK-NEXT: }
35-
; CHECK: [[FMTFILE2:%.+]] = sim.fmt.concat ([[LITFILE1]], [[FMT]], [[LITFILE2]])
36-
; CHECK: sim.triggered %clock if %enable {
3734
; CHECK-NEXT: [[FILE2:%.+]] = sim.get_file [[FMTFILE2]]
3835
; CHECK-NEXT: sim.proc.print [[MSG]] to [[FILE2]]
39-
; CHECK-NEXT: }
40-
; CHECK: sim.triggered %clock if %enable {
4136
; CHECK-NEXT: [[FILE3:%.+]] = sim.get_file [[FMTFILE2]]
4237
; CHECK-NEXT: sim.flush [[FILE3]]
43-
; CHECK-NEXT: }
44-
; CHECK: [[STDERR:%.+]] = sim.stderr_stream
45-
; CHECK: sim.triggered %clock if %enable {
4638
; CHECK-NEXT: sim.flush [[STDERR]]
4739
; CHECK-NEXT: }
4840
; CHECK-NOT: sv.assert

0 commit comments

Comments
 (0)