Professional Documents
Culture Documents
By
Dr. Nermeen Talaat
Lecture 10
1
Logic gates types
Logic circuits for digital systems may be:
1- Combinational circuits
2- Sequential circuits
Combinational circuits
3
Sequential circuits
Sequential circuits employ storage elements in
addition to logic gates. Their outputs are a function of
the inputs and the state of the storage elements.
The state of storage elements, in turn, is a function of
previous inputs.
As a consequence, the outputs of a sequential circuit
depend not only on present values of inputs, but also
on past inputs, and the circuit behavior must be
specified by a time sequence of inputs and internal
state.
4
Examples of combinational circuits
5
Examples of combinational circuits
6
More basic gates – Very popular
NAND – Not AND
NOR – Not OR
7
Complex Logic Gates
XOR – Exclusive OR
F = XY’ + X’Y
=XY
8
Complex Logic Gates
XNOR – Exclusive NOR
F = XY + X’Y’
=XY
9
More complex logic gates
AND-OR-INVERT (AOI)
F=(AB+CD)’
OR-AND-INVERT (OAI)
F = ( (W+X)(Y+Z) )’ W
F=((W+X)(Y+Z))’
X
Z 10
And some more complex gates
AND-OR
F = AB + CD
OR-AND
F = (W+X)(Y+Z) W
X
F=(W+X)(Y+Z)
Y
11
Identities of the XOR operation
The following identities apply to the XOR
operation:
X 0 = X X 1 = X’
XX=0 X X’ = 1
X Y’ = (X Y)’
X’ Y = (X Y)’
3-variable map
Z=X Y Z
14
XOR K-maps (continued)
4-variable map
Z=W X Y Z
15
Binary additon &
subtraction
16
Iterative Circuits
The concept – Create a functional block and
create the circuit for doing the multiple bit
operation by simply repeating it.
Iterative connection.
18
Iterative circuit area
A lot in arithmetic area of application.
Adders
Subtractors
Incrementors
Decrementors
Multiplication circuits
19
Half Adder
Design procedure: Design circuit to calculate 1+0
1) State Problem
Example: Build a Half Adder to add two bits
2) Determine and label the inputs & outputs of circuit.
Example: Two inputs and two outputs labeled, as
follows:
X Y C S
X Half S 0 0 0 0
Adder
0 1 0 1
Y C 1 0 0 1
(X + Y) 1 1 1 0
3) Draw truth table.
Half Adder
4) Obtain simplified Boolean function. X Y C S
0 0 0 0
Example: C = X.Y 0 1 0 1
S = X'.Y + X.Y' = XY 1 0 0 1
1 1 1 0
5) Draw logic diagram.
X
S
Y
Half Adder
21
Half Adder
The half adder is an example of a simple, functional
digital circuit built from two logic gates.
A half adder adds two one-bit binary numbers A
and B (two inputs). It has two outputs ,S and C (the
value theoretically carried on to the next addition);
The simplest half-adder design, shown in fig. 3,
incorporates an XOR gate for S and an AND gate for
C. S Sum, C carry
Half adders cannot be used compositely, given their
incapacity for a carry-in bit.
22
Half Adder
C=xy S=x’y+xy’=
X AND y
x XOR y
23
Half-Adder
24
Full Adder
Half-adder adds up only two bits.
To add two binary numbers, we need to add 3 bits
(including the carry).
Example: carry
1 1 1
0 0 1 1 X
+ 0 1 1 1 Y
1 0 1 0 S
Need Full Adder (so called as it can be made from
two half-adders).
X
Full S
Y
Z
Adder C
(X + Y + Z) 25
Full Adder
Truth table:
X Y Z C S Note:
0 0 0 0 0
0 0 1 0 1 Z - carry in (to the current
0 1 0 0 1 position)
0 1 1 1 0 C - carry out (to the next position)
1 0 0 0 1
1 0 1 1 0 C
YZ
1 1 0 1 0 X
00 01 11 10
1 1 1 1 1 0 1
form: YZ
S
X
00 01 11 10
C = X.Y + X.Z + Y.Z 0 1 1
S = X'.Y'.Z + X'.Y.Z'+X.Y'.Z'+X.Y.Z
1 1 1
26
Full Adder
Alternative formulae using algebraic manipulation:
C = X.Y + X.Z + Y.Z
= X.Y + (X + Y).Z
= X.Y + ((XY) + X.Y).Z
= X.Y + (XY).Z + X.Y.Z
= X.Y + (XY).Z
27
Full Adder
Circuit for above formulae:
C = X.Y + (XY).Z
S = (XY)Z
X (XY)
Y S
(XY)
Z
Full Adder made from two Half-Adders (+ OR gate).
28
Full Adder
Circuit for above formulae:
C = X.Y + (XY).Z
Block diagrams.
S = (XY)Z
X (XY)
X Sum X
Y Y Sum S
Y
Half Half
Adder Adder
(X.Y)
Carry Carry
C
Z
Full Adder made from two Half-Adders (+ OR gate).
29
The full adder
Have just seen a full adder implemented from the
structural connection of two half adders and an OR
gate.
Can do a direct implementation. It will end up with
the same number and type of gates.
For a multibit implementation need a symbol for the
unit.
30
Multibit use
And then can use that symbol in multibit or
hierarchical representations.
1 0 1 1
A 2 bit example 0
1 11 (A)
0 1 01 (B)
------
0 0 1 00
In this adder the final output carry is
generated in the final stage after the carry
inputs to all the previous stages has settled.
31
Carry ripple
So the carry ripples from the lsb to msb A
ripple carry adder.
.
33
And a full example
And more ripple -
34
In General
When there is no borrow into the msb
position, then the subtrahend in not larger
than the minuend and the result is positive and
correct. lsb
msb
36
1’s Complement
1’s complement of N is defined as (2n -1)-N.
If n=4 have (2n -1) being 1 0000 - 1 = 1111
So for n=4 would subtract any 4-bit binary
number from 1111.
This is just inverting each bit.
Example: 1’s compliment of 1011001
is 0100110
37
2’s complement
The 2’s complement is defined as 2n-N
Can be done by subtraction of N from 2n or
adding 1 to the 1’s complement of a number.
For 6 = 0110
The 1’s complement is 1001
The 2’s complement is= 1001+ 1 = 1010
38
Operation with 2’s complement
Add 4 and -6
Will use the 2’s complement of -6 or 1010
4 0100
-6 1010
1110
And taking the 2’s complement of 1110 get
0001 + 1 = 0010
39
A 2’s complement table for 4 bits
Listing the
values
represented.
40
Half subtractor
The half-subtractor is a combinational circuit which
is used to perform subtraction of two bits. It has two
inputs, X (minuend) and Y (subtrahend) and two
outputs D (difference) and B (borrow).
Minuend (X) 10110
Subtrahend - (Y) 10010
43
Overflow
When adding 2 n-bit numbers it is possible to
get a n+1 bit result if there is a carry out.
On paper it is easy just add another bit.
In 2’s complement add a msb 0 for a positive
or a msb 1 for a negative.
.
46
Incrementer
Often just want to increment the value by 1
and that is the only operation needed.
An incrementer is a circuit that is much
simpler than an adder.
Start with the equations:
SUM = A xor B xor Cin
Cout = AB +Cin (A xor B )
47
Incrementer
Often we just want a circuit to create the value
+1 each time.
The circuit is a significant simplification.
Start with the equations for general addition
Sum = A B Cin
Cout = AB +Cin (A xor B )
Now if B = 0 these reduce to
IncSum = A Cin
Inc Carry= Cout = A*0 +Cin (A xor 0 )= ACin
A Half Adder!!!
48
Implementation
A increment unit
50
The circuit
And again can do a dedicated circuit
51