sim: sim_core: handle SETAM and SETAB as MOVEM, add unit tests

This commit is contained in:
Mikael Pettersson
2020-07-24 17:48:44 +02:00
parent 8f7e4d7210
commit a30384b185
2 changed files with 26 additions and 0 deletions

View File

@@ -66,6 +66,8 @@
-define(OP_ANDCMB, 8#423).
-define(OP_SETA, 8#424).
-define(OP_SETAI, 8#425).
-define(OP_SETAM, 8#426).
-define(OP_SETAB, 8#426).
%% 2.4 Boolean Functions =======================================================
@@ -350,6 +352,28 @@ setai_test() ->
],
expect(Prog, [], {1, 8#101}, ?DEFAULT_FLAGS, []).
setam_test() ->
Prog =
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#42)} % 1,,100/ MOVEI 1,42
, {1, 8#101, ?INSN(?OP_SETAM, 1, 0, 0, 8#150)} % 1,,101/ SETAM 1,150
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
, {1, 8#150, 8#27} % 1,,150/ 0,,27
],
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
[ {#ea{section = 1, offset = 8#150, islocal = false}, 8#42} % C(1,,150) = 42
]).
setab_test() ->
Prog =
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#42)} % 1,,100/ MOVEI 1,42
, {1, 8#101, ?INSN(?OP_SETAB, 1, 0, 0, 8#150)} % 1,,101/ SETAB 1,150
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
, {1, 8#150, 8#27} % 1,,150/ 0,,27
],
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
[ {#ea{section = 1, offset = 8#150, islocal = false}, 8#42} % C(1,,150) = 42
]).
%% Common code to run short sequences ==========================================
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->