mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-02-04 07:43:15 +00:00
sim: sim_boolean: handle ORCMB, add unit test
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
, handle_ORCAI/4
|
||||
, handle_ORCAM/4
|
||||
, handle_ORCM/4
|
||||
, handle_ORCMB/4
|
||||
, handle_ORCMI/4
|
||||
, handle_ORCMM/4
|
||||
, handle_SETCA/4
|
||||
@@ -690,6 +691,20 @@ handle_ORCMM(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_ORCMM(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
-spec handle_ORCMB(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_ORCMB(Core, Mem, IR, EA) ->
|
||||
case sim_core:c(Core, Mem, EA) of
|
||||
{ok, CE} ->
|
||||
AC = IR band 8#17,
|
||||
CA = sim_core:get_ac(Core, AC),
|
||||
Word = (CA bor bnot CE) band ((1 bsl 36) - 1),
|
||||
handle_ANDB(Core, Mem, AC, EA, Word);
|
||||
{error, Reason} ->
|
||||
sim_core:page_fault(Core, Mem, ea_address(EA), read, Reason,
|
||||
fun(Core1, Mem1) -> handle_ORCMB(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@@ -308,6 +308,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#464 -> sim_boolean:handle_ORCM(Core, Mem, IR, EA);
|
||||
8#465 -> sim_boolean:handle_ORCMI(Core, Mem, IR, EA);
|
||||
8#466 -> sim_boolean:handle_ORCMM(Core, Mem, IR, EA);
|
||||
8#467 -> sim_boolean:handle_ORCMB(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
-define(OP_ORCM, 8#464).
|
||||
-define(OP_ORCMI, 8#465).
|
||||
-define(OP_ORCMM, 8#466).
|
||||
-define(OP_ORCMB, 8#467).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@@ -756,6 +757,18 @@ orcmm_test() ->
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, -1)} % C(1,,200) = -1,,-1
|
||||
]).
|
||||
|
||||
orcmb_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_ORCMB, 1, 0, 0, 8#200)} % 1,,101/ ORCMB 1,200
|
||||
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
|
||||
, {1, 8#200, ?COMMA2(0, 8#707070)} % 1,,200/ 0,,707070
|
||||
],
|
||||
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, -1)} % C(1,,200) = -1,,-1
|
||||
, {#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