I completed this project during my time at Kennesaw State University for my CPE 3020 class, VHDL Design with FPGAs. This project uses the Digilent Basys3 FPGA board alongside the VHDL coding language.
I started this project by creating multiple diagrams, which include block diagrams and state machine diagrams. Then, I started coding in VHDL and would code bits of the code at a time and would test them with some testbench code, which I would also write. The main thing I learned from this class and making the diagrams is that organization and planning is most of the work that goes into coding, especially VHDL or any hardware description language. The more time you spend organizing and planning your code is directly correlated to the amount of time saved debugging it later, and this became very apparent to me during this class.
The goal of this project is to send commands via a PC to the Basys3 board and these commands are as follows:
- Lxx – where xx is the LED number to turn on
- Mxx – where xx is the LED number to turn off
- Dxxxx – where xxxx is the number to display on the seven-segment display
- Sxx – reads xx switch and returns its position (up/down)
- B – reads the buttons that are currently active (up, left, center, or right)
- The down button is the system reset
After planning the code and organizing the diagrams, it was not difficult to code as you follow the order in your diagrams. It was tedious as there were a lot of states and quite a lot of blocks to be coded, but was not terribly difficult, due to how much time I spend working on the diagrams. Furthermore, before implementing the design onto the board, I could ensure proper functionality of the code by running simulations with the testbench code that I had also written. This code would simply change the serial in, mimicking a user entering commands on a keyboard, and then I would be able to see the output and make sure that it is as expected.
The hardest part of this project was translating the serial input into ASCII characters. This involved analyzing the ASCII table and making sure that I would only respond to capital letters, and was accomplished using a state machine.
Also, this project taught me about baud rate, and how devices communicate with one another. I used PuTTy to open a terminal for communicating with the Basys board, and before this project, I had only used PuTTy to SSH into a raspberry pi.
A pdf containing the diagrams, code, and testbench code is available below. Also, a video showing the code implemented on the Basys3 board is underneath the pdf.