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.

650 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

from the right. When shifting right, bits equal to the sign bit must be<br />

brought in. Adding entire bytes to the left <strong>of</strong> a short number so that it can be<br />

added to a long number is essentially equivalent to shifting right so these<br />

bytes must be filled with sign bits. If an unsigned number is to be added to a<br />

signed number, it is usually necessary to provide a high order extension <strong>of</strong><br />

the signed number because <strong>of</strong> the greater range <strong>of</strong> the unsigned number.<br />

Rule 2 simply says that to avoid overflow when unknown numbers are<br />

added up, it is necessary to allow for sums larger than the addends. When a<br />

string <strong>of</strong> equal-length numbers is being added, the word size <strong>of</strong> the final sum<br />

will not exceed 10gzN more bits than the word sizes <strong>of</strong> the addends, where N<br />

is the number <strong>of</strong> numbers added. Ifit is known that the addends do not cover<br />

the full range allowed by their word size, then the word size allowed for the<br />

sum may be less than that given by the rule.<br />

The usable resolution <strong>of</strong> the sum may be less than the resolution given<br />

by Rule 2. If the addend with less resolution is an audio signal or other<br />

"approximate" value, the usable resolution <strong>of</strong> the result cannot be any greater<br />

because <strong>of</strong> quantization noise.<br />

In subtraction, there is a distinction between the operands. When done<br />

on paper, the top number is called the minuend and the number being<br />

subtracted is called the subtrahend. Twos-complement subtraction is generally<br />

accomplished by negating the subtrahend and adding the result to the<br />

minuend. This may be done either by a hardware subtract instruction or by<br />

actually complementing the subtrahend and adding. Since signed operands<br />

were assumed for addition anyway, the properties and rules for subtraction<br />

are the same as for addition.<br />

Often, such as in digital filters, a quantity <strong>of</strong> numbers that partially<br />

cancel each other may be added up. A property <strong>of</strong> twos-complement arithmetic<br />

is that the order <strong>of</strong> addition/subtraction is immaterial. This is true even if<br />

intermediate sums overflow! This is a handy property to keep in mind<br />

because it may allow the word size <strong>of</strong> intermediate results to be the same as<br />

the addends.<br />

Multiplication<br />

The rules <strong>of</strong> binary multiplication are quite different from addition and<br />

subtraction. In particular, there is none governing location <strong>of</strong> the binary<br />

points <strong>of</strong> the operands. Those governing the range and resolution <strong>of</strong> the<br />

result are as follows:<br />

1. The range <strong>of</strong> the result is the product <strong>of</strong> the ranges <strong>of</strong> the operands.<br />

This means that the number <strong>of</strong> magnitude bits in the integer part <strong>of</strong><br />

the product is the sum <strong>of</strong> the number <strong>of</strong> magnitude bits in the integer<br />

parts <strong>of</strong> the operands.<br />

2. The resolution <strong>of</strong> the result is the product <strong>of</strong> the resolutions <strong>of</strong> the

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

Saved successfully!

Ooh no, something went wrong!