FPGA · Medium · SystemVerilog

SPI Sample / Shift Edge Classifier

Classify each SCLK transition as a sample edge or a shift edge using CPHA.

Task

For CPHA=0, the leading edge samples and trailing edge shifts. For CPHA=1, leading shifts and trailing samples.

Examples

Constraints

What this problem is testing

FPGA problems test whether logically correct RTL will behave predictably in hardware, including clock-domain boundaries, reset release, noisy inputs, inferred resources, and timing.

Interview habit: before coding, state reset behavior, the state that must be stored, and the conditions that update each output.

Verification plan

Edge cases worth testing

Common mistakes

Interview follow-up questions

Concepts to review

SPI, CPHA, timing

Open SPI Sample / Shift Edge Classifier in the HDLForge interactive editor.

Related problems

Explore the FPGA Design Practice & Interview Preparation hub.

Continue practising