Overview

Instruction Set

Register

Overview

The Nios CPU ships with the GNUPro compiler and debugger from Cygnus, an industry-standard open-source C/C++ compiler, linker and debugger toolkit. The GNUPro toolkit includes a C/C++ compiler, macro- assembler, linker, debugger, binary utilities, and libraries.

The Nios instruction set is tailored to support programs compiled from C and C++. It includes a standard set of arithmetic and logical operations, and instruction support for bit operations, byte extraction, data movement, control flow modification, and conditionally executed instructions, which can be useful in eliminating short conditional branches.

This section describes the organization of the Nios CPU general-purpose registers and control registers. The Nios CPU architecture has a large general-purpose register file, several machine-control registers, a program counter, and the K register used for instruction prefixing.

General-Purpose Registers

The general-purpose registers are 32 bits wide in the 32-bit Nios CPU and 16 bits wide in the 16-bit Nios CPU. The register file size is configurable and contains a total of either 128, 256, or 512 registers. The software can access the registers using a 32-register-long sliding window that moves with a 16-register granularity. This sliding window can traverse the entire register file. This sliding window provides access to a subset of the register file.

The register window is divided into four even sections as shown in Table 5. The lowest eight registers (%r0-%r7) are global registers, also known as %g0-%g7. These global registers do not change with the movement or position of the window, but remain accessible as

(%g0-%g7). The top 24 registers (%r8-%r31) in the register file are accessible through the current window.

Table 5. Register Groups

In registers

%r24-%r31 or %i0-%i7

 

 

Local registers

%r16-%r23 or %L0-%L7

 

 

 

 

Out registers

%r8-%r15

or

%o0-%o7

 

 

 

 

Global registers

%r0-%r7

or

%g0-%g7

 

 

 

 

The top eight registers (%i0-%i7) are known as in registers, the next eight (%L0-%L7) as local registers, and the other eight (%o0-%o7) are known as out registers. When a register window moves down 16-registers (as it does for a SAVE instruction), the out registers become the in registers of the new window position. Also, the local and in registers of the last window position become inaccessible. See Table 6 for more detailed information.

2

Altera Corporation

Page 14
Image 14
Excalibur electronic A-MNL-NIOSPROG-01.1 manual General-Purpose Registers, Register Groups