mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
@@ -33,6 +33,7 @@ Gianfranco Costamagna
|
||||
Glen Gibb
|
||||
Graham Rushton
|
||||
Guokai Chen
|
||||
Gustav Svensk
|
||||
Harald Heckmann
|
||||
Howard Su
|
||||
Huang Rui
|
||||
|
||||
@@ -1459,11 +1459,12 @@ void VL_SFORMAT_X(int obits, void* destp, const char* formatp, ...) VL_MT_SAFE {
|
||||
|
||||
void VL_SFORMAT_X(int obits_ignored, std::string& output, const char* formatp, ...) VL_MT_SAFE {
|
||||
if (obits_ignored) {}
|
||||
output = "";
|
||||
std::string temp_output;
|
||||
va_list ap;
|
||||
va_start(ap, formatp);
|
||||
_vl_vsformat(output, formatp, ap);
|
||||
_vl_vsformat(temp_output, formatp, ap);
|
||||
va_end(ap);
|
||||
output = temp_output;
|
||||
}
|
||||
|
||||
std::string VL_SFORMATF_NX(const char* formatp, ...) VL_MT_SAFE {
|
||||
|
||||
@@ -83,6 +83,12 @@ module t;
|
||||
$swriteo(str2, 4'd12);
|
||||
if (str2 != "14") $stop;
|
||||
|
||||
str3 = "foo";
|
||||
$sformat(str3, "%s", str3); // $sformat twice so verilator does not
|
||||
$sformat(str3, "%s", str3); // optimize the call to $sformat(str3, "%s", "foo")
|
||||
`ifdef TEST_VERBOSE $display("str3=%0s", str3); `endif
|
||||
if (str3 != "foo") $stop;
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user