firtool 1.131.0 generates references to non-existant layer files
When generating a single verilog file, the layer files are included, even if they are not generated, leading to errors.
- untar no-include.tar.gz
- Run
firtool '--format=mlir' --disable-all-randomization -strip-debug-info '-disable-layers=Verification' '-disable-layers=Verification.Assert' '-disable-layers=Verification.Assume' '-disable-layers=Verification.Cover' counter_fir.fir -o counter.sv
Now we see that references to non-existant files are generated:
$ grep include counter.sv
`include "layers-TestCounter-Verification.sv"
`include "layers-TestCounter-Verification.sv"
`include "layers-TestCounter-Verification.sv"
$ find . | grep layers
$
@jackkoenig @seldridge Just FYI, I discovered this when hacking and slashing support for Chisel + sby in bazel. https://github.com/The-OpenROAD-Project/bazel-orfs/pull/387
@ollef and @TLoubiere made an effort to get LLVM CIRCT to work with sby without having to write the FormalCounter.v manually, but so far sby has proven to be a few Verilog features short of working.
Disabling those layers should cause those includes to not be there. Could you may want to re-upload your test: that .fir is a symlink to a .cache directory in your home area.
Disabling those layers should cause those
includes to not be there. Could you may want to re-upload your test: that.firis a symlink to a.cachedirectory in your home area.
Fixed.
Okay, so I see two things:
- That input file is actually
.mlirand it's all the way at SV dialect. At that point, things like--disable-layerswill not have any effect. The layers are not stripped because this needs to be FIRRTL (or FIRRTL dialect). - If you run with
--split-verilog -o <output-directory>you shouldn't have any issues and this is the advised way to run. The problem is that in single-file output (what you get without--split-verilog), then the file separations are just comments. Hence, the output in single file mode is not correct and can't be fed to another tool. It's more for debugging, testing, and example use.
I see....
Trying again:
- untar with what I believe to be prior to SV dialect(though I don't speak mlir well enough to know) split.tar.gz
firtool '--format=mlir' --split-verilog --disable-all-randomization -strip-debug-info '-disable-layers=Verification' '-disable-layers=Verification.Assert' '-disable-layers=Verification.Assume' '-disable-layers=Verification.Cover' counter_fir.fir -o split
The layer files are still generated. For bazel reasons, it is useful to have a single file(bazel wants to know beforehand which files are generated, so a folder of files isn't great), so I want to cat *.sv into a single file, so having these files I don't need or want is causing constipation.
$ grep -r include split/*
split/verification/assert/layers-TestCounter-Verification-Assert.sv: `include "layers-TestCounter-Verification.sv"
split/verification/assume/layers-TestCounter-Verification-Assume.sv: `include "layers-TestCounter-Verification.sv"
split/verification/cover/layers-TestCounter-Verification-Cover.sv: `include "layers-TestCounter-Verification.sv"
$ find split/
split/
split/TestCounter.sv
split/FormalCounter.v
split/Counter.sv
split/filelist.f
split/verification
split/verification/assert
split/verification/assert/layers-TestCounter-Verification-Assert.sv
split/verification/assume
split/verification/assume/layers-TestCounter-Verification-Assume.sv
split/verification/layers-TestCounter-Verification.sv
split/verification/cover
split/verification/cover/layers-TestCounter-Verification-Cover.sv
Is there a Chisel argument not to generate these layers rather than firtool argument?
Ah, I wasn't holding it right...
What confuses me is that firtool is now being invoked several times and I have to include these options every time?
From .fir to .mlir, from .mlir to .sv...
https://github.com/The-OpenROAD-Project/bazel-orfs/pull/395