From f87edabd3a2c2a502143d170b2f83bba58eb8df0 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Wed, 5 Apr 2023 20:38:42 +0200 Subject: [PATCH] Fix fwl simulation --- b_asic/operation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/b_asic/operation.py b/b_asic/operation.py index acbd7bd0..557210ba 100644 --- a/b_asic/operation.py +++ b/b_asic/operation.py @@ -928,14 +928,13 @@ class AbstractOperation(Operation, AbstractGraphComponent): ) return self.input(0) - # TODO: Fix def quantize_input(self, index: int, value: Num, bits: int) -> Num: if isinstance(value, (float, int)): - return round(value) & ((2**bits) - 1) + b = 2**bits + return round((value + 1) * b % (2 * b) - b) / b else: raise TypeError - # TODO: Seems wrong??? - Oscar def quantize_inputs( self, input_values: Sequence[Num], -- GitLab