cva6 icon indicating copy to clipboard operation
cva6 copied to clipboard

[BUG] make verilate fails with undefined reference to `Verilated::s_ns' errors

Open mik1234mc opened this issue 3 years ago • 1 comments

Is there an existing CVA6 bug for this?

  • [X] I have searched the existing bug issues

Bug Description

Hi all,

if I run make verilate, it fails with multiple of undefined reference to 'Verilated::s_ns errors and one undefined reference to 'Verilated::commandArgs(int, char const**)'. Can you advice, how to proceed?

verilator --version
Verilator 4.110 2021-02-25 rev UNKNOWN.REV
g++    ariane_tb.o SimDTM.o SimJTAG.o msim_helper.o remote_bitbang.o verilated.o verilated_dpi.o verilated_vpi.o Variane_testharness__ALL.a   -L/opt/riscv/lib -L/opt/riscv/lib -Wl,-rpath,/opt/riscv/lib -Wl,-rpath,/opt/riscv/lib -lfesvr  -lpthread  -pthread -lpthread -latomic   -o Variane_testharness
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness_REG_BUS__A20_D20__Slow.o): warning: relocation against `_ZN9Verilated4s_nsE' in read-only section `.text.unlikely'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness.o): in function `Variane_testharness::eval_step()':
Variane_testharness.cpp:(.text+0x2e): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness.cpp:(.text+0x62): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness.cpp:(.text+0x95): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness.o): in function `Variane_testharness::_combo__TOP__19(Variane_testharness__Syms*)':
Variane_testharness.cpp:(.text+0x162): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness.o): in function `Variane_testharness::_eval_initial_loop(Variane_testharness__Syms*)':
Variane_testharness.cpp:(.text.unlikely+0x3a): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__Slow.o): in function `Variane_testharness::__Vconfigure(Variane_testharness__Syms*, bool)':
Variane_testharness__Slow.cpp:(.text+0x61): undefined reference to `Verilated::timeunit(int)'
/usr/bin/ld: Variane_testharness__Slow.cpp:(.text+0x6f): undefined reference to `Verilated::timeprecision(int)'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__Slow.o): in function `Variane_testharness::_final_TOP(Variane_testharness__Syms*)':
Variane_testharness__Slow.cpp:(.text.unlikely+0x3a): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__Slow.o): in function `Variane_testharness::_settle__TOP__1(Variane_testharness__Syms*)':
Variane_testharness__Slow.cpp:(.text.unlikely+0x9a): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__18__Slow.o): in function `Variane_testharness::final()':
Variane_testharness__18__Slow.cpp:(.text+0x2): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__18__Slow.o): in function `Variane_testharness::_initial__TOP__20(Variane_testharness__Syms*)':
Variane_testharness__18__Slow.cpp:(.text.unlikely+0xa8): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__18__Slow.o): in function `Variane_testharness::_settle__TOP__33(Variane_testharness__Syms*)':
Variane_testharness__18__Slow.cpp:(.text.unlikely+0x31b): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__18__Slow.o):Variane_testharness__18__Slow.cpp:(.text.unlikely+0x1bba): more undefined references to `Verilated::s_ns' follow
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__Syms.o): in function `Variane_testharness__Syms::Variane_testharness__Syms(Variane_testharness*, char const*)':
Variane_testharness__Syms.cpp:(.text+0xb3): undefined reference to `VerilatedSyms::VerilatedSyms()'
/usr/bin/ld: Variane_testharness__Syms.cpp:(.text+0x3a1): undefined reference to `VerilatedScope::configure(VerilatedSyms*, char const*, char const*, char const*, char, VerilatedScope::Type const&)'
/usr/bin/ld: Variane_testharness__Syms.cpp:(.text+0x3ce): undefined reference to `VerilatedScope::configure(VerilatedSyms*, char const*, char const*, char const*, char, VerilatedScope::Type const&)'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__1__Slow.o): in function `Variane_testharness::_settle__TOP__2(Variane_testharness__Syms*)':
Variane_testharness__1__Slow.cpp:(.text.unlikely+0x16): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__2__Slow.o): in function `Variane_testharness::_settle__TOP__3(Variane_testharness__Syms*)':
Variane_testharness__2__Slow.cpp:(.text.unlikely+0x13): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__3__Slow.o): in function `Variane_testharness::_settle__TOP__4(Variane_testharness__Syms*)':
Variane_testharness__3__Slow.cpp:(.text.unlikely+0x16): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__4__Slow.o): in function `Variane_testharness::_settle__TOP__5(Variane_testharness__Syms*)':
Variane_testharness__4__Slow.cpp:(.text.unlikely+0x16): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__5__Slow.o): in function `Variane_testharness::_settle__TOP__6(Variane_testharness__Syms*)':
Variane_testharness__5__Slow.cpp:(.text.unlikely+0x220): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__6__Slow.o):Variane_testharness__6__Slow.cpp:(.text.unlikely+0x172): more undefined references to `Verilated::s_ns' follow
/usr/bin/ld: ariane_tb.o: in function `main':
ariane_tb.cpp:(.text.startup+0x476): undefined reference to `Verilated::commandArgs(int, char const**)'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__19.o): in function `Variane_testharness::_multiclk__TOP__46(Variane_testharness__Syms*)':
Variane_testharness__19.cpp:(.text+0x2): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__19.o): in function `Variane_testharness::_sequent__TOP__47(Variane_testharness__Syms*)':
Variane_testharness__19.cpp:(.text+0x33e): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__19.o): in function `Variane_testharness::_sequent__TOP__48(Variane_testharness__Syms*)':
Variane_testharness__19.cpp:(.text+0x383): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__19.o): in function `Variane_testharness::_sequent__TOP__49(Variane_testharness__Syms*)':
Variane_testharness__19.cpp:(.text+0x1094): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__19.o): in function `Variane_testharness::_multiclk__TOP__50(Variane_testharness__Syms*)':
Variane_testharness__19.cpp:(.text+0x118e): undefined reference to `Verilated::s_ns'
/usr/bin/ld: Variane_testharness__ALL.a(Variane_testharness__19.o):Variane_testharness__19.cpp:(.text+0x163c): more undefined references to `Verilated::s_ns' follow
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make[1]: *** [Variane_testharness.mk:78: Variane_testharness] Error 1
make[1]: Leaving directory '/home/michael/projects/cva6/work-ver'
make: *** [Makefile:682: verilate] Error 2

mik1234mc avatar Jul 06 '22 19:07 mik1234mc

I did a better results with the latest Verilator version 4.200+ (I have debian11), but I needed to add

#include "Variane_testharness___024root.h" in ariane_tb.cpp and change there sram preload to memif.read(0x80000000, mem_size, (void*)(top->rootp->ariane_testharness__DOT__i_sram__DOT__gen_cut__BRA__0__KET____DOT__gen_mem__DOT__i_tc_sram_wrapper__DOT__i_tc_sram__DOT__sram.m_storage));

I can then run ISA tests, but there is no debug output....

michael@debian11:~/projects/cva6$ ./work-ver/Variane_testharness ./tmp/riscv-tests/build/isa/rv64ua-v-amoadd_w
This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1.
Listening on port 35257
- /home/michael/projects/cva6/corev_apu/tb/rvfi_tracer.sv:60: Verilog $finish
- /home/michael/projects/cva6/corev_apu/tb/rvfi_tracer.sv:61: Verilog $finish
- /home/michael/projects/cva6/corev_apu/tb/rvfi_tracer.sv:61: Second verilog $finish, exiting

If verilate the model with DEBUG=1, then I got Segmentation Fault error....

mik1234mc avatar Jul 14 '22 16:07 mik1234mc

Hi @mik1234mc, I see that this issue has not been updated in > 6 months so I am closing it. If you are still having trouble, please open a new issue.

MikeOpenHWGroup avatar Feb 07 '23 20:02 MikeOpenHWGroup