From 350c35d49bc9b1a797ad545da03ad8549bad8724 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 3 Nov 2021 14:39:04 +0000 Subject: [PATCH] add name prefix to PrevControl and NextControl (useful for multi-fan-in/out) --- src/nmutil/iocontrol.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/nmutil/iocontrol.py b/src/nmutil/iocontrol.py index bcdb135..c4da57b 100644 --- a/src/nmutil/iocontrol.py +++ b/src/nmutil/iocontrol.py @@ -150,14 +150,20 @@ class PrevControl(Elaboratable): * i_data : an input - MUST be added by the USER of this class """ - def __init__(self, i_width=1, stage_ctl=False, maskwid=0, offs=0): + def __init__(self, i_width=1, stage_ctl=False, maskwid=0, offs=0, + name=None): + if name is None: + name = "" + n_piv = "p_i_valid"+name + n_por = "p_o_ready"+name + self.stage_ctl = stage_ctl self.maskwid = maskwid if maskwid: - self.mask_i = Signal(maskwid) # prev >>in self - self.stop_i = Signal(maskwid) # prev >>in self - self.i_valid = Signal(i_width, name="p_i_valid") # prev >>in self - self._o_ready = Signal(name="p_o_ready") # prev <>in self + self.stop_i = Signal(maskwid) # prev >>in self + self.i_valid = Signal(i_width, name=n_piv) # prev >>in self + self._o_ready = Signal(name=n_por) # prev <> next - self.stop_o = Signal(maskwid) # self out>> next - self.o_valid = Signal(name="n_o_valid") # self out>> next - self.i_ready = Signal(name="n_i_ready") # self <> next + self.stop_o = Signal(maskwid) # self out>> next + self.o_valid = Signal(name=n_nov) # self out>> next + self.i_ready = Signal(name=n_nir) # self <