Skip to main content

Build a Soft Processor on Xilinx FPGA and Guess A Random Number

This project presents a number guessing game through Xilinx MicroBlaze Processor, created by a student intern at Digilent. The soft processor on FPGA chooses a number between 0 and 15 and gives the player 4 chances to guess that number. By building this game, users can learn how to create a simple processor on FPGA and then create some fun applications. 

The project uses the Digilent Arty A7 (193-2598) : Artix-7 FPGA Development Board, making use of the Arty's switches, buttons, and LEDs to create an easy interaction.

The Arty A7 is a ready-to-use development platform designed around the Artix-7â„¢ Field Programmable Gate Array (FPGA) from Xilinx. It was designed specifically for use as a MicroBlaze Soft Processing System. Unlike other single board computers, Arty isn't bound to a single set of processing peripherals; one moment it's a communication powerhouse chock-full of UARTs, SPIs, IICs, and an Ethernet MAC, and the next it's a meticulous timekeeper with a dozen 32-bit timers.

MicroBlaze is Xilinx’s 32-bit RISC soft processor core, optimized for embedded applications on Xilinx devices. The MicroBlaze processoris easy to use and delivers the flexibility to select the combination of peripherals, memory, and interfaces as needed. In order to use the MicroBlaze, users must Instal Vivado, create a new global repository, browse for the MicroBlaze SDK and the use it in the project.

Digilent Arty Board

To play the game, the user must have a terminal emulator with UART support, such as Tera Term. The terminal will display messages. Players toggles the switches to set a number they want to guess in binary. Switches which are set light up the corresponding RGB LEDs in blue. Players then submit the guess by pressing Button 0 on the board. If the guess is correct, the program will print a message stating this. If the guess is incorrect, the program will print a message telling the player whether the guess was too high or too low and the number of chances remaining. If the player guesses incorrectly four times, all of the LEDs and RGB LEDs, set to red, will flash three times. Then, the program prints a message revealing the correct answer. Finally, the game asks players if they would like to continue playing. Button 0 begins another game and Button 3 ends the game. Players can also end the game at any time by pressing Button 3.

Guessing game terminal emulator screen

Some of the features implemented in the software include user-input debouncing and edge detection, LED pulse width modulation (PWM), and random number generation for the game.

Get all the project details and the source code on the Digilent Project Page.

awong has not written a bio yet…
DesignSpark Electrical Logolinkedin