X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fadd%2Fqueue.py;h=f1ad3a2e2887f329c0688e5f7041ba859d55723c;hb=7804b6aaa3482097d09f23a62d10862b2820d372;hp=543aaaf278a16cf48b430c30200637f2c5253e15;hpb=846bda983943008ff508e0d4d3548fcee01422e8;p=ieee754fpu.git 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),