+++ /dev/null
-###################################################################
-"""Function Units Construction
-
-This module pulls all of the pipelines together (soc.fu.*) and, using
-the regspec and Computation Unit APIs, constructs Scoreboard-aware
-Function Units that may systematically and automatically be wired up
-to appropriate Register Files.
-
-Two types exist:
-
-* Single-cycle Function Units. these are FUs that will only block for
- one cycle. it is expected that multiple of these be instantiated,
- because they are simple and trivial, and not many gates.
-
- - ALU, Logical: definitely several
- - CR: not so many needed (perhaps)
- - Branch: one or two of these (depending on speculation run-ahead)
- - Trap: yeah really only one of these
- - ShiftRot (perhaps not too many of these)
-
-* Multi-cycle (and FSM) Function Units. these are FUs that can only
- handle a limited number of values, and take several cycles to complete.
- Given that under Scoreboard Management, start and completion must be
- fully managed, a "Reservation Station" style approach is required:
- *one* multiple-stage (N stage) pipelines need a minimum of N (plural)
- "CompUnit" front-ends. this includes:
-
- - MUL (all versions including MAC)
- - DIV (including modulo)
-
-In either case, there will be multiple MultiCompUnits: it's just that
-single-cycle ones are instantiated individually (one single-cycle pipeline
-per MultiCompUnit, and multi-cycle ones need to be instantiated en-masse,
-where *only one* actual pipeline (or FSM) has *multiple* Reservation
-Stations.
-
-see:
-
-* https://libre-soc.org/3d_gpu/architecture/regfile/ section on regspecs
-
-"""
-
-from nmigen.cli import rtlil
-from soc.experiment.compalu_multi import MultiCompUnit
-
-# pipeline / spec imports
-
-from soc.fu.alu.pipeline import ALUBasePipe
-from soc.fu.alu.pipe_data import ALUPipeSpec
-
-from soc.fu.cr.pipeline import CRBasePipe
-from soc.fu.cr.pipe_data import CRPipeSpec
-
-from soc.fu.branch.pipeline import BranchBasePipe
-from soc.fu.branch.pipe_data import BranchPipeSpec
-
-from soc.fu.shift_rot.pipeline import ShiftRotBasePipe
-from soc.fu.shift_rot.pipe_data import ShiftRotPipeSpec
-
-
-###################################################################
-###### FunctionUnitBaseSingle - use to make single-stge pipes #####
-
-class FunctionUnitBaseSingle(MultiCompUnit):
- """FunctionUnitBaseSingle
-
- main "glue" class that brings everything together.
- ONLY use this class for single-stage pipelines.
-
- * :speckls: - the specification. contains regspec and op subset info,
- and contains common "stuff" like the pipeline ctx,
- what type of nmutil pipeline base is to be used (etc)
- * :pipekls: - the type of pipeline. actually connects things together
-
- note that it is through MultiCompUnit.get_in/out that we *actually*
- connect up the association between regspec variable names (defined
- in the pipe_data).
- """
- def __init__(self, speckls, pipekls):
- pspec = speckls(id_wid=2) # spec (NNNPipeSpec instance)
- opsubset = pspec.opsubsetkls # get the operand subset class
- regspec = pspec.regspec # get the regspec
- alu = pipekls(pspec) # create actual NNNBasePipe
- super().__init__(regspec, alu, opsubset) # pass to MultiCompUnit
-
-
-##############################################################
-# TODO: ReservationStations-based (FunctionUnitBaseConcurrent)
-
-class FunctionUnitBaseMulti:
- pass
-
-
-######################################################################
-###### actual Function Units: these are "single" stage pipelines #####
-
-class ALUFunctionUnit(FunctionUnitBaseSingle):
- def __init__(self): super().__init__(ALUPipeSpec, ALUBasePipe)
-
-class CRFunctionUnit(FunctionUnitBaseSingle):
- def __init__(self): super().__init__(CRPipeSpec, CRBasePipe)
-
-class BranchFunctionUnit(FunctionUnitBaseSingle):
- def __init__(self): super().__init__(BranchPipeSpec, BranchBasePipe)
-
-class ShiftRotFunctionUnit(FunctionUnitBaseSingle):
- def __init__(self): super().__init__(ShiftRotPipeSpec, ShiftRotBasePipe)
-
-#####################################################################
-###### actual Function Units: these are "multi" stage pipelines #####
-
-# TODO: ReservationStations-based.
-
-
-def tst_single_fus_il():
- for (name, kls) in (('alu', ALUFunctionUnit),
- ('cr', CRFunctionUnit),
- ('branch', BranchFunctionUnit),
- ('shiftrot', ShiftRotFunctionUnit)):
- fu = kls()
- vl = rtlil.convert(fu, ports=fu.ports())
- with open("fu_%s.il" % name, "w") as f:
- f.write(vl)
-
-if __name__ == '__main__':
- tst_single_fus_il()