User guide
18-18
DirectC Interface
This call causes a core dump because the function expects a pointer
and gets some random bits instead.
It may happen that a string, or different strings, are assigned to a
signal in Verilog code and their values are passed to C. For example:
task DoStuff(...., result_code); ... output reg [100*8:1]
result_code;
begin
.
.
.
if (...) result_code = "Bus error";
.
.
.
if (...) result_code = "Erroneous address";
.
.
.
else result_code = "Completed");
end
endtask
reg [100*8:1] message;
....
DoStuff(..., message);
You cannot directly call the function as follows:
WriteReport(message, ...)
There are two solutions:
Solution 1: Write a C wrapper function, pass "message" to this
function and perform the conversion of vector to C string in C, calling
vc_ConvertToString.