Skip to content

Commit ce26e35

Browse files
bl0xrroohhh
andauthored
Add support for cmod_a7 and cmod_s7 boards.
Signed-off-by: Bastian Löher <[email protected]> Co-authored-by: Robin Heinemann <[email protected]>
1 parent a1da1f5 commit ce26e35

File tree

2 files changed

+180
-0
lines changed

2 files changed

+180
-0
lines changed

amaranth_boards/cmod_a7.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import os
2+
import subprocess
3+
4+
from amaranth.build import *
5+
from amaranth.vendor.xilinx import *
6+
from .resources import *
7+
8+
"""
9+
Example Usage:
10+
platform = CModA7_35Platform(toolchain="Symbiflow")
11+
platform.build(Top(), do_program=True)
12+
13+
Supported programmer:
14+
openocd
15+
"""
16+
17+
__all__ = ["CmodA7_15Platform", "CmodA7_35Platform"]
18+
19+
20+
class _CmodA7Platform(XilinxPlatform):
21+
package = "cpg236"
22+
speed = "1"
23+
default_clk = "clk12"
24+
resources = [
25+
Resource("clk12", 0, Pins("L17", dir="i"),
26+
Clock(12e6), Attrs(IOSTANDARD="LVCMOS33")),
27+
28+
*LEDResources(pins="A17 C16", attrs=Attrs(IOSTANDARD="LVCMOS33")),
29+
30+
RGBLEDResource(0, r="C17", g="B16", b="B17", invert=True,
31+
attrs=Attrs(IOSTANDARD="LVCMOS33")),
32+
33+
*ButtonResources(pins="A18 B18", attrs=Attrs(IOSTANDARD="LVCMOS33")),
34+
35+
UARTResource(0,
36+
rx="J18", tx="J17",
37+
attrs=Attrs(IOSTANDARD="LVCMOS33")
38+
),
39+
40+
*SPIFlashResources(0,
41+
cs_n="K19", clk="E19", copi="D19", cipo="D18", wp_n="G18",
42+
hold_n="F18",
43+
attrs=Attrs(IOSTANDARD="LVCMOS33")
44+
),
45+
46+
SRAMResource(0,
47+
cs_n="N19", oe_n="P19", we_n="R19",
48+
a="M18 M19 K17 N17 P17 P18 R18 W19 U19 V19 W18 T17 T18 U17 U18 V16 W16 W17 V15",
49+
d="W15 W13 W14 U15 U16 V13 V14 U14"),
50+
51+
# One-wire interface to crypto authentication device
52+
# May not be populated on the board
53+
Resource("atsha204a", 0, Pins("D17", dir="io"),
54+
Attrs(IOSTANDARD="LVCMOS33"))
55+
]
56+
connectors = [
57+
Connector("pmod", 0, "G17 G19 N18 L18 - - H17 H19 J19 K18 - -"), # JA
58+
59+
# Pin 24/25 are VCC and GND
60+
# Pin 15/16 are analog (XADC)
61+
Connector("gpio", 0,
62+
"""
63+
M3 L3 A16 K3 C15 H1 A15 B15 A14 J3 J1 K2
64+
L1 L2 - - M1 M3 P3 M2 N1 N2 P1 -
65+
- R3 T3 R2 T1 T2 U1 W2 V2 W3 V3 W5
66+
V4 U4 V5 W4 U5 U2 W6 U3 U7 W7 U8 V8
67+
"""),
68+
69+
Connector("xadc", 0, {
70+
"vaux4_n": "G2",
71+
"vaux4_p": "G3",
72+
"vaux12_n": "J2",
73+
"vaux12_p": "H2"
74+
})
75+
]
76+
77+
def toolchain_program(self, products, name):
78+
with products.extract("{}.bit".format(name)) as bitstream_filename:
79+
subprocess.check_call(["openFPGALoader",
80+
"-c", "digilent",
81+
"--fpga-part", "xc7a35",
82+
"{}".format(bitstream_filename)
83+
])
84+
85+
86+
class CmodA7_15Platform(_CmodA7Platform):
87+
device = "xc7a15t"
88+
89+
class CmodA7_35Platform(_CmodA7Platform):
90+
device = "xc7a35t"
91+
92+
if __name__ == "__main__":
93+
from .test.blinky import *
94+
CmodA7_35Platform().build(Blinky(), do_program=True)

amaranth_boards/cmod_s7.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import os
2+
import subprocess
3+
4+
from amaranth.build import *
5+
from amaranth.vendor.xilinx import *
6+
from .resources import *
7+
8+
"""
9+
Example Usage:
10+
platform = CModS7_Platform(toolchain="Symbiflow")
11+
platform.build(Top(), do_program=True)
12+
13+
Supported programmer:
14+
openocd
15+
"""
16+
17+
__all__ = ["CmodS7_Platform"]
18+
19+
20+
class CmodS7_Platform(XilinxPlatform):
21+
device = "xc7s25"
22+
package = "csga225"
23+
speed = "1"
24+
default_clk = "clk12"
25+
resources = [
26+
Resource("clk12", 0, Pins("M9", dir="i"),
27+
Clock(12e6), Attrs(IOSTANDARD="LVCMOS33")),
28+
29+
*LEDResources(pins="E2 K1 J1 E1", attrs=Attrs(IOSTANDARD="LVCMOS33")),
30+
31+
RGBLEDResource(0, r="F2", g="D3", b="F1", invert=True,
32+
attrs=Attrs(IOSTANDARD="LVCMOS33")),
33+
34+
*ButtonResources(pins="D2 D1", attrs=Attrs(IOSTANDARD="LVCMOS33")),
35+
36+
UARTResource(0,
37+
rx="L12", tx="K15",
38+
attrs=Attrs(IOSTANDARD="LVCMOS33")
39+
),
40+
41+
# Clock only via STARTUPE2 primitive
42+
*SPIFlashResources(0,
43+
cs_n="L11", clk="F5", copi="H14", cipo="H15", wp_n="J12",
44+
hold_n="K13",
45+
attrs=Attrs(IOSTANDARD="LVCMOS33")
46+
),
47+
48+
# One-wire interface to crypto authentication device
49+
# May not be populated on the board
50+
Resource("atsha204a", 0, Pins("D17", dir="io"),
51+
Attrs(IOSTANDARD="LVCMOS33"))
52+
]
53+
connectors = [
54+
Connector("pmod", 0, "J2 H2 H4 F3 - - H3 H1 G1 F4 - -"), # JA
55+
56+
# Pin 24/25 are VCC and GND
57+
# Pin 32/33 are analog (XADC)
58+
# Pin 9-15 and 34-39 do not exist
59+
Connector("gpio", 0,
60+
"""
61+
L1 M4 M3 N2 M2 P3 N3 P1 N1 - - -
62+
- - - P14 P15 N13 N15 N14 M15 M14 L15 -
63+
- L14 K14 J15 L13 M13 J11 - - - - -
64+
- - - C5 A2 B2 B1 C1 B3 B4 A3 A4
65+
"""),
66+
67+
Connector("xadc", 0, {
68+
"vaux5_n": "A13",
69+
"vaux5_p": "A14",
70+
"vaux12_n": "A11",
71+
"vaux12_p": "A12"
72+
})
73+
]
74+
75+
def toolchain_program(self, products, name):
76+
with products.extract("{}.bit".format(name)) as bitstream_filename:
77+
subprocess.check_call(["openFPGALoader",
78+
"-c", "digilent",
79+
"--fpga-part", "xc7s25",
80+
"{}".format(bitstream_filename)
81+
])
82+
83+
84+
if __name__ == "__main__":
85+
from .test.blinky import *
86+
CmodS7_Platform().build(Blinky(), do_program=True)

0 commit comments

Comments
 (0)