hdl: remove Repl per RFC 10.

Closes #770.
This commit is contained in:
Catherine 2024-01-31 02:55:57 +00:00
parent 4da8adf7ba
commit 357ffb680c
6 changed files with 5 additions and 58 deletions

View file

@ -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",

View file

@ -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

View file

@ -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)

View file

@ -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",