This project implements a digital memory game that tests whether a subject can correctly enter a predefined sequence of button presses (ABAABBABABA
). If successful, the system simulates a reward using a green LED; if incorrect, it simulates a penalty with a red LED and resets. The design began as a finite state machine and was later fully implemented in Verilog, then deployed on the Nexys A7-100T FPGA.
The core logic of the game was written in Verilog. The implementation includes modular design, clock division, and full testbench verification.
-
jkFlipFlop
A basic JK flip-flop module, triggered on the clock's rising edge. -
InputFlipFlop
A sequential logic unit using four JK flip-flops to track button sequences (X1
andX2
) and represent system state. -
OutputFlipFlop
Generates output indicators (Z1
toZ12
) based on the internal state. These outputs control the progress, shock, and reward LEDs. -
TopModule
Integrates the input and output modules and connects to external I/O. -
ClockDivider
Divides the system clock to a slower frequency for human-observable LED changes.
The testbench simulates the complete button sequence under different conditions and verifies all expected LED outputs. It also tests invalid inputs (e.g., simultaneous button presses) to confirm error handling.
The Verilog design was synthesized and deployed on a Digilent Nexys A7-100T FPGA board using Xilinx Vivado.
-
Constraints File (.xdc)
Created to map Verilog I/Os (X1
,X2
,Z1-Z12
) to the Nexys A7’s physical pins. -
Synthesis and Implementation
Verilog files imported to Vivado → synthesized → implemented with successful timing and resource mapping. -
Bitstream Generation and Upload
Generated.bit
file was uploaded via USB to configure the FPGA. -
Physical Testing
Button presses were simulated via switches or external input, and LED behavior was verified for all sequences.
🔧 Hardware Demo on Nexys A7-100T:
Demo.mov
🧪 Simulation in Logisim:
StateMachine.mp4
🧠 Click to view the original FSM design process
Originally, this project was a conceptual state machine design, developed using standard digital logic techniques before moving to HDL implementation.
- System starts in idle state until a button is pressed.
- Correct button → progress LED (yellow) lights up.
- Incorrect button or simultaneous press → shock (red LED), reset.
- Successful sequence → reward (green LED), reset.
This project demonstrated the full lifecycle of a digital system—from concept and theoretical design to Verilog implementation, simulation, and FPGA deployment. Building and testing this memory game provided hands-on experience in modular HDL design, timing control, testbench development, and hardware interfacing.