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

make[1]: *** [Makefile:69: obj-pc/lfsr_tb.o] Error 1 #4

Open
fjpolo opened this issue Feb 10, 2025 · 1 comment
Open

make[1]: *** [Makefile:69: obj-pc/lfsr_tb.o] Error 1 #4

fjpolo opened this issue Feb 10, 2025 · 1 comment
Assignees

Comments

@fjpolo
Copy link

fjpolo commented Feb 10, 2025

Setup:

  • W10 WSL2 Ubuntu 20.04
  • GNU Make 4.3
  • Verilator 5.020 2024-01-01 rev (Debian 5.020-1)

How to reproduce:

Make output:

In file included from /usr/include/c++/13/cassert:44,
                 from /home/fpolo/oss-cad-suite/share/verilator/include/verilated.h:50:
lfsr_tb.cpp: In function ‘int main(int, char**)’:
lfsr_tb.cpp:59:17: error: ‘class Vlfsr’ has no member named ‘v__DOT__sreg’
   59 | #define VVAR(A) v__DOT_ ## A
      |                 ^~~~~~~
lfsr_tb.cpp:61:17: note: in expansion of macro ‘VVAR’
   61 | #define sreg    VVAR(_sreg)
      |                 ^~~~
lfsr_tb.cpp:97:21: note: in expansion of macro ‘sreg’
   97 |         assert(((tb.sreg)&((1<<LN)-1)) == 1);
      |                     ^~~~
lfsr_tb.cpp:59:17: error: ‘class Vlfsr’ has no member named ‘v__DOT__sreg’
   59 | #define VVAR(A) v__DOT_ ## A
      |                 ^~~~~~~
lfsr_tb.cpp:61:17: note: in expansion of macro ‘VVAR’
   61 | #define sreg    VVAR(_sreg)
      |                 ^~~~
lfsr_tb.cpp:98:19: note: in expansion of macro ‘sreg’
   98 |         assert(tb.sreg != 0);
      |                   ^~~~
lfsr_tb.cpp:59:17: error: ‘class Vlfsr’ has no member named ‘v__DOT__sreg’
   59 | #define VVAR(A) v__DOT_ ## A
      |                 ^~~~~~~
lfsr_tb.cpp:61:17: note: in expansion of macro ‘VVAR’
   61 | #define sreg    VVAR(_sreg)
      |                 ^~~~
lfsr_tb.cpp:126:27: note: in expansion of macro ‘sreg’
  126 |                 assert(tb.sreg != 0);
      |                           ^~~~
lfsr_tb.cpp:59:17: error: ‘class Vlfsr’ has no member named ‘v__DOT__sreg’
   59 | #define VVAR(A) v__DOT_ ## A
      |                 ^~~~~~~
lfsr_tb.cpp:61:17: note: in expansion of macro ‘VVAR’
   61 | #define sreg    VVAR(_sreg)
      |                 ^~~~
lfsr_tb.cpp:127:26: note: in expansion of macro ‘sreg’
  127 |                 if (((tb.sreg)&((1<<LN)-1)) == 1)
      |                          ^~~~
lfsr_tb.cpp:59:17: error: ‘class Vlfsr’ has no member named ‘v__DOT__sreg’
   59 | #define VVAR(A) v__DOT_ ## A
      |                 ^~~~~~~
lfsr_tb.cpp:61:17: note: in expansion of macro ‘VVAR’
   61 | #define sreg    VVAR(_sreg)
      |                 ^~~~
lfsr_tb.cpp:132:20: note: in expansion of macro ‘sreg’
  132 |         while(((tb.sreg)&((1<<LN)-1)) != 1) {
      |                    ^~~~
lfsr_tb.cpp:59:17: error: ‘class Vlfsr’ has no member named ‘v__DOT__sreg’
   59 | #define VVAR(A) v__DOT_ ## A
      |                 ^~~~~~~
lfsr_tb.cpp:61:17: note: in expansion of macro ‘VVAR’
   61 | #define sreg    VVAR(_sreg)
      |                 ^~~~
lfsr_tb.cpp:145:27: note: in expansion of macro ‘sreg’
  145 |                 assert(tb.sreg != 0);
      |                           ^~~~
In file included from lfsr_tb.cpp:40:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘const T_Value& VlQueue<T_Value, N_MaxSize>::at(int32_t) const [with T_Value = unsigned char; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:1591:73:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:632:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<unsigned char, std::allocator<unsigned char> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  632 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘const T_Value& VlQueue<T_Value, N_MaxSize>::at(int32_t) const [with T_Value = short unsigned int; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:1597:73:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:632:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<short unsigned int, std::allocator<short unsigned int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  632 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘const T_Value& VlQueue<T_Value, N_MaxSize>::at(int32_t) const [with T_Value = unsigned int; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:1603:54:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:632:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<unsigned int, std::allocator<unsigned int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  632 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘const T_Value& VlQueue<T_Value, N_MaxSize>::at(int32_t) const [with T_Value = long unsigned int; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:1674:54:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:632:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<long unsigned int, std::allocator<long unsigned int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  632 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘T_Value& VlQueue<T_Value, N_MaxSize>::atWrite(int32_t) [with T_Value = unsigned char; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:2210:48:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:611:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<unsigned char, std::allocator<unsigned char> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  611 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘T_Value& VlQueue<T_Value, N_MaxSize>::atWrite(int32_t) [with T_Value = short unsigned int; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:2217:48:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:611:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<short unsigned int, std::allocator<short unsigned int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  611 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘T_Value& VlQueue<T_Value, N_MaxSize>::atWrite(int32_t) [with T_Value = unsigned int; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:2224:48:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:611:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<unsigned int, std::allocator<unsigned int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  611 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h: In instantiation of ‘T_Value& VlQueue<T_Value, N_MaxSize>::atWrite(int32_t) [with T_Value = long unsigned int; long unsigned int N_MaxSize = 0; int32_t = int]’:
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_funcs.h:2252:48:   required from here
/home/fpolo/oss-cad-suite/share/verilator/include/verilated_types.h:611:44: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::deque<long unsigned int, std::allocator<long unsigned int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  611 |         if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
      |                                      ~~~~~~^~~~~~~~~~~~~~~~~
/home/fpolo/oss-cad-suite/share/verilator/include/verilatedos.h:69:45: note: in definition of macro ‘VL_UNLIKELY’
   69 | # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)  // Prefer over C++20 [[unlikely]]
      |                                             ^
make[1]: *** [Makefile:69: obj-pc/lfsr_tb.o] Error 1
make: *** [Makefile:61: benchcpp] Error 2
@ZipCPU
Copy link
Owner

ZipCPU commented Feb 10, 2025

Thank you for the report.

The actual "bug" is the VVAR macro expansion. At one time, that worked to access values internal to the design.

Shame on me for using references to Verilator's internal data structures. Verilator changed the name(s) to those structures, and now they are more challenging to access from a C++ program trying to peek at those internals.

There are a couple of approaches to fixing this. I could ...

  • Look to remove all references to internal variables.
  • Create a test bench wrapper with access to those values via Verilog "dot-notation", and export them as proper outputs to the module
  • Continue the VVAR expansion, but just use a quick bash script to determine which version of Verilator is being used, and direct them as appropriate.

Bottom line, I need to look into this.

Dan

@ZipCPU ZipCPU self-assigned this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants