Tutorial – Structure and Communication¶
In this tutorial we’re going to cover structuring your programs and writing effective Go code for FPGAs. We’ll look at our template project and use it to complete a couple of simple examples. Along the way we’ll learn a bit more about the shared memory available on the FPGA card. There are some elements that need to be present in your code to keep our compiler happy, and there are some areas where you’re free to move and process data however you want. Also, we’re not just dealing with an FPGA in isolation, Reconfigure.io programs include code for a host CPU as well as the FPGA, so you need to consider how best to split up the work between the two, and how to pass data around effectively, for more on this see our style guide.
What we will do¶
- Look at our program structure
- Look at the basic requirements for the CPU and FPGA code. A template is available here
- Discuss how to share data between the host CPU and FPGA
- Use our template to create a simple program in which a single integer is passed from host CPU to the FPGA, multiplied by 2, and passed back to the host
- Use the code above as the basis to create another program where an array of 10 integers is passed from the host to the FPGA, each integer is then multiplied by 2 and the resulting array is passed back to the host