Mercurial > lcfOS
comparison python/msp430.py @ 199:a690473b79e2
Added msp430 target
author | Windel Bouwman |
---|---|
date | Fri, 07 Jun 2013 18:59:57 +0200 |
parents | |
children | 5e391d9a3381 |
comparison
equal
deleted
inserted
replaced
198:33d50727a23c | 199:a690473b79e2 |
---|---|
1 from target import Register, Instruction, Target | |
2 | |
3 # Target description for the MSP430 processor | |
4 | |
5 class MSP430Reg(Register): | |
6 def __init__(self, num, name): | |
7 super().__init__(name) | |
8 self.num = num | |
9 | |
10 # 8 bit variants: | |
11 PCB = MSP430Reg(0, 'r0') | |
12 R14B = MSP430Reg(14, 'r14') | |
13 R15B = MSP430Reg(15, 'r15') | |
14 | |
15 # .. etc | |
16 | |
17 #GR8 = RegisterClass((PCB, R15B)) | |
18 | |
19 class TwoOpArith(Instruction): | |
20 def __init__(self, opc, name): | |
21 super().__init__(opc) | |
22 self.name = name | |
23 | |
24 mov_ins = TwoOpArith(4, 'mov') | |
25 add_ins = TwoOpArith(5, 'add') | |
26 | |
27 class MSP430(Target): | |
28 def __init__(self): | |
29 self.registers = [PCB, R14B, R15B] | |
30 self.instructions = [mov_ins, add_ins] | |
31 | |
32 |