In this lab we learned how to create a custom FPGA embedded component using Altera’s Qsys tool. We also learned how to interface the component with the HPS processor as an Avalon Memory-Mapped Slave. In the second part of the lab, we learned how to use the different types of memories available. We learned how to use SDRAM, DDR3 on the FPGA, and the DDR3 on the HPS system.
First we followed through the steps and created a 32-bit register module using Verilog. We simulated the module using ModelSim and ensured that it behaved as expected. We had a few logical problems, but we were able to fix them easily. Afterwards, on Qsys, we created a new component and instantiated the component in the Qsys system. On the Hard Processor System (HPS), we wrote a c-code to store and retrieve values into the register. We created a program that prompts the user to enter a 32-bit integer, which then the program displays on the six Seven-Segment-Displays and the LEDs. The program would keep asking the user to enter a new number until the user quits the program.
In the second part, we instantiated an SDRAM Controller in Qsys and integrating the component with our system. We instantiated the required components needed for communicating with SDRAM, the on-chip memory on the FPGA, and the on-chip memory on the HPS system. We took notes of the base addresses of the components and their respective busses’ address. We wrote C-code that ran on the HPS, which asked the user to choose one of the available rams to write and read data to. The available options were the On-Chip Memory on the FPGA, the FPGA SDRAM, the On-Chip memory of the HPS, and the HPS SDRAM (DDR3). Each time, we wrote 32KB of data into the selected memory and then read the data from the memory to verify that data was written correctly.
In the last part of the lab (Programming Assignment), we used everything we learned from previous parts of the lab to create a custom Verilog component that controlled the scrolling feature from lab1. We created a separate Verilog module, which takes inputs and bases on those inputs determines the required speed of the scrolling. This part was the most time consuming and we were not able to finish this part 100%. We came up with a state machine, and then we modeled the state machine using Verilog, and afterwards we debugged the state machine. Debugging the state machine was very tedious and required a lot of time. Every time we made a small change in the state machine, we had regenerate the Qsys system, and recompile. The compilation, on average, took 12 minutes to complete. Even though we did not finish completely, we learned a lot about debugging Qsys systems from this part.
Useful Resources For this lab:
Offical Altera Tutorial on Creating Qsys Component (pdf)
Altera Tutorial on Creating Qsys Component Video (YouTube)
Altera handbook Creating Qsys Component (web)