I'm trying to write an assertion to make sure that only 1-bit of a bus is '1' at any given time (There could be times where all bits are zeros). I used a for loop to write an assertion for the above scenario as follows:
always @(posedge clk) begin
for(int i=0; i<20; i++)begin
automatic int j=i;
check_sel_one_hot : assert property (sel[j] |-> |sel[(j+1) +: 20]);
However, I get the following error when I try running this :
*E : Specified object tb_top.vif.unmblk1.j is a subprogram parameter or (auto) variable.
*E : The above error is for XMMIRROR at File : ./top_if.sv, line : 130
I'm not sure if I'm using the automatic variable wrong. I appreciate if anyone can point out the problem with the above piece of code.
Also, please let me know if there is a simpler way to write this assertion.
Thanks in advance.