Hi,
I got segmenting fault error with below DPI codes.
Please let me know how to fix it.
// SV code
export "DPI-C" task randomize32;
class rand_define;
rand bit [31:0] out;
constraint const_out{out[31:0] >= 0; out[31:0] <= 32'hffff_ffff;};
endclass
task randomize32(output int out);
bit [31:0] out;
rand_define exec;
begin
exec = new();
exec.randomize();
out = exec.out;
$display("random_data = %h", out); // display OK
end
endtask
// C++ code
extern "C" void randomize32(int out);
void Test(void)
{
int out;
out = 0;
randomize32(out); // display OK
printf_sub("test bla bla"); // Looks Segmenting fault happend here
.....
.....
}