Академический Документы
Профессиональный Документы
Культура Документы
Fall 2002 EECS150 - Lec18-counters Page 1 Fall 2002 EECS150 - Lec18-counters Page 2
selectSum
Fall 2002 EECS150 - Lec18-counters Page 3 Fall 2002 EECS150 - Lec18-counters Page 4
1
Controller using Counters Controller using Counters
State Transition Diagram: Controller circuit Outputs:
Assume presence of two implementation:
counters. An i counter for the
CEi = q2
outer loop and j counter for
inner loop. IDLE START CEj = q1
IDLE q0
CEi,CEj START RSTi = q0
START S R
RST i RSTj = q2
CLK RST
TCj
TC i INNER shiftA = q1
CE counter TC TC i
<inner contol> TCi
INNER q1
shiftB = q2
CEi,CEj S R
creset shiftLOW = q2
TC is asserted when the counter OUTER
reaches it maximum count value. <outer contol> shiftHI = q1 + q2
CEi,CEj TC j
CE is clock enable. The counter reset = q2
RSTj
increments its value on the rising q2 selectSUM = q1
TCj OUTER
edge of the clock if CE is asserted.
S R
Fall 2002 EECS150 - Lec18-counters Page 5 Fall 2002 EECS150 - Lec18-counters Page 6
2
Synchronous Counters Synchronous Counters
All outputs change with clock edge. How do we extend to n-bits?
a+ = a Extrapolate c+: d+ = d abc, e+ = e abcd
Binary Counter Design: c b a c + b+ a+ b+ = a b
Start with 3-bit version and 0 0 0 0 0 1
0 0 1 0 1 0 cb
generalize: 0 1 0 0 1 1 a 00 01 11 10 a+ b+ c+ d+
0 1 1 1 0 0 0 0 0 1 1
1 0 0 1 0 1 1 0 1 0 1
1 0 1 1 1 0
1 1 0 1 1 1 a b c d
c+ = ac + abc + bc
1 1 1 0 0 0 = c(a+b) + c(ab) Has difficulty scaling (AND gate inputs grow with n)
= c(ab) + c(ab)
CE TC
= c ab
a+ b+ c+ d+
a+ b+ c+
a b c d
a b c
CE is count enable, allows external control of counting,
TC is terminal count, is asserted on highest value, allows
cascading, external sensing of occurrence of max value.
Fall 2002 EECS150 - Lec18-counters Page 9 Fall 2002 EECS150 - Lec18-counters Page 10
a b c d
How does this one scale? Generation of TC signals very similar to
/ Delay grows n generation of carry signals in adder. c b a c + b+ a+
Parallel Prefix circuit reduces delay: 0 0 0 1 1 1
0 0 1 0 0 0
a b c d e f g h
0 1 0 0 0 1
0 1 1 0 1 0
1 0 0 0 1 1
1 0 1 1 0 0
log2n
1 1 0 1 0 1
1 1 1 1 1 0
Down-count
log2n
TC a TC b TC c TC c TC d TC e TC f TC g
Fall 2002 EECS150 - Lec18-counters Page 11 Fall 2002 EECS150 - Lec18-counters Page 12
3
Odd Counts Ring Counters
Extra combinational logic can be Alternative: one-hot counters What are these good for?
added to terminate count before 0001, 0010, 0100, 1000, 0001,
max value is reached: 4
q3 q2 q1 q0
Example: count to 12
load 4-bit binary TC
4-bit binary D Q D Q D Q D Q
reset counter S R S R S R S R
counter
reset 0 0 0 0
= 11 ?
Self-starting version:
q3 q2 q1 q0
D Q D Q D Q D Q
= 11 ?
Fall 2002 EECS150 - Lec18-counters Page 13 Fall 2002 EECS150 - Lec18-counters Page 14
Fall 2002 EECS150 - Lec18-counters Page 15 Fall 2002 EECS150 - Lec18-counters Page 16
4
Register Summary Shift-registers
All registers (this semester) Parallel load shift register:
based on Flip-flops:
q3 q2 q1 q0
D Q D Q D Q D Q
S R S R S R S R
reset 0 0 0 0
d3 d2 d1 d0
D Q D Q D Q D Q
Parallel-to-serial converter
S R S R S R S R
Also, works as Serial-to-parallel converter, if q values are
reset 0 0 0 0
0 0 0 0
Xilinx flip-flops employ a clock connected out.
enable (CE) for same purpose.
1 1 1 1 Also get used as controllers (ala ring counters)
load
d3 d2 d1 d0
Fall 2002 EECS150 - Lec18-counters Page 17 Fall 2002 EECS150 - Lec18-counters Page 18
Universal Sift-register