targets/icebreaker: simplify CRG, just use a 12MHz sys_clk and por_clk for reset.

This commit is contained in:
Florent Kermarrec 2020-03-07 18:25:26 +01:00
parent 9416ddd84a
commit 2b1b9684de
1 changed files with 12 additions and 35 deletions

View File

@ -36,51 +36,28 @@ class JumpToAddressROM(wishbone.SRAM):
# CRG ---------------------------------------------------------------------------------------------- # CRG ----------------------------------------------------------------------------------------------
class _CRG(Module):
class _CRG(Module, AutoDoc):
"""Icebreaker Clock Resource Generator
The following clock domains are available on this design:
+---------+------------+---------------------------------+
| Name | Frequency | Description |
+=========+============+=================================+
+---------+------------+---------------------------------+
| clk_12 | 12 MHz | Main control logic |
+---------+------------+---------------------------------+
| sys | 12 MHz | System CPU and wishbone bus |
+---------+------------+---------------------------------+
"""
def __init__(self, platform): def __init__(self, platform):
clk12 = platform.request("clk12") self.clock_domains.cd_sys = ClockDomain()
reset_delay = Signal(12, reset=4095)
self.clock_domains.cd_por = ClockDomain() self.clock_domains.cd_por = ClockDomain()
self.reset = Signal() self.reset = Signal()
self.clock_domains.cd_sys = ClockDomain() # # #
self.clock_domains.cd_clk_12 = ClockDomain()
platform.add_period_constraint(self.cd_sys.clk, 1e9 / 12e6) reset_delay = Signal(12, reset=4095)
platform.add_period_constraint(self.cd_clk_12.clk, 1e9 / 12e6)
# POR reset logic- POR generated from sys clk, POR logic feeds sys clk
# reset.
self.comb += [
self.cd_por.clk.eq(self.cd_sys.clk),
self.cd_sys.rst.eq(reset_delay != 0),
self.cd_clk_12.rst.eq(reset_delay != 0),
]
# Clocks
clk12 = platform.request("clk12")
platform.add_period_constraint(clk12, 1e9/12e6)
self.comb += self.cd_sys.clk.eq(clk12) self.comb += self.cd_sys.clk.eq(clk12)
self.comb += self.cd_clk_12.clk.eq(clk12) self.comb += self.cd_por.clk.eq(clk12)
self.comb += self.cd_sys.rst.eq(reset_delay != 0)
self.sync.por += \ # Power On Reset
If(reset_delay != 0, self.sync.por += If(reset_delay != 0, reset_delay.eq(reset_delay - 1))
reset_delay.eq(reset_delay - 1))
self.specials += AsyncResetSynchronizer(self.cd_por, self.reset) self.specials += AsyncResetSynchronizer(self.cd_por, self.reset)
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCCore): class BaseSoC(SoCCore):