mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-25 03:37:15 +00:00
sim: sim_boolean: handle ORCAI, add unit test
This commit is contained in:
parent
9586833e1e
commit
1a3633d336
@ -49,6 +49,7 @@
|
||||
, handle_IORI/4
|
||||
, handle_IORM/4
|
||||
, handle_ORCA/4
|
||||
, handle_ORCAI/4
|
||||
, handle_SETCA/4
|
||||
, handle_SETCAB/4
|
||||
, handle_SETCAM/4
|
||||
@ -559,6 +560,14 @@ handle_ORCA(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_ORCA(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
-spec handle_ORCAI(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_ORCAI(Core, Mem, IR, EA) ->
|
||||
AC = IR band 8#17,
|
||||
CA = sim_core:get_ac(Core, AC),
|
||||
Word = (EA#ea.offset bor 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}) ->
|
||||
|
||||
@ -298,6 +298,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#452 -> sim_boolean:handle_SETCAM(Core, Mem, IR, EA);
|
||||
8#453 -> sim_boolean:handle_SETCAB(Core, Mem, IR, EA);
|
||||
8#454 -> sim_boolean:handle_ORCA(Core, Mem, IR, EA);
|
||||
8#455 -> sim_boolean:handle_ORCAI(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@ -89,6 +89,7 @@
|
||||
-define(OP_SETCAM, 8#452).
|
||||
-define(OP_SETCAB, 8#453).
|
||||
-define(OP_ORCA, 8#454).
|
||||
-define(OP_ORCAI, 8#455).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@ -637,6 +638,16 @@ orca_test() ->
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, 8#373737)} % AC1 = -1,,373737
|
||||
]).
|
||||
|
||||
orcai_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_ORCAI, 1, 0, 0, 8#303030)} % 1,,101/ ORCAI 1,303030
|
||||
, {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#373737)} % AC1 = -1,,373737
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user