comparison test/testarmasm.py @ 375:19eacf4f7270

Started on memory manager
author Windel Bouwman
date Sun, 23 Mar 2014 15:44:06 +0100
parents c05ab629976a
children 6df89163e114
comparison
equal deleted inserted replaced
374:72a3b646d543 375:19eacf4f7270
13 def setUp(self): 13 def setUp(self):
14 self.t = arm_target 14 self.t = arm_target
15 self.obj = ObjectFile() 15 self.obj = ObjectFile()
16 self.ostream = BinaryOutputStream(self.obj) 16 self.ostream = BinaryOutputStream(self.obj)
17 self.ostream.select_section('.text') 17 self.ostream.select_section('.text')
18 self.a = a #Assembler(target=self.t) 18 self.a = a
19 19
20 def testMovImm(self): 20 def testMovImm(self):
21 self.feed('mov r4, 100') 21 self.feed('mov r4, 100')
22 self.check('6440a0e3') 22 self.check('6440a0e3')
23 23
104 self.feed('ldr r10, lab1') 104 self.feed('ldr r10, lab1')
105 self.feed('lab1:') 105 self.feed('lab1:')
106 self.feed('dcd 0x12345566') 106 self.feed('dcd 0x12345566')
107 self.check('04509fe5 00b09fe5 04a01fe5 66553412') 107 self.check('04509fe5 00b09fe5 04a01fe5 66553412')
108 108
109 def testAdr(self):
110 self.feed('adr r5, cval')
111 self.feed('adr r9, cval')
112 self.feed('adr r8, cval')
113 self.feed('cval:')
114 self.feed('adr r11, cval')
115 self.feed('adr r12, cval')
116 self.feed('adr r1, cval')
117 self.check('04508fe2 00908fe2 04804fe2 08b04fe2 0cc04fe2 10104fe2')
118
119 @unittest.skip('Too hard')
120 def testLdrLabelAddress(self):
121 self.feed('ldr r8, =a')
122 self.feed('a:')
123 self.feed('dcd 6677')
124 self.check('00801fe5 151a0000 04000000')
125
109 def testCmp(self): 126 def testCmp(self):
110 self.feed('cmp r4, r11') 127 self.feed('cmp r4, r11')
111 self.feed('cmp r5, 0x50000') 128 self.feed('cmp r5, 0x50000')
112 self.check('0b0054e1 050855e3') 129 self.check('0b0054e1 050855e3')
113 130
115 self.feed('sub r4,r5,23') 132 self.feed('sub r4,r5,23')
116 self.feed('blt x') 133 self.feed('blt x')
117 self.feed('x:') 134 self.feed('x:')
118 self.feed('mul r4,r5,r2') 135 self.feed('mul r4,r5,r2')
119 self.check('174045e2 ffffffba 950204e0') 136 self.check('174045e2 ffffffba 950204e0')
120
121 def testAdr(self):
122 self.feed('adr r5, cval')
123 self.feed('adr r9, cval')
124 self.feed('adr r8, cval')
125 self.feed('cval:')
126 self.feed('adr r11, cval')
127 self.feed('adr r12, cval')
128 self.feed('adr r1, cval')
129 self.check('04508fe2 00908fe2 04804fe2 08b04fe2 0cc04fe2 10104fe2')
130 137
131 def testMcr(self): 138 def testMcr(self):
132 """ Test move coprocessor register from arm register """ 139 """ Test move coprocessor register from arm register """
133 self.feed('mcr p15, 0, r1, c2, c0, 0') 140 self.feed('mcr p15, 0, r1, c2, c0, 0')
134 self.feed('mcr p14, 0, r1, c8, c7, 0') 141 self.feed('mcr p14, 0, r1, c8, c7, 0')