Part of Curriculum: Memory and FIFO Design (Module 1: Fun & Games)
View Full Roadmap →
Level 4 Medium 25 pts ✓ Solved

Simon Says Sequence Checker

Fun & Games · sequential, fsm, game-logic

Check a player's button presses against a fixed 4-step target sequence, one press at a time — freeze on the first mistake, celebrate after the last correct press.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
press[1:0]press_validstep[1:0]failsuccess>clkrst_nSIMON SAYS SEQUENCE DIGITAL HARDWARE BLOCK
⚡ Timing & Synthesizability Constraints

Timing Contract: Strict synchronous timing aligned to posedge clk or zero-delay combinational propagation.

RTL Constraints: Synthesizable Verilog-2001. No # delays in synthesizable RTL.

Concept: The checker advances one step for every press that matches the target sequence, and the moment a press is wrong it must latch failure and stop reacting to anything else until reset: else if(!fail && !success && press_valid) .... Dropping the !fail half of that guard is a subtle "the game doesn't actually end" bug — the fail flag still gets set correctly on the first wrong press, but because the FSM keeps evaluating later presses against the still-unfrozen step, a lucky continuation can silently advance the sequence (or even reach success) after the player already lost.
NameDirWidthDescription
clkinput1Clock
rstinput1Sync active-high reset (step=0, fail=0, success=0)
pressinput2Player's current button press (0-3)
press_validinput11 when press holds a new press this cycle
stepoutput2How many correct presses in a row so far
failoutput11 once a wrong press has occurred; freezes state
successoutput11 once all 4 steps of the fixed sequence [1,3,0,2] are matched
Expected Waveform (Golden Timing Contract)
Verilog-2001 / SV Saved
Font: |
// Click Run Tests (or press Ctrl+Enter) to compile your RTL and simulate against hidden testbenches.
Simulation Timing Diagram (VCD Waveform)
100%
No simulation waveform yet. Run tests to simulate and generate VCD traces.
No compilation run yet. Syntax warnings and elaboration messages will appear here.
No simulation output yet. Raw stdout from vvp will appear here.

RTL Problems / Level 4 · Fun & Games

What You Will Learn

By solving Simon Says Sequence Checker, you will acquire core industry skills:

  • Synthesizable hardware modeling in standard Verilog-2001 / SystemVerilog.
  • Correct handling of interface port contracts, edge-triggered clocks, and active-low/high resets.
  • Simulation waveform interpretation and debugging using timing diagrams (VCD traces).
  • Architectural avoidance of timing violations, glitching hazards, and synthesis warnings.

Problem Statement & Requirements

Check a player's button presses against a fixed 4-step target sequence, one press at a time — freeze on the first mistake, celebrate after the last correct press.

Hardware design teams at leading semiconductor firms evaluate these exact port contracts, race-condition assertions, and corner cases during technical design reviews and ASIC engineer interviews.

Concept: The checker advances one step for every press that matches the target sequence, and the moment a press is wrong it must latch failure and stop reacting to anything else until reset: else if(!fail && !success && press_valid) .... Dropping the !fail half of that guard is a subtle "the game doesn't actually end" bug — the fail flag still gets set correctly on the first wrong press, but because the FSM keeps evaluating later presses against the still-unfrozen step, a lucky continuation can silently advance the sequence (or even reach success) after the player already lost.

Port List & Interface Timing

The hidden testbench instantiates top_module. Module port names and bit-widths must match the interface contract exactly:

NameDirWidthDescription
clkinput1Clock
rstinput1Sync active-high reset (step=0, fail=0, success=0)
pressinput2Player's current button press (0-3)
press_validinput11 when press holds a new press this cycle
stepoutput2How many correct presses in a row so far
failoutput11 once a wrong press has occurred; freezes state
successoutput11 once all 4 steps of the fixed sequence [1,3,0,2] are matched

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Strict synchronous timing aligned to posedge clk or zero-delay combinational propagation.

Synthesis Constraints: Synthesizable Verilog-2001. No # delays in synthesizable RTL.

Starter RTL Code

module top_module(
  input  clk,
  input  rst,
  input  [1:0] press,
  input  press_valid,
  output reg [1:0] step,
  output reg fail,
  output reg success
);

  // Your code here — fixed target sequence [1,3,0,2]. On press_valid (while !fail && !success):
  // if press matches target[step], advance step (or set success at step 3); else set fail and freeze.

endmodule

Related RTL Problems in Level 4

Frequently Asked Questions

What does Simon Says Sequence Checker require?

Check a player's button presses against a fixed 4-step target sequence, one press at a time — freeze on the first mistake, celebrate after the last correct press. Implement it as Verilog module top_module matching the listed ports.

Is this design combinational or sequential?

Tags: sequential, fsm, game-logic. If a clock signal is present in the port table, implement it as sequential logic; otherwise, use continuous assignments or combinational blocks.

How is my solution graded?

A hidden SystemVerilog testbench simulates your module in the cloud judge. You pass when all directed corner cases match the golden model and the VCD timing waveform matches the contract.

How does this challenge help with semiconductor interviews?

Technical interviewers at NVIDIA, Qualcomm, Apple, and Intel routinely ask candidates to code, debug, and explain the timing waveforms of Simon Says Sequence Checker to assess real-world synthesizability and race-condition awareness.