mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-02-18 13:37:21 +00:00
sim: sim_boolean: handle ORCMI, add unit test
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
, handle_ORCAI/4
|
||||
, handle_ORCAM/4
|
||||
, handle_ORCM/4
|
||||
, handle_ORCMI/4
|
||||
, handle_SETCA/4
|
||||
, handle_SETCAB/4
|
||||
, handle_SETCAM/4
|
||||
@@ -666,6 +667,14 @@ handle_ORCM(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_ORCM(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
-spec handle_ORCMI(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_ORCMI(Core, Mem, IR, EA) ->
|
||||
AC = IR band 8#17,
|
||||
CA = sim_core:get_ac(Core, AC),
|
||||
Word = (CA bor bnot EA#ea.offset) 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}) ->
|
||||
|
||||
@@ -306,6 +306,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#462 -> sim_boolean:handle_SETCMM(Core, Mem, IR, EA);
|
||||
8#463 -> sim_boolean:handle_SETCMB(Core, Mem, IR, EA);
|
||||
8#464 -> sim_boolean:handle_ORCM(Core, Mem, IR, EA);
|
||||
8#465 -> sim_boolean:handle_ORCMI(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
-define(OP_SETCMM, 8#462).
|
||||
-define(OP_SETCMB, 8#463).
|
||||
-define(OP_ORCM, 8#464).
|
||||
-define(OP_ORCMI, 8#465).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@@ -733,6 +734,16 @@ orcm_test() ->
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, -1)} % AC1 = -1,,-1
|
||||
]).
|
||||
|
||||
orcmi_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_ORCMI, 1, 0, 0, 8#707070)} % 1,,101/ ORCMI 1,707070
|
||||
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
|
||||
],
|
||||
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, -1)} % AC1 = -1,,-1
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Reference in New Issue
Block a user