Codiode
All tracks
Circuit Lab · Intermediate

Counters

Design any modulus counter from ripple to synchronous. Learn lockup analysis and self-correcting counter techniques.

What you will learn

Counters appear in timers, clock dividers and state machines everywhere. This track covers:

  • Ripple (asynchronous) binary counter
  • Synchronous binary counter
  • Mod-N counter design for any modulus
  • Up/down counter and BCD decade counter (mod-10)
  • Johnson and ring counters
  • Self-correcting counter design and lockup state analysis
139 problems in 10 sections
139 problems in 10 sections
Section 1

Ripple (Asynchronous) Binary Counter

12
014-Bit Ripple Binary Counter from T Flip-FlopsBuild10 GE024-Bit Ripple Counter from D Flip-Flops Wired as ToggleBuild10 GE034-Bit Ripple Counter: Propagation StaggerTiming15 GE04Ripple Counter Maximum Clock Frequency DerivationAnalyze25 GE05Ripple Counter with Asynchronous CLEARBuild15 GE06Ripple Counter CLR Timing WaveformTiming15 GE074-Bit Ripple Down-CounterBuild15 GE08Ripple Down-Counter Waveform TraceTiming15 GE09Ripple Counter: Wrong Trigger Stage DebugDebug15 GE10Ripple Counter: Q2 Stuck-at-0 Fault DebugDebug25 GE11Ripple Counter: Glitch Duration CalculationAnalyze25 GE12Ripple Counter Cascaded for 8-Bit CountBuild25 GE
Section 2

Synchronous Binary Counter

14
134-Bit Synchronous Binary Counter: Carry Chain DerivationBuild10 GE144-Bit Synchronous Counter TimingTiming10 GE154-Bit Synchronous Counter with Terminal CountBuild15 GE16Cascaded 4-Bit Synchronous CountersTiming15 GE17Synchronous Counter with Synchronous LoadBuild15 GE18Synchronous Counter Missing Carry Term DebugDebug15 GE19Synchronous Counter Q3 Stuck-at-0 DebugDebug25 GE204-Bit Synchronous Counter Using JK Flip-FlopsBuild25 GE21Synchronous Counter with EnableTiming15 GE22Synchronous Counter Carry ChainTiming25 GE23Synchronous Reset PriorityTiming15 GE248-Bit Synchronous Counter with Carry-LookaheadBuild25 GE25Synchronous Counter: Gate Count vs. Ripple CounterAnalyze15 GE26Synchronous Counter: Count Sequence VerificationTiming10 GE
Section 3

Mod-N Counter Design

19
27Mod-5 Counter: Synchronous Reset ApproachBuild10 GE28Mod-6 Counter: One-Cycle Terminal State WaveformTiming10 GE29Mod-6 Counter: Synchronous ResetBuild10 GE30Mod-6 Counter: Next-State TableBuild15 GE31Mod-3 CounterBuild15 GE32Mod-N Counter: Synchronous vs. Async Reset Terminal State ComparisonTiming15 GE33Mod-10 Counter: Synchronous Reset DecodeBuild15 GE34Mod-6 Counter: Self-Correcting (No Don't-Cares)Build25 GE35Mod-6 Counter Reset Decode Wrong Bit DebugDebug15 GE36Mod-7 Counter: Full Next-State Table DesignBuild25 GE37Mod-9 Counter: 4-Bit Design with Multiple Don't-CaresBuild25 GE38Mod-12 Counter: Cascade of Mod-3 and Mod-4Build25 GE39Mod-12 Counter: Cascade Timing WaveformTiming25 GE40Programmable Modulus Counter: Comparator-Based ResetBuild25 GE41Mod-60 CounterBuild25 GE42Mod-N Counter: Non-50% Duty Cycle AnalysisTiming15 GE43Mod-N Counter with Enable: Modulus PreservationTiming15 GE44Mod-N Counter: Off-by-One in Terminal Count Detection DebugDebug25 GE45Mod-N Counter: Two Approaches ComparedAnalyze15 GE
Section 4

Up/Down Counter

14
464-Bit Synchronous Up/Down Counter: T Expression DerivationBuild15 GE47Up/Down Counter: Direction Change Mid-Count WaveformTiming10 GE48Up/Down Counter: Overflow and Underflow DetectionBuild15 GE49Up/Down Counter: Direction Change at Terminal CountTiming25 GE504-Bit Up/Down Counter with Parallel LoadBuild25 GE51Up/Down Counter: DOWN Mode Counting UP DebugDebug15 GE524-Bit Up/Down Counter Using D Flip-Flops: K-Map DerivationBuild25 GE53Decade Up/Down CounterBuild25 GE54Up/Down Counter: Timing Analysis for DOWN ModeAnalyze25 GE55Bidirectional Ring CounterBuild25 GE56Up/Down Counter: Saturating ModeTiming15 GE57Up/Down Counter: Underflow Detection Missing DebugDebug25 GE58Up/Down Counter with 7-Segment DisplayBuild15 GE59Up/Down Counter: Enable Direction LatchTiming25 GE
Section 5

BCD Decade Counter

17
60BCD Decade Counter: Synchronous Reset ConstructionBuild10 GE61BCD Counter: Full Decade WaveformTiming10 GE62BCD Counter: Next-State Table DerivationBuild15 GE63BCD Counter: Carry Out for CascadeBuild15 GE64Two-Digit BCD CounterBuild25 GE65BCD Counter: Self-Correction from Invalid StatesBuild25 GE66BCD Counter: State 12 Lockup DebugDebug25 GE67BCD Counter: Reset at 8 Instead of 10 DebugDebug15 GE68BCD Counter with Enable: Count PreservationTiming15 GE694-Digit BCD Counter: 0000 to 9999Build25 GE70BCD Counter Gate Count Analysis: Simplified vs. BinaryAnalyze25 GE71BCD Counter: Power-On Invalid State Recovery TraceTiming25 GE72BCD Counter Sequence ErrorDebug15 GE73BCD Counter: CO Timing Relative to Clock EdgeTiming15 GE74BCD Counter: 7-Segment Decoder IntegrationBuild15 GE75BCD Counter: Synchronous vs. Asynchronous ResetTiming25 GE76BCD Counter: 3-Stage CascadeBuild25 GE
Section 6

Johnson Counter

12
774-Bit Johnson Counter: Basic ConstructionBuild10 GE784-Bit Johnson Counter: Full Sequence TraceTiming10 GE79Johnson Counter: Glitch-Free DecodeTiming15 GE804-Bit Johnson Counter: Lockup State Complete AnalysisAnalyze25 GE81Johnson Counter: Q Feedback Instead of Q_bar DebugDebug15 GE82Johnson Counter: 8-Phase Clock GeneratorBuild15 GE83Johnson Counter: 8-State Sequence TraceTiming10 GE843-Bit Johnson CounterBuild10 GE85Johnson Counter: State Count Efficiency ComparisonAnalyze15 GE86Johnson Counter: One Flip-Flop Stuck at 0Debug25 GE87Johnson vs. Ring Counter: Area and Timing Comparison for 8-State SequenceAnalyze15 GE88Johnson Counter: Non-Glitchy Decoded Output During TransitionTiming15 GE
Section 7

Ring Counter

12
894-Bit Ring Counter: Basic Construction with Initial PresetBuild10 GE904-Bit Ring Counter: Full Sequence TraceTiming10 GE91Ring Counter: Lockup State AnalysisAnalyze25 GE92Ring Counter: Self-Correction for Any Invalid StateBuild25 GE93Ring Counter: Invalid State Never Reaches Valid SequenceTiming15 GE94Ring Counter: Wrong Feedback Stage DebugDebug15 GE95Ring Counter vs. Johnson Counter: Area Comparison for 8 PhasesAnalyze15 GE96Ring CounterBuild10 GE97Ring Counter: Glitch-Free Output PropertyAnalyze15 GE98Ring Counter: Asynchronous Preset for Power-On InitializationBuild15 GE998-Bit Ring Counter: Period and State VerificationTiming15 GE100Ring Counter: Initialization via Synchronous LoadBuild15 GE
Section 8

Self-Correcting Counter Design

14
101Don't-Care Self-Loop Audit: Post-Optimization CheckAnalyze15 GE102Mod-6 Counter: Self-Correction by Explicit Next-State AssignmentBuild15 GE103Mod-6 Counter: State 7 Self-LoopDebug25 GE104BCD Counter: Self-Correction for All Six Invalid StatesBuild25 GE105Counter: Recovery Within 1 Cycle vs. 2 Cycle SpecificationTiming25 GE1064-Bit Custom Counter: Complete State Transition DiagramAnalyze25 GE107Counter: Adding Minimal Lockup Correction GateBuild25 GE108Self-Correcting Ring Counter: One-Hot Detection CircuitBuild25 GE109Counter: Worst-Case Recovery Time for Multi-State Invalid ChainAnalyze25 GE110Counter: Self-Correcting but Skips Valid State DebugDebug25 GE111Self-Correction with Synchronous LoadBuild25 GE112Johnson Counter: Self-Correction for 2-State Lockup CycleBuild25 GE113Mod-9 Counter: Self-Correction VerificationTiming25 GE114Self-Correcting Counter: State 3 RecoveryBuild25 GE
Section 9

Lockup State Analysis and Recovery

10
115Unknown Counter: Reverse-Engineer from Excitation EquationsAnalyze25 GE116Counter: Two Separate Invalid State CyclesAnalyze25 GE117Counter: Minimum Gate Correction for Single Self-LoopBuild25 GE118Counter from State Diagram: ImplementationBuild25 GE119Counter: Wrong Sequence DiagnosisDebug25 GE120Counter: K-Map Don't-Care Resolves to LockupAnalyze25 GE121Counter: Maximal Valid Sequence Design (15 of 16 States)Build25 GE122Counter: Lockup Detection Output SignalBuild15 GE123Counter: Recovery to Non-Zero Target StateBuild25 GE124Counter: Distinguishing Logic Error from Stuck-at FaultDebug25 GE
Section 10

Counter Design from Scratch

15
1253-Bit Gray Code CounterBuild15 GE1264-Bit Counter from Timing Diagram: Reverse EngineerBuild25 GE1274-Bit Step-3 Counter: Custom SequenceBuild25 GE128LFSR: Self-Correction for All-Zeros LockupBuild15 GE129LFSR Sequence Trace: Non-Binary Pattern VerificationTiming15 GE130Custom Even-Number Sequence CounterBuild25 GE131Counter: Identifying Count Type from WaveformAnalyze25 GE132LFSR vs. Binary Counter: Timing Advantage AnalysisAnalyze25 GE133Sequence Counter Partial SpecificationBuild25 GE134LFSR as a Counter: 4-Bit Maximal-Length SequenceBuild25 GE135Counter Type Identification: Eliminate Possibilities by Bit-Change CountAnalyze15 GE136Minimum Flip-Flop Count for Mod-N CounterAnalyze15 GE137Complete Counter DesignBuild25 GE138Depth Constraints of Gray Code PointersAnalyze15 GE139Pessimistic vs Optimistic Flag GenerationAnalyze25 GE