diff --git a/b_asic/port.py b/b_asic/port.py index 45db07d74c6f9ded190733bafd86526fe4d42efe..5b129287c40f011a84d88433c75f01a4445a670d 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 c3bd2bd10e2e4b291add4efe70a22865a2b9abc9..d02517f20bfbac4c7630df9040654a485579649f 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