Exemple #1
0
 def test_addition_overflow3_flag(self):
     res = util.add8(util.make_8bit_twos_comp(-10), util.make_8bit_twos_comp(-10),
               self.registers)
     self.assertEqual(util.get_8bit_twos_comp(res), util.get_8bit_twos_comp(-20))
     print util.get_8bit_twos_comp(res)
     self.assertFalse(self.registers.condition.PV)
     self.assertTrue(self.registers.condition.S)
Exemple #2
0
 def test_addition_overflow2_flag(self):
     res = util.add8(util.make_8bit_twos_comp(-10),
                     util.make_8bit_twos_comp(10), self.registers)
     print(util.get_8bit_twos_comp(res))
     self.assertEqual(util.get_8bit_twos_comp(res), 0)
     self.assertFalse(self.registers.condition.PV)
     self.assertFalse(self.registers.condition.S)
Exemple #3
0
 def test_addition_overflow5_flag(self):
     res = util.add8(util.make_8bit_twos_comp(100), util.make_8bit_twos_comp(100),
               self.registers)
     self.assertTrue(self.registers.condition.PV)
Exemple #4
0
 def test_addition_overflow1_flag(self):
     res = util.add8(util.make_8bit_twos_comp(10), util.make_8bit_twos_comp(10),
               self.registers)
     self.assertEqual(util.get_8bit_twos_comp(res), 20)
     self.assertFalse(self.registers.condition.PV)
Exemple #5
0
 def test_addition_overflow5_flag(self):
     res = util.add8(util.make_8bit_twos_comp(100),
                     util.make_8bit_twos_comp(100), self.registers)
     self.assertTrue(self.registers.condition.PV)