def add_rtio(self, rtio_channels): self.submodules.rtio_crg = _RTIOCRG(self.platform, self.crg.cd_sys.clk) self.submodules.rtio = rtio.RTIO(rtio_channels) self.add_constant("RTIO_FINE_TS_WIDTH", self.rtio.fine_ts_width) assert self.rtio.fine_ts_width <= 3 self.add_constant("DDS_RTIO_CLK_RATIO", 8 >> self.rtio.fine_ts_width) self.submodules.rtio_moninj = rtio.MonInj(rtio_channels) if isinstance(self.platform.toolchain, XilinxVivadoToolchain): self.platform.add_platform_command(""" create_clock -name rsys_clk -period 8.0 [get_nets {rsys_clk}] create_clock -name rio_clk -period 8.0 [get_nets {rio_clk}] set_false_path -from [get_clocks rsys_clk] -to [get_clocks rio_clk] set_false_path -from [get_clocks rio_clk] -to [get_clocks rsys_clk] """, rsys_clk=self.rtio.cd_rsys.clk, rio_clk=self.rtio.cd_rio.clk) if isinstance(self.platform.toolchain, XilinxISEToolchain): self.platform.add_platform_command(""" NET "sys_clk" TNM_NET = "GRPrsys_clk"; NET "{rio_clk}" TNM_NET = "GRPrio_clk"; TIMESPEC "TSfix_cdc1" = FROM "GRPrsys_clk" TO "GRPrio_clk" TIG; TIMESPEC "TSfix_cdc2" = FROM "GRPrio_clk" TO "GRPrsys_clk" TIG; """, rio_clk=self.rtio_crg.cd_rtio.clk) rtio_csrs = self.rtio.get_csrs() self.submodules.rtiowb = wbgen.Bank(rtio_csrs) self.kernel_cpu.add_wb_slave(mem_decoder(self.mem_map["rtio"]), self.rtiowb.bus) self.add_csr_region("rtio", self.mem_map["rtio"] | 0x80000000, 32, rtio_csrs)
def add_rtio(self, rtio_channels): self.submodules.rtio_crg = _RTIOCRG(self.platform, self.crg.cd_sys.clk) self.submodules.rtio = rtio.RTIO(rtio_channels) self.register_kernel_cpu_csrdevice("rtio") self.config["RTIO_FINE_TS_WIDTH"] = self.rtio.fine_ts_width self.submodules.rtio_moninj = rtio.MonInj(rtio_channels) self.specials += [ Keep(self.rtio.cd_rsys.clk), Keep(self.rtio_crg.cd_rtio.clk), Keep(self.ethphy.crg.cd_eth_rx.clk), Keep(self.ethphy.crg.cd_eth_tx.clk), ] self.platform.add_period_constraint(self.rtio.cd_rsys.clk, 8.) self.platform.add_period_constraint(self.rtio_crg.cd_rtio.clk, 8.) self.platform.add_period_constraint(self.ethphy.crg.cd_eth_rx.clk, 8.) self.platform.add_period_constraint(self.ethphy.crg.cd_eth_tx.clk, 8.) self.platform.add_false_path_constraints( self.rtio.cd_rsys.clk, self.rtio_crg.cd_rtio.clk, self.ethphy.crg.cd_eth_rx.clk, self.ethphy.crg.cd_eth_tx.clk) self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio, self.get_native_sdram_if())
def __init__(self, cpu_type="or1k", **kwargs): BaseSoC.__init__(self, cpu_type=cpu_type, l2_size=64*1024, with_timer=False, ident=artiq_version, clk_freq=75*1000*1000, **kwargs) AMPSoC.__init__(self) platform = self.platform platform.toolchain.bitgen_opt += " -g compress" platform.toolchain.ise_commands += """ trce -v 12 -fastpaths -tsi {build_name}.tsi -o {build_name}.twr {build_name}.ncd {build_name}.pcf """ platform.add_extension(nist_qc1.papilio_adapter_io) platform.add_extension(_pmod_spi) self.submodules.leds = gpio.GPIOOut(platform.request("user_led", 4)) self.comb += [ platform.request("ttl_l_tx_en").eq(1), platform.request("ttl_h_tx_en").eq(1) ] self.submodules.rtio_crg = _RTIOCRG(platform, self.clk_freq) self.csr_devices.append("rtio_crg") # RTIO channels rtio_channels = [] # pmt1 can run on a 8x serdes if pmt0 is not used for i in range(2): phy = ttl_serdes_spartan6.Inout_4X(platform.request("pmt", i), self.rtio_crg.rtiox4_stb) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=128, ofifo_depth=4)) # the last TTL is used for ClockGen for i in range(15): if i in (0, 1): phy = ttl_serdes_spartan6.Output_4X(platform.request("ttl", i), self.rtio_crg.rtiox4_stb) elif i in (2,): # ttl2 can run on a 8x serdes if xtrig is not used phy = ttl_serdes_spartan6.Output_8X(platform.request("ttl", i), self.rtio_crg.rtiox8_stb) else: phy = ttl_simple.Output(platform.request("ttl", i)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=128)) phy = ttl_simple.Output(platform.request("ext_led", 0)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=4)) for led_number in range(4): phy = ttl_simple.Output(platform.request("user_led", led_number)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=4)) self.config["RTIO_REGULAR_TTL_COUNT"] = len(rtio_channels) phy = ttl_simple.ClockGen(platform.request("ttl", 15)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy)) phy = spi.SPIMaster(self.platform.request("pmod_extended_spi", 0)) self.submodules += phy self.config["RTIO_FIRST_SPI_CHANNEL"] = len(rtio_channels) rtio_channels.append(rtio.Channel.from_phy( phy, ofifo_depth=64, ififo_depth=64)) self.config["RTIO_FIRST_DDS_CHANNEL"] = len(rtio_channels) self.config["RTIO_DDS_COUNT"] = 1 self.config["DDS_CHANNELS_PER_BUS"] = 8 self.config["DDS_AD9858"] = True dds_pins = platform.request("dds") self.comb += dds_pins.p.eq(0) phy = dds.AD9858(dds_pins, 8) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=128, ififo_depth=4)) self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) rtio_channels.append(rtio.LogChannel()) # RTIO logic self.submodules.rtio = rtio.RTIO(rtio_channels) self.register_kernel_cpu_csrdevice("rtio") self.config["RTIO_FINE_TS_WIDTH"] = self.rtio.fine_ts_width self.config["DDS_RTIO_CLK_RATIO"] = 8 >> self.rtio.fine_ts_width self.submodules.rtio_moninj = rtio.MonInj(rtio_channels) self.csr_devices.append("rtio_moninj") self.submodules.rtio_analyzer = rtio.Analyzer( self.rtio, self.get_native_sdram_if()) self.csr_devices.append("rtio_analyzer")
def __init__(self, platform, cpu_type="or1k", **kwargs): BaseSoC.__init__(self, platform, cpu_type=cpu_type, sdram_controller_settings=MiniconSettings(l2_size=64 * 1024), with_timer=False, **kwargs) AMPSoC.__init__(self) platform.toolchain.ise_commands += """ trce -v 12 -fastpaths -tsi {build_name}.tsi -o {build_name}.twr {build_name}.ncd {build_name}.pcf """ platform.add_extension(nist_qc1.papilio_adapter_io) self.submodules.leds = gpio.GPIOOut( Cat( platform.request("user_led", 0), platform.request("user_led", 1), platform.request("user_led", 2), platform.request("user_led", 3), )) self.comb += [ platform.request("ttl_l_tx_en").eq(1), platform.request("ttl_h_tx_en").eq(1) ] self.submodules.rtio_crg = _RTIOCRG(platform, self.clk_freq) # RTIO channels rtio_channels = [] # pmt1 can run on a 8x serdes if pmt0 is not used for i in range(2): phy = ttl_serdes_spartan6.Inout_4X(platform.request("pmt", i), self.rtio_crg.rtiox4_stb) self.submodules += phy rtio_channels.append( rtio.Channel.from_phy(phy, ififo_depth=512, ofifo_depth=4)) # ttl2 can run on a 8x serdes if xtrig is not used for i in range(15): if i in (0, 1): phy = ttl_serdes_spartan6.Output_4X(platform.request("ttl", i), self.rtio_crg.rtiox4_stb) elif i in (2, ): phy = ttl_serdes_spartan6.Output_8X(platform.request("ttl", i), self.rtio_crg.rtiox8_stb) else: phy = ttl_simple.Output(platform.request("ttl", i)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=256)) phy = ttl_simple.Output(platform.request("ext_led", 0)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=4)) phy = ttl_simple.Output(platform.request("user_led", 4)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=4)) self.add_constant("RTIO_REGULAR_TTL_COUNT", len(rtio_channels)) phy = ttl_simple.ClockGen(platform.request("ttl", 15)) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy)) self.add_constant("RTIO_DDS_CHANNEL", len(rtio_channels)) self.add_constant("DDS_CHANNEL_COUNT", 8) self.add_constant("DDS_AD9858") dds_pins = platform.request("dds") self.comb += dds_pins.p.eq(0) phy = dds.AD9858(dds_pins, 8) self.submodules += phy rtio_channels.append( rtio.Channel.from_phy(phy, ofifo_depth=512, ififo_depth=4)) # RTIO core self.submodules.rtio = rtio.RTIO(rtio_channels) self.add_constant("RTIO_FINE_TS_WIDTH", self.rtio.fine_ts_width) self.add_constant("DDS_RTIO_CLK_RATIO", 8 >> self.rtio.fine_ts_width) self.submodules.rtio_moninj = rtio.MonInj(rtio_channels) # CPU connections rtio_csrs = self.rtio.get_csrs() self.submodules.rtiowb = wbgen.Bank(rtio_csrs) self.kernel_cpu.add_wb_slave(mem_decoder(self.mem_map["rtio"]), self.rtiowb.bus) self.add_csr_region("rtio", self.mem_map["rtio"] | 0x80000000, 32, rtio_csrs)
def __init__(self, **kwargs): MiniSoC.__init__(self, cpu_type="or1k", sdram_controller_type="minicon", l2_size=128 * 1024, with_timer=False, ident="DRTIO_DEMO", **kwargs) AMPSoC.__init__(self) platform = self.platform platform.add_extension(ttl_extension) rtio_channels = [] phy = ttl_simple.Output(platform.request("user_sma_gpio_p")) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy)) phy = ttl_simple.Output(platform.request("user_sma_gpio_n")) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy)) for i in range(8): phy = ttl_simple.Output(platform.request("user_led")) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy)) for i in range(22): phy = ttl_simple.Output(platform.request("ttl")) self.submodules += phy rtio_channels.append(rtio.Channel.from_phy(phy)) self.comb += platform.request("sfp_tx_disable_n").eq(1) self.submodules.remote_ttl_channels = RemoteTTLChannels( clock_pads=platform.request("sgmii_clock"), tx_pads=platform.request("sfp_tx"), sys_clk_freq=125000000) rtio_channels += self.remote_ttl_channels.rtio_channels self.config["RTIO_REGULAR_TTL_COUNT"] = len(rtio_channels) self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) rtio_channels.append(rtio.LogChannel()) sma = platform.request("user_sma_clock_p") self.comb += sma.eq(ClockSignal("tx")) self.submodules.rtio = rtio.RTIO(rtio_channels) self.register_kernel_cpu_csrdevice("rtio") self.config["RTIO_FINE_TS_WIDTH"] = self.rtio.fine_ts_width self.submodules.rtio_moninj = rtio.MonInj(rtio_channels) self.specials += [ Keep(self.rtio.cd_rsys.clk), Keep(self.remote_ttl_channels.cd_rtio.clk), Keep(self.ethphy.crg.cd_eth_rx.clk), Keep(self.ethphy.crg.cd_eth_tx.clk), ] platform.add_period_constraint(self.rtio.cd_rsys.clk, 8.) platform.add_period_constraint(self.remote_ttl_channels.cd_rtio.clk, 16.) platform.add_period_constraint(self.ethphy.crg.cd_eth_rx.clk, 8.) platform.add_period_constraint(self.ethphy.crg.cd_eth_tx.clk, 8.) platform.add_false_path_constraints( self.rtio.cd_rsys.clk, self.remote_ttl_channels.cd_rtio.clk, self.ethphy.crg.cd_eth_rx.clk, self.ethphy.crg.cd_eth_tx.clk) self.submodules.rtio_analyzer = rtio.Analyzer( self.rtio, self.get_native_sdram_if())