leave off number being subtracted from "ready_o" calculation
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 30 May 2019 21:31:53 +0000 (22:31 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 30 May 2019 21:31:53 +0000 (22:31 +0100)
src/scoreboard/instruction_q.py
src/scoreboard/test_iq.py

index f3be7669e70dd5d6934924d2152d9c29e975300e..f32a91acf79d72e518f62a06e41d34d06092d3c0 100644 (file)
@@ -91,9 +91,9 @@ class InstructionQ(Elaboratable):
                 comb += self.n_sub_o.eq(self.n_sub_i)
 
         # work out how many new items are going to be in the queue
-        comb += left.eq(self.qlen_o - self.n_sub_o)
+        comb += left.eq(self.qlen_o )#- self.n_sub_o)
         comb += spare.eq(mqlen - self.p_add_i)
-        comb += qmaxed.eq(left < spare)
+        comb += qmaxed.eq(left <= spare)
         comb += self.p_ready_o.eq(qmaxed & (self.p_add_i != 0))
 
         # put q (flattened) into output
index 6bbb26db4c33921fbf589242a69a8ed97481f2c4..3f1f99646e3280b37d92a0ebcd4d7f4f697aebe1 100644 (file)
@@ -35,10 +35,10 @@ class IQSim:
                 o_p_ready = yield self.dut.p_ready_o
 
             yield
+            yield self.dut.p_add_i.eq(0)
 
             print ("send", len(self.iq), i, sendlen)
 
-            yield self.dut.p_add_i.eq(0)
             # wait random period of time before queueing another value
             for j in range(randint(0, 3)):
                 yield
@@ -62,6 +62,9 @@ class IQSim:
 
     def rcv(self):
         i = 0
+        yield
+        yield
+        yield
         while i < len(self.iq):
             rcvlen = randint(1, self.n_out)
             #print ("outreq", rcvlen)
@@ -92,7 +95,7 @@ def test_iq():
     wid = 8
     opwid = 4
     qlen = 5
-    n_in = 2
+    n_in = 3
     n_out = 3
     dut = InstructionQ(wid, opwid, qlen, n_in, n_out)
     insns = mk_insns(10, wid, opwid)