Project

General

Profile

[logo] 
 
Home
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

Issue #1598

Updated by Wilson Snyder 9 months ago

I need my verilated model to call something other than printf to perform output $display, and the intended way to do that (according to verilated.h) appears to be to re-define VL_PRINTF

However doing so seems to cause a number of unexpected warnings. It is also unclear what the proper approach should be to make the verilator generated make file 'aware' of the declaration of my new output function (I.e. how do I tell verilator to put "#include "my_printf.h" into the verilated output code)

I'm sure I'm making a schoolboy error here but any pointers would be helpful.

<pre>
verilator -cc --exe -O3 -Wno-lint -Wno-UNOPTFLAT -Wno-COMBDLY -LDFLAGS "-fPIC --shared" --top-module xxxx_wrapper --unroll-count 150 -Mdir obj -CFLAGS "-fPIC -DVL_PRINTF=my_printf" +incdir+. -f ../core.flist --clk clk verilated_xxxx_wrapper.cpp -o ../verilated_xxxx_wrapper.so
make -s -j 4 -C obj OPT=-Os -f Vnvme_core_wrapper.mk
make[2]: Entering directory `xxxxx/verilator/obj'
<command-line>:0:0: warning: "VL_PRINTF" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: warning: "VL_PRINTF" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: warning: "VL_PRINTF" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: warning: "VL_PRINTF" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: warning: "VL_PRINTF" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from /tools/verilator/verilator-4.018/include/verilated.cpp:29:0:
/tools/verilator/verilator-4.018/include/verilated_imp.h: In static member function ‘static void VerilatedImp::userDump()’:
/tools/verilator/verilator-4.018/include/verilated_imp.h:279:54: error: ‘my_printf’ was not declared in this scope
if (first) { VL_PRINTF_MT(" userDump:\n"); first=false; }
</pre>


NOTE: I can work around this by overiding printf itself (and not using -DVL_PRINTF=my_printf) by adding my own version of printf as a wrapper for my new output function to the verilator input files, but I would rather use -DVL_PRINTF=xxxx if that was the intended approach.

Back