To move the 16-bit data into the 40-bit accumulator we first move the 16-bit value into the high byte, then backfill the low byte with 0's. Lastly, extend the sign bit (ACCxH<15>) into the upper byte. This maintains the sign bit, and the implicit radix point for fractional numbers that resides between bits 31 and 30 (1.15 format).
The Zero Backfill and Sign Extension logic is used to interface the X Data Bus and the output of the multiplier to the 40-bit Accumulators, ACCA and ACCB. Each accumulator consists of three (3) adjacent registers: Accumulator Upper, which is the upper byte, bits 39 through 32, Accumulator High, which is the middle word, bits 31 through 16, and Accumulator Low, which is the lower word, bits 15 through 0. The implicit radix point for fractional numbers is set between bits 31 and 30. When an accumulator is loaded using the Load Accumulator, or LAC, instruction, Accumulator Lower will be set to zero from the zero backfill logic, and all bits in Accumulator Upper will take the value of accumulator bit 31 from the sign extension logic. For DSP multiply instructions, the 33-bit result of the Scaler serves as the input to the Sign Extend logic, which will sign extend the result to 40 bits.
Examples
These 2 examples demonstrate how the Zero Backfill and Sign Extension logic operates. The effects of the Zero Backfill logic are shown in green, and the effects of the Sign Extension logic are shown in red.
LAC W1,A; load ACCA with w1
- If W1 = 0xFFF7, ACCA = OxFFFFF70000
- W1<15> = 1, so ACCU = 0xFF, the extended sign bit
- ACCAL is cleared - i.e. backfilled with zeros
In the first example, the contents of W1 are loaded into Accumulator A. Since W1 is negative (as bit 15 is 1), the Sign Extension logic sets Accumulator A Upper ACCAU to 0xFF. The Zero Backfill logic sets Accumulator A Lower ACCAL to zero for all LAC instructions.
LAC W2,B; load ACCB with w2
- If W2 = 0x7FF7, ACCB = 0x007FF70000
- W2<15> = 0, so ACCBU = 0x00, the extended sign bit
- ACCBL is cleared – i.e. backfilled with zeros
In the second example, the contents of W2 are loaded into Accumulator B ACCB. Since W2 is positive (as bit 15 is 0), the Sign Extension logic sets Accumulator A Upper ACCAU to zero. The Zero Backfill logic sets Accumulator A Lower ACCAL to zero for all LAC instructions.