We've overloaded $error etc to allow us to provide a consistent logging mechanism.
Unfortunately this implementation doesn't handle format values appropriately.
Looks like we need to pull off all the values from the args_iter, then create a msg from this to pass to gpi_log. Since this is not speed critical code I don't see a problem with this two stage printing.
Thought some more and I plan on doing this.
Split the gpi_log into gpi_log/gpi_logf, first just takes a string the second a format string. The format string for from vpi/vhpi is then handled in the implementation layer by iterating over the args and then calling vasprintf on those. And calling gpi_log with the string.
Where the whole list is known at the callsite the caller can call gpi_log.
Hi, I see this hasn't ticket hasn't had any activity in some time. We recently came across this issue while helping a customer with a COCOTB environment. Is there any plan to still address this issue? In the interim, is there any workaround to circumvent the overloading? Thanks! Eric Mackie (Mentor Graphics)
Hi Stuart,
Any updates on this issue? This is actually a show stopper for our sim environment. We are unable to upgrade the Modelsim version because of this bug. And the new Modelsim version has the features that we need.
Thanks,
Richard
It looks to me like this is unfortunately going to be a more involved fix than handling the arguments over to vasprintf .
Issues:
So I think we'll need to implement the string interpolation/formatting ourselves similar to what a simulator would do if it were handling the call to $info, $error, etc.
I can work on this but, as it's a non trivial amount of new code, I wanted to run it by the list to see if anyone had a better idea.
We might have to port the extremely heavyweight implementation of get_display from iverilog:
@pgfarley I think your last point is a non-issue, it can be solved with code like:
// this doesn't use C varargs, but VPI iteration
char *str = format_using_verilog_semantics(args_from_vpi);
// no formatting or varargs needed here
gpi_log(..., "%s", str);
free(str);