Add regression test for issue #1273.

This commit is contained in:
Martin Whitaker 2025-10-07 21:54:11 +01:00
parent 936f92ebe6
commit a4c90fb5f0
4 changed files with 59 additions and 0 deletions

42
ivtest/vpi/poke_escaped.c Normal file
View File

@ -0,0 +1,42 @@
#include "vpi_user.h"
static PLI_INT32 poke_escaped_calltf(PLI_BYTE8 *xx)
{
vpiHandle scope;
vpiHandle variable;
s_vpi_value value;
(void)xx; /* Parameter is not used. */
scope = vpi_handle(vpiScope, NULL);
variable = vpi_handle_by_name("!\"escaped\"!\\", scope);
if (variable == 0) {
vpi_printf("FAILED: failed to find !\"escaped\"!\\ by name\n");
vpi_sim_control(vpiFinish, 1);
return 0;
}
value.format = vpiStringVal;
value.value.str = "PASSED";
vpi_put_value(variable, &value, 0, vpiNoDelay);
return 0;
}
static void poke_escaped_register(void)
{
s_vpi_systf_data tf_data;
tf_data.type = vpiSysTask;
tf_data.tfname = "$poke_escaped";
tf_data.calltf = poke_escaped_calltf;
tf_data.compiletf = 0;
tf_data.sizetf = 0;
vpi_register_systf(&tf_data);
}
void (*vlog_startup_routines[])(void) = {
poke_escaped_register,
0
};

13
ivtest/vpi/poke_escaped.v Normal file
View File

@ -0,0 +1,13 @@
module test;
reg [6*8-1:0] \!"escaped"!\ ;
initial begin
\!"escaped"!\ = "FAILED";
$poke_escaped;
$display("%s", \!"escaped"!\ );
end
endmodule

View File

@ -0,0 +1,3 @@
Compiling vpi/poke_escaped.c...
Making poke_escaped.vpi from poke_escaped.o...
PASSED

View File

@ -109,6 +109,7 @@ mipname normal mipname.c mipname.log
myscope normal myscope.c myscope.gold
myscope2 normal myscope2.c myscope2.gold
nulls1 normal nulls1.c nulls1.log
poke_escaped normal poke_escaped.c poke_escaped.gold
pokevent normal pokevent.cc pokevent.log
pokereg normal pokereg.cc pokereg.log
ports_params normal ports_params.c ports_params.gold