Overview

Condition Code Flags

Some instructions modify the condition code flags. These flags are the four least significant bits of the status register as shown in Table 7.

Table 7. Condition Code Flags

N

Sign of result, or most significant bit

VArithmetic overflow—set if bit 31 of 32-bit result is different from sign of result computed with unlimited precision.

 

 

 

 

 

Z

 

Result is 0

 

 

 

 

 

 

 

 

 

 

 

 

 

C

 

Carry-out of addition, borrow-out of subtraction

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ISTATUS (%ctl1)

 

 

 

 

 

 

 

 

 

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ISTATUS is the saved copy of the STATUS register. When an exception is processed, the value of the STATUS register is copied into the ISTATUS register. This action allows the pre-exception value of the STATUS register to be restored before control returns to the interrupted program. See “Exceptions” on page 16 for more information. A return-from-trap (TRET) instruction automatically copies the ISTATUS register into the STATUS register. Interrupts are disabled (IE=0) when an exception is processed. Before re-enabling interrupts, an exception handler must preserve the value of the ISTATUS register. When the CPU is reset, ISTATUS is set to 0.

WVALID (%ctl2)

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

HI_LIMIT

 

 

 

 

LO_LIMIT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WVALID contains two values, HI_LIMIT and LOW_LIMIT. When a SAVE instruction decrements CWP from LOW_LIMIT to LOW_LIMIT –1 a register window underflow (exception #1) is generated. When a RESTORE instruction increments CWP from HI_LIMIT to HI_LIMIT +1, a register window overflow (exception #2) is generated. WVALID is configurable and may be read-only or read/write. When the CPU is reset, LO_LIMIT is set to 1 and HI_LIMIT is set to the highest valid window pointer ((register file size / 16) – 2).

6

Altera Corporation

Page 18
Image 18
Excalibur electronic A-MNL-NIOSPROG-01.1 manual Condition Code Flags