Simulating 4-bit LFSR.
1. Select Simulate Start Simulation. Click ‘Library’ menu from the main window, followed by plus (+) sign next to the work library. You should see the name that you have just compiled in Fig. 7
2. In work library, select lfsr_tb and click ‘Ok’ (Fig. 8). This opens sim-Default window as shown in Fig. 9
3. Go to Add To Wave All items in region
4. Monitor the LFSR for simulation purpose. The test bench is used to verify the LFSR for 4-bit mode. Now you are ready to simulate your design by clicking ‘Run’ from ‘Simulate’ menu bar as shown in Fig. 9. You can view the output on ‘Wave’ window as shown in Fig. 10.
Download source code
Feedback around an LFSR’s shift register comes from a selection of points (taps) in the register chain and constitutes XORing these taps to provide tap(s) back into the register. Register bits that do not need an input tap operate as a standard shift register. It is this feedback that causes the register to loop through repetitive sequences of a pseudo-random value. The choice of taps determines the number of values in a given sequence before the sequence repeats. The implemented LFSR uses a one-to-many structure, rather than a many-to-one structure, as this structure always has the shortest clock-to-clock delay path.