-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SeqToSV] Do not use
always_ff
for compreg with initializer
- Loading branch information
1 parent
f0edc11
commit f8f87e8
Showing
3 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// RUN: circt-opt %s --lower-seq-to-sv=lower-to-always-ff | FileCheck %s | ||
|
||
// CHECK-LABEL: hw.module @basic(in %clk : i1, in %d : i8, out q : i8) { | ||
// CHECK: %[[REG:.*]] = sv.reg : !hw.inout<i8> | ||
// CHECK: %[[RD:.*]] = sv.read_inout %[[REG]] : !hw.inout<i8> | ||
// CHECK: sv.alwaysff(posedge %clk) { | ||
// CHECK-NEXT: sv.passign %[[REG]], %d : i8 | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: hw.output %[[RD]] : i8 | ||
// CHECK-NEXT: } | ||
hw.module @basic(in %clk: !seq.clock, in %d: i8, out q: i8) { | ||
%q = seq.compreg %d, %clk : i8 | ||
hw.output %q : i8 | ||
} | ||
|
||
// CHECK-LABEL: hw.module @basicWithInit(in %clk : i1, in %d : i8, out q : i8) { | ||
// CHECK: sv.initial { | ||
// CHECK: } | ||
// CHECK: %[[CST:.*]] = hw.constant 19 : i8 | ||
// CHECK: %[[REG:.*]] = sv.reg init %[[CST]] : !hw.inout<i8> | ||
// CHECK: %[[RD:.*]] = sv.read_inout %[[REG]] : !hw.inout<i8> | ||
// CHECK: sv.always posedge %clk { | ||
// CHECK-NEXT: sv.passign %[[REG]], %d : i8 | ||
// CHECK-NEXT: } | ||
// CHECK-NEXT: hw.output %[[RD]] : i8 | ||
// CHECK-NEXT: } | ||
hw.module @basicWithInit(in %clk: !seq.clock, in %d: i8, out q: i8) { | ||
%init = seq.initial () { | ||
%cst = hw.constant 19 : i8 | ||
seq.yield %cst : i8 | ||
} : () -> !seq.immutable<i8> | ||
|
||
%q = seq.compreg %d, %clk initial %init : i8 | ||
hw.output %q : i8 | ||
} |