Esempio n. 1
0
    def __init__(self, sys_clk_freq=int(50e6), with_ethernet=False, **kwargs):
        platform = c10lprefkit.Platform()

        # SoCCore ----------------------------------------------------------------------------------
        SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, **kwargs)

        # CRG --------------------------------------------------------------------------------------
        self.submodules.crg = _CRG(platform, sys_clk_freq)

        # HyperRam ---------------------------------------------------------------------------------
        self.submodules.hyperram = HyperRAM(platform.request("hyperram"))
        self.add_wb_slave(self.mem_map["hyperram"], self.hyperram.bus)
        self.add_memory_region("hyperram", self.mem_map["hyperram"],
                               8 * 1024 * 1024)

        # SDR SDRAM --------------------------------------------------------------------------------
        if not self.integrated_main_ram_size:
            self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
            self.add_sdram("sdram",
                           phy=self.sdrphy,
                           module=MT48LC16M16(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 = LiteEthPHYMII(
                clock_pads=self.platform.request("eth_clocks"),
                pads=self.platform.request("eth"))
            self.add_csr("ethphy")
            self.add_ethernet(phy=self.ethphy)
Esempio n. 2
0
    def __init__(self, sys_clk_freq=int(50e6), **kwargs):
        assert sys_clk_freq == int(50e6)
        platform = c10lprefkit.Platform()

        # SoCSDRAM ---------------------------------------------------------------------------------
        SoCSDRAM.__init__(self,
                          platform,
                          clk_freq=sys_clk_freq,
                          integrated_rom_size=0x8000,
                          **kwargs)

        # CRG --------------------------------------------------------------------------------------
        self.submodules.crg = _CRG(platform)

        # HyperRam ---------------------------------------------------------------------------------
        self.submodules.hyperram = HyperRAM(platform.request("hyperram"))
        self.add_wb_slave(mem_decoder(self.mem_map["hyperram"]),
                          self.hyperram.bus)
        self.add_memory_region("hyperram", self.mem_map["hyperram"],
                               8 * 1024 * 1024)

        # SDR SDRAM --------------------------------------------------------------------------------
        if not self.integrated_main_ram_size:
            self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
            sdram_module = MT48LC16M16(self.clk_freq, "1:1")
            self.register_sdram(self.sdrphy,
                                geom_settings=sdram_module.geom_settings,
                                timing_settings=sdram_module.timing_settings)
Esempio n. 3
0
    def __init__(self, sys_clk_freq=int(50e6), with_led_chaser=True, with_video_terminal=False, **kwargs):
        platform = mist.Platform()

        # SoCCore ----------------------------------------------------------------------------------
        SoCCore.__init__(self, platform, sys_clk_freq,
            ident = "LiteX SoC on MIST",
            **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"), sys_clk_freq)
            self.add_sdram("sdram",
                phy           = self.sdrphy,
                module        = MT48LC16M16(sys_clk_freq, "1:1"),
                l2_cache_size = kwargs.get("l2_size", 8192)
            )

        # Video Terminal ---------------------------------------------------------------------------
        if with_video_terminal:
            self.submodules.videophy = VideoVGAPHY(platform.request("vga"), clock_domain="vga")
            self.add_video_terminal(phy=self.videophy, timings="800x600@60Hz", clock_domain="vga")

        # Leds -------------------------------------------------------------------------------------
        if with_led_chaser:
            self.submodules.leds = LedChaser(
                pads         = platform.request_all("user_led"),
                sys_clk_freq = sys_clk_freq)
Esempio n. 4
0
    def __init__(self, platform, **kwargs):
        sys_clk_freq = int(50e6)
        SoCSDRAM.__init__(self,
                          platform,
                          clk_freq=sys_clk_freq,
                          integrated_rom_size=0x8000,
                          **kwargs)

        self.submodules.crg = _CRG(platform)

        if not self.integrated_main_ram_size:
            self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
            sdram_module = MT48LC16M16(sys_clk_freq, "1:1")
            self.register_sdram(self.sdrphy, sdram_module.geom_settings,
                                sdram_module.timing_settings)
Esempio n. 5
0
    def __init__(self,
                 sys_clk_freq=int(50e6),
                 with_led_chaser=True,
                 with_ethernet=False,
                 with_etherbone=False,
                 **kwargs):
        platform = c10lprefkit.Platform()

        # SoCCore ----------------------------------------------------------------------------------
        SoCCore.__init__(self,
                         platform,
                         sys_clk_freq,
                         ident="LiteX SoC on C10 LP RefKit",
                         **kwargs)

        # CRG --------------------------------------------------------------------------------------
        self.submodules.crg = _CRG(platform, sys_clk_freq)

        # HyperRam ---------------------------------------------------------------------------------
        self.submodules.hyperram = HyperRAM(platform.request("hyperram"))
        self.add_wb_slave(self.mem_map["hyperram"], self.hyperram.bus)
        self.add_memory_region("hyperram", self.mem_map["hyperram"],
                               8 * 1024 * 1024)

        # SDR SDRAM --------------------------------------------------------------------------------
        if not self.integrated_main_ram_size:
            self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"),
                                               sys_clk_freq)
            self.add_sdram("sdram",
                           phy=self.sdrphy,
                           module=MT48LC16M16(sys_clk_freq, "1:1"),
                           l2_cache_size=kwargs.get("l2_size", 8192))

        # Ethernet / Etherbone ---------------------------------------------------------------------
        if with_ethernet or with_etherbone:
            self.submodules.ethphy = LiteEthPHYMII(
                clock_pads=self.platform.request("eth_clocks"),
                pads=self.platform.request("eth"))
            if with_ethernet:
                self.add_ethernet(phy=self.ethphy)
            if with_etherbone:
                self.add_etherbone(phy=self.ethphy)

        # Leds -------------------------------------------------------------------------------------
        if with_led_chaser:
            self.submodules.leds = LedChaser(
                pads=platform.request_all("user_led"),
                sys_clk_freq=sys_clk_freq)
Esempio n. 6
0
    def __init__(self, sys_clk_freq=int(50e6), with_vga=False, **kwargs):
        platform = mist.Platform()

        # SoCCore ----------------------------------------------------------------------------------
        SoCCore.__init__(self,
                         platform,
                         sys_clk_freq,
                         ident="LiteX SoC on MIST",
                         ident_version=True,
                         **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"),
                                               sys_clk_freq)
            self.add_sdram("sdram",
                           phy=self.sdrphy,
                           module=MT48LC16M16(sys_clk_freq, "1:1"),
                           origin=self.mem_map["main_ram"],
                           size=kwargs.get("max_sdram_size", 0x2000000),
                           l2_cache_size=kwargs.get("l2_size", 8192),
                           l2_cache_min_data_width=kwargs.get(
                               "min_l2_data_width", 128),
                           l2_cache_reverse=True)

        # VGA Terminal -----------------------------------------------------------------------------
        if with_vga:
            self.submodules.terminal = terminal = Terminal()
            self.bus.add_slave("terminal",
                               self.terminal.bus,
                               region=SoCRegion(origin=0x30000000,
                                                size=0x10000))
            vga_pads = platform.request("vga")
            self.comb += [
                vga_pads.vsync.eq(terminal.vsync),
                vga_pads.hsync.eq(terminal.hsync),
                vga_pads.r.eq(terminal.red[2:8]),
                vga_pads.g.eq(terminal.green[2:8]),
                vga_pads.b.eq(terminal.blue[2:8])
            ]

        # Leds -------------------------------------------------------------------------------------
        self.submodules.leds = LedChaser(pads=platform.request_all("user_led"),
                                         sys_clk_freq=sys_clk_freq)
        self.add_csr("leds")
Esempio n. 7
0
    def __init__(self, device="LFE5U-45F", toolchain="diamond", **kwargs):
        platform = ulx3s.Platform(device=device, toolchain=toolchain)
        sys_clk_freq = int(50e6)
        SoCSDRAM.__init__(self,
                          platform,
                          clk_freq=sys_clk_freq,
                          integrated_rom_size=0x8000,
                          **kwargs)

        self.submodules.crg = _CRG(platform, sys_clk_freq)

        if not self.integrated_main_ram_size:
            self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"), cl=3)
            sdram_module = MT48LC16M16(sys_clk_freq, "1:1")
            self.register_sdram(self.sdrphy, sdram_module.geom_settings,
                                sdram_module.timing_settings)
Esempio n. 8
0
    def __init__(self, **kwargs):
        platform = ulx3s.Platform(toolchain="trellis")
        sys_clk_freq = int(25e6)
        SoCSDRAM.__init__(self,
                          platform,
                          clk_freq=sys_clk_freq,
                          l2_size=32,
                          integrated_rom_size=0x8000,
                          **kwargs)

        self.submodules.crg = _CRG(platform)

        if not self.integrated_main_ram_size:
            self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
            sdram_module = MT48LC16M16(sys_clk_freq, "1:1")
            self.register_sdram(self.sdrphy,
                                sdram_module.geom_settings,
                                sdram_module.timing_settings,
                                controller_settings=ControllerSettings(
                                    with_refresh=False))  # FIXME
Esempio n. 9
0
    def __init__(self, sys_clk_freq=int(50e6), **kwargs):
        assert sys_clk_freq == int(50e6)
        platform = c10lprefkit.Platform()
        SoCSDRAM.__init__(self,
                          platform,
                          clk_freq=sys_clk_freq,
                          integrated_rom_size=0x8000,
                          **kwargs)

        self.submodules.crg = _CRG(platform)

        self.submodules.hyperram = HyperRAM(platform.request("hyperram"))
        self.add_wb_slave(mem_decoder(self.mem_map["hyperram"]),
                          self.hyperram.bus)
        self.add_memory_region("hyperram", self.mem_map["hyperram"],
                               8 * 1024 * 1024)

        if not self.integrated_main_ram_size:
            self.submodules.sdrphy = GENSDRPHY(platform.request("sdram"))
            sdram_module = MT48LC16M16(self.clk_freq, "1:1")
            self.register_sdram(self.sdrphy, sdram_module.geom_settings,
                                sdram_module.timing_settings)

        # create VGA terminal
        self.mem_map['terminal'] = 0x50000000
        self.submodules.terminal = terminal = Terminal(self.crg.cd_vga.clk)
        self.add_wb_slave(mem_decoder(self.mem_map["terminal"]),
                          self.terminal.bus)
        self.add_memory_region("terminal", self.mem_map["terminal"], 0x10000)

        # connect VGA pins
        vga = platform.request('vga', 0)
        self.comb += [
            vga.vsync.eq(terminal.vga_vsync),
            vga.hsync.eq(terminal.vga_hsync),
            vga.red.eq(terminal.red[4:8]),
            vga.green.eq(terminal.green[4:8]),
            vga.blue.eq(terminal.blue[4:8])
        ]
Esempio n. 10
0
    def __init__(self,
                 with_sdram=False,
                 with_ethernet=False,
                 with_etherbone=False,
                 etherbone_mac_address=0x10e2d5000000,
                 etherbone_ip_address="192.168.1.50",
                 with_analyzer=False,
                 **kwargs):
        platform = Platform()
        sys_clk_freq = int(1e6)

        # SoCSDRAM ---------------------------------------------------------------------------------
        SoCSDRAM.__init__(self,
                          platform,
                          clk_freq=sys_clk_freq,
                          integrated_rom_size=0x8000,
                          ident="LiteX Simulation",
                          ident_version=True,
                          with_uart=False,
                          **kwargs)
        # CRG --------------------------------------------------------------------------------------
        self.submodules.crg = CRG(platform.request("sys_clk"))

        # Serial -----------------------------------------------------------------------------------
        self.submodules.uart_phy = uart.RS232PHYModel(
            platform.request("serial"))
        self.submodules.uart = uart.UART(self.uart_phy)
        self.add_csr("uart")
        self.add_interrupt("uart")

        # SDRAM ------------------------------------------------------------------------------------
        if with_sdram:
            sdram_module = MT48LC16M16(100e6, "1:1")  # use 100MHz timings
            phy_settings = PhySettings(memtype="SDR",
                                       databits=32,
                                       dfi_databits=16,
                                       nphases=1,
                                       rdphase=0,
                                       wrphase=0,
                                       rdcmdphase=0,
                                       wrcmdphase=0,
                                       cl=2,
                                       read_latency=4,
                                       write_latency=0)
            self.submodules.sdrphy = SDRAMPHYModel(sdram_module, phy_settings)
            self.register_sdram(self.sdrphy, sdram_module.geom_settings,
                                sdram_module.timing_settings)
            # Reduce memtest size for simulation speedup
            self.add_constant("MEMTEST_DATA_SIZE", 8 * 1024)
            self.add_constant("MEMTEST_ADDR_SIZE", 8 * 1024)

        assert not (with_ethernet and with_etherbone
                    )  # FIXME: fix simulator with 2 ethernet interfaces

        # Ethernet ---------------------------------------------------------------------------------
        if with_ethernet:
            # Ethernet PHY
            self.submodules.ethphy = LiteEthPHYModel(
                self.platform.request("eth", 0))
            self.add_csr("ethphy")
            # Ethernet MAC
            ethmac = LiteEthMAC(phy=self.ethphy,
                                dw=32,
                                interface="wishbone",
                                endianness=self.cpu.endianness)
            if with_etherbone:
                ethmac = ClockDomainsRenamer({
                    "eth_tx": "ethphy_eth_tx",
                    "eth_rx": "ethphy_eth_rx"
                })(ethmac)
            self.submodules.ethmac = ethmac
            self.add_wb_slave(self.mem_map["ethmac"], self.ethmac.bus, 0x2000)
            self.add_memory_region("ethmac",
                                   self.mem_map["ethmac"],
                                   0x2000,
                                   type="io")
            self.add_csr("ethmac")
            self.add_interrupt("ethmac")

        # Ethernet ---------------------------------------------------------------------------------
        if with_etherbone:
            # Ethernet PHY
            self.submodules.etherbonephy = LiteEthPHYModel(
                self.platform.request("eth", 0))  # FIXME
            self.add_csr("etherbonephy")
            # Ethernet MAC
            etherbonecore = LiteEthUDPIPCore(self.etherbonephy,
                                             mac_address=etherbone_mac_address,
                                             ip_address=etherbone_ip_address,
                                             clk_freq=sys_clk_freq)
            self.submodules.etherbonecore = etherbonecore
            # Etherbone
            self.submodules.etherbone = LiteEthEtherbone(
                self.etherbonecore.udp, 1234, mode="master")
            self.add_wb_master(self.etherbone.wishbone.bus)

        # Analyzer ---------------------------------------------------------------------------------
        if with_analyzer:
            analyzer_signals = [
                # FIXME: find interesting signals to probe
                self.cpu.ibus,
                self.cpu.dbus
            ]
            self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 512)
            self.add_csr("analyzer")