diff --git a/ivtest/vpi/br_gh1041.c b/ivtest/vpi/br_gh1041.c new file mode 100644 index 000000000..f057a8236 --- /dev/null +++ b/ivtest/vpi/br_gh1041.c @@ -0,0 +1,52 @@ +#include + +static PLI_INT32 start_cb(struct t_cb_data *cb) +{ + static struct t_vpi_value val; + vpiHandle wire; + + (void)cb; // suppress unused parameter warning + + wire = vpi_handle_by_name("test.w4", NULL); + if (wire) { + val.format = vpiIntVal; + val.value.integer = 1; + vpi_put_value(wire, &val, NULL, vpiNoDelay); + } else { + vpi_printf("Failed to get handle for w4\n"); + } + + wire = vpi_handle_by_name("test.w8", NULL); + if (wire) { + val.format = vpiIntVal; + val.value.integer = 1; + vpi_put_value(wire, &val, NULL, vpiNoDelay); + } else { + vpi_printf("Failed to get handle for w8\n"); + } + + wire = vpi_handle_by_name("test.wr", NULL); + if (wire) { + val.format = vpiRealVal; + val.value.real = 1.0; + vpi_put_value(wire, &val, NULL, vpiNoDelay); + } else { + vpi_printf("Failed to get handle for wr\n"); + } + + return 0; +} + +static void register_cb(void) +{ + struct t_cb_data cbd = {}; + + cbd.reason = cbStartOfSimulation; + cbd.cb_rtn = start_cb; + vpi_register_cb(&cbd); +} + +void (*vlog_startup_routines[])(void) = { + register_cb, + 0 +}; diff --git a/ivtest/vpi/br_gh1041.v b/ivtest/vpi/br_gh1041.v new file mode 100644 index 000000000..bb06ac52e --- /dev/null +++ b/ivtest/vpi/br_gh1041.v @@ -0,0 +1,20 @@ +module test; + wire w4; + tri0 w8; + wire real wr; + + reg failed = 0; + + initial begin + #0; + $display("w4 %b w8 %b wr %f", w4, w8, wr); + if (w4 !== 1'b1) failed = 1; + if (w8 !== 1'b1) failed = 1; + if (wr != 1.0) failed = 1; + + if (failed) + $display("FAILED"); + else + $display("PASSED"); + end +endmodule diff --git a/ivtest/vpi_gold/br_gh1041.gold b/ivtest/vpi_gold/br_gh1041.gold new file mode 100644 index 000000000..9365276e6 --- /dev/null +++ b/ivtest/vpi_gold/br_gh1041.gold @@ -0,0 +1,4 @@ +Compiling vpi/br_gh1041.c... +Making br_gh1041.vpi from br_gh1041.o... +w4 1 w8 1 wr 1.000000 +PASSED diff --git a/ivtest/vpi_regress.list b/ivtest/vpi_regress.list index 240261b84..a8e22b524 100644 --- a/ivtest/vpi_regress.list +++ b/ivtest/vpi_regress.list @@ -71,6 +71,7 @@ br_gh308 normal br_gh308.c br_gh308.gold br_gh317 normal br_gh317.c br_gh317.gold br_gh496 normal,-g2009 br_gh496.c br_gh496.gold br_gh1037 normal,-g2009 br_gh1037.c br_gh1037.gold +br_gh1041 normal br_gh1041.c br_gh1041.gold br_ml20191013 normal br_ml20191013.c br_ml20191013.gold by_index normal by_index.c by_index.gold by_name normal by_name.c by_name.log