From: Luke Kenneth Casson Leighton Date: Fri, 7 Jun 2019 09:32:00 +0000 (+0100) Subject: start preliminary test of load/store dependency matrices X-Git-Tag: div_pipeline~1886 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b479fcb79b7989b86c8a30a5d33af9ceee33239;p=soc.git start preliminary test of load/store dependency matrices --- diff --git a/src/scoreboard/ldst_matrix.py b/src/scoreboard/ldst_matrix.py index 30a946e0..e0209547 100644 --- a/src/scoreboard/ldst_matrix.py +++ b/src/scoreboard/ldst_matrix.py @@ -50,6 +50,7 @@ class LDSTDepMatrix(Elaboratable): self.ld_pend_i = Signal(n_ldst, reset_less=True) # load pending in self.st_pend_i = Signal(n_ldst, reset_less=True) # store pending in self.issue_i = Signal(n_ldst, reset_less=True) # Issue in + self.go_die_i = Signal(n_ldst, reset_less=True) # Die/Reset in self.load_hit_i = Signal(n_ldst, reset_less=True) # load hit in self.stwd_hit_i = Signal(n_ldst, reset_less=True) # store w/data hit in @@ -76,6 +77,7 @@ class LDSTDepMatrix(Elaboratable): load_l = [] stor_l = [] issue_l = [] + go_die_l = [] lh_l = [] sh_l = [] for fu in range(self.n_ldst): @@ -87,6 +89,7 @@ class LDSTDepMatrix(Elaboratable): load_l.append(dc.load_h_i) stor_l.append(dc.stor_h_i) issue_l.append(dc.issue_i) + go_die_l.append(dc.go_die_i) # load-hit and store-with-data-hit go in vertically (top) m.d.comb += [dc.load_hit_i.eq(self.load_hit_i), @@ -97,6 +100,7 @@ class LDSTDepMatrix(Elaboratable): m.d.comb += [Cat(*load_l).eq(self.ld_pend_i), Cat(*stor_l).eq(self.st_pend_i), Cat(*issue_l).eq(self.issue_i), + Cat(*go_die_l).eq(self.go_die_i), ] # connect the load-hold-store / store-hold-load OR-accumulated outputs m.d.comb += self.ld_hold_st_o.eq(Cat(*lhs_l)) @@ -120,6 +124,7 @@ class LDSTDepMatrix(Elaboratable): yield self.ld_pend_i yield self.st_pend_i yield self.issue_i + yield self.go_die_i yield self.load_hit_i yield self.stwd_hit_i yield self.ld_hold_st_o diff --git a/src/scoreboard/mem_fu_matrix.py b/src/scoreboard/mem_fu_matrix.py index 83a6e219..dc88d358 100644 --- a/src/scoreboard/mem_fu_matrix.py +++ b/src/scoreboard/mem_fu_matrix.py @@ -23,8 +23,8 @@ class MemFUDepMatrix(Elaboratable): # Register "Global" vectors for determining RaW and WaR hazards self.ld_pend_i = Signal(n_reg_col, reset_less=True) # ld pending (top) self.st_pend_i = Signal(n_reg_col, reset_less=True) # st pending (top) - self.ld_rsel_o = Signal(n_reg_col, reset_less=True) # ld pending (bot) - self.st_rsel_o = Signal(n_reg_col, reset_less=True) # st pending (bot) + self.v_ld_rsel_o = Signal(n_reg_col, reset_less=True) # ld pending (bot) + self.v_st_rsel_o = Signal(n_reg_col, reset_less=True) # st pending (bot) self.issue_i = Signal(n_fu_row, reset_less=True) # Issue in (top) self.go_ld_i = Signal(n_fu_row, reset_less=True) # Go LOAD in (left) @@ -139,8 +139,8 @@ class MemFUDepMatrix(Elaboratable): m.submodules.st_v = st_v m.submodules.ld_v = ld_v - m.d.comb += self.st_rsel_o.eq(st_v.g_pend_o) - m.d.comb += self.ld_rsel_o.eq(ld_v.g_pend_o) + m.d.comb += self.v_st_rsel_o.eq(st_v.g_pend_o) + m.d.comb += self.v_ld_rsel_o.eq(ld_v.g_pend_o) # --- # connect Dep issue_i/go_st_i/go_ld_i to module issue_i/go_rd/go_wr diff --git a/src/scoreboard/test_mem_fu_matrix.py b/src/scoreboard/test_mem_fu_matrix.py new file mode 100644 index 00000000..43cdf07f --- /dev/null +++ b/src/scoreboard/test_mem_fu_matrix.py @@ -0,0 +1,652 @@ +from nmigen.compat.sim import run_simulation +from nmigen.cli import verilog, rtlil +from nmigen import Module, Const, Signal, Array, Cat, Elaboratable + +from regfile.regfile import RegFileArray, treereduce +from scoreboard.ldst_matrix import LDSTDepMatrix +from scoreboard.mem_fu_matrix import MemFUDepMatrix +from scoreboard.global_pending import GlobalPending +from scoreboard.group_picker import GroupPicker +from scoreboard.issue_unit import IssueUnitGroup, IssueUnitArray, RegDecode +from scoreboard.shadow import ShadowMatrix, BranchSpeculationRecord + +from nmutil.latch import SRLatch +from nmutil.nmoperator import eq + +from random import randint, seed +from copy import deepcopy +from math import log + + +class Memory(Elaboratable): + def __init__(self, regwid, addrw): + self.ddepth = regwid/8 + depth = (1<>self.ddepth] + + def st(self, addr, data): + self.mem[addr>>self.ddepth] = data & ((1<