diff options
Diffstat (limited to 'nmigen_boards/ice40_hx1k_blink_evn.py')
| -rw-r--r-- | nmigen_boards/ice40_hx1k_blink_evn.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/nmigen_boards/ice40_hx1k_blink_evn.py b/nmigen_boards/ice40_hx1k_blink_evn.py new file mode 100644 index 0000000..fc80d64 --- /dev/null +++ b/nmigen_boards/ice40_hx1k_blink_evn.py @@ -0,0 +1,42 @@ +import os +import subprocess + +from nmigen.build import * +from nmigen.vendor.lattice_ice40 import * + + +__all__ = ["ICE40HX1KBlinkEVNPlatform"] + + +class ICE40HX1KBlinkEVNPlatform(LatticeICE40Platform): + device = "hx1k" + package = "vq100" + clocks = [ + ("clk3p3", 3.3e6), + ] + resources = [ + Resource("clk3p3", 0, Pins("13", dir="i"), + extras={"GLOBAL": "1", "IO_STANDARD": "SB_LVCMOS33"}), + + Resource("user_led", 0, Pins("59", dir="o"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + Resource("user_led", 1, Pins("56", dir="o"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + Resource("user_led", 2, Pins("53", dir="o"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + Resource("user_led", 3, Pins("51", dir="o"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + + Resource("user_btn", 0, Pins("60"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + Resource("user_btn", 1, Pins("57"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + Resource("user_btn", 2, Pins("54"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + Resource("user_btn", 3, Pins("52"), extras={"IO_STANDARD": "SB_LVCMOS33"}), + ] + connectors = [ + Connector("pmod", 1, "10 9 8 7 - - 4 3 2 1 - -"), # J1 + Connector("pmod", 5, "40 42 62 64 - - 37 41 63 45 - -"), # J5 + Connector("pmod", 6, "25 24 21 20 - - 26 27 28 33 - -"), # J6 + Connector("pmod", 11, "49 45 46 48 - -"), # J11 + Connector("pmod", 12, "59 56 53 51 - -"), # J12 + ] + + def toolchain_program(self, products, name): + iceburn = os.environ.get("ICEBURN", "iCEburn") + with products.extract("{}.bin".format(name)) as bitstream_filename: + subprocess.run([iceburn, "-evw", bitstream_filename], check=True) |
