Skip to content
Snippets Groups Projects
Commit fe2b75a1 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Add port name

parent 0c22caa5
No related branches found
No related tags found
1 merge request!207Add port name
Pipeline #89945 passed
...@@ -49,8 +49,7 @@ class Port(ABC): ...@@ -49,8 +49,7 @@ class Port(ABC):
@latency_offset.setter @latency_offset.setter
@abstractmethod @abstractmethod
def latency_offset(self, latency_offset: int) -> None: def latency_offset(self, latency_offset: int) -> None:
"""Set the latency_offset of the port to the integer specified value. """Set the latency_offset of the port to the integer specified value."""
"""
raise NotImplementedError raise NotImplementedError
@property @property
...@@ -94,6 +93,12 @@ class Port(ABC): ...@@ -94,6 +93,12 @@ class Port(ABC):
"""Removes all connected signals from the Port.""" """Removes all connected signals from the Port."""
raise NotImplementedError raise NotImplementedError
@property
@abstractmethod
def name(self) -> str:
"""Return a name consisting of *graph_id* of the related operation and the port number.
"""
class AbstractPort(Port): class AbstractPort(Port):
""" """
...@@ -134,6 +139,10 @@ class AbstractPort(Port): ...@@ -134,6 +139,10 @@ class AbstractPort(Port):
def latency_offset(self, latency_offset: Optional[int]): def latency_offset(self, latency_offset: Optional[int]):
self._latency_offset = latency_offset self._latency_offset = latency_offset
@property
def name(self):
return f"{self.operation.graph_id}.{self.index}"
class SignalSourceProvider(ABC): class SignalSourceProvider(ABC):
""" """
...@@ -196,13 +205,9 @@ class InputPort(AbstractPort): ...@@ -196,13 +205,9 @@ class InputPort(AbstractPort):
Get the output port that is currently connected to this input port, Get the output port that is currently connected to this input port,
or None if it is unconnected. or None if it is unconnected.
""" """
return ( return None if self._source_signal is None else self._source_signal.source
None if self._source_signal is None else self._source_signal.source
)
def connect( def connect(self, src: SignalSourceProvider, name: Name = Name("")) -> Signal:
self, src: SignalSourceProvider, name: Name = Name("")
) -> Signal:
""" """
Connect the provided signal source to this input port by creating a new signal. Connect the provided signal source to this input port by creating a new signal.
Returns the new signal. Returns the new signal.
......
...@@ -577,7 +577,7 @@ class Schedule: ...@@ -577,7 +577,7 @@ class Schedule:
start_time + cast(int, outport.latency_offset), start_time + cast(int, outport.latency_offset),
outport, outport,
reads, reads,
outport.operation.graph_id, outport.name,
) )
) )
return ret return ret
...@@ -800,6 +800,7 @@ class Schedule: ...@@ -800,6 +800,7 @@ class Schedule:
The vertical distance between operations in the schedule. The height of The vertical distance between operations in the schedule. The height of
the operation is always 1. the operation is always 1.
""" """
self._plot_schedule(ax, operation_gap=operation_gap)
def plot(self, operation_gap: Optional[float] = None) -> None: def plot(self, operation_gap: Optional[float] = None) -> None:
""" """
......
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment