Skip to content

Commit a8104ed

Browse files
authored
Add DE1-SoC support.
1 parent 5591cd5 commit a8104ed

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

nmigen_boards/de1_soc.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import os
2+
import subprocess
3+
4+
from nmigen.build import *
5+
from nmigen.vendor.intel import *
6+
from .resources import *
7+
8+
9+
__all__ = ["DE1SoCPlatform"]
10+
11+
12+
class DE1SoCPlatform(IntelPlatform):
13+
device = "5CSEMA5" # Cyclone V 85K LEs
14+
package = "F31" # FBGA-896
15+
speed = "C6"
16+
default_clk = "clk50"
17+
resources = [
18+
Resource("clk50", 0, Pins("AF14", dir="i"),
19+
Clock(50e6), Attrs(io_standard="3.3-V LVTTL")),
20+
Resource("clk50", 1, Pins("AA16", dir="i"),
21+
Clock(50e6), Attrs(io_standard="3.3-V LVTTL")),
22+
Resource("clk50", 2, Pins("Y26", dir="i"),
23+
Clock(50e6), Attrs(io_standard="3.3-V LVTTL")),
24+
Resource("clk50", 3, Pins("K14", dir="i"),
25+
Clock(50e6), Attrs(io_standard="3.3-V LVTTL")),
26+
27+
*LEDResources(
28+
pins="V16 W16 V17 V18 W17 W19 Y19 W20 W21 Y21",
29+
attrs=Attrs(io_standard="3.3-V LVTTL")),
30+
*ButtonResources(
31+
pins="AA14 AA15 W15 Y16", invert=True,
32+
attrs=Attrs(io_standard="3.3-V LVTTL")),
33+
*SwitchResources(
34+
pins="AB12 AC12 AF9 AF10 AD11 AD12 AE11 AC9 AD10 AE12",
35+
attrs=Attrs(io_standard="3.3-V LVTTL")),
36+
Display7SegResource(0,
37+
a="AE26", b="AE27", c="AE28", d="AG27", e="AF28",
38+
f="AG28", g="AH28", invert=True,
39+
attrs=Attrs(io_standard="3.3-V LVTTL")),
40+
Display7SegResource(1,
41+
a="AJ29", b="AH29", c="AH30", d="AG30", e="AF29",
42+
f="AF30", g="AD27", invert=True,
43+
attrs=Attrs(io_standard="3.3-V LVTTL")),
44+
Display7SegResource(2,
45+
a="AB23", b="AE29", c="AD29", d="AC28", e="AD30",
46+
f="AC29", g="AC30", invert=True,
47+
attrs=Attrs(io_standard="3.3-V LVTTL")),
48+
Display7SegResource(3,
49+
a="AD26", b="AC27", c="AD25", d="AC25", e="AB28",
50+
f="AB25", g="AB22", invert=True,
51+
attrs=Attrs(io_standard="3.3-V LVTTL")),
52+
Display7SegResource(4,
53+
a="AA24", b="Y23", c="Y24", d="W22", e="W24",
54+
f="V23", g="W25", invert=True,
55+
attrs=Attrs(io_standard="3.3-V LVTTL")),
56+
Display7SegResource(5,
57+
a="V25", b="AA28", c="Y27", d="AB27", e="AB26",
58+
f="AA26", g="AA25", invert=True,
59+
attrs=Attrs(io_standard="3.3-V LVTTL")),
60+
]
61+
connectors = [
62+
# Located on the right hand side of the board
63+
Connector("gpio", 0,
64+
"AC18 Y17 AD17 Y18 AK16 AK18 AK19 AJ19 AJ17 AJ16 "
65+
" - - AH18 AH17 AG16 AE16 AF16 AG17 AA18 AA19 "
66+
"AE17 AC20 AH19 AJ20 AH20 AK21 AD19 AD20 - - "
67+
"AE18 AE19 AF20 AF21 AF19 AG21 AF18 AG20 AG18 AJ21 "),
68+
69+
Connector("gpio", 1,
70+
"AB17 AA21 AB21 AC23 AD24 AE23 AE24 AF25 AF26 AG25 "
71+
"- - AG26 AH24 AH27 AJ27 AK29 AK28 AK27 AJ26 "
72+
"AK26 AH25 AJ25 AJ24 AK24 AG23 AK23 AH23 - - "
73+
"AK22 AJ22 AH22 AG22 AF24 AF23 AE22 AD21 AA20 AC22 "),
74+
]
75+
76+
def toolchain_program(self, products, name):
77+
quartus_pgm = os.environ.get("QUARTUS_PGM", "quartus_pgm")
78+
with products.extract("{}.sof".format(name)) as bitstream_filename:
79+
# The @2 selects the second device in the JTAG chain, because this chip
80+
# puts the ARM cores first.
81+
subprocess.check_call([quartus_pgm, "--haltcc", "--mode", "JTAG",
82+
"--operation", "P;" + bitstream_filename + "@2"])
83+
84+
85+
if __name__ == "__main__":
86+
from .test.blinky import Blinky
87+
DE1SoCPlatform().build(Blinky(), do_program=True)

0 commit comments

Comments
 (0)