From c56a985ee89c38652a0ad38b94624bc6fc62840e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 15 Jul 2020 14:41:35 +0100 Subject: [PATCH] move FPPipeContext to concurrentunit: rename to PipeContext see https://bugs.libre-soc.org/show_bug.cgi?id=431 --- src/nmutil/concurrentunit.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/nmutil/concurrentunit.py b/src/nmutil/concurrentunit.py index 05dd2a6..7e89646 100644 --- a/src/nmutil/concurrentunit.py +++ b/src/nmutil/concurrentunit.py @@ -20,6 +20,29 @@ from nmutil.multipipe import PriorityCombMuxInPipe def num_bits(n): return int(log(n) / log(2)) +class PipeContext: + + def __init__(self, pspec): + """ creates a pipeline context. currently: operator (op) and muxid + + opkls (within pspec) - the class to create that will be the + "operator". instance must have an "eq" + function. + """ + self.id_wid = pspec.id_wid + self.op_wid = pspec.op_wid + self.muxid = Signal(self.id_wid, reset_less=True) # RS multiplex ID + opkls = pspec.opkls + if opkls is None: + self.op = Signal(self.op_wid, reset_less=True) + else: + self.op = opkls(pspec) + + def eq(self, i): + ret = [self.muxid.eq(i.muxid)] + ret.append(self.op.eq(i.op)) + return ret + class InMuxPipe(PriorityCombMuxInPipe): def __init__(self, num_rows, iospecfn, maskwid=0): -- 2.30.2