from liteeth.phy.rmii import LiteEthPHYRMII
-from litespi import LiteSPI
-from litespi.phy.generic import LiteSPIPHY
-
# CRG ----------------------------------------------------------------------------------------------
class _CRG(Module):
# SPI XIP ----------------------------------------------------------------------------------
if with_spi_xip:
+ from litespi import LiteSPI
+ from litespi.phy.generic import LiteSPIPHY
spi_xip_size = 1024*1024*8
self.submodules.spiphy = LiteSPIPHY(platform.request("spiflash4x"))
self.submodules.spictl = LiteSPI(phy=self.spiphy, endianness=self.cpu.endianness)
import importlib
from migen import *
-from migen.genlib.io import CRG
+
+from litex.build.io import CRG
from litex.soc.integration.soc_core import *
from litex.soc.integration.builder import *
from migen.fhdl.structure import Signal
from migen.genlib.record import Record
-from migen.genlib.io import CRG
from litex.gen.fhdl import verilog
+from litex.build.io import CRG
from litex.build import tools
# This file is Copyright (c) 2015-2020 Florent Kermarrec <florent@enjoy-digital.fr>
+# This file is Copyright (c) 2015 Sebastien Bourdeauducq <sb@m-labs.hk>
# License: BSD
from migen import *
def lower(dr):
raise NotImplementedError("Attempted to use a Differential Output, but platform does not support them")
-
# SDR Input/Output ---------------------------------------------------------------------------------
class InferedSDRIO(Module):
@staticmethod
def lower(dr):
raise NotImplementedError("Attempted to use a DDR output, but platform does not support them")
+
+# Clock Reset Generator ----------------------------------------------------------------------------
+
+class CRG(Module):
+ def __init__(self, clk, rst=0):
+ self.clock_domains.cd_sys = ClockDomain()
+ self.clock_domains.cd_por = ClockDomain(reset_less=True)
+
+ if hasattr(clk, "p"):
+ clk_se = Signal()
+ self.specials += DifferentialInput(clk.p, clk.n, clk_se)
+ clk = clk_se
+
+ # Power on Reset (vendor agnostic)
+ int_rst = Signal(reset=1)
+ self.sync.por += int_rst.eq(rst)
+ self.comb += [
+ self.cd_sys.clk.eq(clk),
+ self.cd_por.clk.eq(clk),
+ self.cd_sys.rst.eq(int_rst)
+ ]