Raise ValueError if commands array isn't of len=4 (fixing #48)
authorJean THOMAS <git0@pub.jeanthomas.me>
Tue, 4 Aug 2020 13:43:56 +0000 (15:43 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Tue, 4 Aug 2020 13:43:56 +0000 (15:43 +0200)
gram/core/multiplexer.py

index f59c3894c2edc24b77df069513c4a7ea9cf7e356..37114dca207922f5fcf1db1586373a673a17c65f 100644 (file)
@@ -140,7 +140,9 @@ class _Steerer(Elaboratable):
     """
 
     def __init__(self, commands, dfi):
-        assert len(commands) == 4
+        if len(commands) != 4:
+            raise ValueError("Commands is not the right size")
+
         self._commands = commands
         self._dfi = dfi
         self.sel = [Signal(range(len(commands))) for i in range(len(dfi.phases))]