wip: test works, bypass amaranth-boards not working

This commit is contained in:
saji 2024-09-21 22:33:47 -05:00
parent 20b16b6d40
commit 3188fdefa5
2 changed files with 46 additions and 18 deletions

View file

@ -2,7 +2,7 @@ import os
import subprocess
from amaranth.vendor import LatticeECP5Platform
from amaranth.build import Resource, Pins, Attrs, Clock, Subsignal, PinsN, Connector
from amaranth_boards.resources import SDRAMResource
# from amaranth_boards.resources import SDRAMResource, LEDResources, ButtonResources
class Colorlight_5A75B_R82Platform(LatticeECP5Platform):
@ -23,23 +23,25 @@ class Colorlight_5A75B_R82Platform(LatticeECP5Platform):
Subsignal("copi", Pins("T8", dir="o")),
Attrs(IO_TYPE="LVCMOS33"),
),
Resource("usr_btn", 0, Pins("R7", dir="i"), Attrs(IO_TYPE="LVCMOS33")),
Resource("usr_led", 0, Pins("T6", dir="o"), Attrs(IO_TYPE="LVCMOS33")),
SDRAMResource(
0,
clk="C8",
we_n="B5",
cas_n="A6",
ras_n="B6",
ba="B7 A8",
a="A9 B9 B10 C10 D9 C9 E9 D8 E8 C7 B8",
dq="B2 A2 C3 A3 B3 A4 B4 A5 E7 C6 D7 D6 "
"E6 D5 C5 E5 A11 B11 B12 A13 B13 A14 B14 D14 D13 "
"E11 C13 D11 C12 D10 C11 D10",
attrs=Attrs(
PULLMODE="NONE", DRIVE="4", SLEWRATE="FAST", IO_TYPE="LVCMOS33"
),
),
Resource("led", 0, PinsN("T6", dir="o"), Attrs(IO_TYPE="LVCMOS33")),
# *ButtonResources(
# pins="R7", invert=True, attrs=Attrs(IO_TYPE="LVCMOS33", PULLMODE="UP")
# ),
# SDRAMResource(
# 0,
# clk="C8",
# we_n="B5",
# cas_n="A6",
# ras_n="B6",
# ba="B7 A8",
# a="A9 B9 B10 C10 D9 C9 E9 D8 E8 C7 B8",
# dq="B2 A2 C3 A3 B3 A4 B4 A5 E7 C6 D7 D6 "
# "E6 D5 C5 E5 A11 B11 B12 A13 B13 A14 B14 D14 D13 "
# "E11 C13 D11 C12 D10 C11 D10",
# attrs=Attrs(
# PULLMODE="NONE", DRIVE="4", SLEWRATE="FAST", IO_TYPE="LVCMOS33"
# ),
# ),
Resource(
"eth_rgmii",
0,

26
tests/test_platform.py Normal file
View file

@ -0,0 +1,26 @@
from amaranth import Elaboratable, Module, Signal
from amaranth.lib.io import Buffer
from groovylight.platforms.colorlight_5a75b_v8_2 import Colorlight_5A75B_R82Platform
class Blinky(Elaboratable):
def elaborate(self, platform):
m = Module()
m.submodules.led = led = Buffer("o", platform.request("led", dir="-"))
state = Signal()
counter = Signal(24)
with m.If(counter == 0):
m.d.sync += [counter.eq(~0), state.eq(~state)]
with m.Else():
m.d.sync += counter.eq(counter - 1)
m.d.comb += led.o.eq(state)
return m
def test_platform():
plat = Colorlight_5A75B_R82Platform()
plat.build(Blinky())