02.10.2019 Views

UploadFile_6417

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

258 Chapter 6 IMPLEMENTATION OF DISCRETE-TIME FILTERS<br />

Since the sign bits were the same, an overflow is generated and the result is<br />

invalid.<br />

4. 40 + 20 − 30<br />

This is an example of more than one addition or subtraction. Since the final<br />

result is well within the range, the overflow can be ignored—that is,<br />

which is a correct result.<br />

5. −40 − 20 + 30<br />

In this case, we have<br />

40 + 20 + (100 − 30) = 40 + 20 + 70 = 130 ≡ 30<br />

(100 − 40) + (100 − 20) + 30 = 60 + 80 + 30 = 170 ≡−30<br />

in the sign-magnitude format, which is, again, a correct result.<br />

□<br />

MATLAB Implementation Using (6.34), one can develop the<br />

MATLAB function, TensComplement, which obtains ten’s-complement<br />

format representation. It is similar to the TwosComplement function and<br />

is explored in Problem P6.25.<br />

Advantages of two’s-complement format Using the results of the<br />

Example 6.13, we now state the benefits of the two’s-complement format.<br />

These also hold (with obvious modifications) for the ten’s-complement<br />

format.<br />

1. It provides for all 2 B+1 distinct representations for a B-bit fractional<br />

representation. There is only one representation for zero.<br />

2. This complement is compatible with our notion of negation: the complement<br />

of a complement is the number itself.<br />

3. It unifies the subtraction and addition operations (subtractions are<br />

essentially additions).<br />

4. In a sum of more than two numbers, the internal overflows do not affect<br />

the final result so long as the result is within the range (i.e., adding<br />

two positive numbers gives a positive result, and adding two negative<br />

numbers gives a negative result).<br />

Hence in most A/D converters and processors, negative numbers are represented<br />

using two’s-complement format. Almost all current processors<br />

implement signed arithmetic using this format and provide special functions<br />

(e.g., an overflow flag) to support it.<br />

Excess-2 B−1 format This format is used in describing the exponent<br />

of floating-point arithmetic; hence it is briefly discussed here. In excess-<br />

2 B−1 signed format (also known as a biased format), all positive and<br />

Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).<br />

Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

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

Saved successfully!

Ooh no, something went wrong!