sim: sim_core: handle SETA and SETAI as no-ops, add unit tests

This commit is contained in:
Mikael Pettersson 2020-07-24 17:41:17 +02:00
parent 58e546b177
commit 8f7e4d7210
2 changed files with 18 additions and 0 deletions

View File

@ -273,6 +273,8 @@ dispatch(Core, Mem, IR, EA) ->
8#421 -> sim_boolean:handle_ANDCMI(Core, Mem, IR, EA);
8#422 -> sim_boolean:handle_ANDCMM(Core, Mem, IR, EA);
8#423 -> sim_boolean:handle_ANDCMB(Core, Mem, IR, EA);
8#424 -> next_pc(Core, Mem); % SETA = no-op
8#425 -> next_pc(Core, Mem); % SETAI = no-op
_ ->
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}

View File

@ -64,6 +64,8 @@
-define(OP_ANDCMI, 8#421).
-define(OP_ANDCMM, 8#422).
-define(OP_ANDCMB, 8#423).
-define(OP_SETA, 8#424).
-define(OP_SETAI, 8#425).
%% 2.4 Boolean Functions =======================================================
@ -334,6 +336,20 @@ andcmb_test() ->
, {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(0, 8#030303)} % AC1 = 0,,030303
]).
seta_test() ->
Prog =
[ {1, 8#100, ?INSN(?OP_SETA, 0, 0, 0, 0)} % 1,,100/ SETA 0,0
, {1, 8#101, ?INSN_INVALID} % 1,,101/ <invalid>
],
expect(Prog, [], {1, 8#101}, ?DEFAULT_FLAGS, []).
setai_test() ->
Prog =
[ {1, 8#100, ?INSN(?OP_SETAI, 0, 0, 0, 0)} % 1,,100/ SETAI 0,0
, {1, 8#101, ?INSN_INVALID} % 1,,101/ <invalid>
],
expect(Prog, [], {1, 8#101}, ?DEFAULT_FLAGS, []).
%% Common code to run short sequences ==========================================
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->