Newer
Older
"""
B-ASIC Signal Module.
TODO: More info.
"""
from b_asic.operation import Operation
from typing import NewType
SignalId = NewType("SignalId", int)
class SignalSource:
"""
Handle to a signal source.
TODO: More info.
"""
operation: Operation
port_index: int
def __init__(self, operation: Operation, port_index: int):
"""
Construct a SignalSource.
"""
self.operation = operation
self.port_index = port_index
# TODO: More stuff.
class SignalDestination:
"""
Handle to a signal destination.
TODO: More info.
"""
operation: Operation
port_index: int
def __init__(self, operation: Operation, port_index: int):
"""
Construct a SignalDestination.
"""
self.operation = operation
self.port_index = port_index
# TODO: More stuff.
class Signal:
"""
A connection between two operations consisting of a source and destination handle.
TODO: More info.
"""
_identifier: SignalId
source: SignalSource
destination: SignalDestination
def __init__(self, identifier: SignalId, source: SignalSource, destination: SignalDestination):
"""
Construct a Signal.
"""
self._identifier = identifier
self.source = source
self.destination = destination
def identifier(self) -> SignalId:
"""
Get the unique identifier.
"""
return self._identifier
# TODO: More stuff.