from abc import ABCMeta, abstractmethod
-from typing import Union, Tuple, Any, Iterable, Optional, Mapping
+from typing import (Union, Tuple, Any, Iterable, Optional, Mapping, overload,
+ List)
from collections.abc import MutableSequence
__all__ = [
- "Value", "Const", "C", "AnyConst", "AnySeq", "Operator", "Mux", "Part",
- "Slice", "Cat", "Repl", "Array", "ArrayProxy", "Sample", "Past", "Stable",
- "Rose", "Fell", "Signal", "ClockSignal", "ResetSignal", "Statement",
- "Assign", "Assert", "Assume", "Switch", "Delay", "Tick", "Passive",
- "ValueKey", "ValueDict", "ValueSet", "SignalKey", "SignalDict", "SignalSet"
+ "Value", "Const", "C", "Mux", "Cat", "Repl", "Array", "ArrayProxy",
+ "Signal", "ClockSignal", "ResetSignal", "Statement", "Assign", "Assert",
+ "Assume", "Switch", "Delay", "Tick", "Passive"
]
ValueOrLiteral = Union[int, bool, 'Value']
class Value(metaclass=ABCMeta):
@staticmethod
- def wrap(obj: Any) -> 'Value':
+ def wrap(obj: ValueOrLiteral) -> 'Value':
...
def __invert__(self) -> 'Value':
def bool(self) -> 'Value':
...
+ # noinspection PyMethodParameters
def implies(premise: ValueOrLiteral,
conclusion: ValueOrLiteral) -> 'Value':
...
C = Const
+# noinspection PyPep8Naming
def Mux(sel: ValueOrLiteral,
val1: ValueOrLiteral,
val0: ValueOrLiteral) -> Value:
...
+# noinspection PyShadowingBuiltins
class Signal(Value):
nbits: int
signed: bool
class Passive(Property):
pass
+
+
+class Array(MutableSequence):
+ def __init__(self, iterable: Iterable = ()):
+ ...
+
+ @overload
+ def __getitem__(self, index: int) -> Any:
+ ...
+
+ @overload
+ def __getitem__(self, index: Value) -> 'ArrayProxy':
+ ...
+
+ def __len__(self) -> int:
+ ...
+
+ def __setitem__(self, index: int, value: Any) -> None:
+ ...
+
+ def __delitem__(self, index: int) -> None:
+ ...
+
+ def insert(self, index: int, value: Any) -> None:
+ ...
+
+
+class ArrayProxy(Value):
+ def __init__(self, elems: Union[Array, List[Any]], index: ValueOrLiteral):
+ ...
+
+ def __getattr__(self, attr: Any) -> Any:
+ ...
+
+ def __getitem__(self, index: Any) -> Any:
+ ...
+
+ def shape(self) -> Tuple[int, bool]:
+ ...