I'm trying to build an n_bit adder, but the Quartus gives me this error:
Error (10170): Verilog HDL syntax error at n_bit_adder.sv(12) near text: "for"; expecting "endmodule". Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera.com/support/support-resources/knowledge-base/search.html and search for this specific error message number.
Line 13 is the like where the for is used.
module n_bit_adder #(parameter N = 4)(
input logic [N-1] a,
input logic [N-1] b,
input logic cin,
output logic [N-1] s,
output logic cout
);
logic [N-1:0] carry;
assign carry[0] = cin;
for (i = 0; i < N; i = i + 1) begin
fullAdder f0 (.A(a[i]), .B(b[i]), .Cin(carry[i]), .Cout(carry[i+1]), .S(s[i]));
end
endmodule
module fullAdder
(input logic A,
input logic B,
input logic Cin,
output logic Cout,
output logic S
);
assign S = A ^ B ^ Cin;
assign C = (A & B) | (A & Cin) | (B & Cin);
endmodule