move reading into constructor
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 2 Apr 2020 15:41:43 +0000 (16:41 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 2 Apr 2020 15:41:43 +0000 (16:41 +0100)
src/soc/decoder/pseudo/pagereader.py

index 0b3a3c368323a7fefdf0851cb4a7925181bdcc42..a95824811089848da555e0b2405989c58f523bad 100644 (file)
@@ -64,6 +64,10 @@ class ISA:
     def __init__(self):
         self.instr = OrderedDict()
         self.forms = {}
+        for pth in os.listdir(os.path.join(get_isa_dir())):
+            print (get_isa_dir(), pth)
+            assert pth.endswith(".mdwn"), "only %s in isa dir" % pth
+            self.read_file(pth)
 
     def read_file(self, fname):
         fname = os.path.join(get_isa_dir(), fname)
@@ -165,9 +169,4 @@ class ISA:
 
 if __name__ == '__main__':
     isa = ISA()
-    for pth in os.listdir(os.path.join(get_isa_dir())):
-        print (get_isa_dir(), pth)
-        assert pth.endswith(".mdwn"), "only %s in isa dir" % pth
-        isa.read_file(pth)
-
     isa.pprint_ops()