mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-22 10:32:25 +00:00
sim: sim_boolean: handle ORCBM, add unit test
This commit is contained in:
parent
06c224f0f1
commit
5fa5dc8ab8
@ -54,6 +54,7 @@
|
||||
, handle_ORCAM/4
|
||||
, handle_ORCB/4
|
||||
, handle_ORCBI/4
|
||||
, handle_ORCBM/4
|
||||
, handle_ORCM/4
|
||||
, handle_ORCMB/4
|
||||
, handle_ORCMI/4
|
||||
@ -731,6 +732,20 @@ handle_ORCBI(Core, Mem, IR, EA) ->
|
||||
Word = ((bnot CA) bor (bnot EA#ea.offset)) band ((1 bsl 36) - 1),
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, Word), Mem).
|
||||
|
||||
-spec handle_ORCBM(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_ORCBM(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 = ((bnot CA) bor (bnot CE)) band ((1 bsl 36) - 1),
|
||||
handle_ANDM_1(Core, Mem, EA, Word);
|
||||
{error, Reason} ->
|
||||
sim_core:page_fault(Core, Mem, ea_address(EA), read, Reason,
|
||||
fun(Core1, Mem1) -> handle_ORCBM(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@ -311,6 +311,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#467 -> sim_boolean:handle_ORCMB(Core, Mem, IR, EA);
|
||||
8#470 -> sim_boolean:handle_ORCB(Core, Mem, IR, EA);
|
||||
8#471 -> sim_boolean:handle_ORCBI(Core, Mem, IR, EA);
|
||||
8#472 -> sim_boolean:handle_ORCBM(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@ -102,6 +102,7 @@
|
||||
-define(OP_ORCMB, 8#467).
|
||||
-define(OP_ORCB, 8#470).
|
||||
-define(OP_ORCBI, 8#471).
|
||||
-define(OP_ORCBM, 8#472).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@ -794,6 +795,17 @@ orcbi_test() ->
|
||||
[ {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, -1)} % AC1 = -1,,-1
|
||||
]).
|
||||
|
||||
orcbm_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_ORCBM, 1, 0, 0, 8#200)} % 1,,101/ ORCBM 1,200
|
||||
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
|
||||
, {1, 8#200, ?COMMA2(0, 8#070707)} % 1,,200/ 0,,070707
|
||||
],
|
||||
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, -1)} % C(1,,200) = -1,,-1
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user