2013-05-26 12:07:26 -04:00
|
|
|
from migen.fhdl.std import *
|
2013-02-07 16:07:30 -05:00
|
|
|
|
2013-03-15 13:46:11 -04:00
|
|
|
class SimpleCRG(Module):
|
2013-03-15 05:49:18 -04:00
|
|
|
def __init__(self, platform, clk_name, rst_name, rst_invert=False):
|
2013-05-07 13:09:56 -04:00
|
|
|
reset_less = rst_name is None
|
|
|
|
self.clock_domains.cd_sys = ClockDomain(reset_less=reset_less)
|
2013-04-08 14:28:11 -04:00
|
|
|
self._clk = platform.request(clk_name)
|
|
|
|
self.comb += self.cd_sys.clk.eq(self._clk)
|
2013-05-07 13:09:56 -04:00
|
|
|
|
|
|
|
if not reset_less:
|
|
|
|
if rst_invert:
|
|
|
|
self.comb += self.cd_sys.rst.eq(~platform.request(rst_name))
|
|
|
|
else:
|
|
|
|
self.comb += self.cd_sys.rst.eq(platform.request(rst_name))
|