diff --git a/b_asic/operation.py b/b_asic/operation.py index 5cda2ed7128b1b0278320a4788e020294787ff8a..02995d3f7cc6ee7658b9677fbd36d26406aa82f7 100644 --- a/b_asic/operation.py +++ b/b_asic/operation.py @@ -454,9 +454,10 @@ class AbstractOperation(Operation, AbstractGraphComponent): behavior. """ + __slots__ = ("_input_ports", "_output_ports", "_execution_time") _input_ports: List[InputPort] _output_ports: List[OutputPort] - _execution_time: Union[int, None] = None + _execution_time: Optional[int] def __init__( self, diff --git a/b_asic/port.py b/b_asic/port.py index 25400df20f8626d5042206b25f3ef84e4521763f..b3b3ccfb68cd2d1535b1bdbcca1187ac34eb5d63 100644 --- a/b_asic/port.py +++ b/b_asic/port.py @@ -130,6 +130,7 @@ class AbstractPort(Port): behavior. """ + __slots__ = ("_operation", "_index", "_latency_offset") _operation: "Operation" _index: int _latency_offset: Optional[int] @@ -276,6 +277,7 @@ class InputPort(AbstractPort): May have one or zero signals connected to it. """ + __slots__ = ("_source_signal",) _source_signal: Optional[Signal] def __init__(self, operation: "Operation", index: int): @@ -372,6 +374,7 @@ class OutputPort(AbstractPort, SignalSourceProvider): May have zero or more signals connected to it. """ + __slots__ = ("_destination_signals",) _destination_signals: List[Signal] def __init__(self, operation: "Operation", index: int): diff --git a/b_asic/process.py b/b_asic/process.py index 74ca40b4437c32ba11f2dceb077402d1a2ac5da9..e51fc31e25ae86d2ed912737423b63cf1a73e797 100644 --- a/b_asic/process.py +++ b/b_asic/process.py @@ -24,6 +24,11 @@ class Process: The name of the process. """ + __slots__ = ("_start_time", "_execution_time", "_name") + _start_time: int + _execution_time: int + _name: str + def __init__(self, start_time: int, execution_time: int, name: str = ""): self._start_time = start_time self._execution_time = execution_time @@ -82,6 +87,9 @@ class OperatorProcess(Process): The name of the process. """ + __slots__ = ("_operation",) + _operation: Operation + def __init__( self, start_time: int, @@ -131,6 +139,9 @@ class MemoryProcess(Process): Name of the process. """ + __slots__ = ("_life_times",) + _life_times: List[int] + def __init__( self, write_time: int, @@ -274,6 +285,11 @@ class MemoryVariable(MemoryProcess): The name of the process. """ + __slots__ = ("_reads", "_read_ports", "_write_port") + _reads: Dict[InputPort, int] + _read_ports: List[InputPort] + _write_port: OutputPort + def __init__( self, write_time: int, @@ -359,6 +375,11 @@ class PlainMemoryVariable(MemoryProcess): The name of the process. """ + __slots__ = ("_reads", "_read_ports", "_write_port") + _reads: Dict[int, int] + _read_ports: List[int] + _write_port: OutputPort + def __init__( self, write_time: int, diff --git a/b_asic/resources.py b/b_asic/resources.py index 1fad9dbaabb7aa1e611b81ecacb7c854e303ab4c..97dffb6802daef8d1306f646add9dd090a43a7cc 100644 --- a/b_asic/resources.py +++ b/b_asic/resources.py @@ -449,6 +449,11 @@ class ProcessCollection: .. math:: t = t \bmod T_{\textrm{schedule}}. """ + __slots__ = ("_collection", "_schedule_time", "_cyclic") + _collection: List[Process] + _schedule_time: int + _cyclic: bool + def __init__( self, collection: Iterable[Process],