Beruflich Dokumente
Kultur Dokumente
Flip-Flops, Registers,
and Counters,
Arry Akhmad Arman
School of Electrical Engineering and Informatics
Institut Teknologi Bandung
Last Update : September 2010
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
7.0
Basic Understanding
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
Digital Circuit
Synchronous
Se
Sequential
Se
Digital Circuit
Asynchronous
Se
3
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
Combinational
Circuit
Sequential
Circuit
4
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
There is
Memory!
There is
Feedback line!
Dinamic
characteristic,
Represented by
STATE DIAGRAM!
Combinational
Circuit
Static
characteristic,
Represented by
TRUTH TABLE!
Sequential
Circuit
5
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
A(H)
B(H)
C(H)
Timing Diagram
waktu
A B C
0 1 0
Variabel-variabel STATE
0 1 1
1 0 0
PREVIOUS STATE
1 0 1
1 1 0
1 1 1
0 0 0
0 0 1
NEXT STATE
6
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
Memory Element
in Sequential Circuit
Memory is an important element in
Sequential Logic Circuit
Set
Sensor
Reset
Memory
Element
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
On Off
Alarm
Type of Memories
[different input lines]
Q
Memory
J
K
K
Memory
Clock
Q
Memory
K
Preset
Clear
Memory
Clock
8
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
Memory Implementation
Simple,
Uncontrolled
Controlled
Memory
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
7.1
Basic Latch
10
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
10
Simple Controllable
NOR Memory
Q=0
if Reset=1
Q=1
if Set=1
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
11
NOR Memory
R
Qa
Qb
S
(a) Circuit
t1
t2
S R
Qa Qb
0
0
1
1
0/11/0
0 1
1 0
0 0
0
1
0
1
(no change)
t4
t5
t6
t7
t8
t9
t10
1
R
0
1
S
Qa
0
1
?
0
Qb
1
?
0
Time
(c) Timing diagram
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
12
7.2
Gated SR Latch,
Flip-Flop
7.7
13
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
13
Gated SR Latch
Q
Clk
Clock!
S or R active if
clock active
Q
S
S
(a) Circuit
Clk
1
Clk S
Q( t + 1 )
0
1
Q
0
Q
Previous
NOR Memory
0
Time
(c) Timing diagram
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
14
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
15
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
Clk
Q(t+1)
Q(t)
16
Q(t+1)
Q(t )
Q(t )
Q(t )
Notes:
Dalam CPLD MAX7000
terdapat configurable FF
yang dapat diset menjadi
D-FF atau T-FF
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
17
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
Clk
J-K
XX
Q(t+1)
Q(t )
00
Q(t )
01
10
11
Q(t )
18
Clk
D
Q
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
19
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
20
Edge-Triggered D Flip-Flop
Pada edge triggered FF,
perubahan di sisi output
hanya terjadi pada saat
sisi naik/turun clock.
Pada negative edge triggered,
perubahan terjadi pada saat
clock berubah dari HV ke LV.
Pada positive edge triggered,
perubahan terjadi pada saat
clock berubah dari LV ke HV.
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
21
Pulse triggered
Comparison
Rising
edge triggered
Falling
edge triggered
Perhatikan standar
simbol untuk jenis
clock yang berbeda!
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
22
All Possibilities
Positive
Pulse
Trigger
Negative Pulse
Trigger
Rising Edge
Trigger
Falling Edge
Trigger
D-FF
Positive Pulse
Trigger D-FF
Negative Pulse
Trigger D-FF
Rising Edge
Trigger D-FF
Falling Edge
Trigger D-FF
T-FF
Positive Pulse
Trigger T-FF
Negative Pulse
Trigger T-FF
JK-FF
Positive Pulse
Trigger JK-FF
Negative Pulse
Trigger JK-FF
Rising Edge
Trigger T-FF
Falling Edge
Trigger T-FF
Rising Edge
Trigger JK-FF
Falling Edge
Trigger JK-FF
23
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
23
Clock
Clear
(a) Circuit
Preset
D
Q
Q
Clear
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
24
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
25
7.8
Registers
26
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
26
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
27
Choose
mode!
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
28
7.9
Counters
29
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
29
Asynchronous Counter
(case: a three-bit up-counter)
1
Clock
Q
Q0
Q
Q
Q1
Q2
Clock
Q0
Q1
Q2
Count
000
001
010
011
100
101
110
111
000
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
30
Asynchronous Counter
(case: a three-bit down-counter)
1
Clock
Q
Q0
Q
Q
Q1
Q2
Clock
Q0
Q1
Q2
Count
000
111
110
101
100
011
010
001
000
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
31
Synchronous Counter
(case: a three-bit synchronous up-counter)
Clock
cycle
T0 =1
T 1 = Q0
T 2 = Q0Q1
T 3 = Q0Q1Q2
...
Tn = Q0Q1 L Qn 1
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
0
1
2
3
4
5
6
7
8
Q2 Q1 Q0
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
Q1 changes
Q2 changes
32
Synchronous Counter
(case: a four-bit synchronous up-counter)
1
Q0
Clock
Q1
Q
Q2
Q
Q
Q3
Q
(a) Circuit
All clock lines
connected
together
Clock
Q0
Q1
Q2
Q3
Count 0
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
10 11
12 13
14 15
33
Inclusion of
Enable and Clear Capability
1
Clock
Q
Q0
Q
Q1
Q
Q2
Q
Without
Enable and Clear
Q
Q3
Q
With
Enable and Clear
Enable
Clock
Q
Q
Q
Q
Q
Q
Q
Q
Clear
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
34
Synchronous Counter
with D Flip-Flop
D0 = Q0 = 1 Q0
D1 = Q1 Q0
D2 = Q2 Q1Q0
D3 = Q3 Q2Q1Q0
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
35
Counter with
Parallel-Load Capability
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
36
7.10
Reset Synchronization
37
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
37
Enable
D0
Q0
D1
Q1
D2
Q2
Load
Clock
Clock
A modulo-6
counter
with
synchronous
reset
(a) Circuit
Clock
Q0
Q1
Q2
Count 0
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
38
When Q0=1
and Q2=1 ,
Data=000
loaded
Enable
D0
Q0
D1
Q1
D2
Q2
Load
Clock
Clock
A modulo-6
counter
with
synchronous
reset
(a) Circuit
Clock
Q0
Q1
Q2
Count 0
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
39
Clock
Q0
Q1
Q2
Reset
(Clear)
line!
(a) Circuit
A modulo-6
counter
with
asynchronous
reset
Clock
Q0
Q1
Q2
Count 0
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
40
7.11
Other Types of
Counters
41
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
41
BCD Counter
Reset after 9,
enable next digit
to count.
Reset
after 9
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
42
BCD Counter
BCD
to
7-Segment
Converter
BCD
to
7-Segment
Converter
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
43
Type of 7-Segments
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
44
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
45
Ring Counter
(n-bit Ring Counter)
feedback line
1000
0100
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
0010
0001
46
0100
0010
0001
00
01
10
11
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
47
Johnson Counter
Feedback line
is taken from
complement line
0000
1000
1100
1110
1111
0111
0011
0001
0000
12
14
15
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
48
7.12
Using Storage Elements
with CAD Tools
49
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
49
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
50
Gated D Latch
generated by CAD Tools
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
51
Implementation of
Fig 7.31
in CPLD
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
52
Timing Simulation
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
53
Instantiating of D-FF
from a package
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
LIBRARY altera ;
USE altera.maxplus2.all ;
ENTITY flipflop IS
PORT ( D, Clock
Resetn, Presetn
Q
END flipflop ;
: IN
: IN
STD_LOGIC ;
STD_LOGIC ;
: OUT
STD_LOGIC ) ;
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
54
End of slides
School of Electrical Engineering and Informatics ITB, 2010, Arry Akhmad Arman
55