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–1
October 2007
3. Programming Model
Introduction
This chapter describes the Nios
®
II programming model, covering
processor features at the assembly language level. Fully understanding
the contents of this chapter requires prior knowledge of computer
architecture, exception handling, and instruction sets. This chapter
assumes you have a detailed understanding of the aforementioned
concepts and focuses on how these concepts are specifically implemented
in the Nios II processor. Where possible, this chapter uses industry-
standard terminology.
The following features are discussed from the programmer’s perspective:
■ General-purpose registers, page 3–1
■ Control registers, page 3–2
■ Operating modes, page 3–4
■ Exception processing, page 3–5
■ Processor reset state, page 3–6
■ Hardware-assisted debug processing, page 3–7
■ Hardware interrupts, page 3–8
■ Memory and peripheral organization, page 3–14
■ Cache memory, page 3–14
■ Instruction set categories, page 3–15
■ Custom instructions, page 3–21
f High-level software development tools are not discussed here. See the
Nios II Software Developer’s Handbook for information about developing
software.
General-
Purpose
Registers
The Nios II architecture provides thirty-two 32-bit general-purpose
registers, r0 through r31, as shown in Table 3–1. Some registers have
names recognized by the assembler. The zero register (r0) always
returns the value zero, and writing to zero has no effect. The ra register
(r31) holds the return address used by procedure calls and is implicitly
NII51003-7.2.0