Complete the code to declare a 4-bit register named 'lfsr'.
reg [3:0] [1] ;
The register is named 'lfsr' to hold the shift register bits.
Complete the code to assign the feedback bit as XOR of bits 3 and 2 of the LFSR.
wire feedback = lfsr[3] [1] lfsr[2];
The feedback bit is the XOR (^) of bits 3 and 2.
Fix the error in the always block sensitivity list to trigger on the positive edge of clock.
always @([1]) begin if (reset) lfsr <= 4'b0001; else lfsr <= {lfsr[2:0], feedback}; end
The always block should trigger on the positive edge of the clock signal.
Fill both blanks to complete the LFSR update logic inside the always block.
if (reset) lfsr <= [1]; else lfsr <= [2];
On reset, LFSR is initialized to 0001. Otherwise, it shifts left with feedback bit appended.
Fill all three blanks to create a module named 'lfsr4' with inputs clk, reset and output lfsr_out.
module [1]( input wire [2], input wire reset, output reg [3:0] [3] );
The module is named 'lfsr4'. The clock input is 'clk'. The output register is 'lfsr_out'.