sim: sim_boolean: handle SETCAM, add unit test

This commit is contained in:
Mikael Pettersson
2020-07-25 15:08:26 +02:00
parent cc90c106a8
commit 9f273f13ec
3 changed files with 22 additions and 0 deletions

View File

@@ -86,6 +86,7 @@
-define(OP_EQVB, 8#447).
-define(OP_SETCA, 8#450).
-define(OP_SETCAI, 8#451).
-define(OP_SETCAM, 8#452).
%% 2.4 Boolean Functions =======================================================
@@ -598,6 +599,17 @@ setcai_test() ->
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, 8#070707)} % AC1 = -1,,070707
]).
setcam_test() ->
Prog =
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
, {1, 8#101, ?INSN(?OP_SETCAM, 1, 0, 0, 8#200)} % 1,,101/ SETCAM 1,200
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
, {1, 8#200, 0} % 1,,200/ 0
],
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, 8#070707)} % C(1,,200) = -1,,070707
]).
%% Common code to run short sequences ==========================================
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->