Ahmad Firdaus Bin Zainal Abidin Faculty of Computer System and Software Engineering
Ahmad Firdaus Bin Zainal Abidin Faculty of Computer System and Software Engineering
Ahmad Firdaus Bin Zainal Abidin Faculty of Computer System and Software Engineering
1
Boolean algebra: basis for computer logic design
Transistors: means for implementing Boolean algebra
Switches: on/off to represent the 0’s and 1’s of binary digital circuits
Combined to form logic gates
2
Binary Binary
Digital Digital
Input Output
Signal Gate Signal
.
..
XOR looks like OR but with the We typically represent NOR and NAND by the two on the left,
added curved line but the two on the right are also correct
xy = x x+y=x x bar = NOT x
AND is true only if OR is true if either NOT inverts the bit
both inputs are true inputs are true We will denote x bar as ~x
NOR is NOT of OR NAND is NOT of AND XOR is true if both inputs differ
xy = x x+y=x x bar = NOT x
AND is true only if OR is true if either NOT inverts the bit
both inputs are true inputs are true We will denote x bar as ~x
NOR is NOT of OR NAND is NOT of AND XOR is true if both inputs differ
We form Boolean expressions out of Boolean operations on
Boolean variables or Boolean values
So, like algebraic expressions, we can create more complex Boolean
expressions as we might need
To do ~(A*B) + ~(C*D)
Boolean F = x + ~yz
Function
x
F
Logic y
Diagram
z
Simplification from Boolean
function
Truth Boolean
Finding an equivalent Table Function
expression that is least Unique Many different
expensive to implement expressions exist
20
A Kmap is a matrix consisting of rows and columns that represent the
output values of a Boolean function.
The output values placed in each cell are derived from the minterms of a
Boolean function.
A minterm is a product term that contains all of the function’s variables
exactly once, either complemented or not complemented.
21
Similarly, a function
having three inputs, has
the minterms that are
shown in this diagram.
22
A Kmap has a cell for each minterm.
This means that it has a cell for each line for the truth table of a
function.
The truth table for the function F(x,y) = xy is shown at the right along
with its corresponding Kmap.
23
As another example, we give the truth table and KMap for the function,
F(x,y) = x + y at the right.
This function is equivalent to the OR / + (add) of all of the minterms that
have a value of 1. Thus:
F(x,y) = x + y
24
The rules of Kmap simplification are:
• Groupings can contain only 1s; no 0s.
• Groups can be formed only at right angles; diagonal groups are not
allowed.
• The number of 1s in a group must be a power of 2 – even if it
contains a single 1.
• The groups must be made as large as possible.
• Groups can overlap and wrap around the sides of the Kmap.
25
A Kmap for three variables is constructed as shown in the
diagram below.
We have placed each minterm in the cell that will hold its
value.
Notice that the values for the yz combination at the top of
the matrix form a pattern that is not a normal binary
sequence.
26
Consider the function:
27
This grouping tells us that changes in the variables x and y
have no influence upon the value of the function: They are
irrelevant. Find only the relevant.
This means that the function,
reduces to F(x) = z.
We could
verify this
reduction
with
identities or a
truth table.
28
Question: Construct a K-map for f (A,B,C,D) = Σ(0, 7, 9, 12, 15)
Answer:
29
Recapping the rules of Kmap simplification:
• Groupings can contain only 1s; no 0s.
• Groups can be formed only at right angles; diagonal groups
are not allowed.
• The number of 1s in a group must be a power of 2 – even if
it contains a single 1.
• The groups must be made as large as possible.
• Groups can overlap and wrap around the sides of the Kmap.
30
We will combine logic gates together for
calculations
Example: ~(A*B) and ~(C*D) with an OR gate
The resulting circuit is a combinational circuit
Electrical current flows from one gate to the next
By combining gates, we can compute a boolean expression
What we want to do is:
Derive the boolean expression for some binary calculation (e.g., addition)
Then build the circuit using the various logic gates
This is how we will build the digital circuits that make up the ALU (arithmetic-logic unit)
and other parts of the computer
There are 4 possibilities when adding 2
bits together:
0+0 0+1 1+0 1+1
In the first case, we have a sum of 0 and a carry
of 0
In the second and third cases, we have a sum of
1 and a carry of 0
In the last case, we have a sum of 0 and a carry The truth table for Sum and Carry
of 1 and a circuit to compute these
These patterns are demonstrated in the truth
table above to the right
Notice that sum computes the same as XOR
and carry computes the same as AND
We build an Adder using just one XOR and
one AND gate
The half adder really only does half the work
adds 2 bits, but only 2 bits
D1
A0
D2
D3 A1
D4
D5 A2
D6
D7
2-to-4 Decoder D0
E A1 A0 D0 D1 D2 D3 A0 D1
0 0 0 0 1 1 1 D2
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 1 1 1 1 0 A1 D3
1 d d 1 1 1 1 E
Multiplexer (abbreviated as MUX) is used to select
from a group of inputs which one to pass on as output
Here, 1 of 4 single-bit inputs is passed on using a 2-bit
selector (00 for input 0, 01 for input 1,10 for input 2, 11 for
input 3)
While this circuit is more complex than previous ones, this is
simplified for a MUX – imagine what it would look like if we
wanted to pass on 16 bits from 1 of 4 inputs
A related circuit is the demultiplexer (DEMUX) – it receives 1 input and a select and passes the input onto one of several outputs
Putting all these ideas
together