b1e3b0ba111b08eca8e0d5b17a172b0a8350041c
[ieee754fpu.git] / src / ieee754 / pipeline.py
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2 # See Notices.txt for copyright information
3
4 from nmutil.singlepipe import SimpleHandshake
5
6
7 class PipelineSpec:
8 """ Pipeline Specification base class.
9
10 :attribute width: the IEEE754 FP bitwidth
11 :attribute id_wid: the Reservation Station muxid bitwidth
12 :attribute op_wid: an "operand bitwidth" passed down all stages
13 :attribute opkls: an optional class that is instantiated as the "operand"
14
15 See ieee754/fpcommon/getop FPPipeContext for how (where) PipelineSpec
16 is used. FPPipeContext is passed down *every* stage of a pipeline
17 and contains the Reservation Station multiplexer ID as well as
18 an optional "operand". This "operand" may be used to *change*
19 the behaviour of the pipeline. In RISC-V terminology it would
20 typically be set to e.g. funct7 or parts thereof.
21
22 """
23
24 def __init__(self, width, id_width, op_wid=0, opkls=None, pipekls=None):
25 """ Create a PipelineSpec. """
26 self.width = width
27 self.id_wid = id_width
28 self.op_wid = op_wid
29 self.opkls = opkls
30 self.pipekls = pipekls or SimpleHandshake
31 self.core_config = None
32 self.fpformat = None
33 self.n_comb_stages = None
34
35
36 def DynamicPipeCreate(pspec, *args, **kwargs):
37 superclass = pspec.pipekls
38 class DynamicPipe(superclass):
39 def __init__(self, *args, **kwargs):
40 print(superclass)
41 superclass.__init__(self, *args, **kwargs)
42 pass
43 return DynamicPipe(*args, **kwargs)
44