Overflow Cases; Multiple Value Pushes - Motorola DSP56800 Manual

16-bit digital signal processor
Table of Contents

Advertisement

8.4.5

Overflow Cases

Both integer and fractional division are subject to division overflow. Overflow is the case where the
correct value of the quotient will not fit into the destination available to store it.
For division of fractional numbers, the result must be a 16-bit, signed fractional value greater than or equal
to -1.0 and less than 1.0 - 2
-1.0 ≤ quotient < +1.0 - 2
For the case where the magnitude of the dividend is larger than the magnitude of the divisor, this inequality
will not be true because any result generated will be larger in magnitude than 1.0. Thus, division overflow
occurs with fractional numbers for the case where the absolute value of the divisor is less than or equal to
the absolute value of the dividend:
|divisor| ≤ |dividend|
If this condition can be true when dividing fractional numbers, it must be prevented from occurring by first
scaling the dividend.
For the division of integer numbers, the result must be a 16-bit, signed integer value greater than or equal
-[N-1]
to -2
and less than or equal to [2
≤ quotient ≤ [2
-[N-1]
-2
When integer numbers are being divided, it must be guaranteed that the final result can fit into a signed,
16-bit integer value. Otherwise, to prevent this from occurring, it is first necessary to scale the numerator.
8.5

Multiple Value Pushes

The DSP56800 core currently supports a one-word, one-instruction-cycle POP instruction for removing
information from the stack. The PUSH operation, however, is a two-word, two-instruction-cycle macro,
which expands to the following code. (This instruction macro works quite well when pushing a single
variable.)
; Expansion of the PUSH Instruction Macro
; Emulated in 2 Icyc, 2 Instruction Words
LEA
(SP)+
MOVE
<register>,X:(SP)
However, there is a better technique when it is necessary to push more than one value onto the software
stack. Instead of using consecutive PUSH instruction macros, it is more efficient and saves more
instruction words by expanding out the PUSH operation:
; Faster technique for pushing multiple values onto the stack
; Finishes in 5 Icyc, 5 Instruction Words
LEA
(SP)+
MOVE
X0,X:(SP)+
MOVE
Y0,X:(SP)+
MOVE
R0,X:(SP)+
MOVE
R1,X:(SP)
In this case five instruction cycles and five words are used to push four values onto the software stack. If
the PUSH instruction macro had been used instead, it would have performed the same function in eight
instruction cycles with eight words.
-[N-1]
. In other words, it must satisfy the following:
-[N-1]
[N-1]
-1], where N is equal to 16. In other words:
[N-1]
-1], where N = 16
; Increment the SP (1 Icyc, 1 Word)
; Place value onto the stack
; (1 Icyc, 1 Word)
; Increment SP
; No post-increment SP on last MOVE
Software Techniques
Multiple Value Pushes
8-19

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents