From 1464aba03659adec485de985b4b3ebcfc02ba487 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 2 Jul 2019 10:06:29 +0100 Subject: [PATCH] big convert g/s/r mid --> muxid --- src/ieee754/add/inputgroup.py | 6 +-- src/ieee754/add/test_inputgroup.py | 40 ++++++++-------- src/ieee754/fpadd/add0.py | 2 +- src/ieee754/fpadd/align.py | 2 +- src/ieee754/fpadd/statemachine.py | 6 +-- src/ieee754/fpcommon/denorm.py | 2 +- src/ieee754/fpcommon/getop.py | 14 +++--- src/ieee754/fpcommon/pack.py | 2 +- src/ieee754/fpcommon/postcalc.py | 2 +- src/ieee754/fpcommon/postnormalise.py | 2 +- src/ieee754/fpcommon/roundz.py | 2 +- src/ieee754/fpcommon/test/fpmux.py | 43 ++++++++--------- src/ieee754/fpdiv/div0.py | 2 +- src/ieee754/fpmul/mul0.py | 2 +- src/nmutil/multipipe.py | 16 +++---- src/nmutil/test/test_inout_mux_pipe.py | 60 ++++++++++++------------ src/nmutil/test/test_outmux_pipe.py | 32 ++++++------- src/nmutil/test/test_prioritymux_pipe.py | 54 ++++++++++----------- 18 files changed, 145 insertions(+), 144 deletions(-) diff --git a/src/ieee754/add/inputgroup.py b/src/ieee754/add/inputgroup.py index 9322c8a1..6069817e 100644 --- a/src/ieee754/add/inputgroup.py +++ b/src/ieee754/add/inputgroup.py @@ -63,7 +63,7 @@ class InputGroup: self.num_rows = num_rows self.mmax = int(log(self.num_rows) / log(2)) self.rs = [] - self.mid = Signal(self.mmax, reset_less=True) # multiplex id + self.muxid = Signal(self.mmax, reset_less=True) # multiplex id for i in range(num_rows): self.rs.append(FPGetSyncOpsMod(width, num_ops)) self.rs = Array(self.rs) @@ -92,7 +92,7 @@ class InputGroup: # encoder active: ack relevant input, record MID, pass output with m.If(out_en): rs = self.rs[pe.o] - m.d.sync += self.mid.eq(pe.o) + m.d.sync += self.muxid.eq(pe.o) m.d.sync += rs.ack.eq(0) m.d.sync += self.out_op.stb.eq(0) for j in range(self.num_ops): @@ -110,6 +110,6 @@ class InputGroup: for i in range(self.num_rows): inop = self.rs[i] res += inop.in_op + [inop.stb] - return self.out_op.ports() + res + [self.mid] + return self.out_op.ports() + res + [self.muxid] diff --git a/src/ieee754/add/test_inputgroup.py b/src/ieee754/add/test_inputgroup.py index 09a72e17..96de216f 100644 --- a/src/ieee754/add/test_inputgroup.py +++ b/src/ieee754/add/test_inputgroup.py @@ -43,8 +43,8 @@ def testbench(dut): # output strobe should be active, MID should be 0 until "ack" is set... out_stb = yield dut.out_op.stb assert out_stb == 1 - out_mid = yield dut.mid - assert out_mid == 0 + out_muxid = yield dut.muxid + assert out_muxid == 0 # ... and output should not yet be passed through either op0 = yield dut.out_op.v[0] @@ -72,8 +72,8 @@ def testbench(dut): op0 = yield dut.out_op.v[0] op1 = yield dut.out_op.v[1] assert op0 == 3 and op1 == 4, "op0 %d op1 %d" % (op0, op1) - out_mid = yield dut.mid - assert out_mid == 2 + out_muxid = yield dut.muxid + assert out_muxid == 2 # set row 0 and 3 input yield dut.rs[0].in_op[0].eq(9) @@ -88,15 +88,15 @@ def testbench(dut): yield yield dut.rs[0].stb.eq(0) # clear row 1 strobe yield - out_mid = yield dut.mid - assert out_mid == 0, "out mid %d" % out_mid + out_muxid = yield dut.muxid + assert out_muxid == 0, "out muxid %d" % out_muxid yield yield dut.rs[3].stb.eq(0) # clear row 1 strobe yield dut.out_op.ack.eq(0) # clear ack on output yield - out_mid = yield dut.mid - assert out_mid == 3, "out mid %d" % out_mid + out_muxid = yield dut.muxid + assert out_muxid == 3, "out muxid %d" % out_muxid class InputTest: @@ -105,17 +105,17 @@ class InputTest: self.di = {} self.do = {} self.tlen = 10 - for mid in range(dut.num_rows): - self.di[mid] = {} - self.do[mid] = {} + for muxid in range(dut.num_rows): + self.di[muxid] = {} + self.do[muxid] = {} for i in range(self.tlen): - self.di[mid][i] = randint(0, 100) - self.do[mid][i] = self.di[mid][i] + self.di[muxid][i] = randint(0, 100) + self.do[muxid][i] = self.di[muxid][i] - def send(self, mid): + def send(self, muxid): for i in range(self.tlen): - op2 = self.di[mid][i] - rs = dut.rs[mid] + op2 = self.di[muxid][i] + rs = dut.rs[muxid] ack = yield rs.ack while not ack: yield @@ -146,14 +146,14 @@ class InputTest: while stb: yield stb = yield dut.out_op.stb - mid = yield dut.mid + muxid = yield dut.muxid out_i = yield dut.out_op.v[0] out_v = yield dut.out_op.v[1] # see if this output has occurred already, delete it if it has - assert out_i in self.do[mid] - assert self.do[mid][out_i] == out_v - del self.do[mid][out_i] + assert out_i in self.do[muxid] + assert self.do[muxid][out_i] == out_v + del self.do[muxid][out_i] # check if there's any more outputs zerolen = True diff --git a/src/ieee754/fpadd/add0.py b/src/ieee754/fpadd/add0.py index b487b0dd..d5336b3c 100644 --- a/src/ieee754/fpadd/add0.py +++ b/src/ieee754/fpadd/add0.py @@ -19,7 +19,7 @@ class FPAddStage0Data: self.oz = Signal(width, reset_less=True) self.tot = Signal(self.z.m_width + 4, reset_less=True) self.ctx = FPBaseData(width, pspec) - self.mid = self.ctx.mid + self.muxid = self.ctx.muxid def eq(self, i): return [self.z.eq(i.z), self.out_do_z.eq(i.out_do_z), self.oz.eq(i.oz), diff --git a/src/ieee754/fpadd/align.py b/src/ieee754/fpadd/align.py index 171365ef..b357e309 100644 --- a/src/ieee754/fpadd/align.py +++ b/src/ieee754/fpadd/align.py @@ -22,7 +22,7 @@ class FPNumIn2Ops: self.out_do_z = Signal(reset_less=True) self.oz = Signal(width, reset_less=True) self.ctx = FPBaseData(width, pspec) - self.mid = self.ctx.mid + self.muxid = self.ctx.muxid def eq(self, i): return [self.z.eq(i.z), self.out_do_z.eq(i.out_do_z), self.oz.eq(i.oz), diff --git a/src/ieee754/fpadd/statemachine.py b/src/ieee754/fpadd/statemachine.py index 0ca7ce7a..decbc3d4 100644 --- a/src/ieee754/fpadd/statemachine.py +++ b/src/ieee754/fpadd/statemachine.py @@ -33,14 +33,14 @@ class FPOpData: def __init__(self, width, id_wid): self.z = FPOpOut(width) self.z.data_o = Signal(width) - self.mid = Signal(id_wid, reset_less=True) + self.muxid = Signal(id_wid, reset_less=True) def __iter__(self): yield self.z - yield self.mid + yield self.muxid def eq(self, i): - return [self.z.eq(i.z), self.mid.eq(i.mid)] + return [self.z.eq(i.z), self.muxid.eq(i.mid)] def ports(self): return list(self) diff --git a/src/ieee754/fpcommon/denorm.py b/src/ieee754/fpcommon/denorm.py index f6b26c2a..5c20e535 100644 --- a/src/ieee754/fpcommon/denorm.py +++ b/src/ieee754/fpcommon/denorm.py @@ -25,7 +25,7 @@ class FPSCData: self.oz = Signal(width, reset_less=True) # "finished" (bypass) result self.out_do_z = Signal(reset_less=True) # "bypass" enabled self.ctx = FPBaseData(width, pspec) - self.mid = self.ctx.mid + self.muxid = self.ctx.muxid def __iter__(self): yield from self.a diff --git a/src/ieee754/fpcommon/getop.py b/src/ieee754/fpcommon/getop.py index 17a8334b..5ca46bfd 100644 --- a/src/ieee754/fpcommon/getop.py +++ b/src/ieee754/fpcommon/getop.py @@ -73,13 +73,13 @@ class FPNumBase2Ops: def __init__(self, width, id_wid, m_extra=True): self.a = FPNumBase(width, m_extra) self.b = FPNumBase(width, m_extra) - self.mid = Signal(id_wid, reset_less=True) + self.muxid = Signal(id_wid, reset_less=True) def eq(self, i): - return [self.a.eq(i.a), self.b.eq(i.b), self.mid.eq(i.mid)] + return [self.a.eq(i.a), self.b.eq(i.b), self.muxid.eq(i.muxid)] def ports(self): - return [self.a, self.b, self.mid] + return [self.a, self.b, self.muxid] class FPBaseData: @@ -89,17 +89,17 @@ class FPBaseData: print (pspec) self.id_wid = pspec['id_wid'] self.op_wid = pspec.get('op_wid', 0) - self.mid = Signal(self.id_wid, reset_less=True) # RS multiplex ID + self.muxid = Signal(self.id_wid, reset_less=True) # RS multiplex ID self.op = Signal(self.op_wid, reset_less=True) def eq(self, i): - ret = [self.mid.eq(i.mid)] + ret = [self.muxid.eq(i.muxid)] if self.op_wid: ret.append(self.op.eq(i.op)) return ret def __iter__(self): - yield self.mid + yield self.muxid if self.op_wid: yield self.op @@ -118,7 +118,7 @@ class FPADDBaseData: operand = Signal(width, name=name) setattr(self, name, operand) ops.append(operand) - self.mid = self.ctx.mid # make muxid available here: complicated + self.muxid = self.ctx.muxid # make muxid available here: complicated self.ops = ops def eq(self, i): diff --git a/src/ieee754/fpcommon/pack.py b/src/ieee754/fpcommon/pack.py index 5df5ea7c..37ab1eca 100644 --- a/src/ieee754/fpcommon/pack.py +++ b/src/ieee754/fpcommon/pack.py @@ -18,7 +18,7 @@ class FPPackData(Object): Object.__init__(self) self.z = Signal(width, reset_less=True) # result self.ctx = FPBaseData(width, pspec) - self.mid = self.ctx.mid + self.muxid = self.ctx.muxid class FPPackMod(Elaboratable): diff --git a/src/ieee754/fpcommon/postcalc.py b/src/ieee754/fpcommon/postcalc.py index b815f8cf..24475d38 100644 --- a/src/ieee754/fpcommon/postcalc.py +++ b/src/ieee754/fpcommon/postcalc.py @@ -14,7 +14,7 @@ class FPAddStage1Data: self.oz = Signal(width, reset_less=True) self.of = Overflow() self.ctx = FPBaseData(width, pspec) - self.mid = self.ctx.mid + self.muxid = self.ctx.muxid def __iter__(self): yield from self.z diff --git a/src/ieee754/fpcommon/postnormalise.py b/src/ieee754/fpcommon/postnormalise.py index 0f593865..ce7aad16 100644 --- a/src/ieee754/fpcommon/postnormalise.py +++ b/src/ieee754/fpcommon/postnormalise.py @@ -22,7 +22,7 @@ class FPNorm1Data: self.out_do_z = Signal(reset_less=True) self.oz = Signal(width, reset_less=True) self.ctx = FPBaseData(width, pspec) - self.mid = self.ctx.mid + self.muxid = self.ctx.muxid def eq(self, i): ret = [self.z.eq(i.z), self.out_do_z.eq(i.out_do_z), self.oz.eq(i.oz), diff --git a/src/ieee754/fpcommon/roundz.py b/src/ieee754/fpcommon/roundz.py index a0b56868..ceec0c46 100644 --- a/src/ieee754/fpcommon/roundz.py +++ b/src/ieee754/fpcommon/roundz.py @@ -16,7 +16,7 @@ class FPRoundData: def __init__(self, width, pspec): self.z = FPNumBaseRecord(width, False) self.ctx = FPBaseData(width, pspec) - self.mid = self.ctx.mid + self.muxid = self.ctx.muxid # pipeline bypass [data comes from specialcases] self.out_do_z = Signal(reset_less=True) self.oz = Signal(width, reset_less=True) diff --git a/src/ieee754/fpcommon/test/fpmux.py b/src/ieee754/fpcommon/test/fpmux.py index 01832ec4..239c822d 100644 --- a/src/ieee754/fpcommon/test/fpmux.py +++ b/src/ieee754/fpcommon/test/fpmux.py @@ -19,9 +19,9 @@ class InputTest: self.do = {} self.tlen = 10 self.width = width - for mid in range(dut.num_rows): - self.di[mid] = {} - self.do[mid] = [] + for muxid in range(dut.num_rows): + self.di[muxid] = {} + self.do[muxid] = [] for i in range(self.tlen): op1 = randint(0, (1<