Hi
I am writing a SV assertion on signal which is an array and I want to generate an assertion for each bit of signal .
for (genvar i =0; i < SIGNAL_WIDTH; i ++) begin: assert_block_1
property check_P;
@(posedge clk)
signal_a[i] |-> signal_b[i];
endproperty: check_P
check_A: assert property (check_P)
else begin
<fail_statement>
end
end: assert_block_1
This generates number of assertions properly but should we write one property with arguments as parameterisable inputs and then loop only on assert block .
There is no functional difference between the two styles. However, you should always strive to make you code as reusable as possible. Moving the property outside of the generate loop makes it available for you outside that particular loop.
Concurrent assertions go through an elaboration step similar to module instances and ports collapsing. The elaboration process removes properties and sequence containers and expands them. There is no overhead in passing arguments like there would be for a procedural function.
Iâve always believed that concurrent assertions arguments are processed as if they were âstring substitutionâ, given that they cannot be altered by the property/sequence. With that in mind there canât be any performance penalty between the two code implementations.