connect read-enable and src_i to regfile ports
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 3 Jun 2020 22:00:05 +0000 (23:00 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 3 Jun 2020 22:00:05 +0000 (23:00 +0100)
src/soc/regfile/regfiles.py
src/soc/simple/core.py

index 4dfb522a2ebdaa19b77fbe57c3fc7133bdc182c1..895739a1390543bdfdb0736b06ecb71b5386c2b5 100644 (file)
@@ -135,7 +135,7 @@ class RegFiles:
         for (name, kls) in [('int', IntRegs),
                             ('cr', CRRegs),
                             ('xer', XERRegs),
-                            ('fasr', FastRegs),
+                            ('fast', FastRegs),
                             ('spr', SPRRegs),]:
             rf = self.rf[name] = kls()
             setattr(self, name, rf)
index a8b3b33ef1178fa9bd7d2b68ea042941105a76ce..ff7f9277b683ec28edd35a0f98ed84edbf65b803 100644 (file)
@@ -8,6 +8,7 @@ from nmigen import Elaboratable, Module, Signal
 from nmigen.cli import rtlil
 
 from nmutil.picker import PriorityPicker
+from nmutil.util import treereduce
 
 from soc.fu.compunits.compunits import AllFunctionUnits
 from soc.regfile.regfiles import RegFiles
@@ -15,6 +16,11 @@ from soc.decoder.power_decoder import create_pdecode
 from soc.decoder.power_decoder2 import PowerDecode2
 
 
+
+def ortreereduce(tree, attr="data_o"):
+    return treereduce(tree, operator.or_, lambda x: getattr(x, attr))
+
+
 class NonProductionCore(Elaboratable):
     def __init__(self):
         self.fus = AllFunctionUnits()
@@ -73,14 +79,27 @@ class NonProductionCore(Elaboratable):
         rdpickers = {}
         for regfile, spec in byregfiles_rd.items():
             rdpickers[regfile] = {}
-            for idx, fuspec in spec.items():
+            for rpidx, (idx, fuspec) in enumerate(spec.items()):
+                # select the required read port.  these are pre-defined sizes
+                print (regfile, regs.rf.keys())
+                rport = regs.rf[regfile.lower()].r_ports[rpidx]
+
+                # create a priority picker to manage this port
                 rdpickers[regfile][idx] = rdpick = PriorityPicker(len(fuspec))
                 setattr(m.submodules, "rdpick_%s_%d" % (regfile, idx), rdpick)
+
+                # connect the regspec "reg select" number to this port
+                (regname, rdflag, read, wid) = byregfiles_rdspec[regfile]
+                comb += rport.ren.eq(read)
+
+                # connect up the FU req/go signals and the reg-read to the FU
                 for pi, (funame, fu) in enumerate(fuspec):
                     # connect request-read to picker input, and output to go-rd
                     fu_active = fu_bitdict[funame]
                     comb += rdpick.i[pi].eq(fu.rd_rel_o[idx] & fu_active)
                     comb += fu.go_rd_i[idx].eq(rdpick.o[pi])
+                    # connect regfile port to input
+                    comb += fu.src_i[idx].eq(rport.data_o)
 
         return m