Open Anillc opened 1 month ago
Same output as above, also found on firtool 1.77.0:
~/.cache/llvm-firtool/1.77.0/bin/firtool --version
LLVM (http://llvm.org/):
LLVM version 19.0.0git
Optimized build.
CIRCT firtool-1.77.0
Through the --mlir-print-ir-after-all
command, it can be seen that (firrtl-sfc-compat) has mishandled this.
before
firrtl.module @Top(in %clock: !firrtl.clock, in %reset: !firrtl.uint<1>) attributes {convention = #firrtl<convention scalarized>} {
%foo = firrtl.wire : !firrtl.vector<uint<1>, 1>
%0 = firrtl.subindex %foo[0] : !firrtl.vector<uint<1>, 1>
%c1_ui1 = firrtl.constant 1 : !firrtl.uint<1>
firrtl.strictconnect %0, %c1_ui1 : !firrtl.uint<1>
%bar = firrtl.wire : !firrtl.vector<vector<uint<1>, 1>, 1>
%1 = firrtl.subindex %bar[0] : !firrtl.vector<vector<uint<1>, 1>, 1>
%2 = firrtl.subindex %foo[0] : !firrtl.vector<uint<1>, 1>
%3 = firrtl.subindex %1[0] : !firrtl.vector<uint<1>, 1>
firrtl.strictconnect %3, %2 : !firrtl.uint<1>
%x = firrtl.regreset %clock, %reset, %bar {annotations = [{circt.fieldID = 2 : i32, class = "firrtl.transforms.DontTouchAnnotation"}]} : !firrtl.clock, !firrtl.uint<1>, !firrtl.vector<vector<uint<1>, 1>, 1>, !firrtl.vector<vector<uint<1>, 1>, 1>
%4 = firrtl.subindex %x[0] : !firrtl.vector<vector<uint<1>, 1>, 1>
%5 = firrtl.subindex %4[0] : !firrtl.vector<uint<1>, 1>
firrtl.connect %5, %5 : !firrtl.uint<1>, !firrtl.uint<1>
}
IR Dump After SFCCompat (firrtl-sfc-compat)
firrtl.module @Top(in %clock: !firrtl.clock, in %reset: !firrtl.uint<1>) attributes {convention = #firrtl<convention scalarized>} {
%foo = firrtl.wire : !firrtl.vector<uint<1>, 1>
%0 = firrtl.subindex %foo[0] : !firrtl.vector<uint<1>, 1>
%c1_ui1 = firrtl.constant 1 : !firrtl.uint<1>
firrtl.strictconnect %0, %c1_ui1 : !firrtl.uint<1>
%bar = firrtl.wire : !firrtl.vector<vector<uint<1>, 1>, 1>
%1 = firrtl.subindex %bar[0] : !firrtl.vector<vector<uint<1>, 1>, 1>
%2 = firrtl.subindex %foo[0] : !firrtl.vector<uint<1>, 1>
%3 = firrtl.subindex %1[0] : !firrtl.vector<uint<1>, 1>
firrtl.strictconnect %3, %2 : !firrtl.uint<1>
%x = firrtl.reg %clock {annotations = [{circt.fieldID = 2 : i32, class = "firrtl.transforms.DontTouchAnnotation"}]} : !firrtl.clock, !firrtl.vector<vector<uint<1>, 1>, 1>
%4 = firrtl.subindex %x[0] : !firrtl.vector<vector<uint<1>, 1>, 1>
%5 = firrtl.subindex %4[0] : !firrtl.vector<uint<1>, 1>
firrtl.connect %5, %5 : !firrtl.uint<1>, !firrtl.uint<1>
}
The problem seems to be with the following statement (suppose the width of the other dimension of Vec is 2):
regreset x : UInt<1>[2][1], clock, reset, bar
circt can handle with:
regreset x : UInt<2>[1], clock, reset, bar
Both generated verilog statements are:
reg [0:0][1:0] x;
But the verilog generated by the UInt<1>[2][1]
statement does not contain the reset value
command:
foo.fir:
result:
without
--preserve-aggregate=vec
:tested on circt 1.58.0 and 1.76.0