experimenting with cscore, overlapping instructions
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 14 May 2019 09:35:41 +0000 (10:35 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 14 May 2019 09:35:41 +0000 (10:35 +0100)
src/experiment/cscore.py
src/regfile/regfile.py

index 0d1fc4d517de9a295161fc85238c9529f90b6c4d..9a729be3207bb388f731e7fbd122441664eb8228 100644 (file)
@@ -168,8 +168,8 @@ class Scoreboard(Elaboratable):
 
         # Connect INT Fn Unit global wr/rd pending
         for fu in if_l:
-            m.d.comb += fu.g_int_wr_pend_i.eq(g_int_wr_pend_v.g_pend_o)
-            m.d.comb += fu.g_int_rd_pend_i.eq(g_int_rd_pend_v.g_pend_o)
+            m.d.sync += fu.g_int_wr_pend_i.eq(g_int_wr_pend_v.g_pend_o)
+            m.d.sync += fu.g_int_rd_pend_i.eq(g_int_rd_pend_v.g_pend_o)
 
         # Connect Picker
         #---------
@@ -305,7 +305,7 @@ def scoreboard_sim(dut, alusim):
 
         yield from alusim.check(dut)
 
-    for i in range(20):
+    for i in range(2):
         src1 = randint(1, dut.n_regs-1)
         src2 = randint(1, dut.n_regs-1)
         while True:
@@ -313,12 +313,20 @@ def scoreboard_sim(dut, alusim):
             break
             if dest not in [src1, src2]:
                 break
+        if i == 0:
+            src1 = 6
+            src2 = 6
+            dest = 1
+        else:
+            src1 = 1
+            src2 = 7
+            dest = 1
         #src1 = 2
         #src2 = 3
         #dest = 2 
 
         op = randint(0, 1)
-        #op = 1
+        op = i
         print ("random %d: %d %d %d %d\n" % (i, op, src1, src2, dest))
         yield from int_instr(dut, alusim, op, src1, src2, dest)
         yield from print_reg(dut, [3,4,5])
@@ -327,7 +335,11 @@ def scoreboard_sim(dut, alusim):
         for i in range(len(dut.int_insn_i)):
             yield dut.int_insn_i[i].eq(0)
         yield
-        yield
+        while True:
+            issue_o = yield dut.issue_o
+            if issue_o:
+                break
+            yield
 
 
     yield
@@ -338,6 +350,8 @@ def scoreboard_sim(dut, alusim):
     yield
     yield
     yield
+    yield
+    yield
     yield from alusim.check(dut)
 
 
index 29fbda65b14ad4546e264f3a57f31af06389c900..1d732ba87a78ad6bb37f4a731b39a5495e9335bd 100644 (file)
@@ -10,7 +10,7 @@ import operator
 
 
 class Register(Elaboratable):
-    def __init__(self, width, writethru=False):
+    def __init__(self, width, writethru=True):
         self.width = width
         self.writethru = writethru
         self._rdports = []