ykishore
Member level 3
I am trying to synthesize the following code
It keeps giving me an error in line if(data[i+3:i]==4'b0000) begin
saying 'i' is not a constant.
But when I compare just one bit with
if(data==0)
it synthesizes successfully.
Why is this?
I am just curious why is that comparing for a single bit with i as index is not a problem while I do it for multiple bits i+3:i, its not synthesizable?
or is there anything wrong in the code?
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 integer i; always @(posedge clk) begin for (i=0; i<61; i = i+1) begin if(data[i+3:i]==4'b0000) begin occurrences[i]=1'b1; end else occurrences[i]=0; end end
It keeps giving me an error in line if(data[i+3:i]==4'b0000) begin
saying 'i' is not a constant.
But when I compare just one bit with
if(data==0)
it synthesizes successfully.
Why is this?
I am just curious why is that comparing for a single bit with i as index is not a problem while I do it for multiple bits i+3:i, its not synthesizable?
or is there anything wrong in the code?
Last edited by a moderator: