Move the reset code outside of the sub-test
authorCesar Strauss <cestrauss@gmail.com>
Sat, 22 May 2021 20:31:00 +0000 (17:31 -0300)
committerCesar Strauss <cestrauss@gmail.com>
Sat, 22 May 2021 20:31:00 +0000 (17:31 -0300)
Even if a sub-test fails, the core still needs to be reset.
This code does not check any assertions, so it's safe to move it outside.

src/soc/simple/test/test_runner.py

index 7db90efdfac5ca33ac959a07a34990eb1df3f6c5..cb4ca4589719d3fb09a214dd2e1cc15711f0c4cd 100644 (file)
@@ -306,30 +306,30 @@ class TestRunner(FHDLTestCase):
                         if terminated:
                             break
 
-                    # stop at end
-                    yield from set_dmi(dmi, DBGCore.CTRL, 1<<DBGCtrl.STOP)
-                    yield
-                    yield
+                # stop at end
+                yield from set_dmi(dmi, DBGCore.CTRL, 1<<DBGCtrl.STOP)
+                yield
+                yield
 
-                    # get CR
-                    cr = yield from get_dmi(dmi, DBGCore.CR)
-                    print("after test %s cr value %x" % (test.name, cr))
+                # get CR
+                cr = yield from get_dmi(dmi, DBGCore.CR)
+                print("after test %s cr value %x" % (test.name, cr))
 
-                    # get XER
-                    xer = yield from get_dmi(dmi, DBGCore.XER)
-                    print("after test %s XER value %x" % (test.name, xer))
+                # get XER
+                xer = yield from get_dmi(dmi, DBGCore.XER)
+                print("after test %s XER value %x" % (test.name, xer))
 
-                    # test of dmi reg get
-                    for int_reg in range(32):
-                        yield from set_dmi(dmi, DBGCore.GSPR_IDX, int_reg)
-                        value = yield from get_dmi(dmi, DBGCore.GSPR_DATA)
+                # test of dmi reg get
+                for int_reg in range(32):
+                    yield from set_dmi(dmi, DBGCore.GSPR_IDX, int_reg)
+                    value = yield from get_dmi(dmi, DBGCore.GSPR_DATA)
 
-                        print("after test %s reg %2d value %x" %
-                              (test.name, int_reg, value))
+                    print("after test %s reg %2d value %x" %
+                          (test.name, int_reg, value))
 
-                    # pull a reset
-                    yield from set_dmi(dmi, DBGCore.CTRL, 1<<DBGCtrl.RESET)
-                    yield
+                # pull a reset
+                yield from set_dmi(dmi, DBGCore.CTRL, 1<<DBGCtrl.RESET)
+                yield
 
         styles = {
             'dec': {'base': 'dec'},