From 62a7700ce721cbae1def41c1f1235e42f96019d8 Mon Sep 17 00:00:00 2001 From: angloth <angus.lothian@hotmail.com> Date: Fri, 6 Mar 2020 11:07:27 +0100 Subject: [PATCH] Remove setter for signals source and destination since they shouldn't be modified. --- b_asic/port.py | 3 +++ b_asic/signal.py | 26 ++------------------------ 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/b_asic/port.py b/b_asic/port.py index 45db07d7..5b129287 100644 --- a/b_asic/port.py +++ b/b_asic/port.py @@ -99,6 +99,9 @@ class InputPort(Port): return 0 if self._signal is None else 1 def connect(self, port: "OutputPort") -> sig.Signal: + # Remove previously connected signal if there is one + if self._signal is not None: + self.disconnect() self._signal = sig.Signal(port, self) return self._signal diff --git a/b_asic/signal.py b/b_asic/signal.py index c3bd2bd1..d02517f2 100644 --- a/b_asic/signal.py +++ b/b_asic/signal.py @@ -32,42 +32,20 @@ class Signal(AbstractGraphComponent): """Returns the destination InputPort of the signal.""" return self._destination - @source.setter - def source(self, src: OutputPort) -> None: - """Sets the value of the source OutputPort of the signal. - - Note: Does not connect the src OutputPort to the signal. - - Keyword arguments: - - src: OutPort to connect as source to the signal. - """ - self._source = src - - @destination.setter - def destination(self, dest: InputPort) -> None: - """Sets the value of the destination InputPort of the signal. - - Note: Does not connect the destination InputPort to the signal. - - Keywords argments: - - dest: InputPort to connect as destination to the signal. - """ - self._destination = dest - @property def type_name(self) -> TypeName: return "s" def disconnect_source(self) -> None: """Disconnects the source OutputPort of the signal. - + Note: Does not disconnect the source OutputPort from the signal. """ self._source = None def disconnect_destination(self) -> None: """Disconnects the destination InputPort of the signal. - + Note: Does not disconnect the destination OutputPort from the signal. """ self._destination = None -- GitLab