2013-02-07 16:07:30 -05:00
|
|
|
from migen.fhdl.structure import *
|
2013-03-15 05:48:43 -04:00
|
|
|
from migen.fhdl.module import Module
|
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-03-15 13:46:11 -04:00
|
|
|
self.clock_domains.cd_sys = ClockDomain()
|
|
|
|
platform.request(clk_name, None, self.cd_sys.clk)
|
2013-03-15 05:49:18 -04:00
|
|
|
if rst_invert:
|
|
|
|
rst_n = platform.request(rst_name)
|
2013-03-15 13:46:11 -04:00
|
|
|
self.comb += self.cd_sys.rst.eq(~rst_n)
|
2013-03-15 05:49:18 -04:00
|
|
|
else:
|
2013-03-15 13:46:11 -04:00
|
|
|
platform.request(rst_name, None, self.cd_sys.rst)
|