Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--trace of SystemVerlog string gives compile error #1338

Closed
veripoolbot opened this issue Sep 2, 2018 · 10 comments
Closed

--trace of SystemVerlog string gives compile error #1338

veripoolbot opened this issue Sep 2, 2018 · 10 comments

Comments

@veripoolbot
Copy link
Contributor

@veripoolbot veripoolbot commented Sep 2, 2018


Author Name: Iztok Jeras (@jeras)
Original Redmine Issue: 1338 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


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[0]),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 

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 2, 2018


Original Redmine Comment
Author Name: Iztok Jeras (@jeras)
Original Date: 2018-09-02T17:30:00Z


The offending code (if I comment it out it compiles properly) is a function returning a SV string:

https://github.com/jeras/rp32/blob/Verilator_string_bug/tbn/riscv_asm_pkg.sv#L13

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):

https://github.com/jeras/rp32/blob/Verilator_string_bug/tbn/rp_tb.sv#L111

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 3, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-09-03T00:53:55Z


Your rp32.git seemed to pass on my current master, can you try using the latest code, and if it doesn't pass make a minimal test ideally in test_regress format - sounds like you reduced it quite a bit. Thanks

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 4, 2018


Original Redmine Comment
Author Name: Iztok Jeras (@jeras)
Original Date: 2018-09-04T16:55:41Z


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.

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 5, 2018


Original Redmine Comment
Author Name: Iztok Jeras (@jeras)
Original Date: 2018-09-05T18:53:18Z


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

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 5, 2018


Original Redmine Comment
Author Name: Iztok Jeras (@jeras)
Original Date: 2018-09-05T19:53:45Z


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

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 8, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-09-08T05:17:46Z


Fixed in git towards 4.000. Note the fix is not to trace the string at all, as VCD format isn't speced to have string support.

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 12, 2018


Original Redmine Comment
Author Name: Iztok Jeras (@jeras)
Original Date: 2018-09-12T17:24:14Z


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

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 12, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-09-12T18:08:46Z


Please file a new issue and I'll take a look tonight, thanks.

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 12, 2018


Original Redmine Comment
Author Name: Iztok Jeras (@jeras)
Original Date: 2018-09-12T19:10:32Z


https://www.veripool.org/issues/1345-Verilator-compile-error-in-generated-C-files-probably-SV-string-related

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Sep 16, 2018


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-09-16T21:28:29Z


In 4.002.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.