diff options
| author | Guillaume Valadon <guillaume@valadon.net> | 2018-06-15 12:10:10 +0200 |
|---|---|---|
| committer | Guillaume Valadon <guillaume@valadon.net> | 2018-07-12 22:50:51 +0200 |
| commit | b8e5038798b0dece628846acb5ad25d9d4e60395 (patch) | |
| tree | 932dd2676afcf0c4ba6bf0c57d3b574954461ad2 /test/arch/mep/ir/test_bitmanipulation.py | |
| parent | 82eb5f6eb197fc59d2e9ae21cfda05a1868e462e (diff) | |
| download | miasm-b8e5038798b0dece628846acb5ad25d9d4e60395.tar.gz miasm-b8e5038798b0dece628846acb5ad25d9d4e60395.zip | |
Toshiba MeP support
Diffstat (limited to 'test/arch/mep/ir/test_bitmanipulation.py')
| -rw-r--r-- | test/arch/mep/ir/test_bitmanipulation.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/arch/mep/ir/test_bitmanipulation.py b/test/arch/mep/ir/test_bitmanipulation.py new file mode 100644 index 00000000..06466f9d --- /dev/null +++ b/test/arch/mep/ir/test_bitmanipulation.py @@ -0,0 +1,55 @@ +# Toshiba MeP-c4 - Bit manipulation instructions unit tests +# Guillaume Valadon <guillaume@valadon.net> + +from ut_helpers_ir import exec_instruction + +from miasm2.expression.expression import ExprId, ExprInt, ExprMem + + +class TestBitManipulation: + + def test_bsetm(self): + """Test BSETM execution""" + + # BSETM (Rm),imm3 + exec_instruction("BSETM (R1), 1", + [(ExprId("R1", 32), ExprInt(0x28, 32)), + (ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x1, 8))], + [(ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x3, 8))]) + + def test_bclrm(self): + """Test BCLRM execution""" + + # BCLRM (Rm),imm3 + exec_instruction("BCLRM (R1), 1", + [(ExprId("R1", 32), ExprInt(0x28, 32)), + (ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x3, 8))], + [(ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x1, 8))]) + + def test_bnotm(self): + """Test BNOTM execution""" + + # BNOTM (Rm),imm3 + exec_instruction("BNOTM (R1), 1", + [(ExprId("R1", 32), ExprInt(0x28, 32)), + (ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x1, 8))], + [(ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x3, 8))]) + + def test_btstm(self): + """Test BTSTM execution""" + + # BTSTM R0,(Rm),imm3 + exec_instruction("BTSTM R0, (R1), 1", + [(ExprId("R1", 32), ExprInt(0x28, 32)), + (ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x2, 8))], + [(ExprId("R0", 32), ExprInt(0x2, 32))]) + + def test_tas(self): + """Test TAS execution""" + + # TAS Rn,(Rm) + exec_instruction("TAS R0, (R1)", + [(ExprId("R1", 32), ExprInt(0x28, 32)), + (ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x2, 8))], + [(ExprId("R0", 32), ExprInt(0x2, 32)), + (ExprMem(ExprInt(0x28, 32), 8), ExprInt(0x1, 8))]) |