gateware: Add default TTLs to EBAZ4205 (#335)

Co-authored-by: newell <newell.jensen@gmail.com>
Co-committed-by: newell <newell.jensen@gmail.com>
This commit is contained in:
newell 2024-11-16 10:40:45 +08:00 committed by sb10q
parent 75e7fc55a3
commit d79bf8d54a
2 changed files with 29 additions and 2 deletions

View File

@ -53,13 +53,21 @@ device_db = {
}, },
} }
# TTLs starting at RTIO channel 2, ending at RTIO channel 15
for i in range(2, 16):
device_db["ttl" + str(i)] = {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLInOut",
"arguments": {"channel": i},
}
device_db.update( device_db.update(
spi0={ spi0={
"type": "local", "type": "local",
"module": "artiq.coredevice.spi2", "module": "artiq.coredevice.spi2",
"class": "SPIMaster", "class": "SPIMaster",
"arguments": {"channel": 2}, "arguments": {"channel": 16},
}, },
dds0={ dds0={
"type": "local", "type": "local",

View File

@ -5,7 +5,7 @@ import argparse
import analyzer import analyzer
import dma import dma
from artiq.gateware import rtio from artiq.gateware import rtio
from artiq.gateware.rtio.phy import dds, spi2, ttl_simple from artiq.gateware.rtio.phy import spi2, ttl_simple
from artiq.gateware.rtio.xilinx_clocking import fix_serdes_timing_path from artiq.gateware.rtio.xilinx_clocking import fix_serdes_timing_path
from config import write_csr_file, write_mem_file, write_rustc_cfg_file from config import write_csr_file, write_mem_file, write_rustc_cfg_file
from migen import * from migen import *
@ -91,6 +91,17 @@ _spi = [
] ]
# Connector DATA1
def _create_ttl():
_ttl = []
for idx, elem in enumerate([x for x in range(5, 21) if x not in (10, 12)]):
_ttl.append(
("ttl", idx, Pins("DATA1:DATA1-{}".format(elem)), IOStandard("LVCMOS33")),
)
return _ttl
class EBAZ4205(SoCCore): class EBAZ4205(SoCCore):
def __init__(self, rtio_clk=125e6, acpki=False): def __init__(self, rtio_clk=125e6, acpki=False):
self.acpki = acpki self.acpki = acpki
@ -105,6 +116,7 @@ class EBAZ4205(SoCCore):
platform.add_extension(_ddr) platform.add_extension(_ddr)
platform.add_extension(_i2c) platform.add_extension(_i2c)
platform.add_extension(_spi) platform.add_extension(_spi)
platform.add_extension(_create_ttl())
gmii = platform.request("gmii") gmii = platform.request("gmii")
platform.add_period_constraint(gmii.rx_clk, 10) platform.add_period_constraint(gmii.rx_clk, 10)
@ -180,6 +192,13 @@ class EBAZ4205(SoCCore):
self.submodules += phy self.submodules += phy
self.rtio_channels.append(rtio.Channel.from_phy(phy)) self.rtio_channels.append(rtio.Channel.from_phy(phy))
for i in range(14):
print("TTL at RTIO channel 0x{:06x}".format(len(self.rtio_channels)))
ttl = self.platform.request("ttl", i)
phy = ttl_simple.InOut(ttl)
self.submodules += phy
self.rtio_channels.append(rtio.Channel.from_phy(phy))
print("SPI at RTIO channel 0x{:06x}".format(len(self.rtio_channels))) print("SPI at RTIO channel 0x{:06x}".format(len(self.rtio_channels)))
spi_phy = spi2.SPIMaster(platform.request("spi")) spi_phy = spi2.SPIMaster(platform.request("spi"))
self.submodules += spi_phy self.submodules += spi_phy