diff python/ppci/target/arm/__init__.py @ 352:899ae3aea803

First kernel run for vexpressA9
author Windel Bouwman
date Sun, 09 Mar 2014 11:55:55 +0100
parents 2b02bd286fe9
children 5477e499b039
line wrap: on
line diff
--- a/python/ppci/target/arm/__init__.py	Sat Mar 08 16:46:51 2014 +0100
+++ b/python/ppci/target/arm/__init__.py	Sun Mar 09 11:55:55 2014 +0100
@@ -4,8 +4,8 @@
 from ..arm.registers import R8, R9, R10, R11, R12, SP, LR, PC
 from ..arm.registers import register_range
 
-from .instructions import Dcd, Mov, Add, Sub, Orr1, Mul, Mov2
-from .instructions import B, Bl, Ble, Bgt, Beq, Blt
+from .instructions import Dcd, Mov, Add, Sub, Orr1, Mul, Mov2, Add1
+from .instructions import B, Bl, Ble, Bgt, Beq, Blt, Cmp, Cmp2
 from .instructions import Push, Pop, Str, Ldr, Ldr3, Str1, Ldr1
 from .selector import ArmInstructionSelector
 from .frame import ArmFrame
@@ -21,6 +21,8 @@
         self.add_lowering(Str1, lambda im: Str1(im.src[1], im.src[0], im.others[0]))
         self.add_lowering(Ldr1, lambda im: Ldr1(im.dst[0], im.src[0], im.others[0]))
         self.add_lowering(Mov2, lambda im: Mov2(im.dst[0], im.src[0]))
+        self.add_lowering(Cmp2, lambda im: Cmp2(im.src[0], im.src[1]))
+        self.add_lowering(Add1, lambda im: Add1(im.dst[0], im.src[0], im.src[1]))
 
     def make_parser(self):
         # Assembly grammar:
@@ -66,6 +68,13 @@
         self.add_instruction(['mov', 'reg', ',', 'imm32'],
                 lambda rhs: Mov(rhs[1], rhs[3]))
 
+        self.add_keyword('cmp')
+        self.add_instruction(['cmp', 'reg', ',', 'imm32'],
+                lambda rhs: Cmp(rhs[1], rhs[3]))
+        self.add_instruction(['cmp', 'reg', ',', 'reg'],
+                lambda rhs: Cmp(rhs[1], rhs[3]))
+
+        # Arithmatic:
         self.add_keyword('add')
         self.add_instruction(['add', 'reg', ',', 'reg', ',', 'imm32'],
                 lambda rhs: Add(rhs[1], rhs[3], rhs[5]))