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 05:48:43 -04:00
|
|
|
class CRG(Module):
|
2013-02-07 16:07:30 -05:00
|
|
|
def get_clock_domains(self):
|
|
|
|
r = dict()
|
|
|
|
for k, v in self.__dict__.items():
|
|
|
|
if isinstance(v, ClockDomain):
|
|
|
|
r[v.name] = v
|
|
|
|
return r
|
|
|
|
|
|
|
|
class SimpleCRG(CRG):
|
|
|
|
def __init__(self, platform, clk_name, rst_name):
|
|
|
|
self.cd = ClockDomain("sys")
|
|
|
|
platform.request(clk_name, None, self.cd.clk)
|
|
|
|
platform.request(rst_name, None, self.cd.rst)
|