Nios® V Embedded Processor Design Handbook

ID 726952
Date 4/04/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

7.4.6. Running Simulation in the QuestaSim Simulator Using Command Line

You can launch the QuestaSim simulator using command vsim, in the Nios V Command Shell. The msim_setup.tcl script in the package generated creates alias commands for each step. For the list of commands, refer to the following table:
Macros Description
dev_com Compile device library files.
com Compiles the design files in correct order.
elab Elaborates the top-level design.
elab_debug Elaborates the top-level design with the novopt option.
ld Compiles all the design files and elaborates the top-level design.
ld_debug Compiles all the design files and elaborates the top-level design with the vopt option.
Note: The vopt option is to run optimization before elaborating the top-level design in the simulator.
You can run the simulation in the QuestaSim simulator by performing the following steps.
  1. In the transcript window, change your working directory to mentor by using the following command.
    cd <Project directory>/sys_tb/sys_tb/sim/mentor
  2. Copy the memory initialization file generated into the current path (Mentor folder)

    file copy -force <Project directory>/ram.hex ./

  3. Run the msim_setup.tcl by using the following command.
    do msim_setup.tcl
  4. Compiles all the design files and elaborates the top-level design with vopt option by using the following command
    ld_debug
  5. Type run 2ms to start the simulation for 2 milliseconds.

At the end of the simulation, “Hello world, this is the Nios V/m cpu checking in …” message prints in the Transcript window. You can observe the simulation results from the waveform viewer as well. The following figure shows the simulation result.

Figure 93. Simulation Result