Skip to content

Commit 0a16126

Browse files
copilot: Add hello world example for FPGA. Refs #657.
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.
1 parent 2f8ae35 commit 0a16126

File tree

5 files changed

+685
-0
lines changed

5 files changed

+685
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Main where
2+
3+
import Language.Copilot
4+
import Copilot.Compile.Bluespec
5+
6+
-- Define switches input
7+
sw :: Stream Word8
8+
sw = extern "sw" Nothing
9+
10+
-- Define LEDS output
11+
leds :: Stream Word8
12+
leds = sw
13+
14+
spec = do
15+
trigger "leds" true [arg leds]
16+
17+
main = do
18+
spec' <- reify spec
19+
compile "HelloWorld" spec'

0 commit comments

Comments
 (0)