-import warnings
from collections import OrderedDict
+from ...tools import _ignore_deprecated
from ...hdl.xfrm import ValueTransformer, StatementTransformer
from ...hdl.ast import *
from ..fhdl.module import CompatModule, CompatFinalizeError
self.sync += signal.eq(self.before_leaving(state))
return signal
+ @_ignore_deprecated
def do_finalize(self):
nstates = len(self.actions)
self.encoding = dict((s, n) for n, s in enumerate(self.actions.keys()))
def _finalize_sync(self, ls):
cases = dict((self.encoding[k], ls.on_statement(v)) for k, v in self.actions.items() if v)
- with warnings.catch_warnings():
- self.comb += [
- self.next_state.eq(self.state),
- Case(self.state, cases).makedefault(self.encoding[self.reset_state])
- ]
- self.sync += self.state.eq(self.next_state)
- for register, next_value_ce, next_value in ls.registers:
- self.sync += If(next_value_ce, register.eq(next_value))
+ self.comb += [
+ self.next_state.eq(self.state),
+ Case(self.state, cases).makedefault(self.encoding[self.reset_state])
+ ]
+ self.sync += self.state.eq(self.next_state)
+ for register, next_value_ce, next_value in ls.registers:
+ self.sync += If(next_value_ce, register.eq(next_value))
+from ...tools import _ignore_deprecated
from ...compat import *
from ...compat.fhdl import verilog
class SimCase:
def setUp(self, *args, **kwargs):
- self.tb = self.TestBench(*args, **kwargs)
+ with _ignore_deprecated():
+ self.tb = self.TestBench(*args, **kwargs)
def test_to_verilog(self):
verilog.convert(self.tb)
-from collections.abc import Iterable
+import contextlib
import functools
import warnings
+from collections.abc import Iterable
+from contextlib import contextmanager
__all__ = ["flatten", "union", "log2_int", "bits_for", "deprecated"]
return decorator
+def _ignore_deprecated(f=None):
+ if f is None:
+ @contextlib.contextmanager
+ def context_like():
+ with warnings.catch_warnings():
+ warnings.filterwarnings(action="ignore", category=DeprecationWarning)
+ yield
+ return context_like()
+ else:
+ @functools.wraps(f)
+ def decorator_like(*args, **kwargs):
+ with warnings.catch_warnings():
+ warnings.filterwarnings(action="ignore", category=DeprecationWarning)
+ f(*args, **kwargs)
+ return decorator_like
+
+
def extend(cls):
def decorator(f):
if isinstance(f, property):