diff --git a/amaranth/__init__.py b/amaranth/__init__.py index aef4134..4094b99 100644 --- a/amaranth/__init__.py +++ b/amaranth/__init__.py @@ -15,7 +15,7 @@ from .hdl import * # must be kept in sync with docs/reference.rst! __all__ = [ "Shape", "unsigned", "signed", - "Value", "Const", "C", "Mux", "Cat", "Repl", "Array", "Signal", "ClockSignal", "ResetSignal", + "Value", "Const", "C", "Mux", "Cat", "Array", "Signal", "ClockSignal", "ResetSignal", "Module", "ClockDomain", "Elaboratable", "Fragment", "Instance", diff --git a/amaranth/hdl/__init__.py b/amaranth/hdl/__init__.py index e9fdb85..6ae76f8 100644 --- a/amaranth/hdl/__init__.py +++ b/amaranth/hdl/__init__.py @@ -1,6 +1,6 @@ from ._ast import Shape, unsigned, signed, ShapeCastable, ShapeLike from ._ast import Value, ValueCastable, ValueLike -from ._ast import Const, C, Mux, Cat, Repl, Array, Signal, ClockSignal, ResetSignal +from ._ast import Const, C, Mux, Cat, Array, Signal, ClockSignal, ResetSignal from ._dsl import SyntaxError, SyntaxWarning, Module from ._cd import DomainError, ClockDomain from ._ir import UnusedElaboratable, Elaboratable, DriverConflict, Fragment, Instance @@ -13,7 +13,7 @@ __all__ = [ # _ast "Shape", "unsigned", "signed", "ShapeCastable", "ShapeLike", "Value", "ValueCastable", "ValueLike", - "Const", "C", "Mux", "Cat", "Repl", "Array", "Signal", "ClockSignal", "ResetSignal", + "Const", "C", "Mux", "Cat", "Array", "Signal", "ClockSignal", "ResetSignal", # _dsl "SyntaxError", "SyntaxWarning", "Module", # _cd diff --git a/amaranth/hdl/_ast.py b/amaranth/hdl/_ast.py index b86bf44..16f6373 100644 --- a/amaranth/hdl/_ast.py +++ b/amaranth/hdl/_ast.py @@ -16,7 +16,7 @@ from .._unused import * __all__ = [ "Shape", "signed", "unsigned", "ShapeCastable", "ShapeLike", - "Value", "Const", "C", "AnyConst", "AnySeq", "Operator", "Mux", "Part", "Slice", "Cat", "Repl", + "Value", "Const", "C", "AnyConst", "AnySeq", "Operator", "Mux", "Part", "Slice", "Cat", "Array", "ArrayProxy", "Signal", "ClockSignal", "ResetSignal", "ValueCastable", "ValueLike", @@ -1170,37 +1170,6 @@ class Cat(Value): return "(cat {})".format(" ".join(map(repr, self.parts))) -# TODO(amaranth-0.5): remove -@deprecated("instead of `Repl(value, count)`, use `value.replicate(count)`") -def Repl(value, count): - """Replicate a value - - An input value is replicated (repeated) several times - to be used on the RHS of assignments:: - - len(Repl(s, n)) == len(s) * n - - Parameters - ---------- - value : Value, in - Input value to be replicated. - count : int - Number of replications. - - Returns - ------- - Value, out - Replicated value. - """ - if isinstance(value, int) and value not in [0, 1]: - warnings.warn("Value argument of Repl() is a bare integer {} used in bit vector " - "context; consider specifying explicit width using C({}, {}) instead" - .format(value, value, bits_for(value)), - SyntaxWarning, stacklevel=3) - - return Value.cast(value).replicate(count) - - class _SignalMeta(ABCMeta): def __call__(cls, shape=None, src_loc_at=0, **kwargs): signal = super().__call__(shape, **kwargs, src_loc_at=src_loc_at + 1) diff --git a/amaranth/hdl/ast.py b/amaranth/hdl/ast.py index 41e6a8b..c69f85d 100644 --- a/amaranth/hdl/ast.py +++ b/amaranth/hdl/ast.py @@ -6,7 +6,7 @@ from . import _ast as __origin __all__ = [ "Shape", "signed", "unsigned", "ShapeCastable", "ShapeLike", - "Value", "Const", "C", "AnyConst", "AnySeq", "Operator", "Mux", "Part", "Slice", "Cat", "Repl", + "Value", "Const", "C", "AnyConst", "AnySeq", "Operator", "Mux", "Part", "Slice", "Cat", "Array", "ArrayProxy", "Signal", "ClockSignal", "ResetSignal", "ValueCastable", "ValueLike", diff --git a/docs/reference.rst b/docs/reference.rst index 4186ab5..dfc5a55 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -59,7 +59,6 @@ The prelude exports exactly the following names: * :func:`C` * :func:`Mux` * :class:`Cat` -* :class:`Repl` (deprecated) * :class:`Array` * :class:`Signal` * :class:`ClockSignal` diff --git a/tests/test_hdl_ast.py b/tests/test_hdl_ast.py index 24f8441..cb3e6b9 100644 --- a/tests/test_hdl_ast.py +++ b/tests/test_hdl_ast.py @@ -970,27 +970,6 @@ class CatTestCase(FHDLTestCase): self.assertEqual(a.signed, False) -class ReplTestCase(FHDLTestCase): - @_ignore_deprecated - def test_cast(self): - r = Repl(0, 3) - self.assertEqual(repr(r), "(cat (const 1'd0) (const 1'd0) (const 1'd0))") - - @_ignore_deprecated - def test_int_01(self): - with warnings.catch_warnings(): - warnings.filterwarnings(action="error", category=SyntaxWarning) - Repl(0, 3) - Repl(1, 3) - - @_ignore_deprecated - def test_int_wrong(self): - with self.assertWarnsRegex(SyntaxWarning, - r"^Value argument of Repl\(\) is a bare integer 2 used in bit vector context; " - r"consider specifying explicit width using C\(2, 2\) instead$"): - Repl(2, 3) - - class ArrayTestCase(FHDLTestCase): def test_acts_like_array(self): a = Array([1,2,3])