diff options
| author | Jean THOMAS <pub0@github.jeanthomas.me> | 2020-02-03 07:52:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-03 06:52:26 +0000 |
| commit | 9117a6ae0d074b82142c93ef3891db6f0241166f (patch) | |
| tree | 9c3633bcedd5c1a71803ac61c3a9de2aa46f61cd /nmigen_boards/fomu_pvt.py | |
| parent | fae1ad4d542c41c2f5a6d0432374c74929a8876c (diff) | |
Add Fomu PVT support.
Diffstat (limited to 'nmigen_boards/fomu_pvt.py')
| -rw-r--r-- | nmigen_boards/fomu_pvt.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/nmigen_boards/fomu_pvt.py b/nmigen_boards/fomu_pvt.py new file mode 100644 index 0000000..4a2b1ba --- /dev/null +++ b/nmigen_boards/fomu_pvt.py @@ -0,0 +1,54 @@ +import os +import subprocess + +from nmigen.build import * +from nmigen.vendor.lattice_ice40 import * +from .resources import * + + +__all__ = ["FomuPVTPlatform"] + + +class FomuPVTPlatform(LatticeICE40Platform): + device = "iCE40UP5K" + package = "UWG30" + default_clk = "clk48" + resources = [ + Resource("clk48", 0, Pins("F4", dir="i"), + Clock(48e6), Attrs(GLOBAL=True, IO_STANDARD="SB_LVCMOS")), + + *LEDResources(pins="A5", invert=True, attrs=Attrs(IO_STANDARD="SB_LVCMOS")), + RGBLEDResource(0, + r="B5", g="A5", b="C5", invert=True, + attrs=Attrs(IO_STANDARD="SB_LVCMOS") + ), + + Resource("usb", 0, + Subsignal("d_p", Pins("A1")), + Subsignal("d_n", Pins("A2")), + Subsignal("pullup", Pins("A4")), + Attrs(IO_STANDARD="SB_LVCMOS"), + ), + + *SPIFlashResources(0, + cs="C1", clk="D1", mosi="F1", miso="E1", + attrs=Attrs(IO_STANDARD="SB_LVCMOS"), + ), + + Resource("touch", 0, Pins("E4")), + Resource("touch", 1, Pins("D5")), + Resource("touch", 2, Pins("E5")), + Resource("touch", 3, Pins("F5")), + ] + + connectors = [] + + def toolchain_program(self, products, name): + dfu_util = os.environ.get("DFU_UTIL", "dfu-util") + with products.extract("{}.bin".format(name)) as bitstream_filename: + subprocess.check_call([dfu_util, "-D", bitstream_filename]) + + +if __name__ == "__main__": + from .test.blinky import * + FomuPVTPlatform().build(Blinky(), do_program=True) |
