Merge pull request #616 from maass-hamburg/efinix_reset_pulse
efinix: fix reset
This commit is contained in:
commit
0e77cdf3c8
|
@ -52,6 +52,7 @@ _connectors = [
|
||||||
|
|
||||||
class Platform(EfinixPlatform):
|
class Platform(EfinixPlatform):
|
||||||
default_clk_name = "clk33"
|
default_clk_name = "clk33"
|
||||||
|
default_clk_freq = 33.333e6
|
||||||
default_clk_period = 1e9/33.333e6
|
default_clk_period = 1e9/33.333e6
|
||||||
|
|
||||||
def __init__(self, toolchain="efinity"):
|
def __init__(self, toolchain="efinity"):
|
||||||
|
|
|
@ -183,6 +183,7 @@ def rgmii_ethernet_qse_ios(con, n=""):
|
||||||
|
|
||||||
class Platform(EfinixPlatform):
|
class Platform(EfinixPlatform):
|
||||||
default_clk_name = "clk25"
|
default_clk_name = "clk25"
|
||||||
|
default_clk_freq = 25e6
|
||||||
default_clk_period = 1e9/50e6
|
default_clk_period = 1e9/50e6
|
||||||
|
|
||||||
def __init__(self, toolchain="efinity"):
|
def __init__(self, toolchain="efinity"):
|
||||||
|
|
|
@ -174,6 +174,7 @@ def usb_pmod_io(pmod):
|
||||||
|
|
||||||
class Platform(EfinixPlatform):
|
class Platform(EfinixPlatform):
|
||||||
default_clk_name = "clk40"
|
default_clk_name = "clk40"
|
||||||
|
default_clk_freq = 40e6
|
||||||
default_clk_period = 1e9/40e6
|
default_clk_period = 1e9/40e6
|
||||||
|
|
||||||
def __init__(self, toolchain="efinity"):
|
def __init__(self, toolchain="efinity"):
|
||||||
|
|
|
@ -113,6 +113,7 @@ _connectors = [
|
||||||
|
|
||||||
class Platform(EfinixPlatform):
|
class Platform(EfinixPlatform):
|
||||||
default_clk_name = "clk50"
|
default_clk_name = "clk50"
|
||||||
|
default_clk_freq = 50e6
|
||||||
default_clk_period = 1e9/50e6
|
default_clk_period = 1e9/50e6
|
||||||
|
|
||||||
def __init__(self, toolchain="efinity"):
|
def __init__(self, toolchain="efinity"):
|
||||||
|
|
|
@ -64,6 +64,7 @@ _connectors = []
|
||||||
|
|
||||||
class Platform(EfinixPlatform):
|
class Platform(EfinixPlatform):
|
||||||
default_clk_name = "clk50"
|
default_clk_name = "clk50"
|
||||||
|
default_clk_freq = 50e6
|
||||||
default_clk_period = 1e9/50e6
|
default_clk_period = 1e9/50e6
|
||||||
|
|
||||||
def __init__(self, toolchain="efinity"):
|
def __init__(self, toolchain="efinity"):
|
||||||
|
|
|
@ -71,6 +71,7 @@ _connectors = [
|
||||||
|
|
||||||
class Platform(EfinixPlatform):
|
class Platform(EfinixPlatform):
|
||||||
default_clk_name = "clk33"
|
default_clk_name = "clk33"
|
||||||
|
default_clk_freq = 33.333e6
|
||||||
default_clk_period = 1e9/33.333e6
|
default_clk_period = 1e9/33.333e6
|
||||||
|
|
||||||
def __init__(self, toolchain="efinity"):
|
def __init__(self, toolchain="efinity"):
|
||||||
|
|
|
@ -49,6 +49,7 @@ _connectors = [
|
||||||
|
|
||||||
class Platform(EfinixPlatform):
|
class Platform(EfinixPlatform):
|
||||||
default_clk_name = "clk33"
|
default_clk_name = "clk33"
|
||||||
|
default_clk_freq = 33.33e6
|
||||||
default_clk_period = 1e9/33.33e6
|
default_clk_period = 1e9/33.33e6
|
||||||
|
|
||||||
def __init__(self, toolchain="efinity"):
|
def __init__(self, toolchain="efinity"):
|
||||||
|
|
|
@ -13,6 +13,7 @@ from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
from litex.gen.genlib.misc import WaitTimer
|
||||||
|
|
||||||
from litex_boards.platforms import efinix_t8f81_dev_kit
|
from litex_boards.platforms import efinix_t8f81_dev_kit
|
||||||
|
|
||||||
|
@ -28,16 +29,25 @@ class _CRG(LiteXModule):
|
||||||
def __init__(self, platform, sys_clk_freq):
|
def __init__(self, platform, sys_clk_freq):
|
||||||
self.rst = Signal()
|
self.rst = Signal()
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
clk33 = platform.request("clk33")
|
clk33 = platform.request("clk33")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk33)
|
||||||
|
|
||||||
|
# A pulse is necessary to do a reset.
|
||||||
|
self.rst_pulse = Signal()
|
||||||
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL.
|
# PLL.
|
||||||
self.pll = pll = TRIONPLL(platform)
|
self.pll = pll = TRIONPLL(platform)
|
||||||
self.comb += pll.reset.eq(~rst_n | self.rst)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
pll.register_clkin(clk33, 33.333e6)
|
pll.register_clkin(clk33, platform.default_clk_freq)
|
||||||
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
||||||
|
|
||||||
# BaseSoC ------------------------------------------------------------------------------------------
|
# BaseSoC ------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -10,6 +10,7 @@ from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
from litex.gen.genlib.misc import WaitTimer
|
||||||
|
|
||||||
from litex.build.io import DDROutput, SDROutput, SDRTristate
|
from litex.build.io import DDROutput, SDROutput, SDRTristate
|
||||||
from litex.build.generic_platform import Subsignal, Pins, Misc, IOStandard
|
from litex.build.generic_platform import Subsignal, Pins, Misc, IOStandard
|
||||||
|
@ -39,11 +40,12 @@ from liteeth.phy.trionrgmii import LiteEthPHYRGMII
|
||||||
|
|
||||||
class _CRG(LiteXModule):
|
class _CRG(LiteXModule):
|
||||||
def __init__(self, platform, sys_clk_freq, cpu_clk_freq):
|
def __init__(self, platform, sys_clk_freq, cpu_clk_freq):
|
||||||
#self.rst = Signal()
|
self.rst = Signal()
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
self.cd_usb = ClockDomain()
|
self.cd_usb = ClockDomain()
|
||||||
self.cd_video = ClockDomain()
|
self.cd_video = ClockDomain()
|
||||||
self.cd_cpu = ClockDomain()
|
self.cd_cpu = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
@ -51,10 +53,18 @@ class _CRG(LiteXModule):
|
||||||
clk100 = platform.request("clk100")
|
clk100 = platform.request("clk100")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk100)
|
||||||
|
|
||||||
|
# A pulse is necessary to do a reset.
|
||||||
|
self.rst_pulse = Signal()
|
||||||
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL.
|
# PLL.
|
||||||
self.pll = pll = TITANIUMPLL(platform)
|
self.pll = pll = TITANIUMPLL(platform)
|
||||||
self.comb += pll.reset.eq(~rst_n)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
pll.register_clkin(clk100, 100e6)
|
pll.register_clkin(clk100, platform.default_clk_freq)
|
||||||
# You can use CLKOUT0 only for clocks with a maximum frequency of 4x
|
# You can use CLKOUT0 only for clocks with a maximum frequency of 4x
|
||||||
# (integer) of the reference clock. If all your system clocks do not fall within
|
# (integer) of the reference clock. If all your system clocks do not fall within
|
||||||
# this range, you should dedicate one unused clock for CLKOUT0.
|
# this range, you should dedicate one unused clock for CLKOUT0.
|
||||||
|
|
|
@ -10,6 +10,7 @@ from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
from litex.gen.genlib.misc import WaitTimer
|
||||||
|
|
||||||
from litex_boards.platforms import efinix_titanium_ti60_f225_dev_kit
|
from litex_boards.platforms import efinix_titanium_ti60_f225_dev_kit
|
||||||
|
|
||||||
|
@ -31,16 +32,25 @@ class _CRG(LiteXModule):
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
self.cd_sys2x = ClockDomain()
|
self.cd_sys2x = ClockDomain()
|
||||||
self.cd_sys2x_ps = ClockDomain()
|
self.cd_sys2x_ps = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
clk25 = platform.request("clk25")
|
clk25 = platform.request("clk25")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk25)
|
||||||
|
|
||||||
|
# A pulse is necessary to do a reset.
|
||||||
|
self.rst_pulse = Signal()
|
||||||
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL
|
# PLL
|
||||||
self.pll = pll = TITANIUMPLL(platform)
|
self.pll = pll = TITANIUMPLL(platform)
|
||||||
self.comb += pll.reset.eq(~rst_n | self.rst)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
pll.register_clkin(clk25, 25e6)
|
pll.register_clkin(clk25, platform.default_clk_freq)
|
||||||
# You can use CLKOUT0 only for clocks with a maximum frequency of 4x
|
# You can use CLKOUT0 only for clocks with a maximum frequency of 4x
|
||||||
# (integer) of the reference clock. If all your system clocks do not fall within
|
# (integer) of the reference clock. If all your system clocks do not fall within
|
||||||
# this range, you should dedicate one unused clock for CLKOUT0.
|
# this range, you should dedicate one unused clock for CLKOUT0.
|
||||||
|
|
|
@ -13,6 +13,7 @@ from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
from litex.gen.genlib.misc import WaitTimer
|
||||||
|
|
||||||
from litex_boards.platforms import efinix_trion_t120_bga576_dev_kit
|
from litex_boards.platforms import efinix_trion_t120_bga576_dev_kit
|
||||||
|
|
||||||
|
@ -29,20 +30,27 @@ from liteeth.phy.trionrgmii import LiteEthPHYRGMII
|
||||||
|
|
||||||
class _CRG(LiteXModule):
|
class _CRG(LiteXModule):
|
||||||
def __init__(self, platform, sys_clk_freq):
|
def __init__(self, platform, sys_clk_freq):
|
||||||
#self.rst = Signal()
|
self.rst = Signal()
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
clk40 = platform.request("clk40")
|
clk40 = platform.request("clk40")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk40)
|
||||||
|
|
||||||
|
# A pulse is necessary to do a reset.
|
||||||
|
self.rst_pulse = Signal()
|
||||||
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL
|
# PLL
|
||||||
self.pll = pll = TRIONPLL(platform)
|
self.pll = pll = TRIONPLL(platform)
|
||||||
#self.comb += pll.reset.eq(~rst_n | self.rst)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
self.comb += pll.reset.eq(~rst_n)
|
pll.register_clkin(clk40, platform.default_clk_freq)
|
||||||
pll.register_clkin(clk40, 40e6)
|
|
||||||
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True, name="axi_clk")
|
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True, name="axi_clk")
|
||||||
|
|
||||||
# BaseSoC ------------------------------------------------------------------------------------------
|
# BaseSoC ------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -35,6 +35,7 @@ class _CRG(LiteXModule):
|
||||||
self.rst = Signal()
|
self.rst = Signal()
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
self.cd_sys_ps = ClockDomain()
|
self.cd_sys_ps = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
@ -42,16 +43,18 @@ class _CRG(LiteXModule):
|
||||||
clk50 = platform.request("clk50")
|
clk50 = platform.request("clk50")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk50)
|
||||||
|
|
||||||
# A pulse is necessary to do a reset.
|
# A pulse is necessary to do a reset.
|
||||||
self.rst_pulse = Signal()
|
self.rst_pulse = Signal()
|
||||||
reset_timer = WaitTimer(25e-6*sys_clk_freq)
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
self.comb += reset_timer.wait.eq(self.rst)
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL.
|
# PLL.
|
||||||
self.pll = pll = TRIONPLL(platform)
|
self.pll = pll = TRIONPLL(platform)
|
||||||
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
pll.register_clkin(clk50, 50e6)
|
pll.register_clkin(clk50, platform.default_clk_freq)
|
||||||
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
||||||
pll.create_clkout(self.cd_sys_ps, sys_clk_freq, phase=180)
|
pll.create_clkout(self.cd_sys_ps, sys_clk_freq, phase=180)
|
||||||
|
|
||||||
|
@ -69,7 +72,7 @@ class BaseSoC(SoCCore):
|
||||||
|
|
||||||
# SDR SDRAM --------------------------------------------------------------------------------
|
# SDR SDRAM --------------------------------------------------------------------------------
|
||||||
if not self.integrated_main_ram_size and sys_clk_freq <= 50e6 :
|
if not self.integrated_main_ram_size and sys_clk_freq <= 50e6 :
|
||||||
self.specials += ClkOutput(ClockSignal(self.cd_sys_ps), platform.request("sdram_clock"))
|
self.specials += ClkOutput(ClockSignal("sys_ps"), platform.request("sdram_clock"))
|
||||||
|
|
||||||
self.sdrphy = GENSDRPHY(platform.request("sdram"), sys_clk_freq)
|
self.sdrphy = GENSDRPHY(platform.request("sdram"), sys_clk_freq)
|
||||||
self.add_sdram("sdram",
|
self.add_sdram("sdram",
|
||||||
|
|
|
@ -10,6 +10,7 @@ from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
from litex.gen.genlib.misc import WaitTimer
|
||||||
|
|
||||||
from litex_boards.platforms import efinix_trion_t20_mipi_dev_kit
|
from litex_boards.platforms import efinix_trion_t20_mipi_dev_kit
|
||||||
|
|
||||||
|
@ -26,16 +27,25 @@ class _CRG(LiteXModule):
|
||||||
def __init__(self, platform, sys_clk_freq):
|
def __init__(self, platform, sys_clk_freq):
|
||||||
self.rst = Signal()
|
self.rst = Signal()
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
clk50 = platform.request("clk50")
|
clk50 = platform.request("clk50")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk50)
|
||||||
|
|
||||||
|
# A pulse is necessary to do a reset.
|
||||||
|
self.rst_pulse = Signal()
|
||||||
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL
|
# PLL
|
||||||
self.pll = pll = TRIONPLL(platform)
|
self.pll = pll = TRIONPLL(platform)
|
||||||
self.comb += pll.reset.eq(~rst_n | self.rst)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
pll.register_clkin(clk50, 50e6)
|
pll.register_clkin(clk50, platform.default_clk_freq)
|
||||||
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
||||||
|
|
||||||
# BaseSoC ------------------------------------------------------------------------------------------
|
# BaseSoC ------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -12,6 +12,7 @@ from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
from litex.gen.genlib.misc import WaitTimer
|
||||||
|
|
||||||
from litex_boards.platforms import efinix_xyloni_dev_kit
|
from litex_boards.platforms import efinix_xyloni_dev_kit
|
||||||
|
|
||||||
|
@ -27,16 +28,25 @@ class _CRG(LiteXModule):
|
||||||
def __init__(self, platform, sys_clk_freq):
|
def __init__(self, platform, sys_clk_freq):
|
||||||
self.rst = Signal()
|
self.rst = Signal()
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
clk33 = platform.request("clk33")
|
clk33 = platform.request("clk33")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk33)
|
||||||
|
|
||||||
|
# A pulse is necessary to do a reset.
|
||||||
|
self.rst_pulse = Signal()
|
||||||
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL.
|
# PLL.
|
||||||
self.pll = pll = TRIONPLL(platform)
|
self.pll = pll = TRIONPLL(platform)
|
||||||
self.comb += pll.reset.eq(~rst_n | self.rst)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
pll.register_clkin(clk33, 33.333e6)
|
pll.register_clkin(clk33, platform.default_clk_freq)
|
||||||
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
||||||
|
|
||||||
# BaseSoC ------------------------------------------------------------------------------------------
|
# BaseSoC ------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -13,6 +13,7 @@ from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
from litex.gen import *
|
from litex.gen import *
|
||||||
|
from litex.gen.genlib.misc import WaitTimer
|
||||||
|
|
||||||
from litex_boards.platforms import jungle_electronics_fireant
|
from litex_boards.platforms import jungle_electronics_fireant
|
||||||
|
|
||||||
|
@ -31,16 +32,25 @@ class _CRG(LiteXModule):
|
||||||
def __init__(self, platform, sys_clk_freq):
|
def __init__(self, platform, sys_clk_freq):
|
||||||
self.rst = Signal()
|
self.rst = Signal()
|
||||||
self.cd_sys = ClockDomain()
|
self.cd_sys = ClockDomain()
|
||||||
|
self.cd_rst = ClockDomain(reset_less=True)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
clk33 = platform.request("clk33")
|
clk33 = platform.request("clk33")
|
||||||
rst_n = platform.request("user_btn", 0)
|
rst_n = platform.request("user_btn", 0)
|
||||||
|
|
||||||
|
self.comb += self.cd_rst.clk.eq(clk33)
|
||||||
|
|
||||||
|
# A pulse is necessary to do a reset.
|
||||||
|
self.rst_pulse = Signal()
|
||||||
|
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
|
||||||
|
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
|
||||||
|
self.comb += reset_timer.wait.eq(self.rst)
|
||||||
|
|
||||||
# PLL.
|
# PLL.
|
||||||
self.pll = pll = TRIONPLL(platform)
|
self.pll = pll = TRIONPLL(platform)
|
||||||
self.comb += pll.reset.eq(~rst_n | self.rst)
|
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
|
||||||
pll.register_clkin(clk33, 33.333e6)
|
pll.register_clkin(clk33, platform.default_clk_freq)
|
||||||
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
|
||||||
|
|
||||||
# Default peripherals
|
# Default peripherals
|
||||||
|
|
Loading…
Reference in New Issue