CS302P
CS302P
Prepared by
Waqar Ahmad, Lecturer
Waqas Ahmad, Lecturer
2
Objectives ................................................................................................................................................... 18
Lab Tasks ........................................................................................................................................................ 19
Task 1: Converting Boolean expressions into circuits ............................................................................... 19
Task 2: Converting Boolean expressions into circuits ............................................................................... 19
Task 3: Digital logic circuit analysis – Finding the Boolean expression of a given circuit ....................... 20
Task 4: Digital logic circuit analysis – Finding the Boolean expression of a given circuit ....................... 22
Task 5: Logic circuits with multiple outputs .............................................................................................. 22
Task 6*: Finding the Boolean expression of a given circuit using the logic converter .............................. 23
Task 7*: Converting Boolean expressions to circuits using the logic converter ........................................ 23
Lab Experiment # 04 .............................................................................................................................. 31
Boolean algebra and Simplification of Boolean expressions - I ..................................................................... 31
Objectives ................................................................................................................................................... 31
DE Morgan’s Theory – Background .............................................................................................................. 31
Basics of Boolean algebra .......................................................................................................................... 31
Simplifying Boolean logic functions .......................................................................................................... 34
Lab Tasks ........................................................................................................................................................ 35
Task 1: Circuit analysis .............................................................................................................................. 35
Task 2: Circuit analysis .............................................................................................................................. 36
Task 3: Simplifying Boolean functions ...................................................................................................... 38
Task 4: Simplifying Boolean functions ...................................................................................................... 38
Task 5: Simplifying Boolean functions in EWB using the logic converter ............................................... 39
Task 6: Simplifying Boolean functions in EWB using the logic converter ............................................... 39
Lab Experiment # 05 .............................................................................................................................. 40
DE Morgan’s Theory and the Universal Gates ............................................................................................... 40
Objectives ................................................................................................................................................... 40
Background ................................................................................................................................................. 40
Implement any gate with NAND gates only .............................................................................................. 40
Implement any gate with NOR gates only.................................................................................................. 41
Equivalent Gates ......................................................................................................................................... 41
Building Circuits using NAND and NOR gates only ..................................................................................... 41
Example: Building Circuits using NAND gates only................................................................................. 41
Example: Building Circuits using NOR gates only .................................................................................... 42
Lab Tasks ........................................................................................................................................................ 42
Task 1: The Universal NAND gate ............................................................................................................ 42
3
Task 2: The Universal NOR gate ............................................................................................................... 43
Task 3: Implementing circuits using NAND gates only............................................................................. 43
Task 3: Implementing circuits using NOR gates only................................................................................ 44
Task 4: Implementing circuits using NAND gates only............................................................................. 45
Task 5: Implementing circuits using NAND gates only............................................................................. 46
Lab Experiment # 06 .............................................................................................................................. 47
Simplification of Boolean expressions - II ..................................................................................................... 47
Objectives ................................................................................................................................................... 47
Lab Tasks ........................................................................................................................................................ 47
Task 1: Simplifying two-input Boolean functions ..................................................................................... 47
Task 2: Simplifying three-input Boolean functions ................................................................................... 48
Task 3: Simplifying four-input Boolean functions ..................................................................................... 52
Lab Experiment # 07 .............................................................................................................................. 54
The Story of Minterms and Maxterms............................................................................................................ 54
Objectives ................................................................................................................................................... 54
Background ................................................................................................................................................. 54
Lab Tasks ........................................................................................................................................................ 57
Task 1: Three-input Boolean functions ...................................................................................................... 57
Task 2: Three-input Boolean functions ...................................................................................................... 58
Task 3: Four-input Boolean functions ........................................................................................................ 59
Task 4: Four-input Boolean functions ........................................................................................................ 59
Task 5: Simplifying 4-variable functions ................................................................................................... 60
Task 6: Simplifying 4-variable functions: SOP .......................................................................................... 61
Task 7: Simplifying 4-variable functions: POS .......................................................................................... 62
Lab Experiment # 08 .............................................................................................................................. 61
XOR and XNOR gates: Basics and Applications ............................................................................................... 61
Objectives ................................................................................................................................................... 61
Background ................................................................................................................................................. 61
Lab Tasks ........................................................................................................................................................ 62
Task 1: XOR built from basic gates ........................................................................................................... 62
Task 2: XNOR Gate ................................................................................................................................... 63
Task 3: 3-input XOR Gate ......................................................................................................................... 64
Task 4: Half adder circuit ........................................................................................................................... 64
Task 5: Implementing HA circuit using EWB ........................................................................................... 65
4
Task 6: Implementing FA circuit using EWB ............................................................................................ 65
Task 7: Implementing a 4-bit parallel adder using 4 FA’s ......................................................................... 67
Task 8: Implementing a 4-bit parallel subtracter using 4 FA’s .................................................................. 68
Task 9: Implementing a 4-bit incrementer using 4 FA’s ............................................................................ 68
Task 10: Implementing a 4-bit decrementer using 4 FA’s ......................................................................... 69
Lab Experiment # 09 .............................................................................................................................. 70
Building logic circuits using Multiplexers ........................................................................................................ 70
Objectives ................................................................................................................................................... 70
Background ................................................................................................................................................. 70
4 Channel Multiplexer using Logic Gates .................................................................................................. 70
Drawing Multiplexers in EWB: .................................................................................................................. 71
Multiplexers can be used to synthesize logic functions ............................................................................. 71
Lab Tasks ........................................................................................................................................................ 73
Task 1: Implementing single-output circuits using muxes ......................................................................... 73
Task 2: Implementing single-output circuits using muxes ......................................................................... 74
Task 3: Implementing single-output circuits using muxes ......................................................................... 75
Task 4: Problems with verbal description .................................................................................................. 76
Lab Experiment # 10 .............................................................................................................................. 78
Building digital logic circuits using Decoders ................................................................................................. 78
Objectives ................................................................................................................................................... 78
Background ................................................................................................................................................. 78
Logic Functions Realized with Decoders: .................................................................................................. 78
Drawing Decoders using EWB: ................................................................................................................. 79
Lab Tasks ........................................................................................................................................................ 82
Task 1: Implementing 3-variable Boolean expressions using 3-8 decoder ................................................ 82
Task 2: Implementing multiple 3-variable Boolean expressions using 3-8 decoder .................................. 82
Task 3: Problems with verbal description .................................................................................................. 83
Task 4: Problems with verbal description .................................................................................................. 84
Lab Experiment # 11 .............................................................................................................................. 86
Sequential Circuits?? ...................................................................................................................................... 86
Objectives ................................................................................................................................................... 86
Background ................................................................................................................................................. 86
Lab Experiment # 12 ................................................................................................................................ 87
Design and Implementation of Code Convertor ........................................................................................... 87
5
Objective ..................................................................................................................................................... 87
Parts required:- ........................................................................................................................................... 87
Equipment required:- ................................................................................................................................. 87
Theory: ........................................................................................................................................................ 87
Logic Diagram: ............................................................................................................................................ 89
Binary To Gray Code Convertor ................................................................................................................. 89
Truth Table: ................................................................................................................................................ 92
Logic Diagram: ............................................................................................................................................ 92
Gray Code To Binary Convertor ................................................................................................................. 92
Truth Table: ................................................................................................................................................ 95
Logic Diagram: ............................................................................................................................................ 95
Bcd To Excess-3 Convertor ......................................................................................................................... 95
Truth Table: ................................................................................................................................................ 98
Logic Diagram: ............................................................................................................................................ 98
Excess-3 To Bcd Convertor ......................................................................................................................... 98
Truth Table: .............................................................................................................................................. 101
Procedure: ................................................................................................................................................ 101
Lab Experiment # 13 .............................................................................................................................. 102
Design and Implementation of Magnitude Comparator ............................................................................. 102
Objective ................................................................................................................................................... 102
Parts Required .......................................................................................................................................... 102
Theory: ...................................................................................................................................................... 103
Logic Diagram: .......................................................................................................................................... 104
2 Bit Magnitude Comparator.................................................................................................................... 104
Truth Table................................................................................................................................................ 107
Pin Diagram For IC 7485 ........................................................................................................................... 107
Logic Diagram ........................................................................................................................................... 108
8 Bit Magnitude Comparator ................................................................................................................... 108
Truth Table................................................................................................................................................ 108
Procedure ................................................................................................................................................. 109
Lab Experiment # 14 .............................................................................................................................. 110
Construction and verification of 4 bit ripple counter and mod 10/mod 12 ripple counter ........................ 110
Objective ................................................................................................................................................... 110
Theory ....................................................................................................................................................... 110
6
Pin Diagram for IC 7476: ........................................................................................................................... 111
Logic Diagram For 4 Bit Ripple Counter: ................................................................................................. 111
Truth Table................................................................................................................................................ 112
Logic Diagram for Mod - 10 Ripples Counter ........................................................................................... 113
Truth Table................................................................................................................................................ 113
Logic Diagram for Mod - 12 Ripples Counter ........................................................................................... 114
Truth Table................................................................................................................................................ 114
Procedure ................................................................................................................................................. 115
Lab Experiment # 15 .............................................................................................................................. 116
Design and Implementation Of 3 Bit Synchronous Up/Down Counter ....................................................... 116
Apparatus Required .................................................................................................................................. 116
Theory ....................................................................................................................................................... 116
K Map ........................................................................................................................................................ 117
State Diagram ........................................................................................................................................... 117
Characteristics Table................................................................................................................................. 118
Logic Diagram ........................................................................................................................................... 119
Truth Table................................................................................................................................................ 120
Procedure: ................................................................................................................................................ 121
Lab Experiment # 16 .............................................................................................................................. 122
Design and Implementation of Shift Register .............................................................................................. 122
AIM ........................................................................................................................................................... 122
Apparatus Required .................................................................................................................................. 123
Theory ....................................................................................................................................................... 123
Pin Diagram............................................................................................................................................... 123
Logic Diagram ........................................................................................................................................... 124
Serial in Serial Out .................................................................................................................................... 124
Truth Table................................................................................................................................................ 124
Logic Diagram ........................................................................................................................................... 125
Serial in Parallel Out ................................................................................................................................. 125
Truth Table................................................................................................................................................ 125
Truth Table................................................................................................................................................ 126
Logic Diagram ........................................................................................................................................... 126
Parallel in Parallel Out .............................................................................................................................. 126
Truth Table................................................................................................................................................ 126
7
Procedure ................................................................................................................................................. 127
Lab Experiment # 17 ............................................................................................................................ 128
Appendices ................................................................................................................................................... 128
Appendix #1: K-Maps................................................................................................................................ 128
8
Lab Experiment # 01
Familiarization; Playing with EWB 5.12
Introduction to Electronics Workbench
Electronics Workbench is an electronics and digital logic lab inside a computer, modeled after a real
electronics workbench. It is a design tool that provides you with components & instruments to create
“virtual” board-level designs:
– No actual breadboards, components, or instruments needed.
– Click-and-drag schematic editing.
– It offers mixed analog & digital simulation and graphical waveform analysis.
– Circuit behavior simulated realistically.
– Results displayed on multimeter, oscilloscope, bode plotter, logic analyzer, etc.
1
General EWB Functions
Selecting
– To move a component or instrument need to select it selected item highlights: components red, wires
thicken
– Clicking to Select
To select single item, click on it.
To select additional items, press CTRL+ click.
– Selecting All
Choose Edit/Select All.
– Dragging to Select
Place pointer above & to side of group of items. Press & hold mouse button & drag downward diagonally.
Release mouse button when rectangle encloses everything desired.
– Deselecting
To deselect single item, press CTRL+click.
To deselect all selected items, click on empty spot in window.
– To set labels, values (for simple components) & models (for complex components), select component and
choose Circuit/Component Properties, choose desired tab, make any changes, and click OK.
– Can also invoke Circuit/Component Properties box by double-clicking on component.
* Notes:
The Circuit/Component Properties box contains a number of tabs; depending on which component is
selected an analog component has either a value or a model, not both.
Wiring Components
– Point to a component’s terminal so it highlights; press & hold mouse button, and drag so a wire appears
drag wire to a terminal on another component or to an instrument connection, when terminal on second
component or instrument highlights, release mouse button
– To insert component into existing circuit, place it on top of wire; it will automatically be inserted if there is
room.
Connecting Wires
– If drag a wire from a component’s terminal to another wire, a connector is automatically created when
2
you release mouse button.
– Note: a connector button also appears in the Basic toolbar (to insert connectors into an existing circuit).
Deleting Wires
– To change a wire’s color, double-click it & choose Schematic Options tab; click the Color button &
choose a new color.
Straightening a Wire
– move wire itself.
– move component to which wire is attached.
– press ALT and move component to which wire is attached.
– select component and press appropriate arrow key to align it.
– If two wires cross in a way that makes them hard to follow, select one & drag it to new location
*Note:
– the way a wire is routed sometimes depends on terminal from which wire was dragged; try
disconnecting routed wire & then rewire from the opposite terminal.
Instruments
3
Simulation
Click the power switch to turn power on. Click switch again to turn power off. (Note: Turning off power
erases data & instrument traces.
Lab Tasks
Draw the following circuit. After that make the following changes
- Connect the output of the converter to the red probe
- Connect the Vcc line to the input of the inverter
- Start simulating the circuit State your observation down: Observation:
- In the same circuit above, stop the simulation and connect the ground to the input of the inverter.
State your observation down:
Observation:
Note: You can change the default values of the clock by doing mouse right clicking on the clock and click
on the “Component Properties ...” as shown below:
Task 7: Simple circuit; a clock source with two red probes
Draw the following circuit and simulate it. Write down your observations. Notice that the clock frequency is
2 Hz.
A B C
0 0 0
0 1 0
1 0 0
1 1 1
The NAND gate works opposite to the AND gate. Its Boolean algebra representation is: C= (A.B)’
And it’s truth table and schema as following:
A B C
0 0 1
0 1 1
1 0 1
1 1 0
Its Boolean algebra representation is: C=A+B and its truth table and schema as following:
A B C
0 0 0
0 1 1
1 0 1
1 1 1
The NOR gate works opposite to the OR gate. Its Boolean algebra representation is: C=(A+B)’
And it’s truth table and schema as following:
A B C
0 0 1
0 1 0
1 0 0
1 1 0
NOT gate
This is the simplest gate it just inverts the input, if the input is high the output will be low and conversely.
So, B =A’
A B
0 1
1 0
Lab Tasks
A B A.B (A.B)’
0 0
0 1
1 0
1 1
Task 2: The AND-NOT combination
In EWB, draw the following circuit and fill the truth table
A B (A.B)’
0 0
0 1
1 0
1 1
Task 3: The OR and NOR gates
In EWB, draw the following two circuits and fill the truth table below
A B A+B (A+B)’
0 0
0 1
1 0
1 1
Task 4: The NOR-NOT combination
A B ((A+B)’)’
0 0
0 1
1 0
1 1
Task 5: Finding the truth table of a gate using the logic converter
The logic converter can be found in the Instruments toolbox. It can be used to derive a truth table from a
circuit schematic:
1. Attach the input terminals of the logic converter to up to eight input points in the circuit.
2. Connect the single output of the circuit to the output terminal on the logic converter icon.
3. Click the Circuit to Truth Table button.
The truth table for the circuit appears in the logic converter's display.
In the following circuit, we will be examining the AND gate. The two inputs of the gate are attached the A
and B inputs of the logic converter. The circuit output C is connected to Outline of the logic converter.
After clicking on the Truth Table button of the logic converter, the logic converter tries
all possible combinations of the circuit input and derives its truth table.
4
Task 6: Finding the truth table of a gate using the logic converter
Repeat what you did in task 5 for the NOR gate. Show your connections in the circuit below.
A B A+B (A+B)’
0 0
0 1
1 0
1 1
Task 7: Finding the truth table of a three-input gate using the logic converter
Repeat what you did in task 5 for a three-input AND gate. Show your connections in the circuit below.
Note: you can obtain a three-input AND gate by drawing a regular two-input AND gate and then changing
its Number of Inputs property as shown next.
A B C D
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Task 8: Finding the truth table of a given circuit using the logic converter
Find the truth table of the following circuit:
A B C D F
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
Lab Experiment # 03
Digital logic circuits analysis and converting Boolean expressions to digital circuits
Objectives
• To learn how to directly convert a Boolean expression to circuit.
• To learn how to analyze a given digital logic circuit by finding the Boolean expression that
represents the circuit
• To learn how to analyze a given digital logic circuit by finding the truth table that represents the
circuit.
Example:
Z = A + B . C’
The above function is implemented in the following digital logic Circuit
Now after drawing the circuit above using EWB we find that its truth table is as shown below (notice that
logic 1 means connect the input to the Vcc line, and logic 0 means connecting the input to the ground)
A B C Z
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
Lab Tasks
Task 1: Converting Boolean expressions into circuits
Convert the following Boolean expression to a circuit, draw the circuit on EWB and simulate it to fill-in its
truth table shown below.
X = Y + Z. Y’
Y Z X
0 0
0 1
1 0
1 1
Task 3: Digital logic circuit analysis – Finding the Boolean expression of a given circuit
Find the Boolean expression of the following circuit, draw the circuit on EWB and simulate it to fill-in its
truth table shown below.
W=
Note: the logic converter tool from EWB to fill-in the following table. For that, you need to connect the A,
B and C inputs of the logic converter to X, Y and Z lines, respectively. Further, you need to connect the
‘out’ line of the logic converter to W. As shown in the following diagram
X Y Z W
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Task 4: Digital logic circuit analysis – Finding the Boolean expression of a given circuit
Find the Boolean expression of the following circuit,
D=
Draw the circuit on EWB and simulate it to fill-in its truth table shown below (use logic converter please).
A B C D
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
D=
E=
Draw the circuit on EWB and simulate it to fill-in its truth table shown below (use logic converter please).
Note: You need to use the logic converter two times, once for the output D, and another time for the second
output E.
A B C D E
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Task 6*: Finding the Boolean expression of a given circuit using the logic converter
Draw the following circuit on EWB and then find its Boolean expression using the logic converter.
Task 7*: Converting Boolean expressions to circuits using the logic converter
Use the logic converter to realize the following circuit using suitable logic gates:
AB'C (BD + CDE) + AC'
Lab Experiment # 04
Boolean algebra and Simplification of Boolean expressions - I
Objectives
Object
1- To study DE Morgan’s theory and implemented it.
2- Learn how to simplify Boolean logic equations using DE Morgan’s theory.
In simple words, DE Morgan’s Theory is used to convert AND/NAND gates to OR/NOR ones, and presented
OR/NOR gates by AND/NAND gates by these 2-laws:
A + B= (A’. B’)’
A. B = (A’ + B’)’
P1: X = 0 or X = 1
P2: 0. 0 = 0
P3: 1 + 1 = 1
P4: 0 + 0 = 0
P5: 1. 1 = 1
P6: 1. 0 = 0. 1 = 0
P7: 1 + 0 = 0 + 1 = 1
Boolean Laws
T1: Commutative Law
(a) A + B = B + A
(b) A B = B A
T5:
(a)
(b)
T9:
(a)
(b)
T10:
(a)
(b)
(a)
(b)
Simplifying Boolean logic functions
Given the following circuit
Lab Tasks
X=
Y=
A B X Y
0 0
0 1
1 0
1 1
What do you notice?
X=
Y=
A B X Y
0 0
0 1
1 0
1 1
What do you notice?
Task 3: Simplifying Boolean functions
Simplify the following Boolean expression
F (A, B) = (A. B) + A’ (A+B)
Draw the simplified and the original Boolean expression using EWB and make sure that they
are booth equivalent by filling-in the following truth table.
A B F (A, B) (original) Y (Simplified)
0 0
0 1
1 0
1 1
Draw the simplified Boolean expression using EWB. Find out the truth table of the circuit.
Task 5: Simplifying Boolean functions in EWB using the logic converter
Simplify the following Boolean expression in EWB using the logic converter
F (A, B, C) = AB'C (BD + CD) + AC'
To do so, you need to enter the expression as shown below, and then click on the following
button to extract the truth table of the expression. Finally, click on the
following button that will generate the simplified form of the equation.
To draw the circuit after simplification, you need to click on the following b u t t o n
, this will realize the simplified expression using basic gates.
6- Equivalent gates.
7- Two-level digital circuit implementations using universal gates only.
8- Two-level digital circuit implementations using other gates.
Background
The NAND gate represents the complement of the AND operation. Its name is an abbreviation of NOT
AND. The graphic symbol for the NAND gate consists of an AND symbol with a bubble on the output,
denoting that a complement operation is performed on the output of the AND gate.
The NOR gate represents the complement of the OR operation. Its name is an abbreviation of NOT OR.
The graphic symbol for the NOR gate consists of an OR symbol with a bubble on the output, denoting that a
complement operation is performed on the output of the OR gate.
A universal gate is a gate which can implement any Boolean function without need to use any other gate
type. The NAND and NOR gates are universal gates.
In practice, this is advantageous since NAND and NOR gates are economical and easier to fabricate and are
the basic gates used in all IC digital logic families.
In fact, an AND gate is typically implemented as a NAND gate followed by an inverter not the other way
around!! Likewise, an OR gate is typically implemented as a NOR gate followed by an inverter not the
other way around!!
Equivalent Gates
A NAND gate is equivalent to an inverted-input OR gate.
Last updated on Monday, March 23, 2015 By Dr. Sulieman Bani- Page 40 of
A NOR gate is equivalent to an inverted-input AND gate.
F = XZ + Y’Z + X’YZ
Lab Tasks
Lab Tasks
Draw the simplified and the original Boolean expression using EWB and make sure that they
are booth equivalent by filling-in the following truth table.
A B F (A, B) (original) Y (Simplified)
0 0
0 1
1 0
1 1
A B C F
1 0 0 0
2 0 0 1
3 0 1 0
4 0 1 1
5 1 0 0
6 1 0 1
7 1 1 0
8 1 1 1
Task 3: Simplifying four-input Boolean functions
Simplify the following logic function using k-maps
F (A, B, C, D) = Σ (6, 8, 9, 10, 11, 12, 13, 14)
A B C D F
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Lab Experiment # 07
The Story of Minterms and Maxterms
Objectives
Learn how implement logic functions using the standard forms: Sum of Products and Product of Sums.
Background
We can write expressions in many ways, but some ways are more useful than others
A sum of products (SOP) expression contains: Only OR (sum) operations at the “outermost” level and each
term that is summed must be a product of literals
The advantage is that any sum of products expression can be implemented using a three-level circuit
– literals and their complements at the first level
– AND gates at the second level
– a single OR gate at the third level
Example:
f(x,y,z) = y’ + x’yz’ + xz
Notice that the NOT gates are implicit and that literals are reused.
A minterm is a special product of literals, in which each input variable appears exactly once.
A function with n variables has 2n minterms (since each variable can appear complemented or not)
Example:
A three-variable function, such as f(x,y,z), has 23 = 8 minterms:
Each minterm is true for exactly one combination of inputs:
Those minterms are: x’y’z’ x’y’z x’yz’ x’yz xy’z’ xy’z xyz’ xyz
A Minterm is true when:
Minterm When the minterm is True Minterm ID
x’y’z’ x=0, y=0, z=0 m0
x’y’z x=0, y=0, z=1 m1
x’yz’ x=0, y=1, z=0 m2
x’yz x=0, y=1, z=1 m3
xy’z’ x=1, y=0, z=0 m4
xy’z x=1, y=0, z=1 m5
xyz’ x=1, y=1, z=0 m6
xyz x=1, y=1, z=1 m7
Example
f = x’y’z’ + x’y’z + x’yz’ + x’yz + xyz’
= m0 + m1 + m2 + m3 + m6
= Σm(0,1,2,3,6)
Example
f(x, y, z) = y’ . (x’+y+z’) . (x+z)
A maxterm is a sum of literals, in which each input variable appears exactly once.
A function with n variables has 2n maxterms
Example
A three-variable function f(x,y,z) has 8 maxterms
Each maxterm is false for exactly one combination of inputs:
Those materms are: x’+y’+z’ x’+y’+z x’+ y+z’ x’+ y+z x+y’+z’ x+y’+z x+y+z’ x+y+z
Maxterm Is false when:
Maxterm When the maxterm is false Maxterm ID
x+y+z x=0, y=0, z=0 M0
x + y + z’ x=0, y=0, z=1 M1
x + y’ + z x=0, y=1, z=0 M2
x + y’ + z’ x=0, y=1, z=1 M3
x’ + y + z x=1, y=0, z=0 M4
x’ + y + z’ x=1, y=0, z=1 M5
x’ + y’ + z x=1, y=1, z=0 M6
x’ + y’ + z’ x=1, y=1, z=1 M7
x’y’z’ m0 x+y+z M0
x’y’z m1 x + y + z’ M1
x’yz’ m2 x + y’ + z M2
x’yz m3 x + y’ + z’ M3
xy’z’ m4 x’ + y + z M4
xy’z m5 x’ + y + z’ M5
xyz’ m6 x’ + y’ + z M6
xyz m7 x’ + y’ + z’ M7
Example
From before
f = Σm(0,1,2,3,6)
and f’ = Σm(4,5,7)
= m4 + m5 + m7
complementing (f’)’ = (m4 + m5 + m7)’
so f = m4’ . m5’ . m7’ [ DeMorgan’s law ]
= M4 . M5 . M7
= ΠM(4,5,7)
Lab Tasks
Task 1: Three-input Boolean functions
Given the following truth table of a three-input logic circuit
A B C F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Write the above function in the two standard forms
F(A, B, C)= Σ ( )
F(A, B, C) = Π( )
Draw a circuit that implements the above logic function (use minterms only)
Draw a circuit that implements the above logic function (use maxterms only)
A B C F (simplified)
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
A B C D F
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Background
The XOR gate (sometimes EOR gate, or EXOR gate) is a digital logic gate that implements an exclusive or;
that is, a true output (1) results if one, and only one, of the inputs to the gate is true (1). If both inputs are
false (0) or both are true (1), a false output (0) results. Next is the circuit representation of the XOR gate and
its truth table.
A B F1
0 0 0
0 1 1
1 0 1
1 1 0
Next is one way to build an XOR gate using NAND gates only
The XOR logic gate can be used as a one-bit adder (or a Half-Adder; HA)that adds any two bits together to
output one bit (the sum) and another bit that represents the carry out. As shown below
The XOR logic gate can be used as a one-bit full adder that adds any three bits together to output one bit (the
sum) and another bit that represents the carry out. As shown below
Inputs Outputs
A B Cin Cout S
0 0 0 0 0
1 0 0 0 1
0 1 0 0 1
1 1 0 1 0
0 0 1 0 1
1 0 1 1 0
0 1 1 1 0
1 1 1 1
Lab Tasks
Task 1: XOR built from basic gates
Draw using EWB the following circuits then fill their truth tables:
A B F1
0 0
0 1
1 0
1 1
What do you notice?
Each one of the above circuits can be replaced with one single logic gate that gives the same truth table,
that’s the Exclusive OR Gate or XOR.
A B F No. of 1's
0 0 0 Even
0 1 1 Odd
1 0 1 Odd
1 1 0 Even
A B F
0 0
0 1
1 0
1 1
The above circuit can be replaced with one single logic gate that gives the same truth table, that’s the
Exclusive NOR Gate or XNOR.
A B F No. of 1's
0 0 1 Odd
0 1 0 Even
1 0 0 Even
1 1 1 Odd
A B C A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
(a) Find out the Boolean functions S and C, and write them in the corresponding blanks.
(b) Draw using EWB the HA circuit then find its truth table by using the logic converter.
S=
C=
P Q S C
0 0
0 1
1 0
1 1
P Q S C
0 0
0 1
1 0
1 1
Background
In a Combinational Logic Circuit, the output is dependant at all times on the combination of its
inputs. Some examples of a combinational circuit include Multiplexers, De-multiplexers, Encoders,
Decoders, Full and Half Adders etc.
A Multiplexer is a combination of logic gates resulting into circuits with two or more inputs (data inputs)
and one output.
Last updated on Monday, March 23, 2015 By Dr. Sulieman Bani- Page 70 of
NOTE: the “A” line in the multiplexer is the least significant bit, while “C” is the most significant bit.
Truth table:
A B C D F
0 0 0 0 0 1
F=1
1 0 0 0 1 1
2 0 0 1 0 0
F=D
3 0 0 1 1 1
4 0 1 0 0 1
F=D’
5 0 1 0 1 0
6 0 1 1 0 0
F=0
7 0 1 1 1 0
8 1 0 0 0 1
F=D’
9 1 0 0 1 0
10 1 0 1 0 0
F=0
11 1 0 1 1 0
12 1 1 0 0 1
F=1
13 1 1 0 1 1
14 1 1 1 0 0
F=D
15 1 1 1 1 1
To implement this function using EWB, you draw the following circuit:
Lab Tasks
Task 1: Implementing single-output circuits using muxes
Implement the following function using one 8x1 multiplexer
F(A, B, C, D) = A'B'C'D'+A'B'C'D+A'B'CD+A'BC'D'+AB'C'D'+ABC'D'+ABC'D+ABCD
Note: this example has already been solved above. Just draw the circuit using EWB.
Task 2: Implementing single-output circuits using muxes
Implement the following function using one 16x1 multiplexer
F(A, B, C, D) = A'C'B+AB'C'+B’C'D+ABCD'
Task 3: Implementing single-output circuits using muxes
Implement the following function using one 8x1 multiplexer
F(A, B, C, D) = A'C'B+AB'C'+B’C'D+ABCD'
A B C D F
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Task 4: Problems with verbal description
Design a combinational circuit (using two 8-to-1 multiplexers) with three inputs, and one output to
implement the following function.
A B C D F
0 0 0 0 0 0
1 0 0 0 1 1
2 0 0 1 0 0
3 0 0 1 1 1
4 0 1 0 0 0
5 0 1 0 1 0
6 0 1 1 0 1
7 0 1 1 1 1
8 1 0 0 0 1
9 1 0 0 1 0
10 1 0 1 0 1
11 1 0 1 1 0
12 1 1 0 0 1
13 1 1 0 1 0
14 1 1 1 0 0
15 1 1 1 1 1
Lab Experiment # 10
Building digital logic circuits using Decoders
Objectives
• To learn how to build combinational logic circuits using decoders.
Background
In a Combinational Logic Circuit, the output is dependant at all times on the combination of its inputs.
Some examples of a combinational circuit include Multiplexers, De-multiplexers, Encoders, Decoders,
Full and Half Adders etc.
A Decoder is a circuit with two or more inputs and one or more outputs. Its basic function is to accept a
binary word (code) as an input and create a different binary word as an output.
A B D1 D2 D3 D4
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
Click on the button on the toolbar, then drag a 741xx digital IC into your workspace. From the list,
select either 74138 (3-8 decoder) or 74154 (4-16 decoder) as shown next.
The above function can be implemented as shown next. Redraw this circuit using EWB.
A B C F1 F2 F3
0 0 0 0 0 1 1
1 0 0 1 1 1 0
2 0 1 0 0 0 1
3 0 1 1 1 1 0
4 1 0 0 0 1 1
5 1 0 1 1 0 0
6 1 1 0 1 0 0
7 1 1 1 0 0 1
A B C D F
0 0 0 0 0 0
1 0 0 0 1 1
2 0 0 1 0 0
3 0 0 1 1 1
4 0 1 0 0 0
5 0 1 0 1 0
6 0 1 1 0 1
7 0 1 1 1 1
8 1 0 0 0 1
9 1 0 0 1 0
10 1 0 1 0 1
11 1 0 1 1 0
12 1 1 0 0 1
13 1 1 0 1 0
14 1 1 1 0 0
15 1 1 1 1 1
A B C D F
0 0 0 0 0 0
1 0 0 0 1 1
2 0 0 1 0 0
3 0 0 1 1 1
4 0 1 0 0 0
5 0 1 0 1 0
6 0 1 1 0 1
7 0 1 1 1 1
8 1 0 0 0 1
9 1 0 0 1 0
10 1 0 1 0 1
11 1 0 1 1 0
12 1 1 0 0 1
13 1 1 0 1 0
14 1 1 1 0 0
15 1 1 1 1 1
Lab Experiment # 11
Sequential Circuits??
Objectives
• To learn how to build combinational logic circuits using decoders.
Background
Lab Experiment # 12
Design and Implementation of Code Convertor
Objective
To design and implement 4-bit
(i) Binary to gray code converter
(ii) Gray to binary code converter
(iii) BCD to excess-3 code converter
(iv) Excess-3 to BCD code converter
Parts required:-
Sl.No. COMPONENT SPECIFICATION QTY.
1. X-OR GATE IC 7486 1
2. AND GATE IC 7408 1
3. OR GATE IC 7432 1
4. NOT GATE IC 7404 1
Equipment required:-
• Trainer/ proto board
• Wire cutter
• Patch Cords
• Voltmeter
Theory:
The availability of large variety of codes for the same discrete elements of information results in the use
of different codes by different systems. A conversion circuit must be inserted between the two systems if
each uses different codes for same information. Thus, code converter is a circuit that makes the two
systems compatible even though each uses different binary code.
The bit combination assigned to binary code to gray code. Since each code uses four bits to represent a
decimal digit. There are four inputs and four outputs. Gray code is a non-weighted code.
The input variable are designated as B3, B2, B1, B0 and the output variables are designated as C3, C2,
C1, Co. from the truth table, combinational circuit is designed. The Boolean functions are obtained from
K-Map for each output variable.
A code converter is a circuit that makes the two systems compatible even though each uses a different
binary code. To convert from binary code to Excess-3 code, the input lines must supply the bit
combination of elements as specified by code and the output lines generate the corresponding bit
combination of code. Each one of the four maps represents one of the four outputs of the circuit as a
function of the four input variables.
A two-level logic diagram may be obtained directly from the Boolean expressions derived by the maps.
These are various other possibilities for a logic diagram that implements this circuit. Now the OR gate
whose output is C+D has been used to implement partially each of three outputs.
Logic Diagram:
Binary To Gray Code Convertor
G3 = B3
B3 B2 B1 B0 G3 G2 G1 G0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 1
0 1 1 1 0 1 0 0
1 0 0 0 1 1 0 0
1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1
1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0
1 1 0 1 1 0 1 1
1 1 1 0 1 0 0 1
1 1 1 1 1 0 0 0
Logic Diagram:
Gray Code To Binary Convertor
K-Map for B3:
B3 = G3
G3 G2 G1 G0 B3 B2 B1 B0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 1 0 0 1 0
0 0 1 0 0 0 1 1
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
0 1 0 1 0 1 1 0
0 1 0 0 0 1 1 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 1 1 0 1 0
1 1 1 0 1 0 1 1
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 0 0 1 1 1 1 0
1 0 0 0 1 1 1 1
Logic Diagram:
Bcd To Excess-3 Convertor
K-Map for E3:
E3 = B3 + B2 (B0 + B1)
B3 B2 B1 B0 G3 G2 G1 G0
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 x x x x
1 0 1 1 x x x x
1 1 0 0 x x x x
1 1 0 1 x x x x
1 1 1 0 x x x x
1 1 1 1 x x x x
Logic Diagram:
Excess-3 To Bcd Convertor
K-Map for A:
A = X1 X2 + X3 X4 X
K-Map for B:
K-Map for C:
K-M ap for D:
Truth Table:
B3 B2 B1 B0 G3 G2 G1 G0
0 0 1 1 0 0 0 0
0 1 0 0 0 0 0 1
0 1 0 1 0 0 1 0
0 1 1 0 0 0 1 1
0 1 1 1 0 1 0 0
1 0 0 0 0 1 0 1
1 0 0 1 0 1 1 0
1 0 1 0 0 1 1 1
1 0 1 1 1 0 0 0
1 1 0 0 1 0 0 1
Procedure:
Parts Required
numbers A and B and determine their relative magnitude. The outcome of the comparator is specified by
three binary variables that indicate whether A>B, A=B or A<B.
A = A3 A2 A1 A0 B = B3 B2 B1 B0
The equality of the two numbers and B is displayed in a combinational circuit designated by the symbol
(A=B).
This indicates A greater than B, then inspect the relative magnitude of pairs of significant digits starting
from most significant position. A is 0 and that of B is 0.
The same circuit can be used to compare the relative magnitude of two BCD digits.
Truth Table
Objective
To design and verify 4-bit ripple counter mod 10/ mod 12 ripple counter.
Parts required
Theory
Truth Table
CLK QA QB QC QD
0 0 0 0 0
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 0 0 0
Logic Diagram for Mod - 12 Ripples Counter
Truth Table
CLK QA QB QC QD
0 0 0 0 0
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 1 0 1
11 1 1 0 1
12 0 0 0 0
Procedure
Apparatus Required
Theory
A counter is a register capable of counting number of clock pulse arriving at its clock input. Counter
represents the number of clock pulses arrived. An up/down counter is one that is capable of progressing in
increasing order or decreasing order through a certain sequence. An up/down counter is also called
bidirectional counter. Usually up/down operation of the counter is controlled by up/down signal. When this
signal is high counter goes through up sequence and when up/down signal is low counter follows reverse
sequence.
K Map
State Diagram
Characteristics Table
Q Qt+1 J K
0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0
Logic Diagram
Truth Table
AIM
To design and implement
(i) Serial in serial out
(ii) Serial in parallel out
(iii) Parallel in serial out
(iv) Parallel in parallel out
Apparatus Required
Theory
A register can shift its binary information in one or both directions is
known as shift register. The logical configuration of shift register consists of a
D-Flip flop cascaded with output of one flip flop connected to input of next flip
flop. All flip flops receive common clock pulses which causes the shift in the
output of the flip flop. The simplest possible shift register is one that uses only
flip flop. The output of a given flip flop is connected to the input of next flip
flop of the register. Each clock pulse shifts the content of register one-bit
position to right.
Pin Diagram
Logic Diagram
Serial in Serial Out
Truth Table
1 1 0
2 0 0
3 0 0
4 1 1
5 X 0
6 X 0
7 X 1
Logic Diagram
Serial in Parallel Out
Truth Table
OUTPUT
CLK DATA
QA QB QC QD
1 1 1 0 0 0
2 0 0 1 0 0
3 0 0 0 1 1
4 1 1 0 0 1
Logic Diagram: Parallel in Serial Out
Truth Table
CLK Q3 Q2 Q1 Q0 O/P
0 1 0 0 1 1
1 0 0 0 0 0
2 0 0 0 0 0
3 0 0 0 0 1
Logic Diagram
Parallel in Parallel Out
Truth Table
Procedure