Guest
Hi,
How do I use string constants with tasks, concatenating strings to print a message? My efforts so far have been unsuccessful. I currently have something like:
task mytask(input [1024 * 8:1] a_string);
begin
$display("String: %s", a_string);
end
endtask
mytask("a string for display");
mytask("another string for display");
I put the 1024 in the mytask prototype, becuase I thought this is what I'd need to do, but maybe there is a better way as this solution is not quite working. What gets displayed is "String: " followed by a big gap then the constant string I've passed. What I want printed is the two strings together, e.g. "String: a string for display"
Thx
How do I use string constants with tasks, concatenating strings to print a message? My efforts so far have been unsuccessful. I currently have something like:
task mytask(input [1024 * 8:1] a_string);
begin
$display("String: %s", a_string);
end
endtask
mytask("a string for display");
mytask("another string for display");
I put the 1024 in the mytask prototype, becuase I thought this is what I'd need to do, but maybe there is a better way as this solution is not quite working. What gets displayed is "String: " followed by a big gap then the constant string I've passed. What I want printed is the two strings together, e.g. "String: a string for display"
Thx