From bbb9b7340bbef3918caf7d8bb32879ff16bbcb89 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 5 Apr 2020 18:20:20 -0700 Subject: [PATCH] all tests pass! --- .gitlab-ci.yml | 2 +- src/soc/scoreboard/test_iq.py | 45 +++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6f06981b..037653e9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -87,4 +87,4 @@ build: - python setup.py develop - python src/soc/decoder/pseudo/pywriter.py - - nosetests -v --processes=-1 + - nosetests -v --processes=-1 --process-timeout=120 diff --git a/src/soc/scoreboard/test_iq.py b/src/soc/scoreboard/test_iq.py index b90c0214..fb67d263 100644 --- a/src/soc/scoreboard/test_iq.py +++ b/src/soc/scoreboard/test_iq.py @@ -8,6 +8,7 @@ from nmigen.cli import verilog, rtlil from soc.scoreboard.instruction_q import InstructionQ from nmutil.nmoperator import eq +import unittest class IQSim: @@ -24,12 +25,12 @@ class IQSim: sendlen = randint(1, self.n_in) sendlen = 1 sendlen = min(len(self.iq) - i, sendlen) - print ("sendlen", len(self.iq)-i, sendlen) + print("sendlen", len(self.iq)-i, sendlen) for idx in range(sendlen): instr = self.iq[i+idx] yield from eq(self.dut.data_i[idx], instr) - di = yield self.dut.data_i[idx]#.src1_i - print ("senddata %d %x" % ((i+idx), di)) + di = yield self.dut.data_i[idx] # .src1_i + print("senddata %d %x" % ((i+idx), di)) self.oq.append(di) yield self.dut.p_add_i.eq(sendlen) yield @@ -40,7 +41,7 @@ class IQSim: yield self.dut.p_add_i.eq(0) - print ("send", len(self.iq), i, sendlen) + print("send", len(self.iq), i, sendlen) # wait random period of time before queueing another value for j in range(randint(0, 3)): @@ -51,16 +52,16 @@ class IQSim: yield self.dut.p_add_i.eq(0) yield - print ("send ended") + print("send ended") - ## wait random period of time before queueing another value - #for i in range(randint(0, 3)): + # wait random period of time before queueing another value + # for i in range(randint(0, 3)): # yield #send_range = randint(0, 3) - #if send_range == 0: + # if send_range == 0: # send = True - #else: + # else: # send = randint(0, send_range) != 0 def rcv(self): @@ -73,10 +74,10 @@ class IQSim: #print ("outreq", rcvlen) yield self.dut.n_sub_i.eq(rcvlen) n_sub_o = yield self.dut.n_sub_o - print ("recv", n_sub_o) + print("recv", n_sub_o) for j in range(n_sub_o): - r = yield self.dut.data_o[j]#.src1_i - print ("recvdata %x %s" % (r, repr(self.iq[i+j]))) + r = yield self.dut.data_o[j] # .src1_i + print("recvdata %x %s" % (r, repr(self.iq[i+j]))) assert r == self.oq[i+j] yield if n_sub_o == 0: @@ -85,24 +86,25 @@ class IQSim: i += n_sub_o - print ("recv ended") + print("recv ended") def mk_insns(n_insns, wid, opwid): res = [] for i in range(n_insns): - op1 = randint(0, (1<