def __init__(self, platform, cpu_type="or1k", **kwargs): MiniSoC.__init__(self, platform, cpu_type=cpu_type, sdram_controller_settings=MiniconSettings(l2_size=128*1024), with_timer=False, **kwargs) AMPSoC.__init__(self) self.submodules.leds = gpio.GPIOOut(Cat( platform.request("user_led", 0), platform.request("user_led", 1)))
def __init__(self, platform, firmware_ram_size=0xa000, firmware_filename=None, **kwargs): clk_freq = (83 + Fraction(1, 3)) * 1000 * 1000 SDRAMSoC.__init__(self, platform, clk_freq, integrated_rom_size=0x8000, sdram_controller_settings=LASMIconSettings( l2_size=32, with_bandwidth=True), **kwargs) platform.add_extension(PipistrelloCustom) self.submodules.crg = _CRG(platform, clk_freq) self.submodules.dna = dna.DNA() self.submodules.git_info = git_info.GitInfo() self.submodules.platform_info = platform_info.PlatformInfo( "pipistrello"[:8], self.__class__.__name__[:8]) self.submodules.fx2_reset = gpio.GPIOOut(platform.request("fx2_reset")) self.submodules.fx2_hack = i2c_hack.I2CShiftReg( platform.request("fx2_hack")) self.submodules.firmware_ram = firmware.FirmwareROM( firmware_ram_size, firmware_filename) self.register_mem("firmware_ram", self.mem_map["firmware_ram"], self.firmware_ram.bus, firmware_ram_size) self.add_constant("ROM_BOOT_ADDRESS", self.mem_map["firmware_ram"]) if not self.integrated_main_ram_size: self.submodules.ddrphy = s6ddrphy.S6HalfRateDDRPHY( platform.request("ddram"), MT46H32M16(self.clk_freq), rd_bitslip=1, wr_bitslip=3, dqs_ddr_alignment="C1") self.comb += [ self.ddrphy.clk4x_wr_strb.eq(self.crg.clk4x_wr_strb), self.ddrphy.clk4x_rd_strb.eq(self.crg.clk4x_rd_strb), ] self.register_sdram_phy(self.ddrphy) self.submodules.spiflash = spiflash.SpiFlash( platform.request("spiflash4x"), dummy=platform.spiflash_read_dummy_bits, div=platform.spiflash_clock_div) self.add_constant("SPIFLASH_PAGE_SIZE", platform.spiflash_page_size) self.add_constant("SPIFLASH_SECTOR_SIZE", platform.spiflash_sector_size) self.flash_boot_address = self.mem_map[ "spiflash"] + platform.gateware_size self.register_mem("spiflash", self.mem_map["spiflash"], self.spiflash.bus, size=platform.gateware_size)
def __init__(self, platform, firmware_ram_size=0x10000, firmware_filename=None, **kwargs): clk_freq = 50*1000000 SDRAMSoC.__init__(self, platform, clk_freq, integrated_rom_size=0x8000, sdram_controller_settings=LASMIconSettings(l2_size=32, with_bandwidth=True), with_uart=False, **kwargs) self.submodules.crg = _CRG(platform, clk_freq) self.submodules.dna = dna.DNA() self.submodules.git_info = git_info.GitInfo() self.submodules.platform_info = platform_info.PlatformInfo("opsis", self.__class__.__name__[:8]) fx2_uart_pads = platform.request("serial_fx2") sd_card_uart_pads = platform.request("serial_sd_card") uart_pads = UARTSharedPads() self.comb += [ # TX fx2_uart_pads.tx.eq(uart_pads.tx), sd_card_uart_pads.tx.eq(uart_pads.tx), # RX uart_pads.rx.eq(fx2_uart_pads.rx & sd_card_uart_pads.rx) ] self.submodules.uart_phy = UARTPHY(uart_pads, self.clk_freq, 115200) self.submodules.uart = uart.UART(self.uart_phy) # self.submodules.opsis_eeprom_i2c = i2c.I2C(platform.request("opsis_eeprom")) self.submodules.fx2_reset = gpio.GPIOOut(platform.request("fx2_reset")) self.submodules.fx2_hack = i2c_hack.I2CShiftReg(platform.request("opsis_eeprom")) self.submodules.tofe_eeprom_i2c = i2c.I2C(platform.request("tofe_eeprom")) self.submodules.firmware_ram = firmware.FirmwareROM(firmware_ram_size, firmware_filename) self.register_mem("firmware_ram", self.mem_map["firmware_ram"], self.firmware_ram.bus, firmware_ram_size) self.add_constant("ROM_BOOT_ADDRESS", self.mem_map["firmware_ram"]) if not self.integrated_main_ram_size: self.submodules.ddrphy = s6ddrphy.S6QuarterRateDDRPHY(platform.request("ddram"), MT41J128M16(self.clk_freq), rd_bitslip=0, wr_bitslip=4, dqs_ddr_alignment="C0") self.comb += [ self.ddrphy.clk8x_wr_strb.eq(self.crg.clk8x_wr_strb), self.ddrphy.clk8x_rd_strb.eq(self.crg.clk8x_rd_strb), ] self.register_sdram_phy(self.ddrphy) self.submodules.spiflash = spiflash.SpiFlash( platform.request("spiflash4x"), dummy=platform.spiflash_read_dummy_bits, div=platform.spiflash_clock_div) self.add_constant("SPIFLASH_PAGE_SIZE", platform.spiflash_page_size) self.add_constant("SPIFLASH_SECTOR_SIZE", platform.spiflash_sector_size) self.flash_boot_address = self.mem_map["spiflash"]+platform.gateware_size self.register_mem("spiflash", self.mem_map["spiflash"], self.spiflash.bus, size=platform.gateware_size) self.specials += Keep(self.crg.cd_sys.clk) platform.add_platform_command(""" NET "{sys_clk}" TNM_NET = "GRPsys_clk"; """, sys_clk=self.crg.cd_sys.clk)
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)