Quiz 2

Counters, Registers, and Shift Registers

579 words
3 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Counters, Registers, and Shift Registers ## 🎯 Learning Objectives - Design synchronous and asynchronous counters - Implement registers using D flip-flops - Design shift registers for serial/parallel conversion - Analyze counter timing and propagation delays * * * ## 1. Registers ### 1.1 4-bit Register using D Fli...

Counters, Registers, and Shift Registers

🎯 Learning Objectives

  • Design synchronous and asynchronous counters
  • Implement registers using D flip-flops
  • Design shift registers for serial/parallel conversion
  • Analyze counter timing and propagation delays

1. Registers

1.1 4-bit Register using D Flip-Flops

(Diagram) Operation: On clock edge, Qᵢ = Dᵢ for all bits simultaneously (parallel load).

2. Shift Registers

2.1 Serial-in, Parallel-out (SIPO)

(Diagram) Tracing: Input 1011 (MSB first):
ClockDINQ0Q1Q2Q3
00000
111000
200100
311010
411101
After 4 clocks, Q3Q2Q1Q0 = 1011 (parallel output).

3. Counters

3.1 Synchronous Counter

All flip-flops clocked simultaneously. Faster but more complex logic. 3-bit synchronous binary counter:
StateQ2Q1Q0
0000
1001
2010
3011
4100
5101
6110
7111
Logic: Q0_toggle always; Q1_toggle when Q0=1; Q2_toggle when Q0=Q1=1.

3.2 Asynchronous (Ripple) Counter

Each FF clocks the next. Simple but slower (propagation delay accumulates). 4-bit ripple counter:
  • Clock → FFA (LSB)
  • FFA output → FFB clock
  • FFB output → FFC clock
  • FFC output → FFD clock Delay: 4 × propagation delay per FF. For 4 FF at 10ns each = 40ns. Max frequency = 1/(40ns) = 25 MHz.

3.3 Comparison

FeatureSynchronousAsynchronous
SpeedFast (limited by 1 FF + logic)Slow (n × FF delay)
ComplexityHigher (more gates)Lower
GlitchesNoYes (ripple effect)
PowerHigher (all clocked)Lower
Use caseHigh-speed, preciseLow-power, simple

4. Applications

ComponentApplication
RegisterCPU registers, data storage
Shift registerSerial communication (UART), LED matrix
Synchronous counterProgram counter, timer
Asynchronous counterFrequency divider, low-power counter
Ring counterSequence generator, traffic light control

5. Common Pitfalls

Pitfall: Propagation Delay in Ripple Counters

The mistake: Clocking a ripple counter too fast, causing invalid intermediate states. Correct approach: Max clock frequency = 1/(n × t_pd). For n=8-bit counter, t_pd=10ns: max = 1/(80ns) = 12.5 MHz.

6. Key Concepts Reference

ConceptDescription
RegisterSet of flip-flops storing n bits
Shift registerSerial/parallel data conversion
Synchronous counterAll FFs clocked together
Asynchronous counterFFs clocked sequentially (ripple)
ModulusNumber of states in counter
Ring counterShift register with feedback

7. 📝 Practice Questions

Q1: Design a mod-6 synchronous counter (states 0→1→2→3→4→5→0).
Answer: Use 3 FFs (need 2³ ≥ 6 states). Toggle conditions:
  • Q0: toggle always
  • Q1: toggle when Q0=1 AND NOT (Q2=1 AND Q1=0 AND Q0=1) [skip state 6]
  • Q2: toggle when Q0=Q1=1 AND NOT (Q2=1 AND Q1=0 AND Q0=0) [skip state 7] Reset logic: when state=6 (110), reset to 0. Q2: A 4-bit ripple counter uses FFs with 8ns propagation delay. What's max frequency?
Answer: Total delay = 4 × 8ns = 32ns. Max frequency = 1/(32ns) = 31.25 MHz. For reliable operation, use 80% of this: ~25 MHz. Q3: Show how a shift register converts serial data to parallel.
Answer: 4-bit SIPO shift register: serial data enters Q0, each clock shifts right. After 4 clocks, data appears at Q3Q2Q1Q0 in parallel. Used in UART receivers to convert incoming serial bits to parallel byte. Q4: Why do synchronous counters not have glitches?
Answer: All flip-flops update simultaneously on the clock edge. Even though the next-state logic settles at different times, the outputs only change on the clock edge when all inputs are stable. Asynchronous counters update sequentially: intermediate states are visible at the outputs (e.g., 7→8 shows 7→6→4→0→8 in binary: 0111→0110→0100→0000→1000).

8. 🔗 Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.