Week 4pdf PDF
Week 4pdf PDF
1
Other number representations
2
Fixed-point numbers
3
Fixed-point numbers
For example,
B=(01001010.10101)2
B=1x26+1x23+1x21+1x2-1+1x2-3+1x2-5
B=64+8+2+.5+.125+.03125
B=(74.65625)10
B=(4A.A8)16
Logic circuits that deal with fixed-point numbers
are essentially the same as those used for integers
4
Floating-point numbers
5
Floating-point numbers
The numbers are usually normalized such that the radix point is placed
to the right of the first non-zero digit
(for example, 5.234x1043 or 3.75x10-35)
6
Floating-point numbers
7
Binary-coded-decimal (BCD)
numbers
It is possible to represent decimal numbers simply by encoding
each decimal digit in binary form
– Called binary-coded-decimal (BCD)
Because there are 10 digits to represent, it is necessary to use
four bits per digit
– From 0=0000 to 9=1001
– (01111000)BCD=(78)10
BCD representation was used in some early computers and many
handheld calculators. It provides a format that is convenient
when numerical information is to be displayed on a simple digit-
oriented display
8
Binary-coded-decimal numbers
9
Binary-coded-decimal addition
The addition of two BCD digits is correct if the binary sum is less
than or equal to 1001 (9 in decimal).
Consider adding packed BCD numbers 25 and 33:
10
Binary-coded-decimal addition
Now consider the addition of 8 and 4 in BCD:
The sum 1 100 does not exist in BCD code. It is one of the six
forbidden or invalid 4-bit code groups. This has occurred because
the sum of two digits exceeds 9. Whenever this occurs, the sum
has to be corrected by the addition of 6 (01 10) to skip over the
six invalid code groups.
11
Binary-coded-decimal addition
The addition of two BCD digits is correct if the binary sum is less
than or equal to 1001 (9 in decimal).
A binary sum greater than 1001, results into an invalid BCD sum;
adding 01 10, to an invalid BCD sum provides the correct sum
with an output carry of 1. Furthermore, addition of two BCD
digits along with carry will require correction if the sum is in the
range 16 decimal through 19 decimal.
12
Chapter 3: BOOLEAN ALGEBRA
AND DIGITAL LOGIC GATES
Introduction
Boolean algebra is a mathematical system for the
manipulation of variables that can have one of two values.
◦ In formal logic, these values are “true” and “false.”
◦ In digital systems, these values are “on” and “off,” 1 and 0, or “high” and “low.”
14
Basic Logic Operations: Not
Operation
A NOT gate has one input, A, and one output, Y, A truth table is usually
as shown in Figure 1.12. The NOT gate’s output used with logic operations
is the inverse of its input. If A is FALSE, then Y to represent all possible
is TRUE. If A is TRUE, then Y is FALSE. This combinations of inputs and
relationship is summarized by the truth table and the corresponding outputs.
Boolean equation in the figure. The line over A
in the Boolean equation (overbar) is pronounced
NOT, so Y =Ā is read “Y equals NOT A.”
The NOT gate is also called an inverter.
Other texts use a variety of notations for NOT,
including Y =A′, Y = ¬A, Y = !A or Y = ~A.
15
OR Operation
The OR gate shown in Figure 1.15 produces a TRUE output, Y, if either A or
B (or both) are TRUE.
By convention, the inputs are listed in the order 00, 01, 10, 11, as if you were
counting in binary.
The Boolean equation for an OR gate is written as Y = A + B or Y = A ∪ B.
The ∪ symbol is pronounced union and is preferred by logicians. Digital
designers normally use the + notation, Y = A + B is pronounced “Y equals A
or B.”
16
AND Operation
Two-input logic gates are more interesting. The
AND gate shown in Figure 1.14 produces a
TRUE output, Y, if and only if both A and B are
TRUE. Otherwise, the output is FALSE.
The Boolean equation for an AND gate can be
written in several ways: Y = A • B, Y = AB, or
Y = A ∩ B. The ∩ symbol is pronounced
“intersection” and is preferred by logicians. We
prefer Y = AB, read “Y equals A and B,”
because we are lazy.
17
NOR operation
The NOR output is produced by inverting the output of an OR
operation.
18
NAND operation
The NAND output is generated by inverting the output of an AND
operation.
19
Exclusive-OR operation (XOR)
The eXclusive-OR operation (XOR) generates an output of 1 if the inputs
are different and 0 if the inputs are the same.
20
Example
Perform the following operations. Include your answers in hexadecimal.
A.A616 OR 3 116
B.F7A 16 AND D816 ;
C.NOT (FA516)
D. 3A16 XOR 21 .16
21
A. A616 OR 3 116 B. F7A16 AND D816 ;
22
C.NOT (FA516) D. 3A 16 XOR 2116 ;
23