3.3.12.3.1 Accumulator Status Bits

Six STATUS Register bits that support saturation and overflow are located in the CPU STATUS Register (SR) and are listed in Table 3-6.

Table 3-6. Accumulator Overflow and Saturation Status Bits

Status Bit (SR Location)

Description

OA ([15])

Accumulator A overflowed into guard bits (ACCA[71:63]).

OB ([14])

Accumulator B overflowed into guard bits (ACCB[71:63]).

SA ([13])

ACCA saturated (bit 63 overflow and saturation) or

ACCA overflowed into guard bits and saturated (bit 71 overflow and saturation).

SB ([12])

ACCB saturated (bit 63 overflow and saturation) or

ACCB overflowed into guard bits and saturated (bit 71 overflow and saturation).

OAB ([11])

OA logically ORed with OB, clearing OAB clears both OA and OB.

SAB ([10])

SA logically ORed with SB, clearing SAB clears both SA and SB.

The OA and OB bits are modified each time data passes through the accumulator add/subtract logic. When set, they indicate that the most recent operation has overflowed into the accumulator guard bits (ACCx[71:64]). This type of overflow is not catastrophic; the guard bits preserve the accumulator data. The OAB Status bit is the logically OR value of OA and OB.

The OA and OB bits, when set, can optionally generate an arithmetic error trap. The trap is enabled by setting the corresponding Overflow Trap Flag Enable bit (OVATE or OVBTE) in Interrupt Control Register 4 (INTCON4[10:9]) in the interrupt controller. The trap event allows the user to take immediate corrective action, if desired.

The SA and SB bits can be set each time data passes through the accumulator saturation logic. Once set, these bits remain set until cleared by the user application. The SAB Status bit indicates the logical OR value of SA and SB. When set, these bits indicate that the accumulator has overflowed its maximum range (bit 63 for 64-bit saturation or bit 71 for 72-bit saturation) and are saturated (if saturation is enabled).

When saturation is not enabled, the SA and SB bits indicate that a catastrophic overflow has occurred (the sign of the accumulator has been destroyed). If the Catastrophic Overflow Trap Enable (COVTE) bit (INTCON4[8]) is set, SA and SB bits will generate an arithmetic error trap when saturation is disabled. The SA and SB bits can be set in software, enabling efficient context state switching.