diff --git a/ivtest/ivltests/pv_wr_vec2.v b/ivtest/ivltests/pv_wr_vec2.v new file mode 100644 index 000000000..4d82175c0 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec2.v @@ -0,0 +1,95 @@ +// Check that blocking partial writes to a 2-state vector are correctly +// handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + bit [3:0] x; + integer i; + + initial begin + // Immediate index + + // Within bounds + x = 'h0; + x[2:1] = 2'b10; + `check(x, 4'b0100) + + // Partially oob at high and low side + x = 'h0; + x[4:-1] = 6'b101010; + `check(x, 4'b0101) + // Partially oob at low side + x = 'h0; + x[0:-1] = 2'b10; + `check(x, 4'b0001) + // Partially oob at high side + x = 'h0; + x[4:3] = 2'b01; + `check(x, 4'b1000) + // Fully oob at low side + x = 'h0; + x[-1:-2] = 2'b11; + `check(x, 4'b0000) + // Fully oob at high side + x = 'h0; + x[6:5] = 2'b11; + `check(x, 4'b0000) + + // Variable index + + // Within bounds + i = 1; + x = 'h0; + x[i+:2] = 2'b10; + `check(x, 4'b0100) + + // Partially oob at high and low side + i = -1; + x = 'h0; + x[i+:6] = 6'b101010; + `check(x, 4'b0101) + + // Partially oob at low side + i = -1; + x = 'h0; + x[i+:2] = 2'b10; + `check(x, 4'b0001) + + // Partially oob at high side + i = 3; + x = 'h0; + x[i+:2] = 2'b01; + `check(x, 4'b1000) + + // Fully oob at low side + i = -2; + x = 'h0; + x[i+:2] = 2'b11; + `check(x, 4'b0000) + + // Fully oob at high side + i = 5; + x = 'h0; + x[i+:2] = 2'b11; + `check(x, 4'b0000) + + // Undefined index + i = 'hx; + x = 'h0; + x[i+:2] = 2'b11; + `check(x, 4'b0000) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec2_nb.v b/ivtest/ivltests/pv_wr_vec2_nb.v new file mode 100644 index 000000000..a457551a6 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec2_nb.v @@ -0,0 +1,112 @@ +// Check that non-blocking partial writes to a 2-state vector are correctly +// handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + bit [3:0] x; + integer i; + + initial begin + // Immediate index + + // Within bounds + x = 'h0; + x[2:1] <= 2'b10; + #1 + `check(x, 4'b0100) + + // Partially oob at high and low side + x = 'h0; + x[4:-1] <= 6'b101010; + #1 + `check(x, 4'b0101) + + // Partially oob at low side + x = 'h0; + x[0:-1] <= 2'b10; + #1 + `check(x, 4'b0001) + + // Partially oob at high side + x = 'h0; + x[4:3] <= 2'b01; + #1 + `check(x, 4'b1000) + + // Fully oob at low side + x = 'h0; + x[-1:-2] <= 2'b11; + #1 + `check(x, 4'b0000) + + // Fully oob at high side + x = 'h0; + x[6:5] <= 2'b11; + #1 + `check(x, 4'b0000) + + // Variable index + + // Within bounds + i = 1; + x = 'h0; + x[i+:2] <= 2'b10; + #1 + `check(x, 4'b0100) + + // Partially oob at high and low side + i = -1; + x = 'h0; + x[i+:6] <= 6'b101010; + #1 + `check(x, 4'b0101) + + // Partially oob at low side + i = -1; + x = 'h0; + x[i+:2] <= 2'b10; + #1 + `check(x, 4'b0001) + + // Partially oob at high side + i = 3; + x = 'h0; + x[i+:2] <= 2'b01; + #1 + `check(x, 4'b1000) + + // Fully oob at low side + i = -2; + x = 'h0; + x[i+:2] <= 2'b11; + #1 + `check(x, 4'b0000) + + // Fully oob at high side + i = 5; + x = 'h0; + x[i+:2] <= 2'b11; + #1 + `check(x, 4'b0000) + + // Undefined index + i = 'hx; + x = 'h0; + x[i+:2] <= 2'b11; + #1 + `check(x, 4'b0000) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec2_nb_ec.v b/ivtest/ivltests/pv_wr_vec2_nb_ec.v new file mode 100644 index 000000000..c81966665 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec2_nb_ec.v @@ -0,0 +1,114 @@ +// Check that non-blocking event controlled partial writes to a 2-state vector +// are correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + bit [3:0] x; + integer i; + + event e; + + initial begin + // Immediate index + + // Within bounds + x = 'h0; + x[2:1] <= @e 2'b10; + -> e; + `check(x, 4'b0100) + + // Partially oob at high and low side + x = 'h0; + x[4:-1] <= @e 6'b101010; + -> e; + `check(x, 4'b0101) + + // Partially oob at low side + x = 'h0; + x[0:-1] <= @e 2'b10; + -> e; + `check(x, 4'b0001) + + // Partially oob at high side + x = 'h0; + x[4:3] <= @e 2'b01; + -> e; + `check(x, 4'b1000) + + // Fully oob at low side + x = 'h0; + x[-1:-2] <= @e 2'b11; + -> e; + `check(x, 4'b0000) + + // Fully oob at high side + x = 'h0; + x[6:5] <= @e 2'b11; + -> e; + `check(x, 4'b0000) + + // Variable index + + // Within bounds + i = 1; + x = 'h0; + x[i+:2] <= @e 2'b10; + -> e; + `check(x, 4'b0100) + + // Partially oob at high and low side + i = -1; + x = 'h0; + x[i+:6] <= @e 6'b101010; + -> e; + `check(x, 4'b0101) + + // Partially oob at low side + i = -1; + x = 'h0; + x[i+:2] <= @e 2'b10; + -> e; + `check(x, 4'b0001) + + // Partially oob at high side + i = 3; + x = 'h0; + x[i+:2] <= @e 2'b01; + -> e; + `check(x, 4'b1000) + + // Fully oob at low side + i = -2; + x = 'h0; + x[i+:2] <= @e 2'b11; + -> e; + `check(x, 4'b0000) + + // Fully oob at high side + i = 5; + x = 'h0; + x[i+:2] <= @e 2'b11; + -> e; + `check(x, 4'b0000) + + // Undefined index + i = 'hx; + x = 'h0; + x[i+:2] <= @e 2'b11; + -> e; + `check(x, 4'b0000) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec2a.v b/ivtest/ivltests/pv_wr_vec2a.v new file mode 100644 index 000000000..d97d21d8d --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec2a.v @@ -0,0 +1,95 @@ +// Check that blocking partial writes to a 2-state vector array element are +// correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + bit [3:0] x[1:0]; + integer i; + + initial begin + // Immediate index + + // Within bounds + x[0] = 'h0; + x[0][2:1] = 2'b10; + `check(x[0], 4'b0100) + + // Partially oob at high and low side + x[0] = 'h0; + x[0][4:-1] = 6'b101010; + `check(x[0], 4'b0101) + // Partially oob at low side + x[0] = 'h0; + x[0][0:-1] = 2'b10; + `check(x[0], 4'b0001) + // Partially oob at high side + x[0] = 'h0; + x[0][4:3] = 2'b01; + `check(x[0], 4'b1000) + // Fully oob at low side + x[0] = 'h0; + x[0][-1:-2] = 2'b11; + `check(x[0], 4'b0000) + // Fully oob at high side + x[0] = 'h0; + x[0][6:5] = 2'b11; + `check(x[0], 4'b0000) + + // Variable index + + // Within bounds + i = 1; + x[0] = 'h0; + x[0][i+:2] = 2'b10; + `check(x[0], 4'b0100) + + // Partially oob at high and low side + i = -1; + x[0] = 'h0; + x[0][i+:6] = 6'b101010; + `check(x[0], 4'b0101) + + // Partially oob at low side + i = -1; + x[0] = 'h0; + x[0][i+:2] = 2'b10; + `check(x[0], 4'b0001) + + // Partially oob at high side + i = 3; + x[0] = 'h0; + x[0][i+:2] = 2'b01; + `check(x[0], 4'b1000) + + // Fully oob at low side + i = -2; + x[0] = 'h0; + x[0][i+:2] = 2'b11; + `check(x[0], 4'b0000) + + // Fully oob at high side + i = 5; + x[0] = 'h0; + x[0][i+:2] = 2'b11; + `check(x[0], 4'b0000) + + // Undefined index + i = 'hx; + x[0] = 'h0; + x[0][i+:2] = 2'b11; + `check(x[0], 4'b0000) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec2a_nb.v b/ivtest/ivltests/pv_wr_vec2a_nb.v new file mode 100644 index 000000000..2093d9bf2 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec2a_nb.v @@ -0,0 +1,112 @@ +// Check that non-blocking partial writes to a 2-state vector array element are +// correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + bit [3:0] x[1:0]; + integer i; + + initial begin + // Immediate index + + // Within bounds + x[0] = 'h0; + x[0][2:1] <= 2'b10; + #1 + `check(x[0], 4'b0100) + + // Partially oob at high and low side + x[0] = 'h0; + x[0][4:-1] <= 6'b101010; + #1 + `check(x[0], 4'b0101) + + // Partially oob at low side + x[0] = 'h0; + x[0][0:-1] <= 2'b10; + #1 + `check(x[0], 4'b0001) + + // Partially oob at high side + x[0] = 'h0; + x[0][4:3] <= 2'b01; + #1 + `check(x[0], 4'b1000) + + // Fully oob at low side + x[0] = 'h0; + x[0][-1:-2] <= 2'b11; + #1 + `check(x[0], 4'b0000) + + // Fully oob at high side + x[0] = 'h0; + x[0][6:5] <= 2'b11; + #1 + `check(x[0], 4'b0000) + + // Variable index + + // Within bounds + i = 1; + x[0] = 'h0; + x[0][i+:2] = 2'b10; + #1 + `check(x[0], 4'b0100) + + // Partially oob at high and low side + i = -1; + x[0] = 'h0; + x[0][i+:6] <= 6'b101010; + #1 + `check(x[0], 4'b0101) + + // Partially oob at low side + i = -1; + x[0] = 'h0; + x[0][i+:2] <= 2'b10; + #1 + `check(x[0], 4'b0001) + + // Partially oob at high side + i = 3; + x[0] = 'h0; + x[0][i+:2] <= 2'b01; + #1 + `check(x[0], 4'b1000) + + // Fully oob at low side + i = -2; + x[0] = 'h0; + x[0][i+:2] <= 2'b11; + #1 + `check(x[0], 4'b0000) + + // Fully oob at high side + i = 5; + x[0] = 'h0; + x[0][i+:2] <= 2'b11; + #1 + `check(x[0], 4'b0000) + + // Undefined index + i = 'hx; + x[0] = 'h0; + x[0][i+:2] <= 2'b11; + #1 + `check(x[0], 4'b0000) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec2a_nb_ec.v b/ivtest/ivltests/pv_wr_vec2a_nb_ec.v new file mode 100644 index 000000000..479dbe5a2 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec2a_nb_ec.v @@ -0,0 +1,114 @@ +// Check that non-blocking event controlled partial writes to a 2-state vector +// array element are correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + bit [3:0] x[1:0]; + integer i; + + event e; + + initial begin + // Immediate index + + // Within bounds + x[0] = 'h0; + x[0][2:1] <= @e 2'b10; + -> e; + `check(x[0], 4'b0100) + + // Partially oob at high and low side + x[0] = 'h0; + x[0][4:-1] <= @e 6'b101010; + -> e; + `check(x[0], 4'b0101) + + // Partially oob at low side + x[0] = 'h0; + x[0][0:-1] <= @e 2'b10; + -> e; + `check(x[0], 4'b0001) + + // Partially oob at high side + x[0] = 'h0; + x[0][4:3] <= @e 2'b01; + -> e; + `check(x[0], 4'b1000) + + // Fully oob at low side + x[0] = 'h0; + x[0][-1:-2] <= @e 2'b11; + -> e; + `check(x[0], 4'b0000) + + // Fully oob at high side + x[0] = 'h0; + x[0][6:5] <= @e 2'b11; + -> e; + `check(x[0], 4'b0000) + + // Variable index + + // Within bounds + i = 1; + x[0] = 'h0; + x[0][i+:2] <= @e 2'b10; + -> e; + `check(x[0], 4'b0100) + + // Partially oob at high and low side + i = -1; + x[0] = 'h0; + x[0][i+:6] <= @e 6'b101010; + -> e; + `check(x[0], 4'b0101) + + // Partially oob at low side + i = -1; + x[0] = 'h0; + x[0][i+:2] <= @e 2'b10; + -> e; + `check(x[0], 4'b0001) + + // Partially oob at high side + i = 3; + x[0] = 'h0; + x[0][i+:2] <= @e 2'b01; + -> e; + `check(x[0], 4'b1000) + + // Fully oob at low side + i = -2; + x[0] = 'h0; + x[0][i+:2] <= @e 2'b11; + -> e; + `check(x[0], 4'b0000) + + // Fully oob at high side + i = 5; + x[0] = 'h0; + x[0][i+:2] <= @e 2'b11; + -> e; + `check(x[0], 4'b0000) + + // Undefined index + i = 'hx; + x[0] = 'h0; + x[0][i+:2] <= @e 2'b11; + -> e; + `check(x[0], 4'b0000) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec4.v b/ivtest/ivltests/pv_wr_vec4.v new file mode 100644 index 000000000..3db3ab043 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec4.v @@ -0,0 +1,99 @@ +// Check that blocking partial writes to a 4-state vector are correctly +// handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + reg [3:0] x; + integer i; + + initial begin + // Immediate index + + // Within bounds + x = 'hx; + x[2:1] = 2'b10; + `check(x, 4'bx10x) + + // Partially oob at high and low side + x = 'hx; + x[4:-1] = 6'b101010; + `check(x, 4'b0101) + + // Partially oob at low side + x = 'hx; + x[0:-1] = 2'b10; + `check(x, 4'bxxx1) + + // Partially oob at high side + x = 'hx; + x[4:3] = 2'b01; + `check(x, 4'b1xxx) + + // Fully oob at low side + x = 'hx; + x[-1:-2] = 2'b11; + `check(x, 4'bxxxx) + + // Fully oob at high side + x = 'hx; + x[6:5] = 2'b11; + `check(x, 4'bxxxx) + + // Variable index + + // Within bounds + i = 1; + x = 'hx; + x[i+:2] = 2'b10; + `check(x, 4'bx10x) + + // Partially oob at high and low side + i = -1; + x = 'hx; + x[i+:6] = 6'b101010; + `check(x, 4'b0101) + + // Partially oob at low side + i = -1; + x = 'hx; + x[i+:2] = 2'b10; + `check(x, 4'bxxx1) + + // Partially oob at high side + i = 3; + x = 'hx; + x[i+:2] = 2'b01; + `check(x, 4'b1xxx) + + // Fully oob at low side + i = -2; + x = 'hx; + x[i+:2] = 2'b11; + `check(x, 4'bxxxx) + + // Fully oob at high side + i = 5; + x = 'hx; + x[i+:2] = 2'b11; + `check(x, 4'bxxxx) + + // Undefined index + i = 'hx; + x = 'hx; + x[i+:2] = 2'b11; + `check(x, 4'bxxxx) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec4_nb.v b/ivtest/ivltests/pv_wr_vec4_nb.v new file mode 100644 index 000000000..2d8149b0d --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec4_nb.v @@ -0,0 +1,111 @@ +// Check that non-blocking partial writes to a 4-state vector are correctly +// handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + reg [3:0] x; + integer i; + + initial begin + // Immediate index + + // Within bounds + x = 'hx; + x[2:1] <= 2'b10; + #1 + `check(x, 4'bx10x) + + // Partially oob at high and low side + x = 'hx; + x[4:-1] <= 6'b101010; + #1 + `check(x, 4'b0101) + + // Partially oob at low side + x = 'hx; + x[0:-1] <= 2'b10; + #1 + `check(x, 4'bxxx1) + + // Partially oob at high side + x = 'hx; + x[4:3] <= 2'b01; + #1 + `check(x, 4'b1xxx) + + // Fully oob at low side + x = 'hx; + x[-1:-2] <= 2'b11; + #1 + `check(x, 4'bxxxx) + + // Fully oob at high side + x = 'hx; + x[6:5] <= 2'b11; + #1 + `check(x, 4'bxxxx) + + // Variable index + + // Within bounds + i = 1; + x = 'hx; + x[i+:2] = 2'b10; + `check(x, 4'bx10x) + + // Partially oob at high and low side + i = -1; + x = 'hx; + x[i+:6] <= 6'b101010; + #1 + `check(x, 4'b0101) + + // Partially oob at low side + i = -1; + x = 'hx; + x[i+:2] <= 2'b10; + #1 + `check(x, 4'bxxx1) + + // Partially oob at high side + i = 3; + x = 'hx; + x[i+:2] <= 2'b01; + #1 + `check(x, 4'b1xxx) + + // Fully oob at low side + i = -2; + x = 'hx; + x[i+:2] <= 2'b11; + #1 + `check(x, 4'bxxxx) + + // Fully oob at high side + i = 5; + x = 'hx; + x[i+:2] <= 2'b11; + #1 + `check(x, 4'bxxxx) + + // Undefined index + i = 'hx; + x = 'hx; + x[i+:2] <= 2'b11; + #1 + `check(x, 4'bxxxx) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec4_nb_ec.v b/ivtest/ivltests/pv_wr_vec4_nb_ec.v new file mode 100644 index 000000000..b89029871 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec4_nb_ec.v @@ -0,0 +1,114 @@ +// Check that non-blocking event controlled partial writes to a 4-state vector +// are correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + reg [3:0] x; + integer i; + + event e; + + initial begin + // Immediate index + + // Within bounds + x = 'hx; + x[2:1] <= @e 2'b10; + -> e; + `check(x, 4'bx10x) + + // Partially oob at high and low side + x = 'hx; + x[4:-1] <= @e 6'b101010; + -> e; + `check(x, 4'b0101) + + // Partially oob at low side + x = 'hx; + x[0:-1] <= @e 2'b10; + -> e; + `check(x, 4'bxxx1) + + // Partially oob at high side + x = 'hx; + x[4:3] <= @e 2'b01; + -> e; + `check(x, 4'b1xxx) + + // Fully oob at low side + x = 'hx; + x[-1:-2] <= @e 2'b11; + -> e; + `check(x, 4'bxxxx) + + // Fully oob at high side + x = 'hx; + x[6:5] <= @e 2'b11; + -> e; + `check(x, 4'bxxxx) + + // Variable index + + // Within bounds + i = 1; + x = 'hx; + x[i+:2] <= @e 2'b10; + -> e; + `check(x, 4'bx10x) + + // Partially oob at high and low side + i = -1; + x = 'hx; + x[i+:6] <= @e 6'b101010; + -> e; + `check(x, 4'b0101) + + // Partially oob at low side + i = -1; + x = 'hx; + x[i+:2] <= @e 2'b10; + -> e; + `check(x, 4'bxxx1) + + // Partially oob at high side + i = 3; + x = 'hx; + x[i+:2] <= @e 2'b01; + -> e; + `check(x, 4'b1xxx) + + // Fully oob at low side + i = -2; + x = 'hx; + x[i+:2] <= @e 2'b11; + -> e; + `check(x, 4'bxxxx) + + // Fully oob at high side + i = 5; + x = 'hx; + x[i+:2] <= @e 2'b11; + -> e; + `check(x, 4'bxxxx) + + // Undefined index + i = 'hx; + x = 'hx; + x[i+:2] <= @e 2'b11; + -> e; + `check(x, 4'bxxxx) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec4a.v b/ivtest/ivltests/pv_wr_vec4a.v new file mode 100644 index 000000000..a4765c17c --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec4a.v @@ -0,0 +1,99 @@ +// Check that blocking partial writes to a 4-state vector array element are +// correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + reg [3:0] x[1:0]; + integer i; + + initial begin + // Immediate index + + // Within bounds + x[0] = 'hx; + x[0][2:1] = 2'b10; + `check(x[0], 4'bx10x) + + // Partially oob at high and low side + x[0] = 'hx; + x[0][4:-1] = 6'b101010; + `check(x[0], 4'b0101) + + // Partially oob at low side + x[0] = 'hx; + x[0][0:-1] = 2'b10; + `check(x[0], 4'bxxx1) + + // Partially oob at high side + x[0] = 'hx; + x[0][4:3] = 2'b01; + `check(x[0], 4'b1xxx) + + // Fully oob at low side + x[0] = 'hx; + x[0][-1:-2] = 2'b11; + `check(x[0], 4'bxxxx) + + // Fully oob at high side + x[0] = 'hx; + x[0][6:5] = 2'b11; + `check(x[0], 4'bxxxx) + + // Variable index + + // Within bounds + i = 1; + x[0] = 'hx; + x[0][i+:2] = 2'b10; + `check(x[0], 4'bx10x) + + // Partially oob at high and low side + i = -1; + x[0] = 'hx; + x[0][i+:6] = 6'b101010; + `check(x[0], 4'b0101) + + // Partially oob at low side + i = -1; + x[0] = 'hx; + x[0][i+:2] = 2'b10; + `check(x[0], 4'bxxx1) + + // Partially oob at high side + i = 3; + x[0] = 'hx; + x[0][i+:2] = 2'b01; + `check(x[0], 4'b1xxx) + + // Fully oob at low side + i = -2; + x[0] = 'hx; + x[0][i+:2] = 2'b11; + `check(x[0], 4'bxxxx) + + // Fully oob at high side + i = 5; + x[0] = 'hx; + x[0][i+:2] = 2'b11; + `check(x[0], 4'bxxxx) + + // Undefined index + i = 'hx; + x[0] = 'hx; + x[0][i+:2] = 2'b11; + `check(x[0], 4'bxxxx) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec4a_nb.v b/ivtest/ivltests/pv_wr_vec4a_nb.v new file mode 100644 index 000000000..926991c92 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec4a_nb.v @@ -0,0 +1,112 @@ +// Check that non-blocking partial writes to a 4-state vector array element are +// correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + reg [3:0] x[1:0]; + integer i; + + initial begin + // Immediate index + + // Within bounds + x[0] = 'hx; + x[0][2:1] <= 2'b10; + #1 + `check(x[0], 4'bx10x) + + // Partially oob at high and low side + x[0] = 'hx; + x[0][4:-1] <= 6'b101010; + #1 + `check(x[0], 4'b0101) + + // Partially oob at low side + x[0] = 'hx; + x[0][0:-1] <= 2'b10; + #1 + `check(x[0], 4'bxxx1) + + // Partially oob at high side + x[0] = 'hx; + x[0][4:3] <= 2'b01; + #1 + `check(x[0], 4'b1xxx) + + // Fully oob at low side + x[0] = 'hx; + x[0][-1:-2] <= 2'b11; + #1 + `check(x[0], 4'bxxxx) + + // Fully oob at high side + x[0] = 'hx; + x[0][6:5] <= 2'b11; + #1 + `check(x[0], 4'bxxxx) + + // Variable index + + // Within bounds + i = 1; + x[0] = 'hx; + x[0][i+:2] <= 2'b10; + #1 + `check(x[0], 4'bx10x) + + // Partially oob at high and low side + i = -1; + x[0] = 'hx; + x[0][i+:6] <= 6'b101010; + #1 + `check(x[0], 4'b0101) + + // Partially oob at low side + i = -1; + x[0] = 'hx; + x[0][i+:2] <= 2'b10; + #1 + `check(x[0], 4'bxxx1) + + // Partially oob at high side + i = 3; + x[0] = 'hx; + x[0][i+:2] <= 2'b01; + #1 + `check(x[0], 4'b1xxx) + + // Fully oob at low side + i = -2; + x[0] = 'hx; + x[0][i+:2] <= 2'b11; + #1 + `check(x[0], 4'bxxxx) + + // Fully oob at high side + i = 5; + x[0] = 'hx; + x[0][i+:2] <= 2'b11; + #1 + `check(x[0], 4'bxxxx) + + // Undefined index + i = 5; + x[0] = 'hx; + x[0][i+:2] <= 2'b11; + #1 + `check(x[0], 4'bxxxx) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/ivltests/pv_wr_vec4a_nb_ec.v b/ivtest/ivltests/pv_wr_vec4a_nb_ec.v new file mode 100644 index 000000000..c2c08c024 --- /dev/null +++ b/ivtest/ivltests/pv_wr_vec4a_nb_ec.v @@ -0,0 +1,114 @@ +// Check that non-blocking event controlled partial writes to a 4-state vector +// array element are correctly handlded. + +module test; + + reg failed = 1'b0; + + `define check(val, exp) \ + if (exp !== val) begin \ + $display("FAILED. Got %b, expected %b.", val, exp); \ + failed = 1'b1; \ + end + + reg [3:0] x[1:0]; + integer i; + + event e; + + initial begin + // Immediate index + + // Within bounds + x[0] = 'hx; + x[0][2:1] <= @e 2'b10; + -> e; + `check(x[0], 4'bx10x) + + // Partially oob at high and low side + x[0] = 'hx; + x[0][4:-1] <= @e 6'b101010; + -> e; + `check(x[0], 4'b0101) + + // Partially oob at low side + x[0] = 'hx; + x[0][0:-1] <= @e 2'b10; + -> e; + `check(x[0], 4'bxxx1) + + // Partially oob at high side + x[0] = 'hx; + x[0][4:3] <= @e 2'b01; + -> e; + `check(x[0], 4'b1xxx) + + // Fully oob at low side + x[0] = 'hx; + x[0][-1:-2] <= @e 2'b11; + -> e; + `check(x[0], 4'bxxxx) + + // Fully oob at high side + x[0] = 'hx; + x[0][6:5] <= @e 2'b11; + -> e; + `check(x[0], 4'bxxxx) + + // Variable index + + // Within bounds + i = 1; + x[0] = 'hx; + x[0][i+:2] <= @e 2'b10; + -> e; + `check(x[0], 4'bx10x) + + // Partially oob at high and low side + i = -1; + x[0] = 'hx; + x[0][i+:6] <= @e 6'b101010; + -> e; + `check(x[0], 4'b0101) + + // Partially oob at low side + i = -1; + x[0] = 'hx; + x[0][i+:2] <= @e 2'b10; + -> e; + `check(x[0], 4'bxxx1) + + // Partially oob at high side + i = 3; + x[0] = 'hx; + x[0][i+:2] <= @e 2'b01; + -> e; + `check(x[0], 4'b1xxx) + + // Fully oob at low side + i = -2; + x[0] = 'hx; + x[0][i+:2] <= @e 2'b11; + -> e; + `check(x[0], 4'bxxxx) + + // Fully oob at high side + i = 5; + x[0] = 'hx; + x[0][i+:2] <= @e 2'b11; + -> e; + `check(x[0], 4'bxxxx) + + // Undefined index + i = 'hx; + x[0] = 'hx; + x[0][i+:2] <= @e 2'b11; + -> e; + `check(x[0], 4'bxxxx) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index 1c26458d5..a605f9843 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -415,6 +415,12 @@ program5a CE,-g2009 ivltests program5b CE,-g2009 ivltests program_hello normal,-g2009 ivltests program_hello2 CE,-g2009 ivltests +pv_wr_vec2 normal,-g2005-sv ivltests +pv_wr_vec2_nb normal,-g2005-sv ivltests +pv_wr_vec2_nb_ec normal,-g2005-sv ivltests +pv_wr_vec2a normal,-g2005-sv ivltests +pv_wr_vec2a_nb normal,-g2005-sv ivltests +pv_wr_vec2a_nb_ec normal,-g2005-sv ivltests recursive_func2 normal,-g2005-sv ivltests gold=recursive_func.gold recursive_func_const2 normal,-g2005-sv ivltests gold=recursive_func_const.gold sbyte_test normal,-g2005-sv ivltests diff --git a/ivtest/regress-vlg.list b/ivtest/regress-vlg.list index 5300f4d2b..b42886e66 100644 --- a/ivtest/regress-vlg.list +++ b/ivtest/regress-vlg.list @@ -1435,6 +1435,12 @@ pullupdown normal ivltests # Contributed test pullupdown2 normal ivltests # Contributed test pullupdown3 normal ivltests # Contributed test pv_undef_sig_sel normal ivltests +pv_wr_vec4 normal ivltests +pv_wr_vec4_nb normal ivltests +pv_wr_vec4_nb_ec normal ivltests +pv_wr_vec4a normal ivltests +pv_wr_vec4a_nb normal ivltests +pv_wr_vec4a_nb_ec normal ivltests qmark normal ivltests qmark1 normal ivltests qmark3 normal ivltests