In the code you can see that, I want to instantiate LSFR_counter for 8 times using generate statement. It simulated well, but I want to synthesize for FPGA.
I have problems which are:
1) I found an error when synthesized it.
Line 31: Signal Reg[4] in unit Main is connected to following multiple drivers:
2) Can I use random parameter for #(.n(random))?
module Main( output Reg , input clk , input reset );
parameter N =5 ;
wire [N-1:0] Reg ;
generate
genvar i =0 ;
for (i ; i<8 ; i=i+1 )
begin
LSFR_counter #(.n(5)) F1 ( .Reg (Reg ) , .clk (clk ), .reset(reset) );
end
endgenerate
endmodule
and
module LSFR_counter #(parameter n=6)( output Reg, input clk, input reset);
//parameter n=6; // Change more than n to change LFSR length.
reg [n:1]Reg; //All procedure outputs must be registered
always @(posedge clk or posedge reset)
if
(reset) Reg <=1;
else
Reg <= {Reg[n-1:2], Reg[n]^Reg[1], Reg[n]};
endmodule