Questions tagged [system-verilog-dpi]

Direct Programming Interface (DPI) from SystemVerilog. This interface allows direct communication between SystemVerilog simulation and foreign programming languages.

Direct Programming Interface (DPI) from . This interface allows direct communication between SystemVerilog simulation and foreign programming languages. Different programming languages can be used to intact with SystemVerilog; however, the SystemVerilog LRM (IEEE Std 1800-2017) only defines the C programming language as a foreign language layer.

Full details can be found in IEEE Std 1800-2017 § 35 Direct programming interface

55 questions
2
votes
5 answers

undefined reference to `main' in C

Hi I am getting below error while compiling a c code using gcc /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: ld returned 1 exit status I am trying to…
sanforyou
  • 455
  • 2
  • 8
  • 22
1
vote
1 answer

How can I copy data from C/C++ array to the entire SV array using SV-DPI?

I would like my array of data from SystemVerilog have the entire copy of data from the array on the C/C++ side: C/C++ code: void myCfunc(svOpenArrayHandle results) { int randomsize; ... uint32_t myArray[randomsize]; ... …
Cit5
  • 400
  • 5
  • 19
1
vote
1 answer

DPI-C export of a task defined inside a SystemVerilog class

Would it be possible to export to C a task defined inside a SystemVerilog class as the following? class packet_bfm_t; int id = 0; export "DPI-C" task send; // Is this possible and legal to call from C code? function new (int my_id =…
Dustin
  • 11
  • 2
1
vote
2 answers

DPI-C and SystemVerilog External Compilation flow issue

ModelSim User's manual (v10.1c), in page 660, talks about the default autocompile flow (using vlog) and external compilation flow to get the the DPI-C to work in ModelSim. I'm able to get the auto-compile flow to work. I'm stuck with the external…
ghertz
  • 11
  • 2
1
vote
1 answer

System Verilog DPI Checker masking 128-bit value

I am writing a DPI checker(.cpp file), In this, Checker reads the 128-bit value on every line and I want to mask it with a 128-bit mask and compare it with RTL value but the issue I am seeing is the data type from which I am creating the mask only…
1
vote
1 answer

Dynamic arrays in Struct in DPI-C

I want to use a dynamic array inside a struct which i pass onto C using DPI. How do i implement it on C-side. I tried using svOpenArrayHandle inside struct but still not working. Example: Struct a { int x; int y[]; }
1
vote
1 answer

Unable to access dimensions of svOpenArrayHandle

I have a multidimensional dynamic unpacked array in my SystemVerilog testbench and am passing this into C code as an argument using DPI-C. I am using Questasim 10.4b. Following the flow of Questa, I ran -dpiheader to generate the header file and…
noobuntu
  • 903
  • 1
  • 18
  • 42
1
vote
2 answers

In DPI-C, what data types to be used for internal variables?

I am not getting correct output for the following piece of code using DPI-C in VCS in EDA Playground. I expect 6 as answer but I get 248 every time, irrespective of a and b values. I have tried using svLogic, int and unsigned char for data type for…
1
vote
1 answer

Compiling SystemVerilog DPI with Modelsim DE 10.6b on Ubuntu 64-bit 16.04

I have Modelsim DE 10.6b installed on 64-bit Ubuntu 16.04 and when I run Modelsim examples of SystemVerilog DPI, I get auto compile linking error shown below: ** Fatal: ** Fatal: (vsim-3828) Could not link 'vsim_auto_compile.so': cmd =…
seannia
  • 11
  • 1
1
vote
2 answers

How to use DPI systemVerilog to detect a substring match?

How do I use SystemVerilog DPI to check if some string contains another string? For example, strstr() in C can detect "str" is contained within "string".
sara8d
  • 403
  • 4
  • 17
  • 32
1
vote
2 answers

SystemVerilog DPI returning string from C++ to verilog - ASCII charaters at the end?

I am returning a string from C function to SystemVerilog using DPI. const char* print_input_dpi(int w, int h, int p, ......int mtail){ std::stringstream ss; ss<<"w="<
user749632
  • 1,989
  • 2
  • 12
  • 5
1
vote
1 answer

Systemverilog: Simulation error when passing structs as module input\outputs

I am trying to pass one structure as an input and get the output in another structure. However I am having some issues during simulation. The following example code compiles fine in questasim, however the simulation gives the following…
user3716072
  • 187
  • 1
  • 2
  • 14
1
vote
3 answers

How to Embed Systemverilog Interpreter using DPI-C?

Problem Description: I design in SystemVerilog and write the testbenches in the same language. I want to be able to compile my design and test different functions during simulation in the way you would using an interpreter with e. Ideally, I would…
Nyarmith
  • 35
  • 1
  • 5
1
vote
1 answer

SystemVerilog DPI-C pointers

I have a question about the DPI connection between SystemVerilog and C. Specifically, I have a C function that looks like: unsigned short C_FUN(unsigned char* data) and what I want to pass to it is a bit[7:0] my_darray[]; Which is the best way to…
arandomuser
  • 521
  • 1
  • 7
  • 22
1
vote
1 answer

System Verilog DPI - unknown array size

I have the following code: file.sv module svtest(); import "DPI-C" function void my_func(output bit [31:0] id, input bit [31:0] size); bit [31:0] my_id; bit [31:0] my_size; initial begin my_size = 1 << 30; …