lib.cdc: adjust MultiReg for new CDC primitive conventions.

Refs #97.
This commit is contained in:
whitequark 2019-09-12 13:48:24 +00:00
parent 8c30147e39
commit 8f659b6cd6
3 changed files with 23 additions and 11 deletions

View file

@ -1,5 +1,7 @@
import warnings
from ...tools import deprecated
from ...lib.cdc import MultiReg
from ...lib.cdc import MultiReg as NativeMultiReg
from ...hdl.ast import *
from ..fhdl.module import CompatModule
from ..fhdl.structure import If
@ -8,6 +10,16 @@ from ..fhdl.structure import If
__all__ = ["MultiReg", "GrayCounter", "GrayDecoder"]
class MultiReg(NativeMultiReg):
def __init__(self, i, o, odomain="sync", n=2, reset=0):
if odomain != "sync":
warnings.warn("instead of `MultiReg(..., odomain={!r})`, "
"use `MultiReg(..., o_domain={!r})`"
.format(odomain, odomain),
DeprecationWarning, stacklevel=2)
super().__init__(i, o, o_domain=odomain, n=n, reset=reset)
@deprecated("instead of `migen.genlib.cdc.GrayCounter`, use `nmigen.lib.coding.GrayEncoder`")
class GrayCounter(CompatModule):
def __init__(self, width):