From 7804b6aaa3482097d09f23a62d10862b2820d372 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 17 Apr 2019 07:39:50 +0100 Subject: [PATCH] fix bug in setting up count --- src/add/queue.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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), -- 2.30.2