Skip to content

Commit fde0b9a

Browse files
committed
cmod_a7 support: Transition to amaranth_boards.
1 parent ba5adf8 commit fde0b9a

File tree

2 files changed

+102
-95
lines changed

2 files changed

+102
-95
lines changed

amaranth_boards/cmod_a7.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import os
2+
import subprocess
3+
4+
from amaranth.build import *
5+
from amaranth.vendor.xilinx_7series 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(Xilinx7SeriesPlatform):
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+
openocd = os.environ.get("OPENOCD", "openocd")
79+
with products.extract("{}.bit".format(name)) as bitstream_filename:
80+
subprocess.check_call([openocd,
81+
# Use for debug output
82+
#"-d",
83+
"-c",
84+
"source [find board/digilent_cmod_a7.cfg]; init; pld load 0 {}; exit"
85+
.format(bitstream_filename)
86+
])
87+
88+
89+
class CmodA7_15Platform(_CmodA7Platform):
90+
device = "xc7a15t"
91+
92+
class CmodA7_35Platform(_CmodA7Platform):
93+
device = "xc7a35t"
94+
95+
if __name__ == "__main__":
96+
from .test.blinky import *
97+
CmodA7_35Platform().build(Blinky(), do_program=True)

nmigen_boards/cmod_a7.py

Lines changed: 5 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,7 @@
1-
import os
2-
import subprocess
1+
from amaranth_boards.cmod_a7 import *
2+
from amaranth_boards.cmod_a7 import __all__
33

4-
from nmigen.build import *
5-
from nmigen.vendor.xilinx_7series import *
6-
from .resources import *
74

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(Xilinx7SeriesPlatform):
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-
openocd = os.environ.get("OPENOCD", "openocd")
79-
with products.extract("{}.bit".format(name)) as bitstream_filename:
80-
subprocess.check_call([openocd,
81-
# Use for debug output
82-
#"-d",
83-
"-c",
84-
"source [find board/digilent_cmod_a7.cfg]; init; pld load 0 {}; exit"
85-
.format(bitstream_filename)
86-
])
87-
88-
89-
class CmodA7_15Platform(_CmodA7Platform):
90-
device = "xc7a15t"
91-
92-
class CmodA7_35Platform(_CmodA7Platform):
93-
device = "xc7a35t"
94-
95-
if __name__ == "__main__":
96-
from .test.blinky import *
97-
CmodA7_35Platform().build(Blinky(), do_program=True)
5+
import warnings
6+
warnings.warn("instead of nmigen_boards.cmod_a7, use amaranth_boards.cmod_a7",
7+
DeprecationWarning, stacklevel=2)

0 commit comments

Comments
 (0)