DLD - Ch.1 Notes PDF
DLD - Ch.1 Notes PDF
DLD - Ch.1 Notes PDF
The coefficients are any of the 10 digits (0, 1, 2, …, 9), and the
subscript value gives the place value and, hence, the power of 10 by
which the coefficient must be multiplied.
with .
The octal number system is a base‐8 system that has eight digits: 0,
1, 2, 3, 4, 5, 6, 7.
Every system with the base of less than 10 borrows the needed r
digits for the coefficients from the decimal system. The letters of the
alphabet are used to supplement the 10 decimal digits when
the base of the number is greater than 10. For example, in the
hexadecimal (base‐16) number system, the first 10 digits are
borrowed from the decimal system. The letters A, B, C, D, E, and F
are used for the digits 10, 11, 12, 13, 14, and 15, respectively. An
example of a hexadecimal number is:
As noted before, the digits in a binary number are called bits. When
a bit is equal to 0, it does not contribute to the sum during the
conversion. Therefore, the conversion from binary to decimal can be
obtained by adding only the numbers with powers of two
corresponding to the bits that are equal to 1. For example,
There are four 1’s in the binary number. The corresponding decimal
number is the sum of the four powers of two. In computer work, is
referred to as K (kilo), as M (mega), as G (giga), and as T
(tera). Thus, and .
EXAMPLE 1.1
SOLUTION
SOLUTION
EXAMPLE 1.3
Convert to binary.
SOLUTION
The answer is .
Convert to octal.
SOLUTION
Radix ’s Complement
The r’s complement of an n‐digit number N in base r is defined as
for and as 0 for . Comparing with the ’s
complement, we note that the r’s complement is obtained by adding
1 to the ’s complement.
In the previous definitions, it was assumed that the numbers did not
have a radix point. If the original number N contains a radix point,
the point should be removed temporarily in order to form the
complement. The radix point is then restored to the
complemented number in the same relative position.
EXAMPLE 1.5
SOLUTION
EXAMPLE 1.6
SOLUTION
a) X - Y
b) Y - X
SOLUTION
a)
b)
EXAMPLE 1.8
a)
b)
Table 1.3 lists all possible four‐bit signed binary numbers in the
three representations. The equivalent decimal number is also shown
for reference. Note that the positive numbers in all three
representations are identical and have 0 in the leftmost position.
Arithmetic Subtraction
Take the 2’s complement of the subtrahend (including the sign bit)
and add it to the minuend (including the sign bit). A carry out of the
sign‐bit position is discarded.
A set of four elements can be coded with two bits, with each element
assigned one of the following bit combinations: 00, 01, 10, and 11.
A set of eight elements requires a three‐bit code and a set of 16
elements requires a four‐bit code. The bit combination of an n‐bit
code is determined from the count in binary from to .
The binary combinations 1010 through 1111 are not used and
have no meaning in BCD.
BCD Addition
Since each digit does not exceed 9, the sum cannot be greater than
, with the 1 being a previous carry. Suppose we add
the BCD digits as if they were binary numbers. Then the binary sum
will produce a result in the range from 0 to 19. In binary, this range
will be from 0000 to 10011, but in BCD, it is from 0000 to 1 1001,
with the first (i.e., leftmost) 1 being a carry and the next four bits
being the BCD sum. Consider the following three BCD additions:
BCD and the 2421 code are weighted codes. In a weighted code,
each bit position is assigned a weighting factor in such a way that
each digit can be evaluated by adding the weights of all the 1’s in the
coded combination. BCD adders add BCD values directly, digit by
digit, without converting the numbers to binary. However, it is
necessary to add 6 to the result if it is greater than 9.
Gray Code
The output data of many physical systems are quantities that are
continuous. These data must be converted into digital form before
they are applied to a digital system, using an Analog‐to‐Digital
Converter (ADC).
The control characters are used for routing data and arranging the
printed text into a prescribed format. There are three types of control
characters:
Format effectors that control the layout of printing, such as: (BS)
backspace, (HT) horizontal tabulation, and (CR) carriage return.
Information separators that are used to separate the data
into divisions such as paragraphs and pages, such as: (RS)
record separator and (FS) file separator.
Communication‐control characters that are useful during the
transmission of text between remote devices, such as: STX
(start of text) and ETX (end of text), which are used to frame a
text message transmitted through a communication channel.
Error‐Detecting Code
To detect errors in data communication and processing, an eighth bit
is sometimes added to the ASCII character to indicate its parity. A
parity bit is an extra bit included with a message to make the total
number of 1’s either even or odd. For example:
Register Transfer
The truth tables for AND, OR, and NOT are given in Table 1.8.
Logic Gates
Logic gates are electronic circuits that operate on one or more input
signals to produce an output signal. Voltage‐operated logic circuits
respond to two separate voltage levels that represent a binary
variable equal to logic 1 or logic 0. For example, a particular digital
system may define logic 0 as a signal equal to 0 V and logic 1 as a
signal equal to 3 V. In practice, each voltage level has an acceptable
range, as shown in Fig. 1.3. The intermediate region between the
allowed regions is crossed only during a state transition. Any desired
information for computing or control can be operated on by passing
binary signals through various combinations of logic gates, with each
signal representing a particular binary variable. The graphic symbols
used to designate the three types of gates are shown in Fig. 1.4. The
gates are blocks of hardware that produce the equivalent of logic ‐1 or
logic‐0 output signals if input logic requirements are satisfied.
AND & OR gates may have more than two inputs. An AND gate with
three inputs and an OR gate with four inputs are shown in Fig. 1.6.
The three‐input AND gate responds with logic 1 output if all three
inputs are logic 1. The output produces logic 0 if any input is logic 0.
The four‐input OR gate responds with logic 1 if any input is logic 1;
its output becomes logic 0 only when all inputs are logic 0.