Computer Organization & Architecture

Download Report

Transcript Computer Organization & Architecture

Lecture 3
Boolean Algebra and
Digital Logic
Lecture Duration: 2 Hours
Lecture Overview
 Boolean Algebra
•
•
•
•
•




Boolean Expressions
Boolean Identities
Simplification of Boolean Expressions
Complements
Representing Boolean Functions
Logic gates
Digital Components
Combinational circuits
Sequential circuits
AOU – Fall 2012
2
Boolean Algebra
Boolean Algebra – Introduction (1/1)
 Boolean algebra is an algebra for the
manipulation of objects that can take on only
two values, typically true and false
 It returns to its inventor, the famous
mathematician and logician George Boole
AOU – Fall 2012
3
Boolean Algebra
Boolean Expressions (1/5)
 Boolean variable: it is a variable that can take
only two values : 0 (false) or 1 (true)
• Example: x, y, z, … Where, for instance, “x” could be 0
or 1
 Boolean expressions: Combination of Boolean
variables and operators (AND, OR, NOT, …)
• Example: x AND y, x OR y, …
 Boolean function: typically has one or more
input values and yields a result, based on these
input values, in the range {0,1}
• Example: F(x, y, z) = (x AND y) OR z
AOU – Fall 2012
4
Boolean Algebra
Boolean Expressions (2/5)
 Three common Boolean operators AND, OR and NOT
 In Boolean expressions/arithmetic:
• (a AND b) is expressed as a Boolean product:
a.b or simply ab
• (a OR b) is expressed as a Boolean sum: a+b
• (Not a) is expressed as: a
 A Boolean operator can be completely described using
a truth table that lists:
• The inputs,
• All possible values for these inputs,
• The resulting values of the operation for all possible
combinations of these inputs
AOU – Fall 2012
5
Boolean Algebra
Boolean Expressions (3/5)
The truth table for AND
Inputs
The truth table for OR
Outputs
Inputs
Outputs
x
y
xy
x
y
x+y
0
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
1
1
1
1
1
1
1
The truth table for NOT
Inputs
Outputs
x
𝐱
0
1
1
0
AOU – Fall 2012
6
Boolean Algebra
Boolean Expressions (4/5)
 Boolean function can also be described using
a truth table
 The following rules of precedence should be
respected
•
•
•
•
Parentheses first
NOT next
AND next
OR finally
AOU – Fall 2012
7
Boolean Algebra
Boolean Expressions (5/5)
 Example: Draw the truth table to show all possible
outputs of the following Boolean function: F(x, y, z) = x
+𝑦z
• Logically we should calculate 𝑦, 𝑦z and then x +𝑦z
• The truth table for F(x,y,z) is:
• a
x
0
0
0
0
1
1
1
1
Inputs
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
Intermediate
𝒚
𝒚z
1
0
1
1
0
0
0
0
1
0
1
1
0
0
0
0
AOU – Fall 2012
Outputs
x + 𝒚z
0
1
0
0
1
1
1
1
8
Lecture Overview
 Boolean Algebra
•
•
•
•
•




Boolean Expressions
Boolean Identities
Simplification of Boolean Expressions
Complements
Representing Boolean Functions
Logic gates
Digital Components
Combinational circuits
Sequential circuits
AOU – Fall 2012
9
Boolean Algebra
Boolean Identities (1/3)
 Frequently, a Boolean expression is not in its
simplest form
 Recall from algebra the expression 2x + 6x can
be simplified to 8x
 Boolean expressions can also be simplified
 We need new identities, or laws, that apply to
Boolean algebra instead of regular algebra
 These laws are grouped in the following table
AOU – Fall 2012
10
Boolean Algebra
Boolean Identities (2/3)
 Duality principle: Each identity relationship (with the
exception of the last one) has both an AND form and an OR
form.
 Avoid the most beginners’ common error: 𝑥𝑦 ≠ 𝑥 𝑦
AOU – Fall 2012
11
Boolean Algebra
Boolean Identities (3/3)
 Drawing a truth table can justify DeMorgan’s Law
 Think of drawing the truth table that justifies
each of the other predefined laws
AOU – Fall 2012
12
Lecture Overview
 Boolean Algebra
•
•
•
•
•




Boolean Expressions
Boolean Identities
Simplification of Boolean Expressions
Complements
Representing Boolean Functions
Logic gates
Digital Components
Combinational circuits
Sequential circuits
AOU – Fall 2012
13
Boolean Algebra
Simplification of Boolean Expressions (1/6)
 The Boolean identities can be used to simplify
Boolean expressions in a similar fashion
 Example 1: Simplify the function F(x,y) = xy +
xy.
• xy can be seen as a single variable
• The OR form of the Idempotent Law F(x,y) can be
simplified to F(x,y) = xy + xy = xy.
AOU – Fall 2012
14
Boolean Algebra
Simplification of Boolean Expressions (2/6)
 Example 2: Simplify the function F(x,y,z) = xyz
+ xyz + xz
• F(x,y,z) = xyz + xyz + xz
= xyz + xz (idempotent)
= xz(y + 1) (Distributive)
= xz(1)
(Null)
= xz
(Identity)
• The simplest form for F(x,y,z) is F(x,y,z) = xz
AOU – Fall 2012
15
Boolean Algebra
Simplification of Boolean Expressions (3/6)
 Example 3: Simplify the function F(x,y,z) = 𝑥yz
+ 𝑥y𝑧 + xz
• F(x,y,z) = 𝑥yz + 𝑥y𝑧 + xz
= 𝑥y(z + 𝑧) + xz
(Distributive)
= 𝑥y (1) + xz
(Inverse)
= 𝑥y + xz
(Identity)
• The simplest form for F(x,y,z) is F(x,y,z) = 𝑥y + xz
AOU – Fall 2012
16
Boolean Algebra
Simplification of Boolean Expressions (4/6)
 Example 4 (more tricky): Simplify the
function F(x,y,z) = xy + 𝑥z + yz
• F(x,y,z) = xy + 𝑥z + yz
=xy + 𝑥z + yz(1)
= xy + 𝑥z + yz(x+ 𝑥)
= xy + 𝑥z + yzx+ yz𝑥
= xy + (xy)z + 𝑥z + (𝑥z)y
= xy(1+z) + 𝑥z (1+y)
= xy + 𝑥z
AOU – Fall 2012
Identity
Inverse
Distributive
Commutative + Associative
Distributive
Null + Identity
17
Boolean Algebra
Simplification of Boolean Expressions (5/6)
 We can also use the predefined identities to
prove Boolean equalities
 Example: Prove that (x + y)(𝑥 + y) = y.
AOU – Fall 2012
18
Boolean Algebra
Simplification of Boolean Expressions (6/6)
 The equality between two Boolean
expressions can also be proved by drawing
and comparing their truth tables
 If the outputs of the truth tables are identical,
the expressions are equal
 Exercise: Prove the following equality by
drawing the truth tables of its Boolean
expressions:
(x + y)(𝑥 + y) = y.
AOU – Fall 2012
19
Lecture Overview
 Boolean Algebra
•
•
•
•
•




Boolean Expressions
Boolean Identities
Simplification of Boolean Expressions
Complements
Representing Boolean Functions
Logic gates
Digital Components
Combinational circuits
Sequential circuits
AOU – Fall 2012
20
Boolean Algebra
Complements (1/5)
 Quite often, it is cheaper and less complicated to
implement the complement of a function rather
than the function itself
 To find the complement of a Boolean function,
we use DeMorgan’s Law
 The complement of a function F is expressed as
𝐹
 Example: Find the complement 𝐹 of the function
F(x,y) = x+y
• 𝐹(𝑥, 𝑦)= 𝑥 + 𝑦 = 𝑥 y (OR form of the DeMorgan’s
law)
AOU – Fall 2012
21
Boolean Algebra
Complements (2/5)
 Example 2: Find the complement 𝐹 of the
function F(x,y,z) = x+y+z
• Solution:
𝐹(𝑥, 𝑦, 𝑧)
=𝑥+𝑦+z
= (𝑥 + 𝑦) + 𝑧
= 𝑥+𝑦 𝑧
= 𝑥𝑦 𝑧
= 𝑥 𝑦𝑧
 Applying the principle of duality, we see that
(𝑥𝑦𝑧) = 𝑥 + 𝑦 + 𝑧
AOU – Fall 2012
22
Boolean Algebra
Complements (3/5)
 We have seen that
• (𝑥𝑦𝑧) = 𝑥 + 𝑦 + 𝑧
• (𝑥 + 𝑦 + 𝑧) = 𝑥 𝑦𝑧
 We can clearly see that to find the
complement of a Boolean expression
• we simply replace each variable by its
complement (x is replaced by 𝑥 )
• and interchange ANDs and ORs
AOU – Fall 2012
23
Boolean Algebra
Complements (4/5)
 Example: Find the complement of 𝑥 + yz
• Replacing variable
- 𝑥 is replaced by x
- y is replaced by 𝑦
- z is replaced by z
• Replacing operands
- The “+” between 𝑥 and yz is replaced by a “.”
- The “.” between y and z is replaced by a “+”
• The result is: 𝑥 + yz = x(𝑦 + z)
AOU – Fall 2012
24
Boolean Algebra
Complements (5/5)
 The following truth table prove that if F(x,y,z) = 𝑥 + yz, we
have 𝐹(𝑥, 𝑦, 𝑧) = x(𝑦 + z)
 In fact, when the output of F(x,y,z) is 0, 𝐹(𝑥, 𝑦, 𝑧) is 1 and vice
versa.
AOU – Fall 2012
25
Lecture Overview
 Boolean Algebra
•
•
•
•
•




Boolean Expressions
Boolean Identities
Simplification of Boolean Expressions
Complements
Representing Boolean Functions
Logic gates
Digital Components
Combinational circuits
Sequential circuits
AOU – Fall 2012
26
Boolean Algebra
Representing Boolean Functions (1/5)
 Two expressions that can be represented by the
same truth table are considered logically
equivalent
 In fact, there are an infinite number of Boolean
expressions that are logically equivalent to one
another
 To help eliminate potential confusion, logic
canonical, or standardized, form of Boolean
functions are used:
• The sum-of-products
• The product-of-sums
AOU – Fall 2012
27
Boolean Algebra
Representing Boolean Functions (2/5)
 The sum-of-products: consist of ANDed variables
(or product terms) that are ORed together
• Example: F1(x,y,z) = xy + y𝑧 + xyz
 The product-of-sums: consist of ORed variables
(sum terms) that are ANDed together
• Example: F2(x,y,z) = (x + y)(x + 𝑧)(y + 𝑧)(y + z)
 Note: The sum-of-products form is usually easier
than the product-of-sums. It will hence be used
exclusively in the sections that follow
AOU – Fall 2012
28
Boolean Algebra
Representing Boolean Functions (3/5)
 Any Boolean expression can be represented in
sum-of-products form.
 Any Boolean expression can also be
represented as a truth table
 So any truth table can also be represented in
sum-of-products form
AOU – Fall 2012
29
Boolean Algebra
Representing Boolean Functions (4/5)
 How to generate a sum-of-products expression
using the truth table for any Boolean expression?
1. Search for the lines where the function outputs a
“1”
2. For each of these lines, generate a product term of
the input variables
• If a (for instance “x”) variable is set to 1, take it as it is (“x”)
• If a variable (for instance “y”) is set to 0, take its
complement (“𝑦”)
3. Sum these products
AOU – Fall 2012
30
Boolean Algebra
Representing Boolean Functions (5/5)
 Example: Give the sum-of-products form of the following
majority function’s truth table (outputs the most repeated
bit)
𝑥𝑦𝑧
𝑥 𝑦𝑧
𝑥𝑦𝑧
𝑥𝑦𝑧
 The sum-of-products of this function is:
F(x,y,z) = 𝑥𝑦𝑧 + 𝑥𝑦𝑧 + 𝑥𝑦𝑧 + 𝑥𝑦𝑧
 Note that this expression may not be in simplest form; we
are only guaranteeing a standard form
AOU – Fall 2012
31
Lecture Overview
 Boolean Algebra
 Logic gates
• Symbols for logic gates
• Universal gates
• Multiple-inputs gates
 Digital Components
 Combinational circuits
 Sequential circuits
AOU – Fall 2012
32
Logic gates
Logic Gates – Introduction (1/1)
 The logical operators, functions and expressions
have been represented thus far in an abstract
sense
 What is a Gate?
• It is a group of physical components, or digital
circuits, that perform arithmetic operations or make
choices in a computer.
• A gate is a small, electronic device that computes
various functions of two-valued signals (or more)
• Each gate requires from one to six or more transistors
• If the basic physical component of a computer is the
transistor; the basic logic element is the gate
AOU – Fall 2012
33
Logic gates
Symbols for Logic Gates (1/1)
Boolean expression
AOU – Fall 2012
34
Logic gates
Universal Gates (1/3)
AOU – Fall 2012
35
Logic gates
Universal Gates (2/3)
 The NAND gate is commonly referred to as a
universal gate
• Any electronic circuit can be constructed using
only NAND gates
AOU – Fall 2012
36
Logic gates
Universal Gates (3/3)
 Why not simply use the AND, OR, and NOT gates
we already know exist?
• For two reasons:
- NAND gates are cheaper to build than the other gates
- complex integrated circuits are often much easier to build
using the same building
 Applying the duality principle, NOR is also a
universal gate
 In practice, NAND are used for implementing an
expression in sum of-products form
 In practice, NOR is used for implementing an
expression in product-of-sums form
AOU – Fall 2012
37
Logic gates
Multiple Input Gates (1/1)
 Gates could have multiple inputs
 Also, sometimes it is useful to depict the output of a
gate as Q along with its complement 𝑄
AOU – Fall 2012
38
Lecture Overview
 Boolean Algebra
 Logic gates
 Digital Components
• Digital circuits and Boolean algebra
• Integrated circuits
 Combinational circuits
 Sequential circuits
AOU – Fall 2012
39
Digital Components
Digital Components – Introduction (1/2)
 Every computer is built using collections of
gates that are all connected by way of wires
 These collections of gates are often quite
standard, resulting in a set of building blocks
 These building blocks are all constructed
using the basic AND, OR, and NOT operations.
AOU – Fall 2012
40
Digital Components
Digital Components – Introduction (2/2)
 In this part, we will discuss:
• Digital circuits, and their relationship to Boolean
algebra
• The standard building blocks
• Two different categories, into which these
building blocks can be placed
- Combinational logic
- Sequential logic
AOU – Fall 2012
41
Digital Components
Digital Circuits and Boolean Algebra (1/1)
 Simple Boolean operation (such as AND or OR) can be
represented by a simple logic gate
 Any Boolean expression can be represented as a
logical diagram
 A logical diagram is a combinations of AND, OR, and
NOT gates that describes a Boolean expression
 Example: F(x,y,z) = x + 𝑦z
𝑦
AOU – Fall 2012
42
Digital Components
Integrated Circuits (1/1)
 Gates are sold in units called integrated circuits (ICs)
 First ICs were SSI (small scale integration – See Lecture
1) chips and contained very few transistors (up to 100
transistors)
 We now have ULSI (ultra large-scale integration) with
more than 1 million electronic components per chip
How much gates does this
IC contain??
What is (are) the type(s)
of these gates?
AOU – Fall 2012
43
Lecture Overview




Boolean Algebra
Logic gates
Digital Components
Combinational circuits
• Typical Combinational circuits
- Adder (half adder, full adder, ripple carry adder)
- Decoder
- Multiplexer
 Sequential circuits
AOU – Fall 2012
44
Combinational circuits
Basic Concepts (1/1)
 Combinational logic is used to build circuits
that contain basic Boolean operators, inputs,
and outputs.
 The output of a combinational circuit is a
function of its inputs at any given moment.
 A combinational circuit may have several
outputs. If so, each output represents a
different Boolean function.
AOU – Fall 2012
45
Combinational circuits
Typical Combinational Circuits – A half adder (1/2)
 A half-adder is a very simple combinational circuit
 Consider the problem of adding two binary digits
together, three cases are possible:
• 0+0=0
• 1+0=0+1=1
• 1 + 1 = 10 (the result is “0” with a carry of “1”)
 We have two inputs (the bits to add) and two outputs
(the “sum” and the “carry”)
 Drawing the truth table lead us to the Boolean
function of a half-adder
• Note that each output has a Boolean Function
AOU – Fall 2012
46
Combinational circuits
Typical Combinational Circuits – A half adder (2/2)
 The sum is “1” when only
one of the inputs (x, y) is
equal to “1”
• This is the job of a XOR!
• Sum = 𝑥 ⊕ 𝑦
 The carry is “1” when
only both inputs (x and
y) are “1”
• This is the job of an AND!
• Carry = xy
AOU – Fall 2012
47
Combinational circuits
Typical Combinational Circuits – A full adder (1/2)
 A half adder could be extended to a circuit that
allows the addition of larger binary numbers: A
full adder
 Remember how we added binary numbers?
• We add each column without forgetting the carry
from the nearest right column
 A full adder have three inputs:
• The two bits to add (x and y)
• The carry from the nearest right column (carry-in)
 A full adder has two outputs (the “sum” and the
“carry”)
AOU – Fall 2012
48
Combinational circuits
Typical Combinational Circuits – A full adder (2/2)
 Think of how this logic diagram is obtained.
 Note that a full-adder is composed of two
half-adders and an OR gate.
AOU – Fall 2012
49
Combinational circuits
Typical Combinational Circuits – A binary numbers adder (1/1)
 A full-adder can only add two bits and a carry (three
bits)
 The simplest way to add large binary numbers is to use
a ripple-carry adder
 A ripple-carry is a succession of full-adders but it is
slow
 Faster methods are nowadays implemented in
computers (40% to 90% faster than the ripple-carry
adder)
• Examples: carry-look-ahead adder, the carry-select adder,
and the carry-save adder, as well as others.
AOU – Fall 2012
50
Lecture Overview




Boolean Algebra
Logic gates
Digital Components
Combinational circuits
• Typical Combinational circuits
- Adder (half adder, full adder, ripple carry adder)
- Decoder
- Multiplexer
 Sequential circuits
AOU – Fall 2012
51
Combinational circuits
Typical Combinational Circuits – A decoder (1/3)
 A decoder decodes binary information from a set of n
inputs to a maximum of 2n outputs
 A decoder uses the inputs and their respective values
to select one specific output line
• For a given input, only one output is set to “1” and all
others are set to “0”
AOU – Fall 2012
52
Combinational circuits
Typical Combinational Circuits – A decoder (2/3)
 Examples
11
10
10
10
00
11
2-to-4
decoder
0
0 1
00
0
1 0
10
1
2 0
00
0
3 0
01
11
A 2-to-4 decoder (n=2 ; 2n=4)
0
00
1
00
2
00
4-to-8 3
decoder 4
00
5
10
6
00
7
01
?
00
A 3-to-8 decoder (n=3 ; 2n=8)
 A decoder is something the computer uses frequently
 One of the most application is “Chip selection”
• Example: Selecting one of several memory chips for a
given address
AOU – Fall 2012
53
Combinational circuits
Memory Chip 0
Memory Chip 1
Memory Chip 2
Memory Chip 3
Memory Chip 4
Memory Chip 5
Memory Chip 6
Memory Chip 7
Typical Combinational Circuits – A decoder (3/3)
CS
CS
CS
CS
CS
CS
CS
CS
0 0 1 0 0 0 0 0
0 1 2 3 4 5 6 7
Decoder
1
0
0
1
13
0
0
1
0
0
AOU – Fall 2012
0
1
0
0
1
1
54
Lecture Overview




Boolean Algebra
Logic gates
Digital Components
Combinational circuits
• Typical Combinational circuits
- Adder (half adder, full adder, ripple carry adder)
- Decoder
- Multiplexer
 Sequential circuits
AOU – Fall 2012
55
Combinational circuits
Typical Combinational Circuits – A multiplexer (1/2)
 A multiplexer selects binary information from
one of many input lines and directs it to a single
output line.
 Selection of a particular input line is controlled
by a set of selection variables or control lines
AOU – Fall 2012
56
Combinational circuits
Typical Combinational Circuits – A multiplexer (2/2)
 A 4-to-1 multiplexer
• We have 4=22 input lines
• To select one of the 4 inputs we
need 2 selection bits: S0, S1
 A 8-to-1 multiplexer
• We have 8=23 input lines
• To select one of the 8 inputs we
need 3 selection bits: S0, S1, S2
 A 16-to-1 multiplexer?
 A 64-to-1 multiplexer?
I0
I1
I2
I3
4-to-1
multiplexer
S1
S0
0 0
1 0
0 1
0 1
I0
I1
I2
I3
I4
8-to-1
multiplexer
I5
?I4
I6
I7
S2 S1 S0
1
AOU – Fall 2012
I0 I2
I1 I3
0
0
57
Lecture Overview





Boolean Algebra
Logic gates
Digital Components
Combinational circuits
Sequential circuits
•
•
•
•
Introduction
Clocks
Flip-Flops
Examples of Sequential Circuits
- Register
- Counter
AOU – Fall 2012
58
Sequential circuits
Sequential circuits – Introduction (1/2)
 Computers must have a way to remember
values.
 Combinational circuits are memoryless, they
do not have the concept of storage.
 Computers cannot be built using only
combinational circuits.
 We need sequential circuits.
AOU – Fall 2012
59
Sequential circuits
Sequential circuits – Introduction (2/2)
 Before we discuss sequential logic, we must
first introduce a way to order events
 There are two types of sequential circuits
• Asynchronous: they become active the moment
any input value changes
• Synchronous: they use clocks to order events
 In this course we will study synchronous
sequential circuits only
AOU – Fall 2012
60
Sequential circuits
Clocks (1/1)
 Clock: It is a circuit that emits a series of pulses
• A clock is used to decide when to update the state of the circuit
(when do “present” inputs become “past” inputs?).
 Clock speed: is generally measured in megahertz (MHz), or millions
of pulses per second
 Edge triggered circuits change state on the rising edge or falling
edge of the clock signal
 Level-triggered circuits change state when the clock voltage
reaches its highest or lowest level
Pulse width
Clock cycle
time
AOU – Fall 2012
61
Lecture Overview





Boolean Algebra
Logic gates
Digital Components
Combinational circuits
Sequential circuits
•
•
•
•
Introduction
Clocks
Flip-Flops
Examples of Sequential Circuits
- Register
- Counter
AOU – Fall 2012
62
Sequential circuits
Flip-Flops (1/8)
 In sequential the output depends on past
inputs.
 To remember previous inputs, sequential
circuits use flip-flops.
 If combinational circuits are generalizations of
gates, sequential circuits are generalizations
of flip-flops.
AOU – Fall 2012
63
Sequential circuits
Flip-Flops (2/8)
 In order to “remember” a past state,
sequential circuits rely on a concept called
feedback
• The output of a circuit is fed back as an input to
the same circuit
 A simple example of this concept is shown below.
• If Q is 0 it will always be 0, if it is 1, it will always be 1.
Why?
AOU – Fall 2012
64
Sequential circuits
Flip-Flops (3/8)
 The most basic memory unit is called an SR
flip-flop.
• The “SR” stands for set/reset
AOU – Fall 2012
65
Sequential circuits
Flip-Flops (4/8)
 Try to think how the feedback works?
• Consider Q(t) as the value of the output Q at time t and Q(t+1)
as the new value of Q after a new clock pulse.
• Note also that SR flip-flop has two additional inputs (in addition
to the fed backed output Q)
 The behavior of an SR flip-flop is described by its
characteristic table
AOU – Fall 2012
66
Sequential circuits
Flip-Flops (5/8)
 Considering the three
inputs: S, R, and Q, we
can construct the truth
table of an SR flip-flop
 What happens when both
S and R are 1?
• The output is undefined
• We say that the SR flip-flop
is in an unstable state.
AOU – Fall 2012
67
Sequential circuits
Flip-Flops (6/8)
 It is also important to see how a clocked SR
flip-flop is implemented!
• Example: A level triggered SR flip-flop
- The output will change only when clock is '1',
otherwise all inputs (S and R) will be ignored
AOU – Fall 2012
68
Sequential circuits
Flip-Flops (7/8)
 Jack Kilby has modified the SR flip-flop to provide a
stable state when both inputs are 1
 This creates the JK flip-flop (in honor of Jack Kilby)
 The characteristic table indicates that the flip-flop is
stable for all inputs
 Try to draw the truth table of a JK flip-flop.
AOU – Fall 2012
69
Sequential circuits
Flip-Flops (8/8)
 Another modification of the SR flip-flop is the D
flip-flop (D stands for Data)
 This sequential circuit stores one bit of
information.
 When the clock is pulsed:
• If a 1 is asserted on the input line D the output line Q
becomes a 1 (and is still 1 until the next clock pulse).
• If a 0 is asserted on the input line the output
becomes 0 (and is still 0 until the next clock pulse).
AOU – Fall 2012
70
Lecture Overview





Boolean Algebra
Logic gates
Digital Components
Combinational circuits
Sequential circuits
•
•
•
•
Introduction
Clocks
Flip-Flops
Examples of Sequential Circuits
- Register
- Counter
AOU – Fall 2012
71
Sequential circuits
Examples of Sequential Circuits – A register (1/3)
 As any other sequential circuit, a register is
formed by a group of flip-flops.
 Its basic function is to hold information within
a digital system
 A simple 4-bit Parallel in – Parallel out register
is here described
 It will be implemented using D flip-flops.
AOU – Fall 2012
72
Sequential circuits
Examples of Sequential Circuits – A register (2/3)
 In a parallel in – parallel out
register
• On a clock tick, all inputs are
sent to the output lines
• These outputs are still on
their states until the next
clock tick (the D flip-flops
store the inputs during one
clock cycle)
• The same clock signal is tied
into all four D flip-flops, so
they change at the same
time
AOU – Fall 2012
A 4-bit parallel in –
parallel out register
73
Sequential circuits
Examples of Sequential Circuits – A register (3/3)
 Example:
• The first input is “0000”
• On the first clock tick,
“0000” is sent to the
output
• This “0000” is still an
output until the next
clock tick (even if the
input disappears or is
replaced)
• On the second clock tick,
the output is set to the
new input “0110”
• And so on…
AOU – Fall 2012
00
00
10
01
10
01
00
00
74
Lecture Overview





Boolean Algebra
Logic gates
Digital Components
Combinational circuits
Sequential circuits
•
•
•
•
Introduction
Clocks
Flip-Flops
Examples of Sequential Circuits
- Register
- Counter
AOU – Fall 2012
75
Sequential circuits
Examples of Sequential Circuits – A counter (1/4)
 As any other sequential circuit, a counter is
formed by a group of flip-flops.
 Those are connected is such a way as to
produce the prescribed sequence of binary
states
 A 4-bit counter is here described
AOU – Fall 2012
76
Sequential circuits
Examples of Sequential Circuits – A counter (2/4)
 To understand how a counter works, we
should analyze the binary sequence
produced by it.
 For instance, a 4 bit counter produces the
sequence presented in the next table
• The LSB is complemented each time
• Each of the other bits changes state from 0
to 1 when all bits to the right are equal to 1.
 We hence need to use flip-flops that
complement a current state, a JK flip-flop
AOU – Fall 2012
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
1
1
77
Sequential circuits
Examples of Sequential Circuits – A counter (3/4)
 The sequential circuit
of a 4-bit counter is
shown in the next
picture
• B0 is the LSB
• B3 is the MSB
 A “Count Enable”
line is added to
start/stop counting
• CE = 1 : counting is
on
• CE = 0: counting is
off
Co1
Co2
Co3
Co4
AOU – Fall 2012
78
Sequential circuits
Examples of Sequential Circuits – A counter (4/4)
 Analyze the last circuit very to make sure you
understand how this circuit counts from 0000
to 1111
 Remember that the output changes only
when the clock ticks
 What happens if the current state is 1111 and
the clock is pulsed?
 What is the job of “Output Carry” (OC) line?
AOU – Fall 2012
79
End of lecture 3
Try to solve all exercises related to lecture 3