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

SPI Dummy Byte Generator

MediumLogic CircuitBuild

SPI masters must actively toggle the serial clock to receive data from a slave device. This is achieved by transmitting a dummy byte, typically hex FF, to force clock generation while simultaneously sampling the incoming data line.

When the read_en signal is asserted high for one clock cycle, the circuit must initiate an 8-cycle read operation. During these 8 cycles, the mosi output must be driven high continuously to transmit the FF dummy byte. Concurrently, the circuit must shift the miso input into an internal 8-bit register, MSB first. The data_out port must continuously output the state of this shift register.

On the clock cycle immediately following the 8th shifted bit, the valid output must be asserted high for exactly one cycle, indicating that data_out holds the complete captured byte. When no read operation is in progress, mosi and valid must remain low.

Constraints

  • Implement a synchronous active-high reset using the rst signal.
  • Drive mosi low when the circuit is not actively executing an 8-cycle read operation.
  • Shift the incoming miso data MSB first.
  • Do not initiate a new read operation if read_en is asserted while a read is already in progress.

Topics

Shift RegisterState MachineSPIProtocol

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