diff --git a/test_regress/t/t_vpi_get_value_array.cpp b/test_regress/t/t_vpi_get_value_array.cpp index 079cf98b9..2843d64fa 100644 --- a/test_regress/t/t_vpi_get_value_array.cpp +++ b/test_regress/t/t_vpi_get_value_array.cpp @@ -113,7 +113,7 @@ int mon_check_props(void) { } { - vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_integers", NULL); + vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_words", NULL); CHECK_RESULT_NZ(object); arrayVal.format = vpiIntVal; @@ -128,7 +128,7 @@ int mon_check_props(void) { } { - vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_integers_rl", NULL); + vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_words_rl", NULL); CHECK_RESULT_NZ(object); indexArr[0] = 3; @@ -162,7 +162,7 @@ int mon_check_props(void) { } { - vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_words", NULL); + vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_quads", NULL); CHECK_RESULT_NZ(object); arrayVal.format = vpiRawFourStateVal; @@ -180,7 +180,7 @@ int mon_check_props(void) { } { - vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_integers", NULL); + vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_words", NULL); CHECK_RESULT_NZ(object); arrayVal.format = vpiVector; @@ -198,6 +198,23 @@ int mon_check_props(void) { } } + { + vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_integers", NULL); + CHECK_RESULT_NZ(object); + + indexArr[0] = rand() & 0x3; + + arrayVal.format = vpiIntVal; + vpi_get_value_array(object, &arrayVal, indexArr, num); + + PLI_INT32* ptr = arrayVal.value.integers; + + PLI_INT32 expected[4] = {INT32_MIN, INT32_MAX, 0, 1234567890}; + + for (int i = 0; i < num; i++) + CHECK_RESULT_HEX(ptr[i], expected[(indexArr[0]+i) & 0x3]); + } + { vpiHandle object = vpi_handle_by_name((PLI_BYTE8*)"TOP.test.read_longs", NULL); CHECK_RESULT_NZ(object); diff --git a/test_regress/t/t_vpi_get_value_array.v b/test_regress/t/t_vpi_get_value_array.v index 1d51cb75d..5b385a132 100644 --- a/test_regress/t/t_vpi_get_value_array.v +++ b/test_regress/t/t_vpi_get_value_array.v @@ -26,10 +26,11 @@ extern "C" int mon_check(); reg [7:0] read_bytes [0:3] `PUBLIC_FLAT_RD; reg [15:0] read_shorts [0:3] `PUBLIC_FLAT_RD; - reg [31:0] read_integers [0:3] `PUBLIC_FLAT_RD; - reg [31:0] read_integers_rl [3:0] `PUBLIC_FLAT_RD; + reg [31:0] read_words [0:3] `PUBLIC_FLAT_RD; + reg [31:0] read_words_rl [3:0] `PUBLIC_FLAT_RD; reg [63:0] read_longs [0:3] `PUBLIC_FLAT_RD; - reg [127:0] read_words [0:3] `PUBLIC_FLAT_RD; + reg [127:0] read_quads [0:3] `PUBLIC_FLAT_RD; + integer read_integers [0:3] `PUBLIC_FLAT_RD; integer status; @@ -44,25 +45,30 @@ extern "C" int mon_check(); read_shorts[2] = 16'hbeef; read_shorts[3] = 16'hdead; - read_integers[0] = 32'h00000000; - read_integers[1] = 32'hdeadbeef; - read_integers[2] = 32'h00000000; - read_integers[3] = 32'hdeadbeef; + read_words[0] = 32'h00000000; + read_words[1] = 32'hdeadbeef; + read_words[2] = 32'h00000000; + read_words[3] = 32'hdeadbeef; - read_integers_rl[0] = 32'hdeadbeef; - read_integers_rl[1] = 32'hdeadbeef; - read_integers_rl[2] = 32'h00000000; - read_integers_rl[3] = 32'h00000000; + read_words_rl[0] = 32'hdeadbeef; + read_words_rl[1] = 32'hdeadbeef; + read_words_rl[2] = 32'h00000000; + read_words_rl[3] = 32'h00000000; read_longs[0] = 64'h00000000deadbeef; read_longs[1] = 64'h0000000000000000; read_longs[2] = 64'h00000000beefdead; read_longs[3] = 64'h0000000000000000; - read_words[0] = 128'h00000000000000000000000000000000; - read_words[1] = 128'hbeefdead0000000000000000deadbeef; - read_words[2] = 128'h000000000000000000000000beefdead; - read_words[3] = 128'hbeefdeaddeadbeefbeefdeaddeadbeef; + read_quads[0] = 128'h00000000000000000000000000000000; + read_quads[1] = 128'hbeefdead0000000000000000deadbeef; + read_quads[2] = 128'h000000000000000000000000beefdead; + read_quads[3] = 128'hbeefdeaddeadbeefbeefdeaddeadbeef; + + read_integers[0] = -2147483648; + read_integers[1] = 2147483647; + read_integers[2] = 0; + read_integers[3] = 1234567890; status = $c32("mon_check()");