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

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Apr 18, 2015


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

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Apr 18, 2015


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

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented May 15, 2015


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

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Dec 17, 2017


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


Open arrays supported in git towards 3.917.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Jan 2, 2018


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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.