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

SPI Slave CS Reset Logic

MediumLogic CircuitBuild

Serial Peripheral Interface (SPI) slaves must gracefully handle aborted transactions. When a master deasserts the chip select line before a full byte is transferred, the slave must immediately discard the partial data and reset its internal state.

Construct the bit counter for an SPI slave. The circuit must maintain a 3-bit output bit_cnt that increments on every clock cycle while the active-low chip select CS is 0. If CS is 1, bit_cnt must synchronously reset to 0 on the next clock edge. The counter wraps back to 0 after reaching 7.

| CS | Next bit_cnt | |------|----------------| | 1 | 0 | | 0 | bit_cnt + 1 |

Constraints

  • Implement the reset behavior synchronously.
  • Do not use asynchronous reset pins on the flip-flops.
  • Build the counter using standard D flip-flops and combinational logic.

Topics

Synchronous LogicState MachineCountersSPI

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