aboutsummaryrefslogtreecommitdiff
path: root/design
diff options
context:
space:
mode:
Diffstat (limited to 'design')
-rw-r--r--design/stack_machine.v12
1 files changed, 9 insertions, 3 deletions
diff --git a/design/stack_machine.v b/design/stack_machine.v
index 91e808b..5e6e0d6 100644
--- a/design/stack_machine.v
+++ b/design/stack_machine.v
@@ -247,6 +247,10 @@ module stack_machine_new
assign instr_cond_jump = use_im && stack_shrinks_by_1 &&
instruction[11:7] == 5'd1;
+ wire instr_cond_jump_n;
+ assign instr_cond_jump_n = use_im && stack_shrinks_by_1 &&
+ instruction[11:7] == 5'd2;
+
reg halt; /* Set once a halt instruction is encountered */
assign finished = halt;
@@ -314,7 +318,7 @@ module stack_machine_new
always @ (posedge CLK_I) begin
if (RST_I) begin
`SET_PC(0);
- `SET_SP(21'h0FFFFF);
+ `SET_SP(21'h0FFFFC);
I_STB_O <= 0;
I_CYC_O <= 0;
@@ -563,10 +567,12 @@ module stack_machine_new
if (instr_drop && arithmetic_uncompleted)
r1 <= r0;
- if (instr_cond_jump && arithmetic_uncompleted) begin
+ if ((instr_cond_jump || instr_cond_jump_n) &&
+ arithmetic_uncompleted) begin
r1 <= r0;
- if (r1)
+ if ((r1 && instr_cond_jump) ||
+ (!r1 && instr_cond_jump_n))
`SET_PC(im_effective);
end