From b968cfade961a329c26035ef8bfdf3058e95a9f1 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 10 Dec 2021 07:38:00 +0000 Subject: Rename nMigen to Amaranth HDL. --- nmigen_boards/test/__init__.py | 6 +++++ nmigen_boards/test/blinky.py | 51 +++++------------------------------------- 2 files changed, 11 insertions(+), 46 deletions(-) (limited to 'nmigen_boards/test') diff --git a/nmigen_boards/test/__init__.py b/nmigen_boards/test/__init__.py index e69de29..372b3b3 100644 --- a/nmigen_boards/test/__init__.py +++ b/nmigen_boards/test/__init__.py @@ -0,0 +1,6 @@ +from amaranth_boards.test import * + + +import warnings +warnings.warn("instead of nmigen_boards.test, use amaranth_boards.test", + DeprecationWarning, stacklevel=2) diff --git a/nmigen_boards/test/blinky.py b/nmigen_boards/test/blinky.py index b32b376..717f5c2 100644 --- a/nmigen_boards/test/blinky.py +++ b/nmigen_boards/test/blinky.py @@ -1,48 +1,7 @@ -import itertools +from amaranth_boards.test.blinky import * +from amaranth_boards.test.blinky import __all__ -from nmigen import * -from nmigen.build import ResourceError - -__all__ = ["Blinky"] - - -class Blinky(Elaboratable): - def elaborate(self, platform): - m = Module() - - def get_all_resources(name): - resources = [] - for number in itertools.count(): - try: - resources.append(platform.request(name, number)) - 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")] - - inverts = [0 for _ in leds] - for index, button in zip(itertools.cycle(range(len(inverts))), buttons): - inverts[index] ^= button - for index, switch in zip(itertools.cycle(range(len(inverts))), switches): - inverts[index] ^= switch - - clk_freq = platform.default_clk_frequency - timer = Signal(range(int(clk_freq//2)), reset=int(clk_freq//2) - 1) - flops = Signal(len(leds)) - - m.d.comb += Cat(leds).eq(flops ^ Cat(inverts)) - with m.If(timer == 0): - m.d.sync += timer.eq(timer.reset) - m.d.sync += flops.eq(~flops) - with m.Else(): - m.d.sync += timer.eq(timer - 1) - - return m +import warnings +warnings.warn("instead of nmigen_boards.test.blinky, use amaranth_boards.test.blinky", + DeprecationWarning, stacklevel=2) -- cgit v1.2.3