From d7e6f104d29e7ac2d35a09e801fc7cb55eeb2ad5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 23 Jan 2019 14:11:51 +0800 Subject: [PATCH] kasli: add HUST variants --- artiq/examples/kasli_basic/device_db_hust.py | 323 +++++++++++++++++++ artiq/gateware/targets/kasli.py | 51 ++- 2 files changed, 373 insertions(+), 1 deletion(-) create mode 100644 artiq/examples/kasli_basic/device_db_hust.py diff --git a/artiq/examples/kasli_basic/device_db_hust.py b/artiq/examples/kasli_basic/device_db_hust.py new file mode 100644 index 000000000..07d861766 --- /dev/null +++ b/artiq/examples/kasli_basic/device_db_hust.py @@ -0,0 +1,323 @@ +core_addr = "kasli-1.lab.m-labs.hk" + +device_db = { + "core": { + "type": "local", + "module": "artiq.coredevice.core", + "class": "Core", + "arguments": {"host": core_addr, "ref_period": 1e-9} + }, + "core_log": { + "type": "controller", + "host": "::1", + "port": 1068, + "command": "aqctl_corelog -p {port} --bind {bind} " + core_addr + }, + "core_cache": { + "type": "local", + "module": "artiq.coredevice.cache", + "class": "CoreCache" + }, + "core_dma": { + "type": "local", + "module": "artiq.coredevice.dma", + "class": "CoreDMA" + }, + + "i2c_switch0": { + "type": "local", + "module": "artiq.coredevice.i2c", + "class": "PCA9548", + "arguments": {"address": 0xe0} + }, + "i2c_switch1": { + "type": "local", + "module": "artiq.coredevice.i2c", + "class": "PCA9548", + "arguments": {"address": 0xe2} + }, +} + +kasli2 = 0x010000 + +for i in range(16): + device_db["ttl" + str(i)] = { + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLInOut" if i < 4 else "TTLOut", + "arguments": {"channel": i}, + } + +for i in range(8): + device_db["ttl" + str(16+i)] = { + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | i}, + } + +device_db.update( + spi_urukul0={ + "type": "local", + "module": "artiq.coredevice.spi2", + "class": "SPIMaster", + "arguments": {"channel": 16} + }, + ttl_urukul0_io_update={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 17} + }, + ttl_urukul0_sw0={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 18} + }, + ttl_urukul0_sw1={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 19} + }, + ttl_urukul0_sw2={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 20} + }, + ttl_urukul0_sw3={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 21} + }, + urukul0_cpld={ + "type": "local", + "module": "artiq.coredevice.urukul", + "class": "CPLD", + "arguments": { + "spi_device": "spi_urukul0", + "io_update_device": "ttl_urukul0_io_update", + "refclk": 125e6, + "clk_sel": 2 + } + } +) + +for i in range(4): + device_db["urukul0_ch" + str(i)] = { + "type": "local", + "module": "artiq.coredevice.ad9910", + "class": "AD9910", + "arguments": { + "pll_n": 32, + "chip_select": 4 + i, + "cpld_device": "urukul0_cpld", + "sw_device": "ttl_urukul0_sw" + str(i) + } + } + + +device_db.update( + spi_urukul1={ + "type": "local", + "module": "artiq.coredevice.spi2", + "class": "SPIMaster", + "arguments": {"channel": 22} + }, + ttl_urukul1_io_update={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 23} + }, + ttl_urukul1_sw0={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 24} + }, + ttl_urukul1_sw1={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 25} + }, + ttl_urukul1_sw2={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 26} + }, + ttl_urukul1_sw3={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 27} + }, + urukul1_cpld={ + "type": "local", + "module": "artiq.coredevice.urukul", + "class": "CPLD", + "arguments": { + "spi_device": "spi_urukul1", + "io_update_device": "ttl_urukul1_io_update", + "refclk": 125e6, + "clk_sel": 2 + } + } +) + +for i in range(4): + device_db["urukul1_ch" + str(i)] = { + "type": "local", + "module": "artiq.coredevice.ad9910", + "class": "AD9910", + "arguments": { + "pll_n": 32, + "chip_select": 4 + i, + "cpld_device": "urukul1_cpld", + "sw_device": "ttl_urukul1_sw" + str(i) + } + } + + +device_db.update( + spi_urukul2={ + "type": "local", + "module": "artiq.coredevice.spi2", + "class": "SPIMaster", + "arguments": {"channel": kasli2 | 12} + }, + ttl_urukul2_io_update={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | 13} + }, + ttl_urukul2_sw0={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | 14} + }, + ttl_urukul2_sw1={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | 15} + }, + ttl_urukul2_sw2={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | 16} + }, + ttl_urukul2_sw3={ + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | 17} + }, + urukul2_cpld={ + "type": "local", + "module": "artiq.coredevice.urukul", + "class": "CPLD", + "arguments": { + "spi_device": "spi_urukul2", + "io_update_device": "ttl_urukul2_io_update", + "refclk": 125e6, + "clk_sel": 0 + } + } +) + +for i in range(4): + device_db["urukul2_ch" + str(i)] = { + "type": "local", + "module": "artiq.coredevice.ad9912", + "class": "AD9912", + "arguments": { + "pll_n": 8, + "chip_select": 4 + i, + "cpld_device": "urukul2_cpld", + "sw_device": "ttl_urukul2_sw" + str(i) + } + } + + +device_db["spi_sampler0_adc"] = { + "type": "local", + "module": "artiq.coredevice.spi2", + "class": "SPIMaster", + "arguments": {"channel": 28} +} +device_db["spi_sampler0_pgia"] = { + "type": "local", + "module": "artiq.coredevice.spi2", + "class": "SPIMaster", + "arguments": {"channel": 29} +} +device_db["spi_sampler0_cnv"] = { + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": 30}, +} +device_db["sampler0"] = { + "type": "local", + "module": "artiq.coredevice.sampler", + "class": "Sampler", + "arguments": { + "spi_adc_device": "spi_sampler0_adc", + "spi_pgia_device": "spi_sampler0_pgia", + "cnv_device": "spi_sampler0_cnv" + } +} + + +device_db["grabber0"] = { + "type": "local", + "module": "artiq.coredevice.grabber", + "class": "Grabber", + "arguments": {"channel_base": kasli2 | 8} +} + +device_db["grabber1"] = { + "type": "local", + "module": "artiq.coredevice.grabber", + "class": "Grabber", + "arguments": {"channel_base": kasli2 | 10} +} + + +device_db["spi_zotino0"] = { + "type": "local", + "module": "artiq.coredevice.spi2", + "class": "SPIMaster", + "arguments": {"channel": kasli2 | 18} +} +device_db["ttl_zotino0_ldac"] = { + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | 19} +} +device_db["ttl_zotino0_clr"] = { + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLOut", + "arguments": {"channel": kasli2 | 20} +} +device_db["zotino0"] = { + "type": "local", + "module": "artiq.coredevice.zotino", + "class": "Zotino", + "arguments": { + "spi_device": "spi_zotino0", + "ldac_device": "ttl_zotino0_ldac", + "clr_device": "ttl_zotino0_clr" + } +} diff --git a/artiq/gateware/targets/kasli.py b/artiq/gateware/targets/kasli.py index 8c17c765a..b7d12dc0b 100755 --- a/artiq/gateware/targets/kasli.py +++ b/artiq/gateware/targets/kasli.py @@ -1236,10 +1236,59 @@ class VLBAISatellite(_SatelliteBase): self.add_rtio(self.rtio_channels) +class HUSTMaster(_MasterBase): + def __init__(self, hw_rev=None, *args, **kwargs): + if hw_rev is None: + hw_rev = "v1.1" + _MasterBase.__init__(self, rtio_clk_freq=125e6, hw_rev=hw_rev, + enable_sata=True, *args, **kwargs) + + self.rtio_channels = [] + eem.DIO.add_std(self, 0, + ttl_serdes_7series.InOut_8X, ttl_serdes_7series.Output_8X) + eem.DIO.add_std(self, 1, + ttl_serdes_7series.Output_8X, ttl_serdes_7series.Output_8X) + eem.Urukul.add_std(self, 2, 3, ttl_serdes_7series.Output_8X) + eem.Urukul.add_std(self, 4, 5, ttl_serdes_7series.Output_8X) + eem.Sampler.add_std(self, 6, 7, ttl_serdes_7series.Output_8X) + + self.config["HAS_RTIO_LOG"] = None + self.config["RTIO_LOG_CHANNEL"] = len(self.rtio_channels) + self.rtio_channels.append(rtio.LogChannel()) + + self.add_rtio(self.rtio_channels) + + +class HUSTSatellite(_SatelliteBase): + def __init__(self, hw_rev=None, *args, **kwargs): + if hw_rev is None: + hw_rev = "v1.1" + _SatelliteBase.__init__(self, rtio_clk_freq=125e6, hw_rev=hw_rev, + enable_sata=True, *args, **kwargs) + + self.rtio_channels = [] + self.grabber_csr_group = [] + eem.DIO.add_std(self, 0, + ttl_serdes_7series.Output_8X, ttl_serdes_7series.Output_8X) + eem.Grabber.add_std(self, 1, 2) + eem.Grabber.add_std(self, 3, 4) + eem.Urukul.add_std(self, 5, 6, ttl_serdes_7series.Output_8X) + eem.Zotino.add_std(self, 7, ttl_serdes_7series.Output_8X) + + self.add_rtio(self.rtio_channels) + self.config["HAS_GRABBER"] = None + self.add_csr_group("grabber", self.grabber_csr_group) + self.platform.add_false_path_constraints( + self.drtio_transceiver.gtps[0].txoutclk, self.grabber0.deserializer.cd_cl.clk) + self.platform.add_false_path_constraints( + self.drtio_transceiver.gtps[0].txoutclk, self.grabber1.deserializer.cd_cl.clk) + + VARIANTS = {cls.__name__.lower(): cls for cls in [ Opticlock, SUServo, PTB, PTB2, HUB, LUH, SYSU, MITLL, MITLL2, USTC, Tsinghua, Tsinghua2, WIPM, NUDT, Berkeley, - VLBAIMaster, VLBAISatellite, Tester, Master, Satellite]} + VLBAIMaster, VLBAISatellite, HUSTMaster, HUSTSatellite, + Tester, Master, Satellite]} def main():