-
Notifications
You must be signed in to change notification settings - Fork 71
copilot
: Add hello world example for FPGA. Refs #657.
#658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
copilot
: Add hello world example for FPGA. Refs #657.
#658
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you for writing it up!
I've left some minor review suggestions below.
The main Copilot specification is created in a file `HelloWorld.hs`. The final | ||
contents of | ||
[HelloWorld.hs](https://github.com/Copilot-Language/copilot/tree/master/copilot/examples/fpga/HelloWorld/HelloWorld.hs) | ||
is available in the [examples/fpga |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be:
is available in the [examples/fpga | |
is available in the [`examples/fpga/HelloWorld` |
of the repository. The directory contains several examples, as well as any | ||
auxiliary files needed to run the code onto an FPGA board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This says that the directory contains several examples, but I only see a single example (HelloWorld
).
``` | ||
|
||
In the above trigger definition, `"leds"` is the name of the output, whereas | ||
`leds` is an internal Copilot entity that, at each point in time will contain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling leds
"internal" is perhaps a bit misleading, as it is wholly possible to observe the value of the leds
stream using the Copilot interpreter. Perhaps we should just say "leds
is a Copilot stream that [...]".
`mkTop.v` is successfully created in your current directory. To program the | ||
code onto the FPGA, the ports declarations and assignments need modifications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My hope is that after #654 is implemented upstream, we will no longer need to make modifications to the generated Verilog code. (This isn't a review suggestion so much as it is a TODO for myself.)
`mkTop.v` is successfully created in your current directory. To program the | ||
code onto the FPGA, the ports declarations and assignments need modifications. | ||
|
||
In our `Top.bs`, the module that had the register and interface for the leds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our `Top.bs`, the module that had the register and interface for the leds | |
In our `Top.bs`, the module that had the register and interface for the LEDs |
edge of the `CLK`. | ||
|
||
Replace / add the following lines mentioned above. For reference, the complete | ||
contents of mkTop.v after applying the changes are included below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contents of mkTop.v after applying the changes are included below. | |
contents of `mkTop.v` after applying the changes are included below. |
|
||
Once installed, open your Vivado Design Suite. | ||
|
||
1. Click `Create Project` > `Next` > Project Name : `HelloWorld` and choose the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Click `Create Project` > `Next` > Project Name : `HelloWorld` and choose the | |
1. Click `Create Project` > `Next` > `Project Name` : `HelloWorld` and choose the |
`Open Target` > Plug in your FPGA board via USB. > `Auto Connect` > `Program | ||
Device`. | ||
|
||
The LEDS on your FPGA board should now display the LEDS counting up in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LEDS on your FPGA board should now display the LEDS counting up in | |
The LEDS on your FPGA board should now display the LEDs counting up in |
We need an example that demonstrates how to work with FPGAs using Copilot. This will help users start with copilot-bluespec, and also help validate our work. This commit adds a hello world example that demonstrates how to control 4 LEDs from 4 switches. The tutorial describes how to install Vivado, create the spec, compile it (in bluespec and then verilog), and upload it to the board.
22e142a
to
24840c0
Compare
Introduce a new hello world example for FPGA with instructions in a README and all necessary auxiliary files, as prescribed in the solution proposed for #657.