From: Luke Kenneth Casson Leighton Date: Sun, 26 May 2019 01:03:07 +0000 (+0100) Subject: have to bring in a reset signal into the shadow units to get them to go to X-Git-Tag: div_pipeline~1942 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=298b4165b1a7eafff5c5b93bc926f6736899c8be;p=soc.git have to bring in a reset signal into the shadow units to get them to go to a known state, after a branch result is known --- diff --git a/src/experiment/score6600.py b/src/experiment/score6600.py index 617fc32f..eca0ae22 100644 --- a/src/experiment/score6600.py +++ b/src/experiment/score6600.py @@ -327,8 +327,10 @@ class Scoreboard(Elaboratable): # connected to the FUReg and FUFU Matrices, to get them to reset anydie = Signal(n_int_fus, reset_less=True) allshadown = Signal(n_int_fus, reset_less=True) + shreset = Signal(n_int_fus, reset_less=True) comb += allshadown.eq(shadows.shadown_o & bshadow.shadown_o) comb += anydie.eq(shadows.go_die_o | bshadow.go_die_o) + comb += shreset.eq(bspec.match_g_o | bspec.match_f_o) #--------- # connect fu-fu matrix @@ -359,6 +361,7 @@ class Scoreboard(Elaboratable): #--------- comb += shadows.issue_i.eq(fn_issue_o) + comb += shadows.reset_i[0:n_int_fus].eq(shreset[0:n_int_fus]) #--------- # NOTE; this setup is for the instruction order preservation... @@ -392,6 +395,7 @@ class Scoreboard(Elaboratable): # issue captures shadow_i (if enabled) comb += bshadow.issue_i.eq(fn_issue_o) + comb += bshadow.reset_i[0:n_int_fus].eq(shreset[0:n_int_fus]) # instruction being issued (fn_issue_o) has a shadow cast by the branch with m.If(self.branch_succ_i | self.branch_fail_i): @@ -406,9 +410,9 @@ class Scoreboard(Elaboratable): with m.If(cu.br1.issue_i): sync += bspec.active_i.eq(1) with m.If(self.branch_succ_i): - comb += bspec.good_i.eq(fn_issue_o & 0xf) + comb += bspec.good_i.eq(fn_issue_o & 0x1f) with m.If(self.branch_fail_i): - comb += bspec.fail_i.eq(fn_issue_o & 0xf) + comb += bspec.fail_i.eq(fn_issue_o & 0x1f) # branch is active (TODO: a better signal: this is over-using the # go_write signal - actually the branch should not be "writing") @@ -594,6 +598,8 @@ def scoreboard_branch_sim(dut, alusim): # create some instructions: branches create a tree insts = create_random_ops(dut, 0, True) + #insts.append((6, 6, 1, 2, (0, 0))) + insts.append((4, 3, 3, 0, (0, 0))) src1 = randint(1, dut.n_regs-1) src2 = randint(1, dut.n_regs-1) @@ -629,7 +635,7 @@ def scoreboard_branch_sim(dut, alusim): for ok, fl in zip(branch_ok, branch_fail): instrs.append((ok[0], ok[1], ok[2], ok[3], (1, 0))) instrs.append((fl[0], fl[1], fl[2], fl[3], (0, 1))) - print ("instr %d: (%d, %d, %d, %d, %d, %d)" % \ + print ("instr %d: (%d, %d, %d, %d, (%d, %d))" % \ (i, src1, src2, dest, op, shadow_on, shadow_off)) yield from int_instr(dut, op, src1, src2, dest, shadow_on, shadow_off) diff --git a/src/scoreboard/shadow.py b/src/scoreboard/shadow.py index 841dcd67..ec83038d 100644 --- a/src/scoreboard/shadow.py +++ b/src/scoreboard/shadow.py @@ -25,6 +25,7 @@ class Shadow(Elaboratable): if shadow_wid: # inputs self.issue_i = Signal(reset_less=True) + self.reset_i = Signal(reset_less=True) self.shadow_i = Signal(shadow_wid, reset_less=True) self.s_fail_i = Signal(shadow_wid, reset_less=True) self.s_good_i = Signal(shadow_wid, reset_less=True) @@ -47,6 +48,7 @@ class Shadow(Elaboratable): # shadow / recover (optional: shadow_wid > 0) if self.shadow_wid: i_l = [] + d_l = [] fail_l = [] good_l = [] shi_l = [] @@ -55,12 +57,14 @@ class Shadow(Elaboratable): # get list of latch signals. really must be a better way to do this for l in s_latches: i_l.append(l.issue_i) + d_l.append(l.reset_i) shi_l.append(l.shadow_i) fail_l.append(l.s_fail_i) good_l.append(l.s_good_i) sho_l.append(l.shadow_o) rec_l.append(l.recover_o) m.d.comb += Cat(*i_l).eq(Repl(self.issue_i, self.shadow_wid)) + m.d.comb += Cat(*d_l).eq(Repl(self.reset_i, self.shadow_wid)) m.d.comb += Cat(*fail_l).eq(self.s_fail_i) m.d.comb += Cat(*good_l).eq(self.s_good_i) m.d.comb += Cat(*shi_l).eq(self.shadow_i) @@ -71,6 +75,7 @@ class Shadow(Elaboratable): def __iter__(self): if self.shadow_wid: + yield self.reset_i yield self.issue_i yield self.shadow_i yield self.s_fail_i @@ -116,6 +121,7 @@ class ShadowMatrix(Elaboratable): # inputs self.issue_i = Signal(n_fus, reset_less=True) + self.reset_i = Signal(n_fus, reset_less=True) self.shadow_i = Array(Signal(shadow_wid, name="sh_i", reset_less=True) \ for f in range(n_fus)) self.s_fail_i = Array(Signal(shadow_wid, name="fl_i", reset_less=True) \ @@ -141,13 +147,16 @@ class ShadowMatrix(Elaboratable): # connect all shadow outputs and issue input issue_l = [] + reset_l = [] sho_l = [] rec_l = [] for l in shadows: issue_l.append(l.issue_i) + reset_l.append(l.reset_i) sho_l.append(l.shadown_o) rec_l.append(l.go_die_o) m.d.comb += Cat(*issue_l).eq(self.issue_i) + m.d.comb += Cat(*reset_l).eq(self.reset_i) m.d.comb += self.shadown_o.eq(Cat(*sho_l)) m.d.comb += self.go_die_o.eq(Cat(*rec_l)) @@ -155,6 +164,7 @@ class ShadowMatrix(Elaboratable): def __iter__(self): yield self.issue_i + yield self.reset_i yield from self.shadow_i yield from self.s_fail_i yield from self.s_good_i diff --git a/src/scoreboard/shadow_fn.py b/src/scoreboard/shadow_fn.py index bb91e312..7abc8261 100644 --- a/src/scoreboard/shadow_fn.py +++ b/src/scoreboard/shadow_fn.py @@ -12,6 +12,7 @@ class ShadowFn(Elaboratable): # inputs self.issue_i = Signal(reset_less=True) self.shadow_i = Signal(reset_less=True) + self.reset_i = Signal(reset_less=True) self.s_fail_i = Signal(reset_less=True) self.s_good_i = Signal(reset_less=True) @@ -23,8 +24,13 @@ class ShadowFn(Elaboratable): m = Module() m.submodules.sl = sl = SRLatch(sync=False) - m.d.comb += sl.s.eq(self.shadow_i & self.issue_i & ~self.s_good_i) - m.d.comb += sl.r.eq(self.s_good_i | (self.issue_i & ~self.shadow_i)) + #reset_r = Signal() + #m.d.sync += reset_r.eq(self.s_good_i | self.s_fail_i) + + m.d.comb += sl.s.eq(self.shadow_i & self.issue_i & \ + ~self.s_good_i & ~self.reset_i) + m.d.comb += sl.r.eq(self.reset_i | self.s_good_i | \ + (self.issue_i & ~self.shadow_i)) m.d.comb += self.recover_o.eq(sl.qlq & self.s_fail_i) m.d.comb += self.shadow_o.eq(sl.qlq) @@ -32,6 +38,7 @@ class ShadowFn(Elaboratable): def __iter__(self): yield self.issue_i + yield self.s_reset_i yield self.shadow_i yield self.s_fail_i yield self.s_good_i