Skip to content

Commit bc2d92f

Browse files
committed
Expand to use pytest.
1 parent ed730e0 commit bc2d92f

File tree

7 files changed

+205
-74
lines changed

7 files changed

+205
-74
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ __pycache__/
88
/.pdm-python
99
/.venv
1010

11+
# pytest
12+
/.pytest_cache
13+
1114
# Amaranth
1215
/build*

pdm.lock

+119-37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+10-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@ description = "Template for a generic FPGA project using Amaranth"
55

66
requires-python = "~=3.8"
77
dependencies = [
8-
"amaranth @ git+https://github.com/amaranth-lang/amaranth",
9-
"amaranth-yosys",
8+
"amaranth[builtin-yosys] @ git+https://github.com/amaranth-lang/amaranth",
109
"amaranth-boards @ git+https://github.com/amaranth-lang/amaranth-boards",
1110
"yowasp-yosys",
1211
"yowasp-nextpnr-ice40",
1312
"yowasp-nextpnr-ecp5",
1413
"yowasp-nextpnr-gowin",
1514
]
1615

16+
[tool.pdm.dev-dependencies]
17+
test = [
18+
"pytest"
19+
]
20+
1721
[tool.pdm.scripts]
1822
_.env_file = ".env.toolchain"
19-
build_ice40 = {call = "amaranth_template_fpga:build_ice40()"}
20-
build_ecp5 = {call = "amaranth_template_fpga:build_ecp5()"}
21-
build_gowin = {call = "amaranth_template_fpga:build_gowin()"}
23+
test = { cmd = "pytest" }
24+
build_ice40 = { call = "amaranth_template_fpga:build_ice40()" }
25+
build_ecp5 = { call = "amaranth_template_fpga:build_ecp5()" }
26+
build_gowin = { call = "amaranth_template_fpga:build_gowin()" }

src/amaranth_template_fpga.py

-32
This file was deleted.
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from amaranth import *
2+
3+
from amaranth_boards.icestick import ICEStickPlatform
4+
from amaranth_boards.versa_ecp5 import VersaECP5Platform
5+
from amaranth_boards.tang_nano import TangNanoPlatform
6+
7+
from .blinky import Blinky
8+
9+
10+
class Toplevel(Elaboratable):
11+
def elaborate(self, platform):
12+
m = Module()
13+
14+
m.submodules.blinky = blinky = Blinky(frequency=platform.default_clk_frequency)
15+
m.d.comb += platform.request("led", 0).o.eq(blinky.led)
16+
17+
return m
18+
19+
20+
def build_ice40():
21+
ICEStickPlatform().build(Toplevel())
22+
23+
24+
def build_ecp5():
25+
VersaECP5Platform().build(Toplevel())
26+
27+
28+
def build_gowin():
29+
TangNanoPlatform().build(Toplevel())

0 commit comments

Comments
 (0)