Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/nmigen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 73244f2bd25b
Choose a base ref
...
head repository: m-labs/nmigen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2d2ab6e09d92
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Sep 12, 2019

  1. lib.cdc: make domain properties private.

    It is not correct to access domain properties from user code, because
    it will not match the reality if DomainRenamer has been applied to
    the module.
    whitequark committed Sep 12, 2019
    Copy the full SHA
    2d2ab6e View commit details
Showing with 6 additions and 5 deletions.
  1. +1 −0 nmigen/compat/genlib/cdc.py
  2. +5 −5 nmigen/lib/cdc.py
1 change: 1 addition & 0 deletions nmigen/compat/genlib/cdc.py
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ def __init__(self, i, o, odomain="sync", n=2, reset=0):
.format(odomain, odomain),
DeprecationWarning, stacklevel=2)
super().__init__(i, o, o_domain=odomain, n=n, reset=reset)
self.odomain = odomain


@deprecated("instead of `migen.genlib.cdc.GrayCounter`, use `nmigen.lib.coding.GrayEncoder`")
10 changes: 5 additions & 5 deletions nmigen/lib/cdc.py
Original file line number Diff line number Diff line change
@@ -52,8 +52,8 @@ class MultiReg(Elaboratable):
def __init__(self, i, o, *, o_domain="sync", n=2, reset=0, reset_less=True):
self.i = i
self.o = o
self.o_domain = o_domain

self._o_domain = o_domain
self._regs = [Signal(self.i.shape(), name="cdc{}".format(i), reset=reset,
reset_less=reset_less)
for i in range(n)]
@@ -64,16 +64,16 @@ def elaborate(self, platform):

m = Module()
for i, o in zip((self.i, *self._regs), self._regs):
m.d[self.o_domain] += o.eq(i)
m.d[self._o_domain] += o.eq(i)
m.d.comb += self.o.eq(self._regs[-1])
return m


class ResetSynchronizer(Elaboratable):
def __init__(self, arst, *, domain="sync", n=2):
self.arst = arst
self.domain = domain

self._domain = domain
self._regs = [Signal(1, name="arst{}".format(i), reset=1)
for i in range(n)]

@@ -86,8 +86,8 @@ def elaborate(self, platform):
for i, o in zip((0, *self._regs), self._regs):
m.d.reset_sync += o.eq(i)
m.d.comb += [
ClockSignal("reset_sync").eq(ClockSignal(self.domain)),
ClockSignal("reset_sync").eq(ClockSignal(self._domain)),
ResetSignal("reset_sync").eq(self.arst),
ResetSignal(self.domain).eq(self._regs[-1])
ResetSignal(self._domain).eq(self._regs[-1])
]
return m