From 2e2db1ecc444223ff4d7094cb65613d8f9e795f0 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 30 Jul 2019 16:07:08 +0100 Subject: [PATCH] add DynamicPipeCreate function - needs to be a class --- src/ieee754/pipeline.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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) + -- 2.30.2