2 from typing import List, Union, Tuple, Any, Dict, Optional, Generator
3 from .ast import Signal, Value
5 __all__ = ["Direction", "DIR_NONE", "DIR_FANOUT",
6 "DIR_FANIN", "Layout", "Record"]
9 class Direction(enum.Enum):
15 DIR_NONE = Direction.NONE
16 DIR_FANOUT = Direction.FANOUT
17 DIR_FANIN = Direction.FANIN
19 # recursive types are not yet supported by mypy, manually recurse a few times
20 LayoutInputFields0 = Union['Layout',
30 LayoutInputFields1 = Union['Layout',
40 LayoutInputFields2 = Union['Layout',
50 LayoutInputFields3 = Union['Layout',
60 LayoutInputFields = Union['Layout',
70 LayoutFieldShape = Union[int, Tuple[int, bool], 'Layout']
74 fields: Dict[str, Tuple[LayoutFieldShape, Direction]]
77 def wrap(obj: LayoutInputFields) -> 'Layout':
80 def __init__(self, fields: LayoutInputFields) -> None:
83 def __getitem__(self, name: str) -> Tuple[LayoutFieldShape, Direction]:
86 def __iter__(self) -> Generator[Tuple[str, LayoutFieldShape, Direction],
94 fields: Dict[str, Union[Record, Signal]]
96 def __init__(self, layout: LayoutInputFields, name: Optional[str] = None):
99 def shape(self) -> Tuple[int, bool]:
102 def __getattr__(self, name: str) -> Union[Record, Signal]:
105 def __getitem__(self,
106 name: Union[slice, int, str]) -> Union[Record, Signal]: