From ddbe856d8820a8a56a5e46d43ebd726a155da0ae Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 18 Jun 2020 10:50:47 +0100 Subject: [PATCH] use while / exception in test_compunit loop --- src/soc/fu/compunits/test/test_compunit.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/soc/fu/compunits/test/test_compunit.py b/src/soc/fu/compunits/test/test_compunit.py index 705b18dc..efc8e9d5 100644 --- a/src/soc/fu/compunits/test/test_compunit.py +++ b/src/soc/fu/compunits/test/test_compunit.py @@ -195,11 +195,14 @@ class TestRunner(FHDLTestCase): yield from setup_test_memory(l0, sim) index = sim.pc.CIA.value//4 - while index < len(instructions): - ins, code = instructions[index] - yield from sim.setup_one() + while True: + try: + yield from sim.setup_one() + except KeyError: # indicates instruction not in imem: stop + break yield Settle() - print(code) + ins, code = instructions[index] + print(index, code) # ask the decoder to decode this binary data (endian'd) yield pdecode2.dec.bigendian.eq(0) # little / big? @@ -246,9 +249,9 @@ class TestRunner(FHDLTestCase): # call simulated operation yield from sim.execute_one() + yield Settle() index = sim.pc.CIA.value//4 - yield Settle() # get all outputs (one by one, just "because") res = yield from get_cu_outputs(cu, code) wrmask = yield cu.wrmask -- 2.30.2