mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-02-18 21:47:36 +00:00
sim: sim_boolean: handle IORB, add unit test
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
, handle_ANDI/4
|
||||
, handle_ANDM/4
|
||||
, handle_IOR/4
|
||||
, handle_IORB/4
|
||||
, handle_IORI/4
|
||||
, handle_IORM/4
|
||||
, handle_SETMB/4
|
||||
@@ -386,6 +387,20 @@ handle_IORM(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_IORM(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
-spec handle_IORB(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_IORB(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 = CE bor CA,
|
||||
handle_ANDB(Core, Mem, AC, EA, Word);
|
||||
{error, Reason} ->
|
||||
sim_core:page_fault(Core, Mem, ea_address(EA), read, Reason,
|
||||
fun(Core1, Mem1) -> handle_IORB(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@@ -284,6 +284,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#434 -> sim_boolean:handle_IOR(Core, Mem, IR, EA);
|
||||
8#435 -> sim_boolean:handle_IORI(Core, Mem, IR, EA);
|
||||
8#436 -> sim_boolean:handle_IORM(Core, Mem, IR, EA);
|
||||
8#437 -> sim_boolean:handle_IORB(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
-define(OP_IOR, 8#434).
|
||||
-define(OP_IORI, 8#435).
|
||||
-define(OP_IORM, 8#436).
|
||||
-define(OP_IORB, 8#437).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@@ -461,6 +462,18 @@ iorm_test() ->
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, 8#777777} % C(1,,200) = 0,,-1
|
||||
]).
|
||||
|
||||
iorb_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_IORB, 1, 0, 0, 8#200)} % 1,,101/ IORB 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}, 8#777777} % C(1,,200) = 0,,-1
|
||||
, {#ea{section = 1, offset = 1, islocal = false}, 8#777777} % AC1 = 0,,-1
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Reference in New Issue
Block a user