Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

6.5.5. Running Simulation in the ModelSim Simulator Using Command Line

After you have launched the Modelsim simulator using command vsim & in the Nios® II Command Shell, you can run the simulation in the modelsim simulator by performing the following steps:

  1. In the transcript window, change your working directory to mentor by using the command cd <qsys_name>/testbench/mentor.
  2. Now, modify the msim_setup.tcl by including the command below into the section copy ROM/RAM files to simulation directory file copy -force<projects>/software/app/mem_init/<qsysname_ram.hex> ./
  3. Run the msim_setup.tcl by using the command do msim_setup.tcl.
  4. Compiles all the design files and elaborates the top-level design with novopt option by using command ld_debug.
  5. Load the wave.do file provided by using the command do <projects>/wave.do.
  6. Type run 2ms to start the simulation for 2 milliseconds

At the end of the simulation, you should see a “Hello from Nios® II!” message in the Transcript window. You can observe the simulation results from the waveform viewer as well. The figure below shows the simulation result. The waveform is zoomed in at a specific simulation time in which the Nios® II processor writes the first H character to the JTAG UART component.

Figure 267. Simulation Results