aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-François Nguyen <jf@jfng.fr>2024-10-18 11:48:34 +0200
committerCatherine <whitequark@whitequark.org>2024-10-18 11:19:26 +0100
commit23c66d68045831de0a372c8c237274d74c71ef4e (patch)
tree1c08962f2e904236b712485892807235c18159ab
parentd2caa61a1ceb851da8e4e1109fddc56dc29e05ec (diff)
Drop compatibility with Amaranth 0.4.
-rw-r--r--.github/workflows/main.yml3
-rw-r--r--amaranth_boards/test/blinky.py27
-rw-r--r--pyproject.toml2
3 files changed, 17 insertions, 15 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b43fbba..eb396bf 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -21,14 +21,13 @@ jobs:
- 'pypy-3.10'
# this version range needs to be synchronized with the one in pyproject.toml
amaranth-version:
- - '0.4'
- '0.5'
- 'git'
allow-failure:
- true
- false
exclude: # all of these are inverted (this is unfortunately the best way to do this)
- - amaranth-version: '0.4'
+ - amaranth-version: '0.5'
allow-failure: false
- amaranth-version: 'git'
allow-failure: true
diff --git a/amaranth_boards/test/blinky.py b/amaranth_boards/test/blinky.py
index 9999246..60ca799 100644
--- a/amaranth_boards/test/blinky.py
+++ b/amaranth_boards/test/blinky.py
@@ -2,6 +2,7 @@ import itertools
from amaranth import *
from amaranth.build import ResourceError
+from amaranth.lib import io
__all__ = ["Blinky"]
@@ -15,32 +16,34 @@ class Blinky(Elaboratable):
resources = []
for number in itertools.count():
try:
- resources.append(platform.request(name, number))
+ resources.append(platform.request(name, number, dir="-"))
except ResourceError:
break
return resources
rgb_leds = [res for res in get_all_resources("rgb_led")]
- leds = [res.o for res in get_all_resources("led")]
- leds.extend([led.r.o for led in rgb_leds])
- leds.extend([led.g.o for led in rgb_leds])
- leds.extend([led.b.o for led in rgb_leds])
- buttons = [res.i for res in get_all_resources("button")]
- switches = [res.i for res in get_all_resources("switch")]
+ leds = [io.Buffer("o", res) for res in get_all_resources("led")]
+ leds.extend([io.Buffer("o", led.r) for led in rgb_leds])
+ leds.extend([io.Buffer("o", led.g) for led in rgb_leds])
+ leds.extend([io.Buffer("o", led.b) for led in rgb_leds])
+ buttons = [io.Buffer("i", res) for res in get_all_resources("button")]
+ switches = [io.Buffer("i", res) for res in get_all_resources("switch")]
+
+ m.submodules += leds + buttons + switches
inverts = [0 for _ in leds]
for index, button in zip(itertools.cycle(range(len(inverts))), buttons):
- inverts[index] ^= button
+ inverts[index] ^= button.i
for index, switch in zip(itertools.cycle(range(len(inverts))), switches):
- inverts[index] ^= switch
+ inverts[index] ^= switch.i
clk_freq = platform.default_clk_frequency
- timer = Signal(range(int(clk_freq//2)), reset=int(clk_freq//2) - 1)
+ timer = Signal(range(int(clk_freq//2)), init=int(clk_freq//2) - 1)
flops = Signal(len(leds))
- m.d.comb += Cat(leds).eq(flops ^ Cat(inverts))
+ m.d.comb += Cat(led.o for led in leds).eq(flops ^ Cat(inverts))
with m.If(timer == 0):
- m.d.sync += timer.eq(timer.reset)
+ m.d.sync += timer.eq(timer.init)
m.d.sync += flops.eq(~flops)
with m.Else():
m.d.sync += timer.eq(timer - 1)
diff --git a/pyproject.toml b/pyproject.toml
index 1882d75..46a389d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,7 +14,7 @@ license = {file = "LICENSE.txt"}
requires-python = "~=3.9"
dependencies = [
# this version requirement needs to be synchronized with the one in .github/workflows/main.yml
- "amaranth>=0.4,<0.7",
+ "amaranth>=0.5,<0.7",
]
[project.urls]