2019-06-24 06:13:30 -04:00
|
|
|
# This file is Copyright (c) 2019 Tom Keddie <git@bronwenandtom.com>
|
|
|
|
# This file is Copyright (c) 2019 Sean Cross <sean@xobs.io>
|
|
|
|
# License: BSD
|
|
|
|
|
2019-08-07 03:04:31 -04:00
|
|
|
# Fomu EVT board:
|
|
|
|
# - Crowd Supply campaign: https://www.crowdsupply.com/sutajio-kosagi/fomu
|
|
|
|
# - Design files: https://github.com/im-tomu/fomu-hardware/tree/evt/hardware/pcb
|
|
|
|
|
2019-06-05 12:45:38 -04:00
|
|
|
from litex.build.generic_platform import *
|
|
|
|
from litex.build.lattice import LatticePlatform
|
|
|
|
from litex.build.lattice.programmer import IceStormProgrammer
|
|
|
|
|
2019-08-07 03:04:31 -04:00
|
|
|
# IOs ----------------------------------------------------------------------------------------------
|
2019-06-05 12:45:38 -04:00
|
|
|
|
|
|
|
_io = [
|
2019-08-07 03:04:31 -04:00
|
|
|
("clk48", 0, Pins("44"), IOStandard("LVCMOS33")),
|
|
|
|
|
|
|
|
("user_led_n", 0, Pins("41"), IOStandard("LVCMOS33")),
|
2019-06-19 22:21:15 -04:00
|
|
|
("rgb_led", 0,
|
2019-06-05 14:14:32 -04:00
|
|
|
Subsignal("r", Pins("40")),
|
|
|
|
Subsignal("g", Pins("39")),
|
|
|
|
Subsignal("b", Pins("41")),
|
|
|
|
IOStandard("LVCMOS33"),
|
|
|
|
),
|
2019-08-07 03:04:31 -04:00
|
|
|
|
|
|
|
("user_btn_n", 0, Pins("42"), IOStandard("LVCMOS33")),
|
|
|
|
("user_btn_n", 1, Pins("38"), IOStandard("LVCMOS33")),
|
2019-06-05 12:45:38 -04:00
|
|
|
|
|
|
|
("serial", 0,
|
|
|
|
Subsignal("rx", Pins("21")),
|
|
|
|
Subsignal("tx", Pins("13"), Misc("PULLUP")),
|
|
|
|
IOStandard("LVCMOS33")
|
|
|
|
),
|
|
|
|
|
|
|
|
("usb", 0,
|
|
|
|
Subsignal("d_p", Pins("34")),
|
|
|
|
Subsignal("d_n", Pins("37")),
|
2020-04-09 14:02:02 -04:00
|
|
|
Subsignal("pullup", Pins("35")),
|
2019-06-05 14:14:32 -04:00
|
|
|
Subsignal("pulldown", Pins("36")),
|
2019-06-05 12:45:38 -04:00
|
|
|
IOStandard("LVCMOS33")
|
|
|
|
),
|
|
|
|
|
|
|
|
("spiflash", 0,
|
2019-06-05 14:14:32 -04:00
|
|
|
Subsignal("cs_n", Pins("16"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("clk", Pins("15"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("miso", Pins("17"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("mosi", Pins("14"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("wp", Pins("18"), IOStandard("LVCMOS33")),
|
2019-06-05 12:45:38 -04:00
|
|
|
Subsignal("hold", Pins("19"), IOStandard("LVCMOS33")),
|
|
|
|
),
|
|
|
|
|
|
|
|
("spiflash4x", 0,
|
|
|
|
Subsignal("cs_n", Pins("16"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("clk", Pins("15"), IOStandard("LVCMOS33")),
|
2019-10-11 09:38:50 -04:00
|
|
|
Subsignal("dq", Pins("14 17 18 19"), IOStandard("LVCMOS33")),
|
2019-06-05 12:45:38 -04:00
|
|
|
),
|
2019-09-26 23:26:23 -04:00
|
|
|
("i2c", 0,
|
|
|
|
Subsignal("scl", Pins("12"), IOStandard("LVCMOS18")),
|
|
|
|
Subsignal("sda", Pins("20"), IOStandard("LVCMOS18")),
|
|
|
|
),
|
2019-06-05 12:45:38 -04:00
|
|
|
]
|
|
|
|
|
2019-08-07 03:04:31 -04:00
|
|
|
# Connectors ---------------------------------------------------------------------------------------
|
|
|
|
|
2019-06-05 14:14:32 -04:00
|
|
|
_connectors = [
|
|
|
|
("touch_pins", "48 47 46 45"),
|
2020-04-09 14:02:02 -04:00
|
|
|
("pmoda_n", "28 27 26 23"),
|
|
|
|
("pmodb_n", "48 47 46 45"),
|
|
|
|
("dbg", "20 12 11 25 10 9"),
|
2019-06-05 14:14:32 -04:00
|
|
|
]
|
2019-06-05 12:45:38 -04:00
|
|
|
|
2019-08-07 03:04:31 -04:00
|
|
|
# Platform -----------------------------------------------------------------------------------------
|
2019-06-05 12:45:38 -04:00
|
|
|
|
|
|
|
class Platform(LatticePlatform):
|
2020-04-09 14:02:02 -04:00
|
|
|
default_clk_name = "clk48"
|
2019-08-07 02:47:08 -04:00
|
|
|
default_clk_period = 1e9/48e6
|
2019-06-05 12:45:38 -04:00
|
|
|
|
|
|
|
def __init__(self):
|
2019-08-07 03:04:31 -04:00
|
|
|
LatticePlatform.__init__(self, "ice40-up5k-sg48", _io, _connectors, toolchain="icestorm")
|
2019-06-05 12:45:38 -04:00
|
|
|
|
|
|
|
def create_programmer(self):
|
|
|
|
return IceStormProgrammer()
|
2020-05-05 05:45:41 -04:00
|
|
|
|
|
|
|
def do_finalize(self, fragment):
|
|
|
|
LatticePlatform.do_finalize(self, fragment)
|
|
|
|
self.add_period_constraint(self.lookup_request("clk48", loose=True), 1e9/48e6)
|