
This project implements a simple Simon Says memory game in Verilog. The design uses a 16x8 RAM to store a sequence of values, a finite state machine to control the game, and comparison logic to check the player's input.
The goal of the project is to demonstrate a small digital system that combines memory, control logic, counters, and basic user interaction.
The circuit has two main modes: programming mode and game mode.
In programming mode, the RAM is loaded with a sequence of values. The signal prog_mode enables this mode, we enables writing, prog_addr selects the memory position, and prog_data provides the value to be stored.
In game mode, the circuit reads the stored sequence from RAM and shows each value through the led_out output. The player must repeat the sequence using the player_input pins and confirm each input with the enter signal.
The finite state machine controls the game flow. It starts in an idle state, shows the stored sequence, waits for the player's input, checks the answer, and either increases the level or activates the error signal. If the player completes the full sequence, the win signal is activated.
The main outputs are:
led_out: shows the current value of the sequence.show_valid: indicates that the value shown in led_out is valid.correct: indicates a correct player input.error: indicates an incorrect player input.win: indicates that the player completed the sequence.level: shows the current game level.The project is tested using the Cocotb testbench located in the test folder.
The test performs the following steps:
0, 1, 2, 3.error output is activated after the wrong answer.The test verifies that the memory can be programmed, that the game can start, that correct answers do not activate the error signal, and that an incorrect answer activates the error signal.
To run the test locally, use the Tiny Tapeout test workflow or run the test from the test directory with the provided Makefile.
This design can be tested using simple switches and LEDs.
Suggested usage:
prog_mode, we, start, enter, and player_input.led_out, show_valid, correct, error, and win.ui_in[0]: prog_modeui_in[1]: weui_in[2]: startui_in[3]: enterui_in[5:4]: player_inputuo_out[1:0]: led_outuo_out[2]: show_validuo_out[3]: correctuo_out[4]: erroruo_out[5]: winuo_out[7:6]: state debug outputuio_in[3:0]: programming addressuio_in[7:0]: programming datauio_out[4:0]: current level| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | prog_mode | led_out[0] | prog_data[0] / prog_addr[0] / level[0] |
| 1 | we | led_out[1] | prog_data[1] / prog_addr[1] / level[1] |
| 2 | start | show_valid | prog_data[2] / prog_addr[2] / level[2] |
| 3 | enter | correct | prog_data[3] / prog_addr[3] / level[3] |
| 4 | player_input[0] | error | prog_data[4] / level[4] |
| 5 | player_input[1] | win | prog_data[5] |
| 6 | state_out[0] | prog_data[6] | |
| 7 | state_out[1] | prog_data[7] |