From c5fb1df9409ba4038a1429cec96e67b2daa74368 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 3 May 2019 07:36:28 +0100 Subject: [PATCH] split out InputTest code into separate fpmux.py --- src/ieee754/fpcommon/test/fpmux.py | 128 ++++++++++++++++++++++ src/ieee754/fpmul/test/test_fpmul_pipe.py | 19 ++++ 2 files changed, 147 insertions(+) create mode 100644 src/ieee754/fpcommon/test/fpmux.py create mode 100644 src/ieee754/fpmul/test/test_fpmul_pipe.py diff --git a/src/ieee754/fpcommon/test/fpmux.py b/src/ieee754/fpcommon/test/fpmux.py new file mode 100644 index 00000000..01832ec4 --- /dev/null +++ b/src/ieee754/fpcommon/test/fpmux.py @@ -0,0 +1,128 @@ +""" key strategic example showing how to do multi-input fan-in into a + multi-stage pipeline, then multi-output fanout. + + the multiplex ID from the fan-in is passed in to the pipeline, preserved, + and used as a routing ID on the fanout. +""" + +from random import randint +from nmigen.compat.sim import run_simulation +from nmigen.cli import verilog, rtlil + + +class InputTest: + def __init__(self, dut, width, fpkls, fpop): + self.dut = dut + self.fpkls = fpkls + self.fpop = fpop + self.di = {} + self.do = {} + self.tlen = 10 + self.width = width + for mid in range(dut.num_rows): + self.di[mid] = {} + self.do[mid] = [] + for i in range(self.tlen): + op1 = randint(0, (1<