
Multiply-accumulate unit (MAC)
UM0404
84/564
DocID13284 Rev 2
4.2.1 Instruction
pipelining
All MAC instructions use the 4-stage pipeline. During each stage the following tasks are
performed:
•
FETCH: All new instructions are double-word instructions.
•
DECODE: If required, operand addresses are calculated and the resulting operands
are fetched. IDX and GPR pointers are post-modified if necessary.
•
EXECUTE: Performs the MAC operation. At the end of the cycle, the Accumulator and
the MAC condition flags are updated if required. Modified GPR pointers are written-
back during this stage, if required.
•
WRITEBACK: Operand write-back in the case of parallel data move.
4.2.2
Particular pipeline effects with the MAC unit
Because the registers used by the MAC are shared with the standard ALU and because of
the MAC instructions pipelining, some care must be taken when switching from the
‘standard instruction set’ to the ‘MAC instruction set’.
Initialization of the pointers and offset registers
The new MAC instructions which use IDX
i
pointers is mostly not capable of using a new IDXi
register value, which is to be updated by an immediately preceding instruction. Thus, to
make sure that the new IDX
i
register value is used, at least one instruction must be inserted
between a IDX
i
-changing instruction and one MAC instruction which explicitly uses IDX
i
in
its addressing mode as shown in the following example:
Same requirements between the update of one of the offset reg. QX
i
& QR
i
and their next
use.
Read Access to MAC registers (CoReg)
At least one instruction which does not use the MAC must be inserted between a MAC
instruction (CoXXX) writing to a MAC register (MAH, MAL, MSW, MRW, MCW) and a
standard instruction reading this register. This is because the accumulator and the status of
the MAC are modified during the execute stage.
Example 1
I
n
:
MOV IDX0,
#0F200h
; update IDX0 register
I
n+1
:
...
; must not be a CoXXX [IDX0
⊗
], [Rw
m
⊗
] instruction
I
n+2
:
CoXXX
[IDX0+QX1], [R2]
; first operand read at (IDX0) address to provide the MAC function
; parallel data move to (((IDX0))-((QX1))) address (if CoXXX is
CoMACM)
; move (R2) content to (IDX0) address (if CoXXX is CoMOV)
; (IDX0) <-- (IDX0) + (QX1) post modification of the pointer