mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-26 04:02:19 +00:00
sim: sim_boolean: handle SETO, add unit test
This commit is contained in:
@@ -70,6 +70,7 @@
|
||||
, handle_SETMB/4
|
||||
, handle_SETMI/4
|
||||
, handle_SETMM/4
|
||||
, handle_SETO/4
|
||||
, handle_SETZ/4
|
||||
, handle_SETZB/4
|
||||
, handle_SETZM/4
|
||||
@@ -761,6 +762,15 @@ handle_ORCBB(Core, Mem, IR, EA) ->
|
||||
fun(Core1, Mem1) -> handle_ORCBB(Core1, Mem1, IR, EA) end)
|
||||
end.
|
||||
|
||||
%% SETO - Set to Ones
|
||||
|
||||
-spec handle_SETO(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_SETO(Core, Mem, IR, _EA) ->
|
||||
AC = IR band 8#17,
|
||||
Word = (1 bsl 36) - 1,
|
||||
sim_core:next_pc(sim_core:set_ac(Core, AC, Word), Mem).
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@@ -313,6 +313,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#471 -> sim_boolean:handle_ORCBI(Core, Mem, IR, EA);
|
||||
8#472 -> sim_boolean:handle_ORCBM(Core, Mem, IR, EA);
|
||||
8#473 -> sim_boolean:handle_ORCBB(Core, Mem, IR, EA);
|
||||
8#474 -> sim_boolean:handle_SETO(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
-define(OP_ORCBI, 8#471).
|
||||
-define(OP_ORCBM, 8#472).
|
||||
-define(OP_ORCBB, 8#473).
|
||||
-define(OP_SETO, 8#474).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@@ -819,6 +820,17 @@ orcbb_test() ->
|
||||
, {#ea{section = 1, offset = 1, islocal = false}, ?COMMA2(-1, -1)} % AC1 = -1,,-1
|
||||
]).
|
||||
|
||||
%% SETO - Set to Ones
|
||||
|
||||
seto_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_SETO, 1, 0, 0, 0)} % 1,,100/ SETO 1,
|
||||
, {1, 8#101, ?INSN_INVALID} % 1,,101/ <invalid>
|
||||
],
|
||||
expect(Prog, [], {1, 8#101}, ?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