CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

ROM Based State Machine Next State Logic

HardLogic CircuitBuild

Microcode sequencers in complex CPUs often replace dense combinational control paths with lookup tables. A ROM-based finite state machine uses the current state and external inputs as an address to fetch the next state directly from memory.

Implement a 2-bit saturating counter using a ROM array for the next-state logic. The counter increments when en is 1 and holds its value when en is 0. The maximum value is 3. The ROM address lines must be driven by the current state bits S1 and S0, along with the enable signal en. The ROM data outputs must drive the next state bits N1 and N0.

| S1 | S0 | en | N1 | N0 | |------|------|------|------|------| | 0 | 0 | 0 | 0 | 0 | | 0 | 0 | 1 | 0 | 1 | | 0 | 1 | 0 | 0 | 1 | | 0 | 1 | 1 | 1 | 0 | | 1 | 0 | 0 | 1 | 0 | | 1 | 0 | 1 | 1 | 1 | | 1 | 1 | 0 | 1 | 1 | | 1 | 1 | 1 | 1 | 1 |

Constraints

  • Use a ROM component for all next-state combinational logic.
  • Do not use discrete logic gates for the next-state calculation.
  • Use D flip-flops for the state register.
  • Connect rst directly to the asynchronous reset pins of the flip-flops.

Topics

FSMDatapathROM

Solve this problem

Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.

This problem is part of Codiode Pro. The statement above is free to read.

Sign in to solveSee what Pro unlocks

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks