I have an array of length x. A signals output for a given testbench will be each value in the array in its respective order from 0:x-1.
In my problem in particular, the array is filter coefficients and the testbench is the impulse response. The test needs to be self-checking, which will require a sequence with dynamic length, as the coefficients will change from test to test.
The sequence I would like should look something like this:
always @(posedge clk) begin
assert_sequence : assert property (
(data_out == array_1[0])
|=> (data_out == array_1[1])
|=> (data_out == array_1[2])
|=> (data_out == array_1[3])
|=> (data_out == array_1[4])
|=> (data_out == 0) )
$info("Seen the sequence");
else
$error("Sequence was incorrect");
end
Can this be possible to do dynamically? I've tried a genvar for loop but it throws errors. I've searched the forums and can't find anything that meets my requirement like so.
Possibly something like this could give the right answer?
always @(posedge clk) begin
assert_sequence : assert property (
(data_out == array1[0][0])
for(genvar i = 1; i < 5, i++) begin
|=> (data_out == array1[i])
end
|=> (data_out == 0) )
$info("Seen the sequence");
else
$error("Sequence was incorrect");
end