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

integer arrays as DPI-C function call arguments #909

Closed
veripoolbot opened this issue Apr 18, 2015 · 4 comments
Closed

integer arrays as DPI-C function call arguments #909

veripoolbot opened this issue Apr 18, 2015 · 4 comments
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800

Comments

@veripoolbot
Copy link
Contributor


Author Name: David Pierce
Original Redmine Issue: 909 from https://www.veripool.org


For an integer array,
    integer dbuf [DBYTES-1:0];     // byte values

function imports like this,
    import "DPI-C" context function int readFILE(
       input int fd, output integer dbuf[], input int nbytes, input int offset
    );
    import "DPI-C" context function int writeFILE(
       input int fd, input integer dbuf[], input int nbytes, input int offset
    );

function calls like this,
       if( !writeFILE(fd, dbuf, wsize, addrval) ) begin
       ...
       if( !readFILE(fd, dbuf, DBYTES, addrval*DBYTES) ) begin
       ...@

gives compile errors,
       In file included from Vtb_mem__ALLcls.cpp:3:
       ./Vtb_mem.cpp:765:64: error: cannot initialize a parameter of type 'IData' (aka 'unsigned int') with an lvalue of type 'IData [16]'
       ..."ram_dynamem.sv", 0xc3U, vlTOPp->v__DOT__r0__DOT__fd, vlTOPp->v__DOT__r0__DOT__dbuf, 0x...


Works in both models and ncsim

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: David Pierce
Original Date: 2015-04-18T02:33:00Z


For an integer array,

       integer dbuf [DBYTES-1:0];     // byte values

function imports like this,

       import "DPI-C" context function int readFILE(
           input int fd, output integer dbuf[], input int nbytes, input int offset
       );
       import "DPI-C" context function int writeFILE(
           input int fd, input integer dbuf[], input int nbytes, input int offset
       );

function calls like this,

       if( !writeFILE(fd, dbuf, wsize, addrval) ) begin
        ...
       if( !readFILE(fd, dbuf, DBYTES, addrval*DBYTES) ) begin
        ...

gives compile errors,

        In file included from Vtb_mem__ALLcls.cpp:3:
        ./Vtb_mem.cpp:765:64: error: cannot initialize a parameter of type 'IData' (aka 'unsigned int') with an lvalue of type 'IData [16]'
        ..."ram_dynamem.sv", 0xc3U, vlTOPp->v__DOT__r0__DOT__fd, vlTOPp->v__DOT__r0__DOT__dbuf, 0x...


Works in both models and ncsim

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-05-15T01:51:04Z


Almost no code is in place to support array calls into DPI. I don't think I'll get to this soon, but if you'd like to try a patch I'll be glad to advise.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-12-17T21:29:49Z


Open arrays supported in git towards 3.917.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-01-02T23:14:54Z


In 3.918.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800
Projects
None yet
Development

No branches or pull requests

1 participant