Specifications
Table Of Contents
- Nios II Processor Reference Handbook
- Contents
- Chapter Revision Dates
- About This Handbook
- Section I. Nios II Processor
- 1. Introduction
- 2. Processor Architecture
- 3. Programming Model
- Introduction
- General- Purpose Registers
- Control Registers
- Operating Modes
- Exception Processing
- Memory and Peripheral Access
- Instruction Set Categories
- Referenced Documents
- Document Revision History
- 4. Instantiating the Nios II Processor in SOPC Builder
- Section II. Appendices
- 5. Nios II Core Implementation Details
- Introduction
- Device Family Support
- Nios II/f Core
- Nios II/s Core
- Nios II/e Core
- Referenced Documents
- Document Revision History
- 6. Nios II Processor Revision History
- 7. Application Binary Interface
- 8. Instruction Set Reference
- Introduction
- Word Formats
- Instruction Opcodes
- Assembler Pseudo- instructions
- Assembler Macros
- Instruction Set Reference
- add
- addi
- and
- andhi
- andi
- beq
- bge
- bgeu
- bgt
- bgtu
- ble
- bleu
- blt
- bltu
- bne
- br
- break
- bret
- call
- callr
- cmpeq
- cmpeqi
- cmpge
- cmpgei
- cmpgeu
- cmpgeui
- cmpgt
- cmpgti
- cmpgtu
- cmpgtui
- cmple
- cmplei
- cmpleu
- cmpleui
- cmplt
- cmplti
- cmpltu
- cmpltui
- cmpne
- cmpnei
- custom
- div
- divu
- eret
- flushd
- flushda
- flushi
- flushp
- initd
- initi
- jmp
- jmpi
- ldb / ldbio
- ldbu / ldbuio
- ldh / ldhio
- ldhu / ldhuio
- ldw / ldwio
- mov
- movhi
- movi
- movia
- movui
- mul
- muli
- mulxss
- mulxsu
- mulxuu
- nextpc
- nop
- nor
- or
- orhi
- ori
- rdctl
- ret
- rol
- roli
- ror
- sll
- slli
- sra
- srai
- srl
- srli
- stb / stbio
- sth / sthio
- stw / stwio
- sub
- subi
- sync
- trap
- wrctl
- xor
- xorhi
- xori
- Referenced Documents
- Document Revision History

Altera Corporation 3–5
October 2007 Nios II Processor Reference Handbook
Programming Model
The following sections define the modes and the transitions between
modes.
Normal Mode
In general, system and application code execute in normal mode. The
processor is in normal mode immediately after processor reset.
General-purpose registers bt (r25) and ba (r30) are reserved for
debugging and are not available in normal mode. Programs are not
prevented from storing values in these registers, but if they do, the debug
mode could overwrite the values. The bstatus control register is also
unavailable in normal mode.
Debug Mode
Software debugging tools use debug mode to implement features such as
breakpoints and watchpoints. System code and application code never
execute in debug mode. The processor enters debug mode only after the
break instruction or after the JTAG debug module forces a break via
hardware.
In debug mode all processor functions are available and unrestricted to
the software debugging tool. See “Break Exceptions” on page 3–7 for
further information.
Changing Modes
The processor starts in normal mode after reset. It enters debug mode in
response to a break instruction or as directed by software debugging
tools. Except by executing a break instruction, system code and
application code have no control over when the processor enters debug
mode. The processor always returns to its prior state when exiting from
debug mode. See “Break Exceptions” on page 3–7 for further information.
Exception
Processing
An exception is a transfer of control away from a program’s normal flow
of execution, caused by an event, either internal or external to the
processor, which requires immediate attention. Exception processing is
the act of responding to an exception, and then returning to the pre-
exception execution state.
Each of the Nios II exceptions falls into one of the following categories:
■ Reset exceptions
■ Break exceptions
■ Interrupt exceptions