From: Luke Kenneth Casson Leighton Date: Tue, 30 Jul 2019 15:07:08 +0000 (+0100) Subject: add DynamicPipeCreate function - needs to be a class X-Git-Tag: ls180-24jan2020~659 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e2db1ecc444223ff4d7094cb65613d8f9e795f0;p=ieee754fpu.git add DynamicPipeCreate function - needs to be a class --- diff --git a/src/ieee754/pipeline.py b/src/ieee754/pipeline.py index c547f36f..b1e3b0ba 100644 --- a/src/ieee754/pipeline.py +++ b/src/ieee754/pipeline.py @@ -1,6 +1,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later # See Notices.txt for copyright information +from nmutil.singlepipe import SimpleHandshake + class PipelineSpec: """ Pipeline Specification base class. @@ -19,12 +21,24 @@ class PipelineSpec: """ - def __init__(self, width, id_width, op_wid=0, opkls=None): + def __init__(self, width, id_width, op_wid=0, opkls=None, pipekls=None): """ Create a PipelineSpec. """ self.width = width self.id_wid = id_width self.op_wid = op_wid self.opkls = opkls + self.pipekls = pipekls or SimpleHandshake self.core_config = None self.fpformat = None self.n_comb_stages = None + + +def DynamicPipeCreate(pspec, *args, **kwargs): + superclass = pspec.pipekls + class DynamicPipe(superclass): + def __init__(self, *args, **kwargs): + print(superclass) + superclass.__init__(self, *args, **kwargs) + pass + return DynamicPipe(*args, **kwargs) +