22.09.2015 Views

of Microprocessors

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

652 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

2. The range <strong>of</strong> the quotient is equal to the range <strong>of</strong> the dividend divided<br />

by the range <strong>of</strong> the divisor. This means that the number <strong>of</strong> bits in the<br />

integer part <strong>of</strong> the quotient is equal to the number <strong>of</strong> integer bits in the<br />

dividend minus the number <strong>of</strong> integer bits in the divisor.<br />

3. The resolution <strong>of</strong> the quotient is equal to the resolution <strong>of</strong> the dividend<br />

divided by the resolution <strong>of</strong> the divisor. This means that the number <strong>of</strong><br />

fraction bits in the quotient is equal to the number <strong>of</strong> fraction bits in<br />

the dividend minus the number <strong>of</strong> fraction bits in the divisor.<br />

Examination <strong>of</strong> these rules reveals that one just can't win with division.<br />

For example, if both operands have the same word size and both are fractions,<br />

the one used for the dividend must be padded on the right by N zeroes,<br />

where N is the fraction size desired in the quotient. Thus, if the desired<br />

resolution is the same as the operands, the dividend must also be smaller than<br />

the divisor so that the range <strong>of</strong> the result is less than unity. The only way to<br />

cover all possible combinations (except a zero divisor) <strong>of</strong> two N~bit fractional<br />

operands without overflow or loss <strong>of</strong> resolution is to use a dividend 4N bits<br />

long and a divisor 2N bits long. The dividend used in the arithmetic operation<br />

would be the actual N dividend bits padded on the left by N zeroes (or<br />

sign bits if signed) and padded on the right by 2N zeroes. The divisor would<br />

similarly be padded by N zeroes on the right. The 2N quotient bits then<br />

allow N range bits (N-1 for signed operands) and N resolution bits. Fortunately,<br />

when division is needed in signal processing (usually for computing a<br />

scale facror), the values <strong>of</strong> the operands will be known well enough to avoid<br />

trouble.<br />

Required Arithmetic Instructions<br />

Regardless <strong>of</strong> whether hardware instructions are available or an arithmetic<br />

subroutine package is being used, there is a certain "complete set" <strong>of</strong><br />

operations that is needed for straightforward signal-processing computation,<br />

Such a set is usually built around a particular word length. When hardware<br />

instructions are available, this is usually the machine's accumulator word<br />

length. Some <strong>of</strong> the operations produce or process double words, which then<br />

require a pair <strong>of</strong> registers to hold. In fact, classic single-accumulator computers<br />

usually had an accumulator extension or multiplier/quotient register,<br />

which was used to hold the low order half <strong>of</strong> double words.<br />

For illustrating a fixed-point arithmetic package with the 6502, a word<br />

length <strong>of</strong> 8 bits will be used for simplicity, although 16 bits would be more<br />

practical in high-quality synthesis. Since the 6502 has very few registers, two<br />

bytes are set aside in memory for a double-word accumulator. The other<br />

operand if singl,e byte or its address if double byte is passed to the subroutine<br />

in a register, Following is a list <strong>of</strong> the arithmetic operations and the operand<br />

word lengths that would be expected in such a package:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!