Mercurial > lcfOS
comparison python/cortexm3.py @ 279:2ccd57b1d78c
Fix register allocator to do burn2 OK
author | Windel Bouwman |
---|---|
date | Sat, 12 Oct 2013 09:56:23 +0200 |
parents | 046017431c6a |
children | 02385f62f250 |
comparison
equal
deleted
inserted
replaced
278:9fca39eebe50 | 279:2ccd57b1d78c |
---|---|
216 return u32(self.expr) | 216 return u32(self.expr) |
217 | 217 |
218 def __repr__(self): | 218 def __repr__(self): |
219 return 'DCD 0x{0:X}'.format(self.expr) | 219 return 'DCD 0x{0:X}'.format(self.expr) |
220 | 220 |
221 @armtarget.instruction | |
222 class nop_ins(ArmInstruction): | |
223 mnemonic = 'nop' | |
224 operands = tuple() | |
225 | |
226 def encode(self): | |
227 return bytes() | |
228 | |
229 def __repr__(self): | |
230 return 'NOP' | |
221 | 231 |
222 | 232 |
223 # Memory related | 233 # Memory related |
224 | 234 |
225 class LS_imm5_base(ArmInstruction): | 235 class LS_imm5_base(ArmInstruction): |
297 self.offset = 0 | 307 self.offset = 0 |
298 | 308 |
299 def encode(self): | 309 def encode(self): |
300 rt = self.rt.num | 310 rt = self.rt.num |
301 assert rt < 8 | 311 assert rt < 8 |
312 assert self.offset % 4 == 0 | |
302 imm8 = self.offset >> 2 | 313 imm8 = self.offset >> 2 |
303 assert imm8 < 256 | 314 assert imm8 < 256 |
304 assert imm8 >= 0 | 315 assert imm8 >= 0 |
305 h = (0x9 << 11) | (rt << 8) | imm8 | 316 h = (0x9 << 11) | (rt << 8) | imm8 |
306 return u16(h) | 317 return u16(h) |
432 | 443 |
433 @armtarget.instruction | 444 @armtarget.instruction |
434 class mulregreg_ins(ArmInstruction): | 445 class mulregreg_ins(ArmInstruction): |
435 """ mul Rn, Rdm """ | 446 """ mul Rn, Rdm """ |
436 operands = (Reg8Op, Reg8Op) | 447 operands = (Reg8Op, Reg8Op) |
437 mnemonic = 'mul' | 448 mnemonic = 'MUL' |
438 def __init__(self, rn, rdm): | 449 def __init__(self, rn, rdm): |
439 self.rn = rn | 450 self.rn = rn |
440 self.rdm = rdm | 451 self.rdm = rdm |
441 | 452 |
442 def encode(self): | 453 def encode(self): |