+| <a name="SYNTH_VERILOG_SURGERY"></a>SYNTH_VERILOG_SURGERY| Surgery at home: a script that copies VERILOG_FILES and edits the copies before synthesis reads them. A hack; you asked for it, you deserve the results. Good for simple RTL, especially generated RTL (firtool, sv2v), whose text is regular enough to edit reliably. Unsuitable for idiomatic SystemVerilog code bases with include files, macros, packages, `bind` and other advanced language features, where an edit to the text cannot see what the code means. As the RTL is read (canonicalization, memory extraction, and the SYNTH_USE_SYN frontend), it runs with SYNTH_VERILOG_SURGERY_ARGS, then `--out-dir $(OBJECTS_DIR)/surgery --` and the VERILOG_FILES (by PYTHON_EXE when it ends in .py), and writes one copy per source under the same file name; synthesis reads the copies. They are kept for inspection but are no make target or build output. Input file names must be unique. Nothing checks what the script changed: write it to fail loudly when it cannot recognise its input. Its use so far is making seams: logic with no module of its own (a register file, say) moved into one so a generated netlist can replace that module, and test inputs tied off. Why: the RTL keeps changing (a regenerated Chisel core, a bumped upstream), so a fix is made as an operation that is redone on every version rather than as an edited copy that goes stale. In a build system such as Bazel, a step of one's own before synthesis is easy and this matters less; in make it is a way to add a step without hacking the Makefile, and a surgery script may turn out to be reusable across designs.| |
0 commit comments