MicroZed Chronicles: Having Fun with the Basys3 Artix-7 FPGA Development Board

I recently hosted two webinars for Crowd Supply on how to create a fun, breakout Pong-type game on the Basys3 board. The class was not intended for FPGA experts and meant to be an introduction to the Basys3 board and the Xilinx ecosystem and therefore included several different design aspects.

  • Vivado Design Suite

  • How to work with Xilinx IP in IP Integrator

  • How to create a MicroBlaze processing system

  • How to create custom IP libraries and add IP

  • How to create image processing pipelines

  • How to merge MicroBlaze applications

  • How to program QSPI Flash

  • Vitis Unified Software Platform

  • How to create embedded platforms

  • How to debug applications on the MicroBlaze

  • How to interface with buttons to control a software application

  • How to control and configure Xilinx IP using APIs provided in Vitis

It was a fun project to put together so I thought I would share it.

To get started in Vivado, I created a MicroBlaze system that ran from the internal BRAM of the Artix-7 35T device on the Basys3 board because there is no DDR to support a larger program.

The MicroBlaze is responsible for determining the ball and bat position in addition to keeping score. To aid acceleration of the frame rate, the output video is not generated by the MicroBlaze but instead by IP blocks in the logic.

Most important is the IP block that displays the ball and bat that is used by the player. A high-level synthesis block was created to do this. The HLS block generates the positions of the ball and bat for every frame. The HLS block outputs a pixel that contains an RGB and alpha channel. Set the alpha channel on high for only the locations of the bat and ball. The inclusion of the alpha channel enables video mixing on a pixel-by-pixel basis.

The video output path consists of the HLS IP block connected to a video mixer. The main feed to the video mixer is supplied by a test pattern generator. This enables the background of the game video to be changed on the fly and between solid or color patterns. The final element of the chain is a video timing controller and AXI Stream to video out block.

The output resolution is 640 by 480 as the pixel clock is only 25 MHz. The MicroBlaze is running at 20 MHz while the video chain is running at 50 MHz.

In Vitis, the application software configured the video timing generator for the required video output in addition to setting up the video mixer to mix the test pattern generator and ball / bat position layers. The test pattern generator is also configured to generate a color bar output.

The ball / bat position is calculated by a software loop that runs every 250 ms. On each loop, it determines if the ball has hit one of the three corners of the screen or the bat. If the ball is hit by the bat, the score is increased by one. If the bat misses the ball, the score is reset to zero and ball is re-generated on the screen.

If you want to re-create the project, you can find recordings of both sessions on my YouTube channel.

You can find step-by-step instructions and completed XSA and Bin files on my GitHub.

I hope you have fun creating it and of course modifying it.

695 views0 comments