Page 97 - Engineering Digital Design
P. 97
68 CHAPTER 2 / NUMBER SYSTEMS, BINARY ARITHMETIC, AND CODES
Table 2.9 Arithmetic codes vs the degree of difficulty of arithmetic operations
Arithmetic Operation Unsigned Numbers S igned-Magnitude Two's Complement
Unsigned addition Easy Easy Easy
Signed — Difficult Easy
addition/subtraction
Unsigned multiplication Fairly difficult Fairly difficult Difficult
Signed multiplication — Fairly difficult Difficult
Unsigned division Difficult Difficult Very difficult
addition/subtraction of signed numbers involves relatively simple arithmetic manipulations
of the operands compared to multiplication; and division requires more decision-making
steps than multiplication. Also not shown in Table 2.9 are the 1's complement, BCD, and
XS3 number codes, since they are not commonly used in computer numeric operations.
Finally, a direct correspondence is implied between degree of difficulty and the hardware
requirements to carry out a given arithmetic operation.
2.10 OTHER CODES
Most binary codes of value in digital design fall into one or more of the following ten
categories:
Weighted binary codes Unit distance codes
Unweighted binary codes Reflective codes
Biased codes Number codes
Decimal codes Alphanumeric codes
Self-complementing codes Error detecting codes
The previous sections have introduced examples of weighted binary codes, number codes,
biased codes, and decimal codes. Number codes are those such as 2's and 1's complement
that are used in addition/subtraction operations. Now, other codes (excluding alphanumeric
codes) will be briefly discussed so as to provide a foundation for the developments in later
chapters.
2.10.1 The Decimal Codes
Shown in Table 2.10 are seven decimal (10 state) codes that can be classified as either
weighted or unweighted codes. All but one of these codes is weighted as indicated in the
table. A weighted code can be converted to its decimal equivalent by using positional weights
in a polynomial series as was done for the BCD code (1) discussed in Subsection 2.4.1.
Code (2), the XS3 code, is a biased-weighted code considered in Subsection 2.4.1 and in
Section 2.7. An unweighted code, such as code (7), cannot be converted to its decimal
equivalent by any mathematical weighting procedure.
Not all weighted decimal codes are natural in the sense that their code weights cannot
be derived from positive powers of 2 as is done for codes (1) and (2). Codes (3) through (6)
in Table 2.10 are of this type. Code weights such as —1, —2, 5, and 6 cannot be generated