I have the following LFSR written in verilog:
module LFSR #(parameter SIZE=1) /*Define a parameter for size of output*/
(
input clk,
input reset,
output [SIZE-1:0] q
);
/*feedback taps for the LFSR*/
parameter shift1=1,shift2=2,shift3=2;
reg [15:0] shift; /*Shift register*/
wire xor_sum1,xor_sum2; /*feedback signals*/
/*Feedback logic*/
assign xor_sum1=shift[shift1] ^ shift[shift2];
assign xor_sum2=xor_sum1 ^ shift[shift3];
/*Shift the registers*/
always @ (posedge clk,posedge reset)
if(reset)
shift<=16'b1111111111111111;
else
shift<={xor_sum2,shift[15:1]};
/*Set the output*/
assign q=shift[SIZE-1:0];
endmodule
I try to instantiate it as follows:
/*Instantiate LFSR for the Random_X_Vel variable*/
LFSR
#(.SIZE(2),
.shift1(3),
.shift2(9),
.shift3(1))
LFSR_Random_X_Vel
(
.clk(clk),
.reset(reset),
.q(Random_X_Vel)
);
Not sure what I am doing wrong, It fails to compile in ISE14.7 and in Modelsim 10.2.
What is causing the issue and how can I fix it?
The LFSR only has 1 configurable parameter.
module LFSR #(parameter SIZE=1)
. But you instance tries to set 4.Moving the 'local' parameters into the port list will allow them to be set on the instance;