mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-22 10:32:25 +00:00
sim: sim_boolean: handle SETCA, add unit test
This commit is contained in:
parent
72005b2f10
commit
33b26588ec
@ -48,6 +48,7 @@
|
||||
, handle_IORB/4
|
||||
, handle_IORI/4
|
||||
, handle_IORM/4
|
||||
, handle_SETCA/4
|
||||
, handle_SETMB/4
|
||||
, handle_SETMI/4
|
||||
, handle_SETMM/4
|
||||
@ -513,6 +514,16 @@ handle_EQVB(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_EQVB(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
%% SETCA - Set to Complement of AC
|
||||
|
||||
-spec handle_SETCA(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_SETCA(Core, Mem, IR, _EA) ->
|
||||
AC = IR band 8#17,
|
||||
CA = sim_core:get_ac(Core, AC),
|
||||
Word = (bnot CA) band ((1 bsl 36) - 1),
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, Word), Mem).
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@ -293,6 +293,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#445 -> sim_boolean:handle_EQVI(Core, Mem, IR, EA);
|
||||
8#446 -> sim_boolean:handle_EQVM(Core, Mem, IR, EA);
|
||||
8#447 -> sim_boolean:handle_EQVB(Core, Mem, IR, EA);
|
||||
8#450 -> sim_boolean:handle_SETCA(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@ -84,6 +84,7 @@
|
||||
-define(OP_EQVI, 8#445).
|
||||
-define(OP_EQVM, 8#446).
|
||||
-define(OP_EQVB, 8#447).
|
||||
-define(OP_SETCA, 8#450).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@ -574,6 +575,18 @@ eqvb_test() ->
|
||||
, {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, 8#343434)} % AC1 = -1,,343434
|
||||
]).
|
||||
|
||||
%% SETCA - Set to Complement of AC
|
||||
|
||||
setca_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_SETCA, 1, 0, 0, 0)} % 1,,101/ SETCA 1,
|
||||
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
|
||||
],
|
||||
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, 8#070707)} % AC1 = -1,,070707
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user