170 likes | 333 Views
ModelSim Tutorial for CSE 535. Michael Attig ( mea1@arl.wustl.edu ). What is it?. ModelSim allows you to simulate VHDL code We will use ModelSim extensively to test and verify our designs. Spending the extra time to simulate your design can saves hours of in-lab testing. .
E N D
ModelSim Tutorial for CSE 535 • Michael Attig (mea1@arl.wustl.edu)
What is it? • ModelSim allows you to simulate VHDL code • We will use ModelSim extensively to test and verify our designs. • Spending the extra time to simulate your design can saves hours of in-lab testing.
Step 1 – Setting up Library Directory • Open a Cygwin Window • Engineering FPGA Tools Cygwin • Enter the ‘sim’ directory • Type ‘vlib work’
Step 2 – Compiling Your Design • Type ‘make compile’ to compile your vhd files
Step 3 – Simulating Your Design • Type ‘vsim testbench’ to Simulate the testbench • The main ModelSim window will appear. • You can type the name of the window you would like to open (i.e. ‘view signals’), or view * for all windows • Alternatively, you can select what to view from the View Menu
Step 4 – Add Signals to Wave Window • Highlight the Snort App Entity in the main window • The signals for this entity will appear in signals window • From the Signals Add Menu, choose Wave Signals in Region – This adds the signals found within this particular entity
Step 5 – Running the Simulation • With an input_IP.DAT file in your sim directory, you can now type ‘run 5000’ • The simulator will now generate the waveforms for the design.
Step 6 – Typical Modifications – Signal Radix • To aid you in simulating, it is sometimes necessary to change the radix of your signals • Right click the signal, highlight radix, and select hexadecimal • You can do this for multiple signals at a time
Typical Modifications – Inserting Dividers • Dividers help you decipher which signals belong to which module. • When you insert signals from many entities into the wave window, dividers can help. • To Insert a Divider, in the Insert menu of the wave window, click on Divider
Typical Modifications – Signal Names • When you have many levels of entities, you don’t always want to see their path • You can just view the signal name • In the Tools Menu, select ‘Window Preferences’ • Change the Display Signal Path to 1 instead of 0 Change to 1
Saving a Wave List • After you’ve set up your waveform list, you can save it so next time you simulate it can be reloaded. • In the File menu, select ‘Save Format’ • This will be saved as a .do file. • To reload this when restarting ModelSim, in the main window, type do <filename>.do