litex/mibuild/crg.py

14 lines
464 B
Python
Raw Normal View History

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):
self._clk = platform.request(clk_name)
self._rst = platform.request(rst_name)
2013-03-15 13:46:11 -04:00
self.clock_domains.cd_sys = ClockDomain()
self.comb += self.cd_sys.clk.eq(self._clk)
2013-03-15 05:49:18 -04:00
if rst_invert:
self.comb += self.cd_sys.rst.eq(~self._rst)
2013-03-15 05:49:18 -04:00
else:
self.comb += self.cd_sys.rst.eq(self._rst)