From c0e9b074756e6bdb10ecb4eb41b329947ffd431c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20H=C3=A4rnqvist?= <ivaha717@student.liu.se> Date: Mon, 13 Apr 2020 15:55:51 +0200 Subject: [PATCH] show error message when trying to truncate complex numbers --- b_asic/operation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/b_asic/operation.py b/b_asic/operation.py index a1f3b7ca..c010ebb0 100644 --- a/b_asic/operation.py +++ b/b_asic/operation.py @@ -195,6 +195,8 @@ class AbstractOperation(Operation, AbstractGraphComponent): if bits is None: args.append(input_values[i]) else: + if isinstance(input_values[i], complex): + raise TypeError("Complex value cannot be truncated to {bits} bits as requested by the signal connected to input #{i}") args.append(self.truncate_input(i, input_values[i], bits)) else: args.append(input_values[i]) -- GitLab