def __init__(self, board, revision, with_ethernet=False, with_etherbone=False, sys_clk_freq=60e6, sdram_rate="1:1", **kwargs): board = board.lower() assert board in ["5a-75b", "5a-75e"] if board == "5a-75b": platform = colorlight_5a_75b.Platform(revision=revision) elif board == "5a-75e": platform = colorlight_5a_75e.Platform(revision=revision) # SoCCore ---------------------------------------------------------------------------------- SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Colorlight " + board.upper(), ident_version=True, **kwargs) # CRG -------------------------------------------------------------------------------------- with_rst = kwargs["uart_name"] not in [ "serial", "bridge" ] # serial_rx shared with user_btn_n. with_usb_pll = kwargs.get("uart_name", None) == "usb_acm" self.submodules.crg = _CRG(platform, sys_clk_freq, with_usb_pll=with_usb_pll, with_rst=with_rst, sdram_rate=sdram_rate) # SDR SDRAM -------------------------------------------------------------------------------- if not self.integrated_main_ram_size: sdrphy_cls = HalfRateGENSDRPHY if sdram_rate == "1:2" else GENSDRPHY self.submodules.sdrphy = sdrphy_cls(platform.request("sdram")) self.add_sdram("sdram", phy=self.sdrphy, module=M12L16161A(sys_clk_freq, sdram_rate), origin=self.mem_map["main_ram"], size=kwargs.get("max_sdram_size", 0x40000000), l2_cache_size=kwargs.get("l2_size", 8192), l2_cache_min_data_width=kwargs.get( "min_l2_data_width", 128), l2_cache_reverse=True) # Ethernet / Etherbone --------------------------------------------------------------------- if with_ethernet or with_etherbone: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads=self.platform.request("eth_clocks"), pads=self.platform.request("eth")) self.add_csr("ethphy") if with_ethernet: self.add_ethernet(phy=self.ethphy) if with_etherbone: self.add_etherbone(phy=self.ethphy)
def __init__(self, revision, with_ethernet=False, with_etherbone=False, sys_clk_freq=60e6, **kwargs): platform = colorlight_5a_75b.Platform(revision=revision) if (with_etherbone): sys_clk_freq = int(125e6) # SoCCore ---------------------------------------------------------------------------------- SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) # CRG -------------------------------------------------------------------------------------- with_rst = kwargs["uart_name"] not in [ "serial", "bridge" ] # serial_rx shared with user_btn_n. with_usb_pll = kwargs.get("uart_name", None) == "usb_cdc" self.submodules.crg = _CRG(platform, sys_clk_freq, with_usb_pll=with_usb_pll, with_rst=with_rst) # SDR SDRAM -------------------------------------------------------------------------------- if not self.integrated_main_ram_size: self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.add_sdram("sdram", phy=self.sdrphy, module=M12L16161A(sys_clk_freq, "1:1"), origin=self.mem_map["main_ram"], size=kwargs.get("max_sdram_size", 0x40000000), l2_cache_size=kwargs.get("l2_size", 8192), l2_cache_min_data_width=kwargs.get( "min_l2_data_width", 128), l2_cache_reverse=True) # Ethernet --------------------------------------------------------------------------------- if with_ethernet: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads=self.platform.request("eth_clocks"), pads=self.platform.request("eth")) self.add_csr("ethphy") self.add_ethernet(phy=self.ethphy) # Etherbone -------------------------------------------------------------------------------- if with_etherbone: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads=self.platform.request("eth_clocks"), pads=self.platform.request("eth")) self.add_csr("ethphy") self.add_etherbone(phy=self.ethphy)
def __init__(self, revision): SoCCore.mem_map = { "rom": 0x00000000, "sram": 0x10000000, "spiflash": 0x20000000, "main_ram": 0x40000000, "csr": 0x82000000, } platform = colorlight_5a_75b.Platform(revision) sys_clk_freq = int(90e6) # SoC with CPU SoCCore.__init__(self, platform, cpu_type = "vexriscv", cpu_variant = "linux", clk_freq = sys_clk_freq, ident = "LiteX RISC-V SoC on 5A-75B", ident_version = True, max_sdram_size = 0x200000, # Limit mapped SDRAM to 2MB. integrated_rom_size = 0x8000) self.submodules.crg = _CRG( platform = platform, sys_clk_freq = sys_clk_freq, use_internal_osc = False, with_usb_pll = True, with_rst = False, sdram_rate = "1:2") self.submodules.sdrphy = HalfRateGENSDRPHY(platform.request("sdram")) self.add_sdram("sdram", phy = self.sdrphy, module = M12L16161A(sys_clk_freq, "1:2"), origin = self.mem_map["main_ram"], size = 2*mB, l2_cache_size = 0x8000, l2_cache_min_data_width = 128, l2_cache_reverse = True ) self.submodules.ethphy = LiteEthPHYRGMII( clock_pads = self.platform.request("eth_clocks", 0), pads = self.platform.request("eth", 0), tx_delay = 0e-9) self.add_csr("ethphy") self.add_ethernet(phy=self.ethphy) self.add_spi_flash(mode="1x", dummy_cycles=8)
def __init__(self, revision, with_ethernet=False, with_etherbone=False, **kwargs): platform = colorlight_5a_75b.Platform(revision=revision) sys_clk_freq = int(125e6) # SoCCore ---------------------------------------------------------------------------------- SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs) # CRG -------------------------------------------------------------------------------------- self.submodules.crg = _CRG(platform, sys_clk_freq) # SDR SDRAM -------------------------------------------------------------------------------- if not self.integrated_main_ram_size: self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"), cl=2) self.add_sdram("sdram", phy = self.sdrphy, module = M12L16161A(sys_clk_freq, "1:1"), origin = self.mem_map["main_ram"], size = kwargs.get("max_sdram_size", 0x40000000), l2_cache_size = kwargs.get("l2_size", 8192), l2_cache_min_data_width = kwargs.get("min_l2_data_width", 128), l2_cache_reverse = True ) # Ethernet --------------------------------------------------------------------------------- if with_ethernet: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads = self.platform.request("eth_clocks"), pads = self.platform.request("eth")) self.add_csr("ethphy") self.add_ethernet(phy=self.ethphy) # Etherbone -------------------------------------------------------------------------------- if with_etherbone: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads = self.platform.request("eth_clocks"), pads = self.platform.request("eth")) self.add_csr("ethphy") self.add_etherbone(phy=self.ethphy) # Led -------------------------------------------------------------------------------------- led_counter = Signal(32) self.sync += led_counter.eq(led_counter + 1) self.comb += platform.request("user_led_n", 0).eq(led_counter[26])
def __init__(self, board, revision, with_ethernet=False, with_etherbone=False, sys_clk_freq=60e6, **kwargs): SoCCore.mem_map = { "rom": 0x00000000, "sram": 0x10000000, "spiflash": 0x20000000, "main_ram": 0x40000000, "csr": 0x82000000, } board = board.lower() assert board in ["5a-75e"] if board == "5a-75e": platform = colorlight_5a_75e.Platform(revision=revision) # platform.add_extension(_serial) if with_etherbone: sys_clk_freq = int(125e6) # SoCCore ----------------------------------------------------------- SoCCore.__init__( self, platform, cpu_type="vexriscv", # cpu_variant="lite+debug", # cpu_variant="lite", cpu_variant="linux", csr_data_width=8, # csr_data_width=32, ident="LiTex Johnny RiscV", # max_sdram_size=0x400000, ident_version=True, # cpu_reset_address=0x0, # integrated_rom_size=0x8000, # integrated_main_ram_size=0x4000) # integrated_main_ram_size=0x0, clk_freq=sys_clk_freq, **kwargs) # CRG --------------------------------------------------------------- with_rst = kwargs["uart_name"] not in ["serial", "bridge"] with_usb_pll = kwargs.get("uart_name", None) == "usb_acm" self.submodules.crg = _CRG(platform, sys_clk_freq, with_usb_pll=with_usb_pll, with_rst=with_rst) # SDR SDRAM --------------------------------------------------------- if not self.integrated_main_ram_size: self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.add_sdram( "sdram", phy=self.sdrphy, module=M12L16161A(sys_clk_freq, "1:1"), origin=self.mem_map["main_ram"], size=kwargs.get("max_sdram_size", 0x40000000), # l2_cache_size=kwargs.get("l2_size", 8192), l2_cache_size=kwargs.get("l2_size", 0x8000), # 0x8000 = 32kiB, 32KiB * 128 = 4096KiB l2_cache_min_data_width=kwargs.get("min_l2_data_width", 128), l2_cache_reverse=True) # Ethernet / Etherbone ---------------------------------------------- if with_ethernet or with_etherbone: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads=self.platform.request("eth_clocks"), pads=self.platform.request("eth")) self.add_csr("ethphy") if with_ethernet: self.add_ethernet(phy=self.ethphy) if with_etherbone: self.add_etherbone(phy=self.ethphy) # Wishbone-UART bridge ---------------------------------------------- # self.submodules.serial_bridge = UARTWishboneBridge( # platform.request("serial", 1), # sys_clk_freq) # self.add_wb_master(self.serial_bridge.wishbone) # CPU DBG ---------------------------------------------------------- # self.register_mem( # "vexriscv_lite_debug", # 0xf00f0000, # self.cpu.debug_bus, # 0x10) # LEDs ------------------------------------------------------------- user_leds = Cat(*[platform.request("user_led", i) for i in range(2)]) self.submodules.leds = Led(user_leds) self.add_csr("leds")
def __init__(self, sys_clk_freq=int(60e6), with_ethernet=False, with_etherbone=False, with_spiflash=False, ip_address=None, mac_address=None, **kwargs): platform = colorlight_5a_75e.Platform() platform.add_extension(ios) # SoCCore ---------------------------------------------------------------------------------- SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, ident="LiteX LiteSPI SoC", ident_version=True, csr_data_width=32, **kwargs) # CRG -------------------------------------------------------------------------------------- self.submodules.crg = _CRG(platform, sys_clk_freq, with_rst=(kwargs["uart_name"] != "serial")) # SDRAM ------------------------------------------------------------------------------------ if not self.integrated_main_ram_size: self.submodules.sdrphy = GENSDRPHY(platform.request("sdram")) self.add_sdram("sdram", phy=self.sdrphy, module=M12L16161A(sys_clk_freq, "1:1"), origin=self.mem_map["main_ram"], size=kwargs.get("max_sdram_size", 0x40000000), l2_cache_size=kwargs.get("l2_size", 8192), l2_cache_min_data_width=kwargs.get( "min_l2_data_width", 128), l2_cache_reverse=True) # SPIFlash --------------------------------------------------------------------------------- if with_spiflash: flash = W25Q32JV(Codes.READ_1_1_1) self.submodules.spiflash_phy = LiteSPIPHY( pads=platform.request("spiflash"), flash=flash, device=platform.device) self.submodules.spiflash_mmap = LiteSPI( phy=self.spiflash_phy, clk_freq=sys_clk_freq, mmap_endianness=self.cpu.endianness) self.add_csr("spiflash_mmap") self.add_csr("spiflash_phy") spiflash_region = SoCRegion(origin=self.mem_map.get( "spiflash", None), size=flash.total_size, cached=False) self.bus.add_slave(name="spiflash", slave=self.spiflash_mmap.bus, region=spiflash_region) # Ethernet --------------------------------------------------------------------------------- if with_ethernet: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads=self.platform.request("eth_clocks"), pads=self.platform.request("eth")) self.add_csr("ethphy") self.add_ethernet(phy=self.ethphy, ip_address=ip_address, mac_address=mac_address) # Etherbone -------------------------------------------------------------------------------- if with_etherbone: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads=self.platform.request("eth_clocks"), pads=self.platform.request("eth")) self.add_csr("ethphy") self.add_etherbone(phy=self.ethphy, ip_address=ip_address, mac_address=mac_address)