From: Luke Kenneth Casson Leighton Date: Sat, 25 Jul 2020 14:33:38 +0000 (+0100) Subject: wait until pipeline indicates that its output is valid in compunit test X-Git-Tag: semi_working_ecp5~549 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0d6210336e58f8e11e632374a53f0001338280c6;p=soc.git 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 --- 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)