Internals: Add `--dump-inputs` to make __inputs without needing `--debug`

This commit is contained in:
Wilson Snyder 2025-11-01 20:34:06 -04:00
parent 8750cdac73
commit e6cdaf112c
5 changed files with 13 additions and 5 deletions

View File

@ -370,6 +370,7 @@ detailed descriptions of these arguments.
--dump-defines Show preprocessor defines with -E
--dump-dfg Enable dumping DfgGraphs to .dot files
--dump-graph Enable dumping V3Graphs to .dot files
--dump-inputs Enable dumping preprocessed input files
--dump-tree Enable dumping Ast .tree files
--dump-tree-addrids Use short identifiers instead of addresses
--dump-tree-dot Enable dumping Ast .tree.dot debug files

View File

@ -77,9 +77,10 @@ reduce a SystemVerilog design to the smallest possible reproducer.
It can be used to automatically reduce a design with hundreds of thousands of
lines to a minimal test case while preserving the bug-inducing behavior.
With :vlopt:`--debug`, Verilator will write a *{prefix}*\ __inputs\ .vpp
file which has all of the individual input files combined and
pre-processed, this is often useful as the input design into `sv-bugpoint`.
With :vlopt:`--debug` or :vlopt:`--dump-inputs`, Verilator will write a
*{prefix}*\ __inputs\ .vpp file which has all of the individual input files
combined and pre-processed, this is often useful as the input design into
`sv-bugpoint`.
Please refer to `sv-bugpoint README
<https://github.com/antmicro/sv-bugpoint/blob/main/README.md>`_ for more

View File

@ -470,6 +470,11 @@ Summary:
level 3. Before Verilator 4.228, :vlopt:`--dump-tree` used
to include this option.
.. option:: --dump-inputs
Rarely needed. Enable dumping a *{prefix}*\ __inputs\ .vpp file which
has all of the individual input files combined and pre-processed
.. option:: --dump-tree
Rarely needed. Enable dumping Ast .tree debug files with dumping level 3,

View File

@ -342,7 +342,8 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i
}
V3Stats::addStatSum(V3Stats::STAT_SOURCE_CHARS, m_ppBytes);
if (debug() && modfilename != V3Options::getStdPackagePath()
if ((debug() || v3Global.opt.dumpLevel("inputs"))
&& modfilename != V3Options::getStdPackagePath()
&& modfilename != V3Options::getStdWaiverPath())
dumpInputsFile();

View File

@ -11,7 +11,7 @@ import vltest_bootstrap
test.scenarios('vlt')
test.lint(v_flags=["--debug --debugi 1 -Wno-MULTITOP t/t_debug_inputs_b.v"])
test.lint(v_flags=["--dump-inputs -Wno-MULTITOP t/t_debug_inputs_b.v"])
test.file_grep(test.obj_dir + "/V" + test.name + "__inputs.vpp", r'module t_debug_inputs;')
test.file_grep(test.obj_dir + "/V" + test.name + "__inputs.vpp", r'module t_debug_inputs_a;')