samuraign
Full Member level 2
dpiheader
Hi
Can any body give me a script or steps to use C-code and SystemVerilog using
NcVerilog.
I am using the following script but ncsim is not taking the *.so file.
Please have a look at the script.
I am not sure whether this is the only procedure that w need to do.
If somebody knows an easy procedure or steps,please post it here.
//script starts from here:-
rm -rf INCA_libs
rm *.so
ncvlog arrays.v -sv
ncelab -dpiheader dpi.h worklib.arrays:module
gcc -g -c -fPIC -shared -o dispary.so dispary.c -I/x/y/z/IUS/5.6/solaris/tools/include
ncsim worklib.arrays:module -dispary.so -sv_root
ncsim log report:-
ncsim(64): 05.60-p001: (c) Copyright 1995-2005 Cadence Design Systems, Inc.
ncsim: *F,BADOPT: unknown or ambiguous options (-dispary.so).
C-file:-(dispary.c)
#include <stdio.h>
void displayArray(char *s) {
printf("The Array Contents: %c\n",*s);
}
SV Testbench file:-arrays.v
`define DYN 6
`define MAX_SIZE 1
`define MIN_SIZE 0
module arrays;
int arrOne [`MAX_SIZE:0][`MIN_SIZE:0];
byte m[]; // Current Size will be '0'.
int i,j;
int k;
import "DPI-C" context displayArray = function void displayValue(inout byte arrVal);
initial begin
for(i=0;i<=`MAX_SIZE;i++) begin
for(j=0;j<=`MIN_SIZE;j++) begin
arrOne[j] = (i+1)*3.2*(j+1);
$display("Array 'arrOne[%0d][%0d]' is: %0d\n",i,j,arrOne[j]);
end
end
end
initial begin
$display("The Array Size is: %0d",m.size());
m = new[`DYN]; // The size is determined at run_time.
for(k=0;k<m.size();k++) begin
m[k] = (k*1) + 80; // Fill the array.
displayValue(m[k]);
end
m.delete(); // Delete the dynamic array.
$display("The new Array Size is: %0d",m.size());
end
endmodule
Hi
Can any body give me a script or steps to use C-code and SystemVerilog using
NcVerilog.
I am using the following script but ncsim is not taking the *.so file.
Please have a look at the script.
I am not sure whether this is the only procedure that w need to do.
If somebody knows an easy procedure or steps,please post it here.
//script starts from here:-
rm -rf INCA_libs
rm *.so
ncvlog arrays.v -sv
ncelab -dpiheader dpi.h worklib.arrays:module
gcc -g -c -fPIC -shared -o dispary.so dispary.c -I/x/y/z/IUS/5.6/solaris/tools/include
ncsim worklib.arrays:module -dispary.so -sv_root
ncsim log report:-
ncsim(64): 05.60-p001: (c) Copyright 1995-2005 Cadence Design Systems, Inc.
ncsim: *F,BADOPT: unknown or ambiguous options (-dispary.so).
C-file:-(dispary.c)
#include <stdio.h>
void displayArray(char *s) {
printf("The Array Contents: %c\n",*s);
}
SV Testbench file:-arrays.v
`define DYN 6
`define MAX_SIZE 1
`define MIN_SIZE 0
module arrays;
int arrOne [`MAX_SIZE:0][`MIN_SIZE:0];
byte m[]; // Current Size will be '0'.
int i,j;
int k;
import "DPI-C" context displayArray = function void displayValue(inout byte arrVal);
initial begin
for(i=0;i<=`MAX_SIZE;i++) begin
for(j=0;j<=`MIN_SIZE;j++) begin
arrOne[j] = (i+1)*3.2*(j+1);
$display("Array 'arrOne[%0d][%0d]' is: %0d\n",i,j,arrOne[j]);
end
end
end
initial begin
$display("The Array Size is: %0d",m.size());
m = new[`DYN]; // The size is determined at run_time.
for(k=0;k<m.size();k++) begin
m[k] = (k*1) + 80; // Fill the array.
displayValue(m[k]);
end
m.delete(); // Delete the dynamic array.
$display("The new Array Size is: %0d",m.size());
end
endmodule