**4-bit Linear Feedback Shift Register (LFSR):** Explain how an LFSR gene…
**4-bit Linear Feedback Shift Register (LFSR):** Explain how an LFSR generates a Pseudo-Random Binary Sequence (PRBS). For a 4-bit LFSR with polynomial $x^4 + x^3 + 1$, discuss why the all-zeros state is forbidden and write synthesizable Verilog RTL code and its testbench.
Model answer
### 1. Working Principle & Polynomial Feedback An LFSR is a shift register whose input bit is a linear function (XOR) of selected internal tap positions. With primitive polynomial $x^4 + x^3 + 1$, the feedback bit is: feedback = Q_3 \oplus Q_2 **Forbidden State:** If initialized to 4'b0000 , the XOR feedback remains $0 \oplus 0 = 0$ indefinitely, trapping the LFSR. Therefore, a non-zero seed (such as 4'b0001 or 4'b1111 ) is mandatory. A maximal-length 4-bit LFSR generates a sequence of length $2^4 - 1 = 15$ states before repeating. ### 2. Verilog RTL Implementation ### 3. Verilog Testbench