Skip to content

Incorrect SFGs do not raise

Raise in a few more situations when creating an SFG.

In !149 (merged) a number of tests were added to check erroneous behavior. However, a few situations which should raise that didn't was identified.

The following code does not raise:

in1 = Input()
in2 = Input()
adaptor = SymmetricTwoportAdaptor(0.5, in1, in2)
out1 = Output(adaptor.output(0))
out2 = Output()
# No error, should be
SFG([in1, in2], [out1, out2])

However, trying to simulate later gives:

IndexError: list index out of range

There are two errors here:

  1. A dangling output from the adaptor, which currently seems to be OK, related to #132 (closed). This may still be OK?
  2. out2 is not connected to anything, which gives the error later on.

Connecting a signal to the dangling output do give an error though:

in1 = Input()
in2 = Input()
adaptor = SymmetricTwoportAdaptor(0.5, in1, in2)
out1 = Output(adaptor.output(0))
signal = Signal(adaptor.output(1))
SFG([in1, in2], [out1, out2])

Also, there is no check for duplicated output_signals, see https://gitlab.liu.se/da/B-ASIC/-/blob/master/test/test_sfg.py#L1512 This is maybe OK? But I think it could also raise an error? (It is maybe not obvious that having the two signals connected to the same port should raise though, but using exactly the same twice would in most cases be a typo?)