question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chisel tester with newest verilator as backend got a compile error

See original GitHub issue

Type of issue: bug report

Impact: no functional change

Development Phase: request

Other information

In this commit of verilator, the function Verilated::flushCall has split into Verilated::runFlushCallbacks and Verilated::runExitCallbacks. This breaking change leads to a compile error when we want to run PeekPokeTester against newest verilator on macOS.

If the current behavior is a bug, please provide the steps to reproduce the problem: Use brew update && brew upgrade to update your enviroment, then run sbt test in chisel-template, then you will see the following text:

cd /Users/name1e5s/Documents/Code/chisel-template/test_run_dir/make_no_vcd && verilator --cc GCD.v --assert -Wno-fatal -Wno-WIDTH -Wno-STMTDLY -O1 --top-module GCD +define+TOP_TYPE=VGCD +define+PRINTF_COND=!GCD.reset +define+STOP_COND=!GCD.reset -CFLAGS "-Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h" -Mdir /Users/name1e5s/Documents/Code/chisel-template/test_run_dir/make_no_vcd --exe /Users/name1e5s/Documents/Code/chisel-template/test_run_dir/make_no_vcd/GCD-harness.cpp
clang++  -I.  -MMD -I/usr/local/Cellar/verilator/4.040/share/verilator/include -I/usr/local/Cellar/verilator/4.040/share/verilator/include/vltstd -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -fbracket-depth=4096 -fcf-protection=none -Qunused-arguments -Wno-parentheses-equality -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h  -Os -c -o GCD-harness.o /Users/name1e5s/Documents/Code/chisel-template/test_run_dir/make_no_vcd/GCD-harness.cpp
clang++  -I.  -MMD -I/usr/local/Cellar/verilator/4.040/share/verilator/include -I/usr/local/Cellar/verilator/4.040/share/verilator/include/vltstd -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -fbracket-depth=4096 -fcf-protection=none -Qunused-arguments -Wno-parentheses-equality -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h  -Os -c -o verilated.o /usr/local/Cellar/verilator/4.040/share/verilator/include/verilated.cpp
/usr/bin/perl /usr/local/Cellar/verilator/4.040/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include VGCD.cpp VGCD__Slow.cpp VGCD__Syms.cpp > VGCD__ALL.cpp
clang++  -I.  -MMD -I/usr/local/Cellar/verilator/4.040/share/verilator/include -I/usr/local/Cellar/verilator/4.040/share/verilator/include/vltstd -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -fbracket-depth=4096 -fcf-protection=none -Qunused-arguments -Wno-parentheses-equality -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h  -Os -c -o VGCD__ALL.o VGCD__ALL.cpp
ar -cr VGCD__ALL.a VGCD__ALL.o
ranlib VGCD__ALL.a
/Users/name1e5s/Documents/Code/chisel-template/test_run_dir/make_no_vcd/GCD-harness.cpp:101:14: error: no member named 'flushCall' in 'Verilated'
  Verilated::flushCall();
  ~~~~~~~~~~~^
1 error generated.
make: *** [GCD-harness.o] Error 1
make: *** Waiting for unfinished jobs....
[info] GCDTester:
[info] GCD
[info] - should calculate proper greatest common denominator (with firrtl)
[info] GCD
[info] - should calculate proper greatest common denominator (with verilator) *** FAILED ***
[info]   java.lang.AssertionError: assertion failed:
[info]   at scala.Predef$.assert(Predef.scala:223)
[info]   at chisel3.assert$.apply(Assert.scala:76)
[info]   at chisel3.iotesters.setupVerilatorBackend$.apply(VerilatorBackend.scala:275)
[info]   at chisel3.iotesters.Driver$.$anonfun$execute$2(Driver.scala:55)
[info]   at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:23)
[info]   at logger.Logger$.$anonfun$makeScope$2(Logger.scala:168)
[info]   at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
[info]   at logger.Logger$.makeScope(Logger.scala:166)
[info]   at logger.Logger$.makeScope(Logger.scala:127)
[info]   at chisel3.iotesters.Driver$.$anonfun$execute$1(Driver.scala:38)
[info]   ...

What is the current behavior? Running sbt test will get a depressing compile error.

What is the expected behavior? The test should runs correctly.

Please tell us about your environment:

  • version: 3.3.1
  • OS: 64bit Mac OS X 10.15.6 19G2021
  • verilator: 4.040

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
danielkaszacommented, Nov 13, 2020

I just ran into this. Apparently, flushCall is deprecated and it got removed at some point, but it was added back for backwards compatibility. Unfortunately, Ubuntu 20.10 ships with the affected Verilator version.

This seems to fix it:

diff --git a/src/main/resources/chisel3/top.cpp b/src/main/resources/chisel3/top.cpp
index 4e9c1433..3e478511 100644
--- a/src/main/resources/chisel3/top.cpp
+++ b/src/main/resources/chisel3/top.cpp
@@ -8,7 +8,7 @@
 // Override Verilator definition so first $finish ends simulation
 // Note: VL_USER_FINISH needs to be defined when compiling Verilator code
 void vl_finish(const char* filename, int linenum, const char* hier) {
-  Verilated::flushCall();
+  Verilated::runFlushCallbacks();
   exit(0);
 }

…though 2 tests are still failing. I am also not sure when runFlushCallbacks was added.

1reaction
name1e5scommented, Aug 24, 2020

If anyone found the same problem, you can firstly

brew uninstall verilator

and then

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/86447d2239a9ebc4d98607fd4ae5b034d3349c02/Formula/verilator.rb

to downgrade the verilator to 4.036.

It is not a good solution, but it works.😂

Read more comments on GitHub >

github_iconTop Results From Across the Web

freechipsproject/chisel3 - Gitter
Any insight as to why the VErilator back-end code generated by Chisel/SBT is making use of a class, which has not been defined?...
Read more >
How to fix chisel test errors whit Verilator (should work with ...
Hi, I made some modifications and I found the file finally but a new error appears %Error: test_run_dir/complex_mem_test/cameraman_a:1: $readmem ...
Read more >
Verilator simulation fails after upgrading to chiseltest 0.5.0-RC1
Hi all,. I've upgraded chiseltest from 0.3.3 of chisel-template to 0.5.0-RC1 to try out the iVerilog backend. By adding .
Read more >
SHA3: Introduction to VLSI with Chisel Overview
The VCS Synopsys backend takes the. Verilog and compiles it down directly. It has worse performance per cycle than Verilator but better ...
Read more >
ChiselTest - Chisel/FIRRTL
Chiseltest is the batteries-included testing and formal verification library for Chisel-based RTL designs. Chiseltest emphasizes tests that are lightweight ( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found