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

SPI Master 8-Bit Transfer

MediumLogic CircuitBuild

Serial Peripheral Interface (SPI) masters control transaction lengths by driving the clock line for a precise duration. To prevent data corruption, the controller must halt the clock and return to idle exactly after the 8-bit payload is exchanged.

The circuit waits in an idle state until the start signal is asserted. Once triggered, it drives the active signal high for exactly 8 clock cycles to frame the transaction. During the 8th and final cycle of the transaction, the done signal must assert high. On the following clock edge, the circuit must return to the idle state.

| State | start | active | done | Next State | |-------|---------|----------|--------|------------| | IDLE | 0 | 0 | 0 | IDLE | | IDLE | 1 | 0 | 0 | ACTIVE (Cycle 1) | | ACTIVE (Cycles 1-7) | X | 1 | 0 | ACTIVE (Cycle N+1) | | ACTIVE (Cycle 8) | X | 1 | 1 | IDLE |

Constraints

  • Implement a synchronous state machine driven by a single clock.
  • Use an active-high synchronous reset rst.
  • The done signal must assert high exclusively during the 8th cycle of the active transaction.
  • The active signal must transition to low immediately after the 8th cycle.

Topics

FSMCountersInterface

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