Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1081

Makefile for --sc --exe with --vpi fails to build

Added by Arthur Kahlich 6 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
TranslationError
% Done:

0%


Description

While I think this is something I can work around, it would be nice if it "just worked".

I took the SystemC example given in the documentation and just changed the verilator command line to:

verilator -Wall --sc --vpi --exe our.v sc_main.cpp

followed by:

cd obj_dir && make -f Vour.mk

and I get a linker failure as follows:

verilated_vpi.o: In function `vpi_get_time':
verilated_vpi.cpp:(.text+0x11e4): undefined reference to `sc_time_stamp()'
verilated_vpi.o: In function `vpi_register_cb':
verilated_vpi.cpp:(.text+0x7ea3): undefined reference to `sc_time_stamp()'
collect2: ld returned 1 exit status

The reason for the undefined reference is because verilated_vpi.cpp in this case really needs

#include "systemc.h"

before the #include "verilated.h" so that the VL_TIME_[IQD]() macros used within it are defined by verilated.h to refer to the SystemC sc_time_stamp() that returns a class instead of the default for non-systemC that returns a double.

This could easily be fixed by adding to $VERILATOR_ROOT/include/verilated.mk a definition of:

ifeq ($(VM_SC),1)
VK_CPPFLAGS_WALL += -DVM_SC=$(VM_SC)
endif

and then adding before line 29 of $VERILATOR_ROOT/include/verilated_vpi.cpp :

#ifdef VM_SC
#include "systemc.h" 
#endif

test_vpi_sc.sh View - example test build script (743 Bytes) Arthur Kahlich, 08/16/2016 03:28 AM

History

#1 Updated by Wilson Snyder 6 months ago

  • Category set to TranslationError
  • Status changed from New to Resolved

Thanks for the good bug report. This is fixed in git towards 3.888.

#2 Updated by Wilson Snyder 4 months ago

  • Status changed from Resolved to Closed

In 3.888 (on 2016-10-14).

Also available in: Atom