@@ -379,7 +379,8 @@ writing multiple Scalatest tests.
379379
380380Sometimes, it is sufficient to directly inspect the result of a generator. This
381381testing strategy is particularly relevent if you are trying to create very
382- specific Verilog structures or to guarantee exact naming of specific constructs.
382+ specific FIRRTL or SystemVerilog structures or to guarantee exact naming of
383+ specific constructs.
383384
384385While simple testing can be done with string comparisons, this is often
385386insufficient as it is necessary to both have a mixture of regular expression
@@ -427,6 +428,36 @@ for its own testing.
427428
428429:::
429430
431+ When writing FileCheck tests, you will often be using a Chisel API to convert
432+ your Chisel circuit into FIRRTL or SystemVerilog. Two methods exist to do this
433+ in the ` circt.stage.ChiselStage ` object:
434+
435+ - ` emitCHIRRTL ` to generate FIRRTL with a few Chisel extensions
436+ - ` emitSystemVerilog ` to generate SystemVerilog
437+
438+ Both of these methods take an optional ` args ` parameter which sets the Chisel
439+ elaboration options. The latter method has an additional, optional
440+ ` firtoolOpts ` parameter which controls the ` firtool ` (FIRRTL compiler) options.
441+
442+ Without any ` firtoolOpts ` provided to ` emitSystemVerilog ` , the generated
443+ SystemVerilog may be difficult for you to use FileCheck with due to the default
444+ SystemVerilog lowering, emission, and pretty printing used by ` firtool ` . To
445+ make it easier to write your tests, we suggest using the following options:
446+
447+ - ` -loweringOptions=emittedLineLength=160 ` to increase the allowable line
448+ length. By default, ` firtool ` will wrap lines that exceed 80 characters. You
449+ may consider using a _ very long_ line length (e.g., 8192) to avoid this
450+ problem altogether.
451+
452+ - ` -loweringOptions=disallowLocalVariables ` to disable generation of `automatic
453+ logic` temporaries in always blocks. This can cause temporaries to spill
454+ within an always block which may be slightly unexpected.
455+
456+ For more information about ` firtool ` and its lowering options see the [ CIRCT's
457+ Verilog Generation
458+ documentation] ( https://circt.llvm.org/docs/VerilogGeneration/#controlling-output-style-with-loweringoptions )
459+ or invoke ` firtool -help ` for a complete list of all supported options.
460+
430461### Example
431462
432463The example below shows a FileCheck test that checks that a module has a
0 commit comments