0% found this document useful (0 votes)
96 views23 pages

Week 4pdf PDF

The document discusses various number systems and binary logic gates. It begins by describing different number representations including fixed-point, floating-point, and binary-coded decimal. It then explains fixed-point numbers through an example. The document also covers floating-point numbers and binary-coded decimal numbers. Finally, it introduces common binary logic gates such as NOT, OR, AND, NOR, NAND, and XOR through truth tables and examples.

Uploaded by

wael mahfouz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views23 pages

Week 4pdf PDF

The document discusses various number systems and binary logic gates. It begins by describing different number representations including fixed-point, floating-point, and binary-coded decimal. It then explains fixed-point numbers through an example. The document also covers floating-point numbers and binary-coded decimal numbers. Finally, it introduces common binary logic gates such as NOT, OR, AND, NOR, NAND, and XOR through truth tables and examples.

Uploaded by

wael mahfouz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Chapter 2: Number Systems

and Codes (Continued)

1
Other number representations

Other number representations are also commonly used :


– Fixed-point: allows for fractional representation
– Floating-point: allows for high precision, very
large and/or very small numbers
– Binary-coded decimal (BCD): another form for
integer representation

2
Fixed-point numbers

• A fixed-point number consists of integer and fraction parts

• In positional notation, it is written as


B=bn-1bn-2. . .b1b0.b-1b-2…b-k

• With a corresponding value of

The position of the radix point is assumed to be fixed

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

Fixed-point numbers have a range that is limited by the significant digits


used to represent the number
For some applications, it is often necessary to deal with numbers that are
very large (or very small)
For these cases, it is better to use a floating-point representation in
which numbers are represented by a mantissa comprising the
significant digits and an exponent of the radix R
The format is:
Mantissa x R Exponent

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:

In this example, none of the sums of the pairs of decimal digits


exceeded 9; therefore, no decimal carries were produced. For
these reasons, the BCD addition process is straightforward and is
actually the same as binary addition.

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.”

Boolean expressions are created by performing operations


on Boolean variables.
◦ basic Boolean operators include AND, OR, and NOT.

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 ;

A6= 1010 01102 F7A= 1111 0111 10102


3 116=0011 00012 D816=1101 10002

1010 0110 1111 0111 1010


0 0 1 1 0 0 0 1 OR 0000 1101 1000 AND

1 0 1 1 0 1 1 1= B716 0000 0101 1000=5816

22
C.NOT (FA516) D. 3A 16 XOR 2116 ;

3A= 0011 10102


FA5= 1111 1010 01012
2116= 0010 00012
Not (1111 1010 0101)=
(0000 0101 1010)=05A16
0011 1010
0010 0001AND
0001 1011 =1D16

23

You might also like