• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Hardware/Software Co-Development, Verification…
  3. passing 2-dimension array in DPI-SC

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 50
  • Views 13781
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

passing 2-dimension array in DPI-SC

ravi999
ravi999 over 13 years ago

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?

 

  • Cancel
  • vjain419
    vjain419 over 13 years ago

     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

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information