Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Dr Pete Sedcole
Department of Electrical & Electronic Engineering • Registers and shift registers
Imperial College London
• Counters: synchronous and asynchronous
http://cas.ee.ic.ac.uk/~nps/
E1.2 Digital Electronics 1 11.1 19 November 2008 E1.2 Digital Electronics 1 11.2 19 November 2008
E1.2 Digital Electronics 1 11.3 19 November 2008 E1.2 Digital Electronics 1 11.4 19 November 2008
Shift registers Shift register operation
• In a shift register, bits move along the register from one flip-flop to
the next flip-flop, like a queue • Bits are input serially into Din
• Many applications, for example: • On the positive edge of the clock, each bit moves right by one flip-
– Conversion of data between parallel format and bit-serial format flop
– Random number generators • The data can be read at any time from the outputs Q[2:0]
• Construction: • Therefore 3 bits can be entered in serial and read out in parallel
format after 3 clock cycles
Q0 Q1 Q2
Din 1D 1D 1D
C1 C1 C1 • Also note that all the flip-flops can be asynchronously reset
R R R • It is also possible to have versions where all flip-flops can be loaded
with data in parallel and read out in serial
CLOCK
CLEAR
E1.2 Digital Electronics 1 11.5 19 November 2008 E1.2 Digital Electronics 1 11.6 19 November 2008
R R R Q0 Q1 Q2 Q3
Din OUT
1D 1D 1D 1D
CLOCK
C1 C1 C1 C1
CLEAR
S S S S
CLOCK
CLOCK PRESET
Q0 Q1 Q2 Q0 Q1 Q2
1D Q 1D Q 1D Q 1D Q 1D Q 1D Q
Q Q Q Q Q Q
CLOCK C1 C1 C1 CLOCK C1 C1 C1
• This counter is asynchronous: the flip-flops are not all clocked with
CLOCK
the same clock signal
• This counter is also known as a ripple counter since changes Q0
“ripple” from one end of the counter to the other
Q1
• Can also be implemented with JK flip-flops
Q2
E1.2 Digital Electronics 1 11.11 19 November 2008 E1.2 Digital Electronics 1 11.12 19 November 2008
Limitations of asynchronous ripple counters Synchronous binary counters
• It takes a small but non-zero amount of time for each flip-flop to • All flip-flops are clocked with the same signal
change state – therefore all outputs change simultaneously
– typically the “Clock-to-Q” time is about 10ns
• It takes time for the changes to ripple through the whole counter • The sequence of the count is controlled by combinational logic
– for an n-bit counter, it would take ~ n x 10ns – this is sometimes called the state sequence
– for a 3-bit counter, this is 30ns – note that synchronous binary counters use both
– so the maximum clock frequency is 1/30ns = 33.3MHz sequential and combinational elements
E1.2 Digital Electronics 1 11.13 19 November 2008 E1.2 Digital Electronics 1 11.14 19 November 2008
A+ A
State diagram Current state Next state combinational 1D
circuit B+ B
Example using
A B C A+ B+ C+ ? C+ C
D flip-flops:
0 0 0 0 0 1