aboutsummaryrefslogtreecommitdiff
path: root/design/stack_machine.v
diff options
context:
space:
mode:
Diffstat (limited to 'design/stack_machine.v')
-rw-r--r--design/stack_machine.v11
1 files changed, 11 insertions, 0 deletions
diff --git a/design/stack_machine.v b/design/stack_machine.v
index 150f6c7..b6c2706 100644
--- a/design/stack_machine.v
+++ b/design/stack_machine.v
@@ -220,6 +220,10 @@ module stack_machine_new
assign instr_mul = !set_im && !use_im && stack_shrinks_by_1 &&
instruction[11:0] == 12'd3;
+ wire instr_cond_jump;
+ assign instr_cond_jump = use_im && stack_shrinks_by_1 &&
+ instruction[11:7] == 5'd1;
+
reg halt; /* Set once a halt instruction is encountered */
assign finished = halt;
@@ -519,6 +523,13 @@ module stack_machine_new
if (instr_mul && arithmetic_uncompleted)
r1 <= r0 * r1;
+
+ if (instr_cond_jump && arithmetic_uncompleted) begin
+ r1 <= r0;
+
+ if (r1)
+ `SET_PC(im_effective);
+ end
end // case: STEP_EXECUTING
endcase // case (step)
end // else: !if(RST_I)