Counters and Registers: State, Storage, and Clocked Updates

Counters and Registers let a digital system remember information between clock events. A counter tracks events or positions in a repeating sequence. A register stores a word of data, such as a sensor reading or a sequence of received bits. To predict either device, identify its current state, active clock edge, and control inputs before calculating the next state.

Stored state and clocked updates

An nn-bit storage device has 2n2^n possible binary patterns. A counter assigns those patterns positions in a sequence; a register treats them as stored data. Their hardware may look similar, but their update rules serve different purposes.


Use the clock-edge convention stated for the device. Here, synchronous devices update on the rising edge. Inputs are assumed stable for the required setup and hold times around that edge. Between active edges, the stored state holds unless an asynchronous control acts.


When several registers share a clock, they use the values present immediately before the edge. A value loaded into one register does not pass through another register on that same edge.


A counter updates its stored count internally, while a shift register moves external data between bit positions.


Counter sequences and timing

The modulus of a counter is the number of states in its repeating count sequence. An enabled modulo-MM up-counter follows


Cnext=(C+1) mod M,C∈{0,1,…,M−1}.C_{\text{next}}=(C+1)\bmod M, \qquad C\in\{0,1,\ldots,M-1\}.


Thus, a modulo-5 counter follows 0,1,2,3,4,0,…0,1,2,3,4,0,\ldots. An nn-bit counter can represent at most 2n2^n states, so choose the smallest integer nn satisfying


2n≥M.2^n\ge M.


A modulo-5 counter needs three bits because 22=4<52^2=4<5 and 23=8≥52^3=8\ge5. Its three unused patterns need a specified recovery rule; their behavior is not determined by the modulus alone.


If a counter increments at a regular rate fincf_{\text{inc}}, one complete cycle takes MM increments. A rollover event, meaning the transition from M−1M-1 to zero, repeats at


frollover=fincM,Trollover=Mfinc.f_{\text{rollover}}=\frac{f_{\text{inc}}}{M}, \qquad T_{\text{rollover}}=\frac{M}{f_{\text{inc}}}.


For a continuously enabled natural binary counter with no resets, bit QiQ_i, numbered from Q0Q_0 at the least significant position, repeats at fclk/2i+1f_{\text{clk}}/2^{i+1}. This bit-frequency rule does not generally apply to truncated sequences.


In a synchronous counter, storage elements receive the same clock. In a ripple counter, a transition propagates through successive stages, so intermediate output patterns can appear before the count settles.



Register operations and controls

A register is a group of storage elements that holds a multi-bit word. Its control inputs determine which operation occurs at an active edge.


Operation

What happens at the active edge

Hold

The stored word remains unchanged.

Parallel load

All bit positions capture their corresponding data inputs.

Shift

Each position captures a neighboring bit; an end position accepts the serial input.

Synchronous reset

The register takes its specified reset value.


For example, display a four-bit word as R3R2R1R0R_3R_2R_1R_0. Define a shift toward higher-numbered positions by


(R3,R2,R1,R0)next=(R2,R1,R0,Din).(R_3,R_2,R_1,R_0)_{\text{next}}=(R_2,R_1,R_0,D_{\text{in}}).


Every right-hand value comes from before the edge. The old R3R_3 leaves the register, and the serial input enters R0R_0. Always use the stated bit mapping because informal shift-direction descriptions can differ.



What to remember

  • Track stored state one active edge at a time.
  • A modulo-MM counter repeats after MM increments.
  • Use the enabled increment rate when calculating rollover timing.
  • Parallel loading captures a word; shifting moves bits between positions.
  • Check reset priority, bit order, and propagation timing before predicting outputs.

Example: Timing and Serial Capture in a Controller

A controller uses a 6.00 kHz6.00\ \text{kHz} clock. A synchronous modulo-12 up-counter starts at zero and increments on every rising edge. It produces a rollover event whenever its count changes from 11 to zero. No resets occur during the interval considered.


The controller also has a separate four-bit serial-input register, initially 00000000. Display its word as R3R2R1R0R_3R_2R_1R_0. On an enabled rising edge, it updates according to


(R3,R2,R1,R0)next=(R2,R1,R0,Din).(R_3,R_2,R_1,R_0)_{\text{next}}=(R_2,R_1,R_0,D_{\text{in}}).


The register is enabled for the first four rising edges. Its serial input values at those edges are, in order, 1,0,1,11,0,1,1. It holds after the fourth edge. All inputs meet setup and hold requirements, and observations are made after propagation has settled.


A four-bit shift register takes serial input at R0 and moves stored bits toward R3.


a) Find the minimum number of counter bits and the counter state after 29 rising edges. Give the state in decimal and in the minimum-width binary representation.


The counter must represent twelve distinct states, from zero through eleven. Compare the capacities of consecutive bit widths:


23=8<12,24=16≥12.2^3=8<12,\qquad 2^4=16\ge12.


The minimum width is therefore four bits. Starting from zero, each complete group of twelve rising edges returns the count to zero. Divide the elapsed increments into complete cycles and a remainder:


29=2(12)+5.29=2(12)+5.


Two cycles use ________ edges, leaving ________ increments. The count after 29 edges is therefore decimal 55, represented with four bits as 01010101.


b) Find the steady rollover-event frequency and the time between consecutive rollover events. Give the results in Hz and ms.


Every clock edge increments the counter, so the increment frequency equals the clock frequency. Twelve increments separate consecutive rollovers:


frollover=6000 Hz12=500 Hz.f_{\text{rollover}}=\frac{6000\ \text{Hz}}{12}=500\ \text{Hz}.


The interval between rollover events is the reciprocal of that frequency:


Trollover=1500 s−1=0.00200 s=2.00 ms.T_{\text{rollover}}=\frac{1}{500\ \text{s}^{-1}}=0.00200\ \text{s}=2.00\ \text{ms}.


Thus, rollover events repeat at 500 Hz500\ \text{Hz}, separated by 2.00 ms2.00\ \text{ms}. These results describe the event repetition, rather than the frequency of an arbitrary counter bit.


c) Find the register word after its four enabled edges and state which bit contains the first received serial value.


At each enabled edge, the old bits move toward higher-numbered positions, and the new serial value enters R0R_0. Update all positions from their pre-edge values:

  1. First edge: starting from 00000000, shift the old R2R1R0=000R_2R_1R_0=000 into R3R2R1R_3R_2R_1 and append the input 11. The word becomes 00010001.
  2. Second edge: starting from 00010001, shift the old R2R1R0=001R_2R_1R_0=001 into R3R2R1R_3R_2R_1 and append the input 00. The word becomes 00100010.
  3. Third edge: starting from 00100010, shift the old R2R1R0=010R_2R_1R_0=010 into R3R2R1R_3R_2R_1 and append the input 11. The word becomes 01010101.
  4. Fourth edge: starting from 01010101, shift the old R2R1R0=101R_2R_1R_0=101 into R3R2R1R_3R_2R_1 and append the input 11. The word becomes 10111011.

The final word is 10111011, which is decimal


1(8)+0(4)+1(2)+1(1)=11.1(8)+0(4)+1(2)+1(1)=11.


The first received value has moved from R0R_0 to R1R_1, then R2R_2, and finally R3R_3. Thus, R3R_3 contains the first received value. Because the register is disabled afterward, it continues to hold 10111011.

A three-bit natural binary up-counter displays its state as Q2Q1Q0Q_2Q_1Q_0, with Q0Q_0 the least significant bit. Immediately before a sequence of three rising clock edges, its state is 110110. The counter increments at every rising edge, wraps after 111111, and receives no reset. What is its state immediately after the third edge, once propagation has settled?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A packaging controller has a three-stage counter. Every stage receives the same external clock signal and responds to its rising edge. The outputs settle 4 ns, 5 ns, and 7 ns after that edge. Based on its clock connections, this is a counter.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A modulo-20 counter receives a clock with frequency 2.40 MHz2.40\ \text{MHz}. Its enable is high at every fourth rising clock edge and low at all other edges. The counter increments only when enable is high. A rollover event occurs whenever its count changes from 19 to 0. With no resets during operation, what is the long-run rollover-event frequency? Answer in kHz, to one decimal place.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice