comparison test/testarmasm.py @ 341:4d204f6f7d4e devel

Rewrite of assembler parts
author Windel Bouwman
date Fri, 28 Feb 2014 18:07:14 +0100
parents c7cc54c0dfdf
children 86b02c98a717
comparison
equal deleted inserted replaced
340:c7cc54c0dfdf 341:4d204f6f7d4e
1 import unittest 1 import unittest
2 import outstream 2 import outstream
3 from ppci.objectfile import ObjectFile 3 from ppci.objectfile import ObjectFile
4 from asm import Assembler 4 from asm import Assembler
5 from testasm import AsmTestCaseBase 5 from testasm import AsmTestCaseBase
6 from target.target_list import armtarget 6 from target.target_list import arm_target, thumb_target
7 7
8 8
9 class AssemblerArmThumb2TestCase(AsmTestCaseBase): 9 class ThumbAssemblerTestCase(AsmTestCaseBase):
10 def setUp(self): 10 def setUp(self):
11 self.t = armtarget 11 self.t = thumb_target
12 self.obj = ObjectFile() 12 self.obj = ObjectFile()
13 self.o = outstream.BinaryOutputStream(self.obj) 13 self.o = outstream.BinaryOutputStream(self.obj)
14 self.o.selectSection('.text') 14 self.o.selectSection('.text')
15 self.a = Assembler(target=self.t, stream=self.o) 15 self.a = Assembler(target=self.t, stream=self.o)
16
17 def testMapOperand(self):
18 pass
19 16
20 def testMovImm8(self): 17 def testMovImm8(self):
21 self.feed('mov r4, 100') 18 self.feed('mov r4, 100')
22 self.check('6424') 19 self.check('6424')
23 20
152 149
153 150
154 class AssemblerArmTestCase(AsmTestCaseBase): 151 class AssemblerArmTestCase(AsmTestCaseBase):
155 """ ARM-mode (not thumb-mode) instruction assembly test case """ 152 """ ARM-mode (not thumb-mode) instruction assembly test case """
156 def setUp(self): 153 def setUp(self):
157 self.t = arm_arm_target 154 self.t = arm_target
158 self.obj = ObjectFile() 155 self.obj = ObjectFile()
159 self.o = outstream.BinaryOutputStream(self.obj) 156 self.o = outstream.BinaryOutputStream(self.obj)
160 self.o.selectSection('.text') 157 self.o.selectSection('.text')
161 self.a = Assembler(target=self.t, stream=self.o) 158 self.a = Assembler(target=self.t, stream=self.o)
162 159
163 def testMapOperand(self):
164 pass
165
166 def testMovImm(self): 160 def testMovImm(self):
167 self.feed('mov r4, 100') 161 self.feed('mov r4, 100')
168 self.check('6440a0e3') 162 self.check('6440a0e3')