From 85a87c0ffdfb955926d37f7fc75ecf05e0cd2097 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 2 Mar 2020 15:42:16 +0000 Subject: [PATCH] annoying, see https://github.com/nmigen/nmigen/issues/302 shift can no longer be signed, even if the amount is guaranteed signed --- src/ieee754/fpcommon/msbhigh.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ieee754/fpcommon/msbhigh.py b/src/ieee754/fpcommon/msbhigh.py index 3a29935a..811555bf 100644 --- a/src/ieee754/fpcommon/msbhigh.py +++ b/src/ieee754/fpcommon/msbhigh.py @@ -46,6 +46,8 @@ class FPMSBHigh(Elaboratable): # took a "reverse" argument. clz = Signal((len(self.e_out), True), reset_less=True) + # GRRR utterly irritating https://github.com/nmigen/nmigen/issues/302 + uclz = Signal(len(self.e_out), reset_less=True) temp = Signal(mwid, reset_less=True) if self.loprop: temp_r = Signal(mwid, reset_less=True) @@ -65,7 +67,8 @@ class FPMSBHigh(Elaboratable): m.d.comb += [ pe.i.eq(self.m_in[::-1]), # inverted clz.eq(limclz), # count zeros from MSB down - temp.eq((self.m_in << clz)), # shift mantissa UP + uclz.eq(limclz), # *sigh*... + temp.eq((self.m_in << uclz)), # shift mantissa UP self.e_out.eq(self.e_in - clz), # DECREASE exponent ] if self.loprop: -- 2.30.2