diff python/msp430.py @ 199:a690473b79e2

Added msp430 target
author Windel Bouwman
date Fri, 07 Jun 2013 18:59:57 +0200
parents
children 5e391d9a3381
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/msp430.py	Fri Jun 07 18:59:57 2013 +0200
@@ -0,0 +1,32 @@
+from target import Register, Instruction, Target
+
+# Target description for the MSP430 processor
+
+class MSP430Reg(Register):
+    def __init__(self, num, name):
+        super().__init__(name)
+        self.num = num
+
+# 8 bit variants:
+PCB = MSP430Reg(0, 'r0')
+R14B = MSP430Reg(14, 'r14')
+R15B = MSP430Reg(15, 'r15')
+
+# .. etc
+
+#GR8 = RegisterClass((PCB, R15B))
+
+class TwoOpArith(Instruction):
+    def __init__(self, opc, name):
+        super().__init__(opc)
+        self.name = name
+
+mov_ins = TwoOpArith(4, 'mov')
+add_ins = TwoOpArith(5, 'add')
+
+class MSP430(Target):
+    def __init__(self):
+        self.registers = [PCB, R14B, R15B]
+        self.instructions = [mov_ins, add_ins]
+
+