ECE2030 Introduction to Computer Engineering Lecture 15: Registers, Toggle Cells, Counters Prof. Hsien-Hsin Sean Lee Prof. Hsien-Hsin Sean Lee School of Electrical and Computer School of Electrical and Computer Engineering Engineering Georgia Tech Georgia Tech
23
Embed
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Registers, Flip-Flops, Toggle Cells, Counters
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
ECE2030 Introduction to Computer Engineering
Lecture 15: Registers, Toggle Cells, Counters
Prof. Hsien-Hsin Sean LeeProf. Hsien-Hsin Sean LeeSchool of Electrical and Computer EngineeringSchool of Electrical and Computer EngineeringGeorgia TechGeorgia Tech
2
4-bit Register• Register is the most fundamental storage,
e.g.– x86 ISA has 8 general purpose registers – MIPS ISA has 32 general purpose registers
• Each 1-bit Flip-flop is a single bit register• Cascade 4 of 1-bit FFs = A 4-bit Register
in0in0
1-bit D1-bit DFlip FlopFlip Flop
11
out0out0
22
in1in1
1-bit D1-bit DFlip FlopFlip Flop
out1out1
in2in2
1-bit D1-bit DFlip FlopFlip Flop
out2out2
in3in3
1-bit D1-bit DFlip FlopFlip Flop
out3out3
3
Read/Write Control a Register• Read: Retrieve data stored inside a flip-flop• Write: Update with a new input data into a flip-flop• Given 1 and 2 are continuous clock signals
OutputOutput1-bit D1-bit DFlip FlopFlip Flop
11 22
In In READREAD mode mode
OutputOutput1-bit D1-bit DFlip FlopFlip Flop
11 22
InputInput
In In WriteWrite mode mode
4
Read/Write Control a Register
OutputOutput1-bit D1-bit DFlip FlopFlip Flop
11 22InputInput
R/W
5
Another Read/Write Control of a Register
OutputOutput1-bit D1-bit DFlip FlopFlip Flop
11 22
InputInput
R/WClock Gating
6
4-bit Register with Parallel LoadQ3Q3
1 2
D Q
D3D3
R / W
Q2Q2
1 2
D Q
D2D2
Q1Q1
1 2
D Q
D1D1
Q0Q0
1 2
D Q
D0D0
7
Logical Shift Register
1 2
D Q
1 2
D Q
1 2
D Q
1 2
D Q
A3 A2 A1 A0
1 2 1 2 1 2 1 2
Right Shift
8
Arithmetic Shift Register
1 2
D Q
1 2
D Q
1 2
D Q
1 2
D Q
A3 A2 A1 A0
1 2 1 2 1 2 1 2
Right Shift
9
Bidirectional Shift Register with Load (1-bit shown)
4-to-1 Mux11 10 01 00s1
s0
1 2
D Q
1 2
D Q
1 2
D Q Q i+1 Q i Q i-1
Di
00: No shift01: Shift Left10: Shift Right11: Load from Di
Toggle Flip-Flop (Toggle Cell)• Upon every clock, the output result is toggled
D1D1 Q1Q1 D2D2 Q2Q2
D1D1
D1D1
Q1=D2Q1=D2
Q2Q2
EnEn EnEn
EnEn
Transparent latch
Transparent latch
14
Toggle Flip-Flop
D1D1 Q1Q1 D2D2 Q2Q2
11 22
Toggle Enable Bit(or TE bit)
Toggle bit controls to toggle (T=1) or not to toggle (T=0)Toggle bit controls to toggle (T=1) or not to toggle (T=0)
Transparent latch
Transparent latch
15
Toggle F/F with Clear bit
Clear Toggle Enable
Present Output
Next Output
0 X X 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
D1D1 Q1Q1 D2D2 Q2Q2
11 22
TE BitOutputOutput
ClearTransparent
latchTransparent
latch
Note that output changes every clock cycle (e.g.rising edge or falling edge)
16
Toggle F/F Symbol
TE Q
CLR
11 22
Clear TE Present Q Next Q0 X X 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
17
Counters• A register counts up or down per clock period
– Count in binary – Could be preset: (with parallel loads)
• Types of counters– Ripple counter– Synchronous counter– Mod-n counter– Up/down counter– BCD counter– Gray code counter– Ring counter a 1 moves in a ring from one F/F to
the next– Johnson counter (or twisted ring count.) The
MSB is inversed and passed to the LSB)
18
2-bit Ripple CounterTE Q
CLR
11 22
TE Q
CLR
O0O0 O1O1
Count Enable
11
O0O0
19
2-bit Ripple CounterTE Q
CLR
11 22
TE Q
CLR
O0O0 O1O1
Count Enable
11
O0O0
O1O1
0
0
1
0
0
1
1
1
0
0
1
0
0
1
20
4-bit Ripple CounterCount Enable
11
O0O0
O1O1
TE Q
CLR
11 22
TE Q
CLR
O0O0 O1O1
TE Q
CLR
O2O2
TE Q
CLR
O3O3
O2O2
O3O3
21
4-bit Synchronous CounterCount Enable
TE Q
CLR
1122
O0O0
TE Q
CLR
O1O1
TE Q
CLR
O2O2
TE Q
CLR
O3O3
Clocks are applied to Clocks are applied to the inputs of all the F/Fthe inputs of all the F/F
11O0O0
=TE1=TE1O1O1
O2O2
O4O4
22
Modulo-N (or Divide-by-N) Counter
• Mod-N– Count from 0 to N-1– Then reset and start over