NiosII Instruction Set Simulator
NiosII Instruction Set Simulator
The Nios II Instruction Set Simulator (ISS) is a program that allows you to simulate the
operation of a Nios II processor, except for the operation of hardware peripherals (such as the
PIO).
One way of working, without generating multiple projects, is to create a blank project and
change the source files to generate variations on the basic project. Just move the old source files
out to another folder and move the new source files in.
The following steps create a blank project based on a current system library.
Select File -- New -- Nios II C/C++ Application to obtain the project dialog box shown below.
Select your nios2lab1 hardware PTF file and Blank Project as the project template. Then press
Next.
On the second page of the wizard, shown below, select the second radio button and then your
existing hello_world_small system library. Then press Finish.
Once your project folders have been created, you can download your source file, e.g. cprog1.c,
into the project folder.
Running a Simulation
Right click on the project name and select Debug As -- Nios II Instruction Set Simulator or
highlight the project name and select Run -- Debug As -- Nios II ISS from the top level menu.
After the debug project make process has completed, you may get the following message:
Let the system change perspective. You can select Window -- Change Perspective -- Nios II
C/C++ to change the perspective back again.
Debug Operations
The debug perspective, shown below, collects a number of views applicable to debugging
operations.
One exploration of these windows, from the screen image above, is shown in the following
sequence.
The Debug window shows that the active thread is suspended at line 9 of cprog1.c, address
0x8094.
The source browser for cprog1.c highlights line 9
The Variables view shows we have already set values for na and nb, and that we changed the
format of nb from decimal to hexadecimal.
The variables in main are defined on the stack, indexed through the frame pointer (fp). They are
listed in the Variables according to their position on the stack:
Address Name
0(fp) na
4(fp) nb
8(fp) nc
12(fp) nd
16(fp) ne
stw r2,0(fp)
stores the contents of register r2 to the stack location corresponding to na.
ldw r3,0(fp)
loads the contents of the stack location corresponding to na into register r3.
Step Into
Step Over
Step Return
Instruction Stepping Mode
The actions are defined for functions - step into a function, over a function, or out of a function.
Usually, going from instruction to instruction, just use Step Into. For serious stepping, use the F5
key shortcut to single step.
The Instruction Stepping Mode toggles between single C statements at a step and single
assembly code instructions at a step.