sim: sim_core:skip/2: new, implement skipping the next instruction

This commit is contained in:
Mikael Pettersson 2020-07-30 17:40:35 +02:00
parent 0915326622
commit 81fd5cb76f

View File

@ -27,6 +27,7 @@
-export([ run/6
, run/2
, next_pc/2
, skip/2
, page_fault/6
, c/3
, cset/4
@ -81,6 +82,13 @@ next_pc(#core{pc_offset = PCOffset} = Core, Mem) ->
PCOffset1 = (PCOffset + 1) band ((1 bsl 18) - 1),
insn_fetch(Core#core{pc_offset = PCOffset1}, Mem).
%% Skip next instruction: increment PC by two but stay in current section.
-spec skip(#core{}, sim_mem:mem())
-> {#core{}, sim_mem:mem(), {ok, integer()} | {error, {module(), term()}}}.
skip(#core{pc_offset = PCOffset} = Core, Mem) ->
PCOffset2 = (PCOffset + 2) band ((1 bsl 18) - 1),
insn_fetch(Core#core{pc_offset = PCOffset2}, Mem).
%% Instruction Fetch and Effective Address Calculation =========================
%% c.f. Toad-1 Architecture Manual, page 41, Figure 1.11