i have a very simple code, which i'm using as a testbench but when i check its syntax (ISE WebPack 11.1 has an option to check for it) i get an error:
ERROR:HDLCompiler:44 - Line 57: i is not a constant
Code:
integer i;
initial begin
clk = 0;
reset = 1;
#20;
reset = 0;
// enter correct code;
for (i = 9; i >= 0; i = i - 2) begin
btn = correct_code[i:i-1]; // <-- this is line 57
end
end
You assign a range and not an individual bit. Assigning a range requires constant expressions, e.g [1:0] and not 'variables' like [j:j-1]. This is a verilog rule.