22 Random number guess game

22 : Random number guess game

Select Project123456789ONSW2
  • Author: Yufei Zhen, Elaina Zodiatis, Khadijatou Dibba
  • Description: Guess 6-bit random number, 3 attemps in one round.
  • GitHub repository
  • Clock: 0 Hz

How it works

Uses '$random' to generate 6-bit random numbers, and input [7:2] to make a guess.

Some combinatorial logics are used to check if the guessed bit matches the random number bit on positive clock edges. If they match, the corresponding bit in the output [5:0] is set to 1; otherwise, it is set to 0.

Of course a correct guess will output 6'b111111 and reset random numebr to enter a new round. If the player uses all 3 guesses, the game outputs 6'b000000 and resets with a new random number as well.

How to test

After reset, output [5:0] should zero out.

IO

#InputOutput
0clockresult[0]
1rstresult[1]
2guess[0]result[2]
3guess[1]result[3]
4guess[2]result[4]
5guess[3]result[5]
6guess[4]
7guess[5]