sim: sim_boolean: handle IORM, add unit test

This commit is contained in:
Mikael Pettersson
2020-07-24 19:41:24 +02:00
parent 2698bd1366
commit da20e78a18
3 changed files with 28 additions and 0 deletions

View File

@@ -38,6 +38,7 @@
, handle_ANDM/4
, handle_IOR/4
, handle_IORI/4
, handle_IORM/4
, handle_SETMB/4
, handle_SETMI/4
, handle_SETMM/4
@@ -371,6 +372,20 @@ handle_IORI(Core, Mem, IR, EA) ->
Word = CA bor EA#ea.offset,
sim_core:next_pc(sim_core:set_ac(Core, AC, Word), Mem).
-spec handle_IORM(#core{}, sim_mem:mem(), IR :: word(), #ea{})
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
handle_IORM(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_ANDM_1(Core, Mem, EA, Word);
{error, Reason} ->
sim_core:page_fault(Core, Mem, ea_address(EA), read, Reason,
fun(Core1, Mem1) -> handle_IORM(Core1, Mem1, IR, EA) end)
end.
%% Miscellaneous ===============================================================
ea_address(#ea{section = Section, offset = Offset}) ->

View File

@@ -283,6 +283,7 @@ dispatch(Core, Mem, IR, EA) ->
8#433 -> sim_boolean:handle_XORB(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);
_ ->
PC = (Core#core.pc_section bsl 18) bor Core#core.pc_offset,
{Core, Mem, {error, {?MODULE, {dispatch, PC, IR, EA}}}}