Merge pull request #1014 from proppy/add-array-test
ivtest: add array_slice_concat
This commit is contained in:
commit
cec7a6452f
|
|
@ -0,0 +1,36 @@
|
||||||
|
module ArraySliceWithNarrowStart(
|
||||||
|
input wire [159:0] a,
|
||||||
|
input wire start,
|
||||||
|
output wire [95:0] out
|
||||||
|
);
|
||||||
|
wire [31:0] a_unflattened[0:4];
|
||||||
|
assign a_unflattened[0] = a[31:0];
|
||||||
|
assign a_unflattened[1] = a[63:32];
|
||||||
|
assign a_unflattened[2] = a[95:64];
|
||||||
|
assign a_unflattened[3] = a[127:96];
|
||||||
|
assign a_unflattened[4] = a[159:128];
|
||||||
|
wire [31:0] array_slice_6[0:2];
|
||||||
|
assign array_slice_6[0] = a_unflattened[{2'h0, start} > 3'h4 ? 3'h4 : {2'h0, start} + 3'h0];
|
||||||
|
assign array_slice_6[1] = a_unflattened[{2'h0, start} > 3'h3 ? 3'h4 : {2'h0, start} + 3'h1];
|
||||||
|
assign array_slice_6[2] = a_unflattened[{2'h0, start} > 3'h2 ? 3'h4 : {2'h0, start} + 3'h2];
|
||||||
|
assign out = {array_slice_6[2], array_slice_6[1], array_slice_6[0]};
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module top;
|
||||||
|
reg [159:0] a;
|
||||||
|
reg start;
|
||||||
|
wire [95:0] out;
|
||||||
|
|
||||||
|
ArraySliceWithNarrowStart dut(.a(a), .start(start), .out(out));
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
a = {32'h44444444, 32'h33333333, 32'h22222222, 32'h11111111};
|
||||||
|
start = 1;
|
||||||
|
#1;
|
||||||
|
if (out !== 96'h444444443333333322222222) begin
|
||||||
|
$display("FAILED");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
$display("PASSED");
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
@ -7,6 +7,7 @@ always4B vvp_tests/always4B.json
|
||||||
analog1 vvp_tests/analog1.json
|
analog1 vvp_tests/analog1.json
|
||||||
analog2 vvp_tests/analog2.json
|
analog2 vvp_tests/analog2.json
|
||||||
array_packed_write_read vvp_tests/array_packed_write_read.json
|
array_packed_write_read vvp_tests/array_packed_write_read.json
|
||||||
|
array_slice_concat vvp_tests/array_slice_concat.json
|
||||||
automatic_error11 vvp_tests/automatic_error11.json
|
automatic_error11 vvp_tests/automatic_error11.json
|
||||||
automatic_error12 vvp_tests/automatic_error12.json
|
automatic_error12 vvp_tests/automatic_error12.json
|
||||||
automatic_error13 vvp_tests/automatic_error13.json
|
automatic_error13 vvp_tests/automatic_error13.json
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"type" : "normal",
|
||||||
|
"source" : "array_slice_concat.v"
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue