humpback-dds/migen/humpback.py

50 lines
1.2 KiB
Python
Raw Normal View History

2020-08-09 02:03:47 +08:00
# Import built in I/O, Connectors & Platform template
from migen.build.platforms.sinara.humpback import _io, _connectors, Platform
# Import migen platform for Lattice Products
from migen.build.lattice import LatticePlatform
# Import migen pin record structure
from migen.build.generic_platform import *
# Modify the SPI record, to include all 3 CS pins
'''
sclk -> PA5 : C8
mosi -> PB5 : N5
miso -> PA6 : T2
cs_0 -> PB12: B13
cs_1 -> PA15: B14
cs_2 -> PC7 : B15
'''
# Filter out SPI record
_io = [record for record in _io if record[0] != "spi"]
2020-08-21 14:18:33 +08:00
# Reinsert new SPI record, without MISO
2020-08-09 02:03:47 +08:00
_io.append(
("spi", 0,
Subsignal("cs" , Pins("B13 B14 B15")),
Subsignal("sclk", Pins("C8")),
Subsignal("mosi", Pins("N5")),
Subsignal("miso", Pins("T2")),
IOStandard("LVCMOS33"),
)
)
2020-08-23 22:28:32 +08:00
# Resource: DDS I/O_Update
'''
2020-08-24 10:57:37 +08:00
io_update -> PB15 : A11
2020-08-23 22:28:32 +08:00
'''
2020-08-21 14:18:33 +08:00
_io.append(
2020-08-24 10:57:37 +08:00
("io_update", 0, Pins("A11"), IOStandard("LVCMOS33"))
2020-08-21 14:18:33 +08:00
)
2020-08-09 02:03:47 +08:00
# Inherit Platform to gain the programmed clock attribute
class HumpbackPlatform(Platform):
def __init__(self):
LatticePlatform.__init__(self, "ice40-hx8k-ct256", _io, _connectors, toolchain="icestorm")
# Syntax check for direct execution
if __name__ == "__main__":
platform = HumpbackPlatform()