Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 passing 2-dimension array in DPI-SC  

Last post Tue, Jun 12 2012 1:34 AM by vjain419. 1 replies.
Started by ravi999 21 May 2012 06:20 AM. Topic has 1 replies and 3731 views
Page 1 of 1 (2 items)
Sort Posts:
  • Mon, May 21 2012 6:20 AM

    • ravi999
    • Not Ranked
    • Joined on Wed, Apr 1 2009
    • Posts 6
    • Points 60
    passing 2-dimension array in DPI-SC Reply

    Hi

    I am able to pass one bit vector as an argument for DPI-SC.

    test.v:
    module test;
    import "DPI-SC" function int c_func(input bit [7:0] data);

    bit [7:0] data;
    int j;

    initial begin
     data=8'h1;
     j=c_func(data);

    end

    endmodule

    code.cpp
    #include <iostream>
    using namespace std;

    #define NCSC_INCLUDE_TASK_CALLS
    #include "systemc.h"
    #include "svdpi.h"

    int c_func(svBitVecVal h) {
     cout<<h;
     return 0;
    }

    NCSC_REGISTER_DPI(c_func)

    Above code is working. 

    But I am unable to pass 2-dimension array as an arguement.

    Is there any way to pass 2-D bit array as an argumenet for DPI-SC?

     

    • Post Points: 20
  • Tue, Jun 12 2012 1:34 AM

    • vjain419
    • Not Ranked
    • Joined on Tue, Jun 12 2012
    • Posts 1
    • Points 5
    Re: passing 2-dimension array in DPI-SC Reply

     may be you will get some help from this example

     program main;

               import "DPI-C" function void get_nums(output logic [15:0] nums[10]);

               logic [15:0] nums[10];

               initial begin
                   get_nums(nums);
                   foreach (nums[i]) $display(i,nums[i]);
               end
          endprogram

     

    #include "svdpi.h"

          void fib(svLogicVecVal nums[10]) {
              int i;
              for (i=0; i<10; i++) {
                  nums[i] = i ;
              }
          }

     

    Regards,

    Vinay

    • Post Points: 5
Page 1 of 1 (2 items)
Sort Posts:
Started by ravi999 at 21 May 2012 06:20 AM. Topic has 1 replies.