From 0d6210336e58f8e11e632374a53f0001338280c6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 25 Jul 2020 15:33:38 +0100 Subject: [PATCH] wait until pipeline indicates that its output is valid in compunit test DIV and other long pipelines only set wrmask when a result is available the previous test, "is wrmask zero if so exit" was therefore reading invalid data. it was a matter of coincidence that all other compunit tests were only one stage long that the wrmask *happened* to be valid --- src/soc/fu/compunits/test/test_compunit.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/soc/fu/compunits/test/test_compunit.py b/src/soc/fu/compunits/test/test_compunit.py index 09c1beee..9ac469f4 100644 --- a/src/soc/fu/compunits/test/test_compunit.py +++ b/src/soc/fu/compunits/test/test_compunit.py @@ -80,6 +80,13 @@ def set_operand(cu, dec2, sim): def get_cu_outputs(cu, code): res = {} + # wait for pipeline to indicate valid. this because for long + # pipelines (or FSMs) the write mask is only valid at that time. + while True: + valid_o = yield cu.alu.n.valid_o + if valid_o: + break + yield wrmask = yield cu.wrmask wr_rel_o = yield cu.wr.rel print("get_cu_outputs", cu.n_dst, wrmask, wr_rel_o) -- 2.30.2