Sequential Logic Circuits
-
Upload
dilum-bandara -
Category
Engineering
-
view
380 -
download
4
Transcript of Sequential Logic Circuits
![Page 1: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/1.jpg)
Sequential Logic Circuits
CS2052 Computer Architecture
Computer Science & Engineering
University of Moratuwa
Dilum [email protected]
![Page 2: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/2.jpg)
Blocks of a Microprocessor
2
Literal
Address
Operation
Program
Memory
Instruction
Register
STACK Program CounterInstruction
Decoder
Timing, Control and Register selection
Accumulator
RAM &
Data
Registers
ALU
IO
IOFLAG &
Special
Function
Registers
Clock
Reset
Interrupts
Program Execution Section Register Processing Section
Set upSet up
Modify
Address
Internal data bus
Source: Makis Malliris & Sabir Ghauri, UWE
![Page 3: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/3.jpg)
Sequential Circuits
Binary values of outputs are a function of binary
combination of inputs & previous outputs
Outputs at any given time are dependent on
inputs that are present at that time as well as
previous outputs3
Source: www.electronics-tutorials.ws/sequential/seq_1.html
![Page 4: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/4.jpg)
Sequential Circuits (Cont.)
4
Combinational
Circuitsn inputs
m outputs
Flip-flops
Clock
![Page 5: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/5.jpg)
Source: www.eeweb.com/electronics-quiz/j-k-flip-flop
Flip-Flops
Binary cell capable of storing 1 bit information
Usually has 2 outputs
Output (Q)
Complement of output (Q/)
Output changes only when a clock pulse is applied
State is then maintained
Types
SR Flip-Flop
D Flip-Flop
JK Flip-Flop
T Flip-Flop 5
![Page 6: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/6.jpg)
SR Flip-Flop
S – Set, R – Reset
Output changes only when a clock pulse is applied
When input is 11, output is unpredictable
May change to 0 or 1 depending internal delays
SR should not be pulsed when input is 11
Preventing this is difficult rarely used in circuits 6
S R Qt+1
0 0 Qt No change
0 1 0 Clear to 0
1 0 1 Set to 1
1 1 ? Indeterminate
![Page 7: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/7.jpg)
How SR Flip-Flop Works
7
Source: wikimedia.org
![Page 8: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/8.jpg)
SR Flip-Flop – Logic Representation
8
Source: http://www.circuitstoday.com/flip-flops
![Page 9: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/9.jpg)
D Flip-Flop
D – Data
Inverter is added between S & R inputs
11 input combination is avoided 9
D Qt+1
0 0 Clear to 0
1 1 Set to 1
Responds to falling edge of clock signal
![Page 10: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/10.jpg)
Edge-Triggered Flip-Flops
Change states on either positive-edge (rising edge)
or negative-edge (falling edge) of clock pulse
10
Source: www.electronics-tutorials.ws/counter/count_3.html
![Page 11: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/11.jpg)
JK Flip-Flop
11 input combination is now defined
11
J K Qt+1
0 0 Qt No change
0 1 0 Clear to 0
1 0 1 Set to 1
1 1 Q/t Complement
![Page 12: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/12.jpg)
T Flip-Flop
Toggles output
12
T Qt+1
0 Qt No change
1 Q/t Complement
![Page 13: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/13.jpg)
Registers
Capable of storing a set of bits
Built using Flip Flops
13
CLK – Clock
CD – Clear/Reset
LD – Load
![Page 14: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/14.jpg)
4-bit Register
This is called a parallel-in, parallel-out register
14
Source: http://virtual-labs.ac.in/labs/cse10/reg_cnt_design.html
![Page 15: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/15.jpg)
4-bit Register (Cont.)
15Source: www.edwardbosworth.com
![Page 16: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/16.jpg)
4-bit Serial-In, Serial-Out Register
16
Source: http://virtual-labs.ac.in/labs/cse10/reg_cnt_design.html
![Page 17: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/17.jpg)
Blocks of a Microprocessor
17
Literal
Address
Operation
Program
Memory
Instruction
Register
STACK Program CounterInstruction
Decoder
Timing, Control and Register selection
Accumulator
RAM &
Data
Registers
ALU
IO
IOFLAG &
Special
Function
Registers
Clock
Reset
Interrupts
Program Execution Section Register Processing Section
Set upSet up
Modify
Address
Internal data bus
Source: Makis Malliris & Sabir Ghauri, UWE
![Page 18: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/18.jpg)
Sift Registers
Multiply 5 by 2, 5 by 4, 5 by 8
Divide 48 by 2, by 4, by 8
Can sift bits either to left or right
Basic shift register is same as serial-in, serial-
out register
18
Source: http://virtual-labs.ac.in/labs/cse10/reg_cnt_design.html
![Page 19: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/19.jpg)
Serial-In, Parallel-Out Shift Register
There are also
Parallel-in, serial out shift registers
Bidirectional shift registers
19
Source: http://virtual-labs.ac.in/labs/cse10/reg_cnt_design.html
![Page 20: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/20.jpg)
Binary Counters
Register that goes through a predetermined
sequence of states is called a counter
e.g., 000, 001, 010, …. 110, 111
e.g., 001, 010, 100, 001, 010, …
Useful in counting, timing, generating patterns, etc.
20
![Page 21: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/21.jpg)
Example – 3-bit Binary Counter
Suppose we want to count from 0 to 7
21Source: http://osp.mans.edu.eg/cs212/Seq_circuits_counter-design_ex_1_5.htm
![Page 22: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/22.jpg)
Example – Counter (Cont.)
Suppose we want to count from 0 to 7
000
001
010
011
100
101
110
111
000
…22
Alternate
Change if all lower order bits
(in previous round) were 1s
Build counter using JK Flip Flops
![Page 23: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/23.jpg)
Excitation Tables
Truth tables tell us what will be the output for a
given combination of inputs
Sometimes we want to find what inputs to give to
achieve a desired output
Can be achieved via excitation tables
23
J K Qt+1
0 0 Qt
0 1 0
1 0 1
1 1 Q/t
Qt Qt+1 J K
0 0
0 1
1 0
1 1
![Page 24: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/24.jpg)
Excitation Table – JK Flip Flop
24
Qt Qt+1 J K
0 0
0 1
1 0
1 1
J K Qt+1
0 0 Qt
0 1 0
1 0 1
1 1 Q/t
Qt Qt+1 J K
0 0 0 X
0 1 1 X
1 0 X 1
1 1 x 0
Qt Qt+1 J K
0 0 0 0/1
0 1 1 0/1
1 0 0/1 1
1 1 0/1 0
![Page 25: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/25.jpg)
Excitation Table – Other Flip Flops
25
Qt Qt+1 S R
0 0 0 X
0 1 1 0
1 0 0 1
1 1 x 0
Qt Qt+1 D
0 0 0
0 1 1
1 0 0
1 1 1
Qt Qt+1 T
0 0 0
0 1 1
1 0 1
1 1 0
![Page 26: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/26.jpg)
Example – Counter (Cont.)
26
Qt Qt+1 Q2 Q1 Q0
Q2 Q1 Q0 Q2 Q1 Q0 J2 K2 J1 K1 J0 K0
0 0 0 0 0 1
0 0 1 0 1 0
0 1 0 0 1 1
0 1 1 1 0 0
1 0 0 1 0 1
1 0 1 1 1 0
1 1 0 1 1 1
1 1 1 0 0 0
![Page 27: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/27.jpg)
Example – Counter (Cont.)
27
Qt Qt+1 Q2 Q1 Q0
Q2 Q1 Q0 Q2 Q1 Q0 J2 K2 J1 K1 J0 K0
0 0 0 0 0 1 0 X 0 X 1 X
0 0 1 0 1 0 0 X 1 X X 1
0 1 0 0 1 1 0 X X 0 1 X
0 1 1 1 0 0 1 X X 1 X 1
1 0 0 1 0 1 X 0 0 X 1 X
1 0 1 1 1 0 X 0 1 X X 1
1 1 0 1 1 1 X 0 X 0 1 X
1 1 1 0 0 0 X 1 X 1 X 1
![Page 28: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/28.jpg)
Example – Counter (Cont.)
Now draw K-maps for all 6 inputs
28Source: http://osp.mans.edu.eg/cs212/Seq_circuits_counter-design_ex_1_5.htm
J0 = K0 = 1
J1 = K1 = Q0
J2 = K2 = Q1 * Q0
![Page 29: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/29.jpg)
Example – Counter (Cont.)
29
Source: http://osp.mans.edu.eg/cs212/Seq_circuits_counter-design_ex_1_5.htm
![Page 30: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/30.jpg)
Exercise – Counter
Build a 0 to 7 counter using T Flip Flops. Show
all steps
Your circuit should be similar to following
30
Source: http://osp.mans.edu.eg/cs212/Seq_circuits_counter-design_ex_1_6.htm
![Page 31: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/31.jpg)
Example – Counter With External
Input
Suppose we want to build a 0 to 3 counter that
increments only when a push button is pressed
31
00
1101
10
01
00
11
10
Pressed
Pressed Pressed
Pressed
! Pressed
! Pressed
! Pressed
! Pressed
![Page 32: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/32.jpg)
Example – Counter With External
Input (Cont.)
32
Qt Qt+1 Q1 Q0
Q1 Q0 B Q1 Q2 J1 K1 J0 K0
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 1 0
1 0 1 1 1
1 1 0 1 1
1 1 1 0 0
![Page 33: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/33.jpg)
Example – Counter With External
Input (Cont.)
33
Qt Qt+1 Q1 Q0
Q1 Q0 B Q1 Q0 J1 K1 J0 K0
0 0 0 0 0 0 X 0 X
0 0 1 0 1 0 X 1 X
0 1 0 0 1 0 X X 0
0 1 1 1 0 1 X X 1
1 0 0 1 0 X 0 0 X
1 0 1 1 1 X 0 1 X
1 1 0 1 1 X 0 X 0
1 1 1 0 0 X 1 X 1
J1 = K1 = Q0B
J0 = K0 = B
![Page 34: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/34.jpg)
Example – Counter With External
Input (Cont.)
Another solution
Use a normal 0-3 counter & connect push button to
clock input
34
![Page 35: Sequential Logic Circuits](https://reader036.fdocuments.net/reader036/viewer/2022081721/55a501341a28abe4098b4635/html5/thumbnails/35.jpg)
State Diagrams
State transition diagram for a washing machine
35
Source: http://courses.cs.washington.edu/courses/cse370/96au/assignments/hw8/hw8_soln/hw8_soln.html