The lowering path in SimToSV that emits sv.fwrite / sv.write does not currently make sure that these operations are protected from synthesis.
This is problematic because these operations are simulation-only side effects. They should probably be emitted under the same synthesis guard mechanism used for other non-synthesizable SV constructs.
Run
circt-opt --lower-sim-to-sv --lower-hw-to-sv test/Conversion/SimToSV/lower-print-formatted-proc-to-sv.mlir
Then the part of output would be:
...
hw.module @print_to_literal_file(in %clk : i1) attributes {emit.fragments = [@CIRCT_LIB_LOGGING_FRAGMENT]} {
sv.always posedge %clk {
%0 = sv.constantStr "static.log"
%1 = sv.func.call.procedural @"__circt_lib_logging::FileDescriptor::get"(%0) : (!hw.string) -> i32
sv.fwrite %1, "value"
}
hw.output
}
...
The generated sv.fwrite is emitted directly in the procedural region, without a synthesis guard around it.
The lowering path in
SimToSVthat emitssv.fwrite/sv.writedoes not currently make sure that these operations are protected from synthesis.This is problematic because these operations are simulation-only side effects. They should probably be emitted under the same synthesis guard mechanism used for other non-synthesizable SV constructs.
Run
Then the part of output would be:
The generated sv.fwrite is emitted directly in the procedural region, without a synthesis guard around it.