Local clock domain example
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 15 Mar 2013 17:18:32 +0000 (18:18 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 15 Mar 2013 17:18:32 +0000 (18:18 +0100)
examples/basic/local_cd.py [new file with mode: 0644]

diff --git a/examples/basic/local_cd.py b/examples/basic/local_cd.py
new file mode 100644 (file)
index 0000000..ca8200a
--- /dev/null
@@ -0,0 +1,17 @@
+from migen.fhdl.structure import *
+from migen.fhdl.module import Module
+from migen.fhdl import verilog
+from migen.genlib.divider import Divider
+
+class CDM(Module):
+       def __init__(self):
+               self.submodules.divider = Divider(5)
+               self.clock_domains.cd_sys = ClockDomain()
+
+class MultiMod(Module):
+       def __init__(self):
+               self.submodules.foo = CDM()
+               self.submodules.bar = CDM()
+
+mm = MultiMod()
+print(verilog.convert(mm, {mm.foo.cd_sys.clk, mm.bar.cd_sys.clk}))