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

Multi Byte SPI Master

HardLogic CircuitBuild

Reading from flash memory or streaming sensor data requires burst mode transactions. The SPI master must assert chip select and maintain the clock across multiple byte boundaries without interruption.

The circuit receives a 1-bit start signal and a 2-bit length input indicating the number of bytes to transfer. Upon detecting start high, it drives the 1-bit cs_n output low and sets the 1-bit busy output high. It then generates continuous pulses on the 1-bit sck output until exactly length multiplied by 8 bits are transferred. The cs_n signal must remain strictly low between bytes to maintain the burst transaction. Once all bits are transferred, cs_n returns high and busy returns low. Assume sck goes high on the first active clock cycle and toggles on every subsequent clock cycle.

Constraints

  • Implement synchronous logic driven by the clk signal.
  • Reset all internal state and counters when the active-high rst signal is asserted.
  • Do not deassert cs_n between bytes during a continuous multi-byte transfer.

Topics

CounterState MachineSPIInterface

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