on-internet
← Community

Hex value in generate for loop

Stack Overflow ·

I have this code in SystemVerilog where I have to use hex numbers in a for loop. I am trying this syntax: genvar i, j; localparam int i_d = 1; localparam int j_d = 134; generate for (i = 8'h01; i <= MAX1; i = i + INCR) begin add_bit[i_d] = (creg_add == i); i_d = i_d + 1; end for (j = 8'h86; j <= MAX2; j = j + INCR) begin add_bit[j_d] = (creg_add == j); j_d = j_d + 1; end endgenerate But, I am facing this error: Error-[SE] Syntax error Following verilog source has syntax error : "creg.vs", 715: token is '[' add_bit[i_d] = (creg_add == i); ^ How do I fix the error?

Comments

Sign in or sign up to comment and upvote.

No comments yet.