Models of a Linear Feedback Shift Register using ModelSim

Arnav Bansal is an electronics hobbyist who loves to tinker with circuit designs

13435
Advertisement

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

Compilation window
Fig. 7: Compilation window

2. In work library, select lfsr_tb and click ‘Ok’ (Fig. 8). This opens sim-Default window as shown in Fig. 9

Library tab
Fig. 8: Library tab
Add wave to the project
Fig. 9: Add wave to the project

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.

Wave window
Fig. 10: Wave window

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.


 

Advertisement


SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here