--trace of SystemVerlog string gives compile error
Using Verilator Verilator 3.924 2018-06-12 (an Ubuntu build hosted as launchpad PPA), and the latest systemC from the same PPA. So it is possible the tools are not compiled properly.The SystemVerilog code compiles without errors, but the generated C++ does not compile:
In file included from Vrp_tb__ALLsup.cpp:3:0: Vrp_tb__Trace.cpp: In static member function ‘static void Vrp_tb::traceChgThis__2(Vrp_tb__Syms*, VerilatedVcd*, uint32_t)’: Vrp_tb__Trace.cpp:65:62: error: no matching function for call to ‘VerilatedVcd::chgQuad(int, std::__cxx11::string&, int)’ vcdp->chgQuad (c+1,(vlSymsp->TOP__riscv_asm_pkg.REG_X),64); ...Steps to reproduce the error:
git clone https://github.com/jeras/rp32.git cd rp32/ git checkout Verilator_string_bug cd sim/ make -f Makefile.verilator
#1 Updated by Iztok Jeras about 1 year ago
The offending code (if I comment it out it compiles properly) is a function returning a SV string:
The error is present regardless if the function is actually used or not, but I tried using it, just in case it would help (it did not):
#3 Updated by Iztok Jeras about 1 year ago
I was able to strip the test down to the basics, but I have not yet created a test_regress unit. I should be able to, I have done this before :)
I was able to reproduce the issue with the git HEAD version of Verilator.
While striping I first removed the SystemC dependency, ... the last part to be removed was the sprintf() function. https://github.com/jeras/rp32/blob/Verilator_string_bug/tbn/rp_tb.sv
It seems the parameter/localparameter of type array of strings is causing the issue.
#4 Updated by Iztok Jeras about 1 year ago
Hi, I updated the string regression test and run "make test", and there was no error, but I am unsure if the test was actually executed. I added a $display debug line into the test bus not able to see it in the make test output, so I am assuming I did something wrong.
The updated test is available here: https://github.com/jeras/verilator/commits/master
#5 Updated by Iztok Jeras about 1 year ago
- File bugreport.tgz added
I will attach a tarball containing my build with all generated files, so you would be able to see if there are errors in the generated code. If there are no errors inside generated code, then a make inside odj_dir should not fail. Now the sources are minimized to 3 short files (Makefile, .cpp, .sv) all in a single directory.
tar -xvf bugreport.tgz cd bugreport/sim export VERILATOR_ROOT=??? make
#7 Updated by Iztok Jeras about 1 year ago
- File bugreport.tgz added
I was able to run the test code properly with the fixed Verilator, then I encountered another error compiling generated code.
I tried to make the test case smaller (it is now about 20 lines), but if I remove additional lines of code the code compiles and runs properly. Verilator Git HEAD from a couple of days ago was used.
I again attached a tarball containing the example and generated code. The rebuild process is the same as with the previous tarball.
Regards, Iztok Jeras
Also available in: Atom