From a68eacb51223b30fe9f0513204a165ba6b12bff7 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 11:22:46 +0000 Subject: [PATCH] use negative slice (now works) --- src/add/nmigen_add_experiment.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 92157d41..2db9c27b 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -9,9 +9,8 @@ from nmigen.cli import main class FPNum: def __init__(self, width, m_width=None): self.width = width - self.mw = 23 # TODO if m_width is None: - m_width = width + 3 # extra accuracy bits + m_width = width - 5 # mantissa extra bits (top,guard,round) self.v = Signal(width) # Latched copy of value self.m = Signal(m_width) # Mantissa self.e = Signal((10, True)) # Exponent: 10 bits, signed @@ -34,7 +33,7 @@ class FPNum: def shift_down(self): return self.create(self.s, self.e + 1, - Cat(self.m[0] | self.m[1], self.m[1:self.mw-1], 0)) + Cat(self.m[0] | self.m[1], self.m[1:-5], 0)) def nan(self, s): return self.create(s, 0xff, 1<<22) -- 2.30.2