mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-22 10:32:25 +00:00
sim: sim_boolean: handle SETCAB, add unit test
This commit is contained in:
parent
9f273f13ec
commit
d2e87ee401
@ -49,6 +49,7 @@
|
||||
, handle_IORI/4
|
||||
, handle_IORM/4
|
||||
, handle_SETCA/4
|
||||
, handle_SETCAB/4
|
||||
, handle_SETCAM/4
|
||||
, handle_SETMB/4
|
||||
, handle_SETMI/4
|
||||
@ -533,6 +534,14 @@ handle_SETCAM(Core, Mem, IR, EA) ->
|
||||
Word = (bnot CA) band ((1 bsl 36) - 1),
|
||||
handle_ANDM_1(Core, Mem, EA, Word).
|
||||
|
||||
-spec handle_SETCAB(#core{}, sim_mem:mem(), IR :: word(), #ea{})
|
||||
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
|
||||
handle_SETCAB(Core, Mem, IR, EA) ->
|
||||
AC = IR band 8#17,
|
||||
CA = sim_core:get_ac(Core, AC),
|
||||
Word = (bnot CA) band ((1 bsl 36) - 1),
|
||||
handle_ANDB(Core, Mem, AC, EA, Word).
|
||||
|
||||
%% Miscellaneous ===============================================================
|
||||
|
||||
ea_address(#ea{section = Section, offset = Offset}) ->
|
||||
|
||||
@ -296,6 +296,7 @@ dispatch(Core, Mem, IR, EA) ->
|
||||
8#450 -> sim_boolean:handle_SETCA(Core, Mem, IR, EA);
|
||||
8#451 -> sim_boolean:handle_SETCA(Core, Mem, IR, EA); % SETCAI = SETCA
|
||||
8#452 -> sim_boolean:handle_SETCAM(Core, Mem, IR, EA);
|
||||
8#453 -> sim_boolean:handle_SETCAB(Core, Mem, IR, EA);
|
||||
_ ->
|
||||
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
|
||||
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}
|
||||
|
||||
@ -87,6 +87,7 @@
|
||||
-define(OP_SETCA, 8#450).
|
||||
-define(OP_SETCAI, 8#451).
|
||||
-define(OP_SETCAM, 8#452).
|
||||
-define(OP_SETCAB, 8#453).
|
||||
|
||||
%% 2.4 Boolean Functions =======================================================
|
||||
|
||||
@ -610,6 +611,18 @@ setcam_test() ->
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, 8#070707)} % C(1,,200) = -1,,070707
|
||||
]).
|
||||
|
||||
setcab_test() ->
|
||||
Prog =
|
||||
[ {1, 8#100, ?INSN(?OP_MOVEI, 1, 0, 0, 8#707070)} % 1,,100/ MOVEI 1,707070
|
||||
, {1, 8#101, ?INSN(?OP_SETCAB, 1, 0, 0, 8#200)} % 1,,101/ SETCAB 1,200
|
||||
, {1, 8#102, ?INSN_INVALID} % 1,,102/ <invalid>
|
||||
, {1, 8#200, 0} % 1,,200/ 0
|
||||
],
|
||||
expect(Prog, [], {1, 8#102}, ?DEFAULT_FLAGS,
|
||||
[ {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, 8#070707)} % C(1,,200) = -1,,070707
|
||||
, {#ea{section = 1, offset = 8#200, islocal = false}, ?COMMA2(-1, 8#070707)} % C(1,,200) = -1,,070707
|
||||
]).
|
||||
|
||||
%% Common code to run short sequences ==========================================
|
||||
|
||||
expect(Prog, ACs, ExpectedPC, ExpectedFlags, ExpectedEs) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user