src/main/resources/doc/en/html/libs/soc/socnios2s.html
| Library: | System On Chip components |
| Introduced: | 3.2 |
| Appearance: |
|
The nios2 simulator is a complete ISA-simulator of Intel's nios2 soft core (except for the f-version). It can be used to show the execution of a program on an embedded system. Note that although the simulator executes one instruction per clock cycle, it is not a cycle accurate simulation as aspects like cache-stalls, data-dependency stalls, bus wait cycles, etc. are not taken into account in the simulation. It provides a functional simulation for showing SOC-design where the hardware is not yet available.
On the north side of the Nios2 simulation component you will find the custom-instruction interface signals where you can add your custom-instruction hardware/accelerators to be used in your simulations. Please refer to Intel's documentation on custom instructions with the nios2 on how to use them.
On the west side of the Nios2 simulation components following inputs are present:
The Nios2 simulation component provides following attributes:
The Nios2 simulator has several state components that are visible when the _ State visible _ attribute is set to _ True _. Most of these components can also be visualized in a separate window when the component is hidden in a sub-circuit (see super-component menu below). The different components are:
The register file. The Nios2 processor contains 32 general purpose registers (r0..r31). The current values of these registers are shown on the left-top square marked by _ Register file _. When a register value is shown by a sequence of question marks, it means that the value is unknown (normal start-up behavior of the processor). Each time a value is written to a register it will be highlighted in blue and the new value will be shown.
The program counter. The program counter (PC) hold the current address from which the next instruction will be fetched.
The status register. The status register (status) hold the current state of the Nios2 processor. For information on the status register please refer to Intel's documentation on the nios2 processor.
The exception status register. The exception status register (estatus) holds a copy of the status register when entering an exception. For information on the estatus register please refer to Intel's documentation on the nios2 processor.
The break status register. The break status register (bstatus) holds a copy of the status register when a break instruction is executed. For information on the bstatus register please refer to Intel's documentation on the nios2 processor.
The execution trace window. The execution trace window shows the last 21 instructions executed by the nios2 processor. The last instruction executed is shown on the top. The tace window provides three parts of information, namely:
The program counter value where the instruction was fetched.
The binary opcode of the fetched instruction.
The assembly mnemonic of the fetched instruction in case the fetched instruction has a correct binary opcode.
This component will be updated at each instruction fetch. 7. The IRQ-status, irq-mask, and irq-pending display. In case at least one IRQ-input is selected by the Number of IRQ lines attribute, this component will be shown. For each of the IRQ-pins a square on the top of the component will indicate the current state of the IRQ-line. The square below will indicate the corresponding bit in the IRQ-mask register. Finally the square on the bottom will indicate if an unmasked IRQ is pending. Note: this component does not show the state of the global IRQ-enable bit which is present in the status register. 8. The connected bus indicator. To the bottom left of the component (shown above in red) is the indicator to which bus component the nios2 is connected. In case the nios2 is connected to a bus component, this indicator will turn green and shows the label of the connected bus. This bus indicator is not available in the separate window view and will not be hidden by the State visible attribute. 9. The simulation control component. To the right of the connected bus indicator you can find the simulation control component. This component is described in more details here, and is available as dynamic element.
The Nios2 simulation components provides the soc simulation controller as dynamic component.
Clicking with the right mouse button on the symbol of the Nios2 simulator will pop-up a menu. This menu is extended with three new menu items, namely:
When the Nios2 simulator is located in a sub-circuit, it will add four menu items to the menu of this sub-circuit, namely:
In the above menu items _ <name> _ is the label of the Nios2 simulator (see the _ Label _ attribute above). If no label name is given <name> is given by Nios2@x,y where x and y are the coordinates of the anchor position of the Nios2 Simulator in the sub-circuit.
| Arithmetic and logical instructions |
| and | or | xor | nor | sub | mul |
| div | divu | mulxss | mulxuu | mulxsu | andi |
| ori | xori | andhi | orhi | xorhi | addi |
| subi | muli | nop | mov | movhi | movi |
| movui | movia |
|
| Comparison instructions |
| cmpeq | cmpne | cmpge | cmpgeu | cmplt | cmpltu |
| cmpgt | cmpgtu | cmple | cmpleu | cmpeqi | cmpnei |
| cmpgei | cmpgeui | cmplti | cmpltui | cmpgti | cmpgtui |
| cmplei | cmpleui |
|
| Custom instructions |
| custom |
|
| Data transfer instructions |
| ldw | ldh | ldhu | ldb | ldbu | ldwio |
| ldhio | ldhuio | ldbio | ldbuio | stw | sth |
| stb | stwio | sthio | stbio |
|
| Other control instructions |
| trap | eret | break | bret | rdctl | wrctl |
| flushd | flushda | flushi | initd | initda | initi |
| flushp | sync |
|
| Program control instructions |
| callr | ret | jmp | call | jmpi | br |
| bge | bgeu | blt | bltu | beq | bne |
| bgt | bgtu | ble | bleu |
|
| Shift and rotate instructions |
| rol | ror | sll | sra | srl | roli |
| slli | srai | srli |
|
| Register | Name | Remarks |
| 0 | status | Only RSIE constant at 1 and PIE |
| 1 | estatus |
|
| 2 | bstatus |
|
| 3 | ienable | Number of bits depends on Number of IRQ lines attribute. |
| 4 | ipending | Number of bits depends on Number of IRQ lines attribute. |