2019-06-24 06:13:30 -04:00
|
|
|
# This file is Copyright (c) 2019 Tom Keddie <git@bronwenandtom.com>
|
|
|
|
# License: BSD
|
|
|
|
|
2019-08-07 03:04:31 -04:00
|
|
|
# Fomu Hacker board:
|
|
|
|
# - Design files: https://github.com/im-tomu/fomu-hardware/tree/master/hacker/releases/v0.0-19-g154fecc
|
2019-06-07 09:29:07 -04:00
|
|
|
|
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("F5"), IOStandard("LVCMOS33")),
|
|
|
|
|
|
|
|
("user_led_n", 0, Pins("A5"), IOStandard("LVCMOS33")),
|
2019-06-05 12:45:38 -04:00
|
|
|
("rgb_led", 0,
|
|
|
|
Subsignal("r", Pins("C5")),
|
|
|
|
Subsignal("g", Pins("B5")),
|
|
|
|
Subsignal("b", Pins("A5")),
|
|
|
|
IOStandard("LVCMOS33")
|
|
|
|
),
|
|
|
|
|
2019-08-07 03:04:31 -04:00
|
|
|
("user_touch_n", 0, Pins("F4"), IOStandard("LVCMOS33")),
|
|
|
|
("user_touch_n", 1, Pins("E5"), IOStandard("LVCMOS33")),
|
|
|
|
("user_touch_n", 2, Pins("E4"), IOStandard("LVCMOS33")),
|
|
|
|
("user_touch_n", 3, Pins("F2"), IOStandard("LVCMOS33")),
|
2019-06-05 12:45:38 -04:00
|
|
|
|
|
|
|
("usb", 0,
|
|
|
|
Subsignal("d_p", Pins("A4")),
|
|
|
|
Subsignal("d_n", Pins("A2")),
|
|
|
|
Subsignal("pullup", Pins("D5")),
|
|
|
|
IOStandard("LVCMOS33")
|
|
|
|
),
|
|
|
|
|
|
|
|
("spiflash", 0,
|
|
|
|
Subsignal("cs_n", Pins("C1"), IOStandard("LVCMOS33")),
|
2019-11-24 08:56:57 -05:00
|
|
|
Subsignal("clk", Pins("D1"), IOStandard("LVCMOS33")),
|
2019-06-05 12:45:38 -04:00
|
|
|
Subsignal("mosi", Pins("F1"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("miso", Pins("E1"), IOStandard("LVCMOS33")),
|
|
|
|
),
|
2019-11-24 08:56:57 -05:00
|
|
|
|
|
|
|
("spiflash4x", 0,
|
|
|
|
Subsignal("cs_n", Pins("C1"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("clk", Pins("D1"), IOStandard("LVCMOS33")),
|
|
|
|
Subsignal("dq", Pins("F1 E1"), IOStandard("LVCMOS33")),
|
|
|
|
),
|
2019-06-05 12:45:38 -04:00
|
|
|
]
|
|
|
|
|
2019-08-07 03:04:31 -04:00
|
|
|
# Connectors ---------------------------------------------------------------------------------------
|
|
|
|
|
2019-06-05 12:45:38 -04:00
|
|
|
_connectors = [
|
2019-06-05 14:14:32 -04:00
|
|
|
("touch_pins", "F4 E5 E4 F2"),
|
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-uwg30", _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)
|