Add regression tests for partial writes to vectors
Add regression tests for the following types partial writes for both 2-state and 4-state vectors. * Non-blocking * Blocking * Blocking event control Check that all in-bounds partial writes, partial out-of-bounds and full out-of-bounds all works as expected. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
2346cc8b69
commit
dbd92bd3cd
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue