[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
  Schedule::Load
  SVN::S4
  Synopsys-modes
  SystemPerl
  Verilog-Pli
  Voneline
  Vregs
General Info
  Papers

Issue #385

Dpi exported tasks with array inputs don't compile.

Added by Thomas Watts 9 months ago. Updated 6 months ago.

Status:Feature Start date:09/02/2011
Priority:Low Due date:
Assignee:Wilson Snyder % Done:

0%

Category:Unsupported
Target version:-

Description

Compiling the following with verilator --lint_only gives the error message

Unsupported: Assignment between packed arrays of different dimensions

   export "DPI-C" task dpi_bytes;
   task dpi_bytes;
      input byte bytes [1:0];
   endtask

I've also tried declaring an input string (which admittedly is documented as unsupported).

Are there any plans to support this sort of thing, or any workarounds?

Thanks, Tom.

History

Updated by Wilson Snyder 9 months ago

Are you trying to pass a string? Strings aren't represented as an array of bytes in verilog, but rather one long number, so you'd do this

task dpi_bytes; input field [2*8-1:0];

Then in C you'd need to convert the null terminated string to the proper width. Or use a SystemVerilog string, but ;)

As for the original question, there isn't any array support across the DPI yet. If that is really what you're trying to do, and this example code works in other simulators, it shouldn't be too hard, let me know and I'll look.

Updated by Thomas Watts 9 months ago

I'm actually trying to pass a transaction of 10s of bytes from C to Verilog. I was hoping to assemble the bytes in a C char array and pass through the DPI to a System Verilog array of bytes. Although using a string or large vector wouldn't be too difficult as you suggest.

However I can't get any of these three approaches to work with Verilator. 2-D arrays get the message as described in the original bug report, strings and vectors larger than 32-bits are unsupported.

I am developing this code to be portable and it does work in another simulator. I pass the dpi function a const char * and can index the bytes in System Verilog.

Let me know if I can help with testcases or beta testing.

Updated by Wilson Snyder 9 months ago

  • Category set to Unsupported
  • Status changed from New to Assigned
  • Assignee set to Wilson Snyder

DPI exports of wide vectors should be supported, there's a test case in test_regress/t/t_dpi_export.v; if you could modify that file to show the failure and to show an example of what you'd like I'll do what I can. (Run it with test_regress/t/t_dpi_export.pl [--vcs] [--nc])

Updated by Thomas Watts 8 months ago

I was using 3.812, updating to 3.820 fixes large vectors. So I have things working with packing / unpacking across the dpi call.

The passing of arrays would be useful, as it would be much cleaner, but can be worked around.

Updated by Wilson Snyder 6 months ago

  • Status changed from Assigned to Feature
  • Priority changed from Normal to Low

Have workaround; revisit when data type changes in.

Also available in: Atom