From: Luke Kenneth Casson Leighton Date: Wed, 17 Apr 2019 06:39:50 +0000 (+0100) Subject: fix bug in setting up count X-Git-Tag: ls180-24jan2020~1227 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7804b6aaa3482097d09f23a62d10862b2820d372;p=ieee754fpu.git fix bug in setting up count --- diff --git a/src/add/queue.py b/src/add/queue.py index 543aaaf2..f1ad3a2e 100644 --- a/src/add/queue.py +++ b/src/add/queue.py @@ -137,10 +137,10 @@ class Queue(FIFOInterface): with m.If(n_i_ready): m.d.comb += p_o_ready.eq(1) - if self.depth == 1 << len(self.count): # is depth a power of 2 + # set the count (available free space), optimise on power-of-two + if self.depth == 1 << ptr_width: # is depth a power of 2 m.d.comb += self.count.eq( - Mux(self.maybe_full & ptr_match, self.depth, 0) - | self.ptr_diff) + Mux(maybe_full & ptr_match, self.depth, 0) | ptr_diff) else: m.d.comb += self.count.eq(Mux(ptr_match, Mux(maybe_full, self.depth, 0),