amaranth-lang / amaranth-boards

Board definitions for Amaranth HDL
BSD 2-Clause "Simplified" License
106 stars 109 forks source link

Please add iCESugar.Pro support #197

Open gromas opened 2 years ago

gromas commented 2 years ago

icesugar_pro.zip

board has some more resources but this is basics for tests

josuah commented 1 year ago

I think this is this board from Muse Labs: https://github.com/wuxx/icesugar-pro

Content of the .zip for convenience:

import subprocess

from amaranth.build import *
from amaranth.vendor.lattice_ecp5 import *
from .resources import *

__all__ = ["ICESugarProPlatform"]

class ICESugarProPlatform(LatticeECP5Platform):
    device      = "LFE5U-25F"
    package     = "BG256"
    speed = "6"
    default_clk = "clk25"
    default_rst = "rst"
    resources   = [
        Resource("clk25", 0, Pins("P6", dir="i"), 
                 Clock(25e6), Attrs(IO_STANDARD="LVCMOS33")),
        Resource("rst", 0, Pins("L14",dir="i"), Attrs(IO_TYPE = "LVCMOS33")),

        RGBLEDResource(0, r="B11", g="A11", b="A12", attrs=Attrs(IOSTANDARD="LVCMOS33"))

    ]

    def toolchain_program(self, products, name):
        with products.extract("{}.bin".format(name)) as bitstream_filename:
            subprocess.check_call(["icesprog", bitstream_filename])

if __name__ == "__main__":
    from .test.blinky import *
    ICESugarProPlatform().build(Blinky(), do_program=True)

A pull-request with it would have been easier to work with for the maintainers maybe.

[EDIT: my bad, there is already one based on top of this work!]

josuah commented 1 year ago

@gromas thank you, this helped consolidating #198