Simon says is a simple electronic memory game: the user has to repeat a growing sequence of colors. The sequence is displayed by lighting up the LEDs. Each color also has a corresponding tone.
In each turn, the game will play the sequence, and then wait for the user to repeat the sequence by pressing the buttons according to the color sequence. If the user repeated the sequence correctly, the game will play a "leveling-up" sound, add a new color at the end of the sequence, and move to the next turn.
The game continues until the user has made a mistake. Then a game over sound is played, and the game restarts.
You can play the game using the online Wokwi simulation at https://wokwi.com/projects/371755521090136065. The simulation also shows the wiring diagram.
You need four buttons, four LEDs, resistors, and optionally a speaker/buzzer and a two digit 7-segment display for the score.
Ideally, you want to use 4 different colors for the buttons/LEDs (red, green, blue, yellow).
The game requires 10 MHz clock input (or 100 KHz when slow_clk
is 1).
- Connect the buttons to pins
btn1
,btn2
,btn3
, andbtn4
, and also connect each button to a pull down resistor. - Connect the LEDs to pins
led1
,led2
,led3
, andled4
, matching the colors of the buttons (soled1
andbtn1
have the same color, etc.) - Connect the speaker to the
speaker
pin. - Connect the seven segment display as follows:
seg_a
throughsev_g
to individual segments,dig1
to the common pin of the first digit,dig2
to the common pin of the second digit. Setseginv
according to the type of 7 segment display you have: high for common anode, low for common cathode. - Connect
slow_clk
to ground - Reset the game, and then press any button to start it. Enjoy!
mprj_io | Function |
---|---|
8 | btn1 |
9 | btn2 |
10 | btn3 |
11 | btn4 |
12 | led1 |
13 | led2 |
14 | led3 |
15 | led4 |
16 | speaker |
17 | seg_a |
18 | seg_b |
19 | seg_c |
20 | seg_d |
21 | seg_e |
22 | seg_f |
23 | seg_g |
24 | dig1 |
25 | dig2 |
26 | seginv |
27 | slow_clk |
-
Set up the environment:
mkdir -p dependencies export OPENLANE_ROOT=$(pwd)/dependencies/openlane_src export PDK_ROOT=$(pwd)/dependencies/pdks export PDK=gf180mcuD # This will download and install caravel, the PDK, required OpenLane version, etc. make setup
-
Each time you want to harden:
export OPENLANE_ROOT=$(pwd)/dependencies/openlane_src export PDK_ROOT=$(pwd)/dependencies/pdks export PDK=gf180mcuD make urish_simon_says