From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 11:22:46 +0000 (+0000) Subject: use negative slice (now works) X-Git-Tag: ls180-24jan2020~2004 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a68eacb51223b30fe9f0513204a165ba6b12bff7;p=ieee754fpu.git use negative slice (now works) --- 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)