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

SPI Clock Generator

EasyLogic CircuitBuild

Every synchronous serial bus relies on a master clock to dictate timing across the interface. The SPI master generates the serial clock line to ensure reliable data sampling at the peripheral.

Derive the SPI clock output SCK from the high-speed system clock. To guarantee a perfect 50 percent duty cycle, use a toggle structure driven by an enable pulse en. On every rising edge of the system clock, if en is 1, SCK must invert its current state. If en is 0, SCK must hold its state. An active-high synchronous reset rst forces SCK to 0.

| rst | en | SCK (current) | SCK (next) | |-------|------|-----------------|--------------| | 1 | X | X | 0 | | 0 | 0 | 0 | 0 | | 0 | 0 | 1 | 1 | | 0 | 1 | 0 | 1 | | 0 | 1 | 1 | 0 |

Constraints

  • Implement using only rising-edge triggered flip-flops and standard combinational logic gates.
  • Use a fully synchronous active-high reset.
  • Do not gate the system clock line directly.

Topics

sequentialflip-flopclockingspi

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

  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Edge Detector Delayed by Extra CycleMedium
  • Signed vs Unsigned Comparison FailureHard
  • Incomplete Case StatementEasy
  • Counter Wrapping at Wrong ValueEasy

Browse all problems · Learning tracks