marco5polo
Newbie level 1
- Joined
- Jul 17, 2014
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 9
My system verification makes use of C function for some processing calculation. The C function needs to pass in a pointer of integer array, where the result will be calculated. Can you show me an example how it could be done? I want to print out the result calculated by my_lib_cal(). There's not much literature about how to implement pass by reference.
Here's how to C function looks like:
Here's how I import the fnction intp my SV environment and execute them.
Here's how to C function looks like:
Code:
void my_lib_cal(int * out, int size)
Code:
import "DPI-C" function void my_lib_cal(int out[9:0], int size);
initial begin
int result[9:0];
int cycle=24;
int (int i=0; i<cycle; i++) begin
my_lib_cal(result,10);
for (int j=0; j<10; j++) begin
$display("%d",result[j]);
end
end
end
Last edited by a moderator: