arch: Make and use endian specific versions of the mem helpers.
[gem5.git] / src / arch / micro_asm_test.py
index 4a643565ce99e92fa61386c0d80de60f8f215c0a..e5755f717a4a3e796d74bcaf012672ea0be00ac7 100755 (executable)
@@ -26,7 +26,9 @@
 #
 # Authors: Gabe Black
 
-from micro_asm import MicroAssembler, Macroop, Rom
+from __future__ import print_function
+
+from micro_asm import MicroAssembler, Combinational_Macroop, Rom_Macroop, Rom
 
 class Bah(object):
     def __init__(self):
@@ -52,40 +54,56 @@ microops = {
     "dah": Dah
 }
 
-class TestMacroop(Macroop):
+class TestMacroop(Combinational_Macroop):
     def tweak(self):
         microops["bah"] = Bah_Tweaked
     def untweak(self):
         microops["bah"] = Bah
+    def print_debug(self, message):
+        print(message)
 
     def __init__(self, name):
         super(TestMacroop, self).__init__(name)
         self.directives = {
             "tweak": self.tweak,
-            "untweak": self.untweak
+            "untweak": self.untweak,
+            "print": self.print_debug
         }
 
-assembler = MicroAssembler(TestMacroop, microops, Rom('main ROM'))
+assembler = MicroAssembler(TestMacroop, microops, Rom('main ROM'), Rom_Macroop)
 
 testAssembly = '''
+# Single line comment
+
 def rom {
     goo: bah
     extern la: hoop 4*8, "a"
-};
+}; /* multiline comment on one line */
+
+/* multi line comment across lines
+   to make sure they work */
 
 def macroop squishy {
     .tweak
     bah
     .untweak
+    .print "In the midst"
     bah
-    dah
+    dah # single line comment after something
     .tweak
 };
 
+#Extending the rom...
+def rom
+{
+    #Here's more stuff for the rom
+    bah
+};
+
 def macroop squashy {
     bah
 };
 
-def macroop (bar);
+def macroop jumper (bar);
 '''
 assembler.assemble(testAssembly)