Exactly how you "program" the actual FPGA hardware depends on which chip and vendor you are using. In the bootcamp where we actually program the IceStick, you'll see more details about exactly how to do it. However, most FPGA "builds" follow a very similar flow and you might find it interesting to know what that is.If you think about a conventional C program, your workflow looks like this:
- Compile C code to object code
- Link object code and libraries to executable
- Debug executable using simulation
- Prepare executable for downloading
- Send executable to target system
- Debug executable on target system
The details vary, but a generic FPGA workflow looks like this:
- Synthesize Verilog into low-level constructs
- Simulate/test/debug system behavior
- Map low-level constructs to specific device blocks
- Place and route blocks -- this means to plan which blocks go where and exactly how to interconnect them
- High-fidelity simulate/test/debug on actual device-specific configuration
- Program configuration to FPGA or configuration device
- In circuit test/debug, if necessary
Some vendors use different terms for things like blocks or place and route, but the ideas are universal.
You might wonder why you would test and debug at three different stages. The simulation in step 2 is like we are doing in this bootcamp. You deal with the source code, things work pretty fast, and you can catch logic errors in your design.
What you can't catch is problems caused by how things are set up on the chip. Maybe this signal arrives just a little too late and causes an error. The device-specific simulation in step 5 can catch that. But it is generally a lot more data to process and model so the simulations take more time and memory. On a big design it can also be costly to have to go fix source code and then re synthesize. So you try to catch your logic errors in the second step.
Of course, nothing works exactly like it does in simulation so sometimes you have to debug on the chip. Modern chips have tools to help you see inside them just like modern CPUs have on chip debugging support. But it is still harder and more time consuming.