diff options
Diffstat (limited to 'design/stack_machine.v')
-rw-r--r-- | design/stack_machine.v | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/design/stack_machine.v b/design/stack_machine.v index d79a136..868a103 100644 --- a/design/stack_machine.v +++ b/design/stack_machine.v @@ -200,6 +200,11 @@ module stack_machine_new assign instr_add = !set_im && !use_im && stack_shrinks_by_1 && instruction[11:0] == 12'd0; + wire instr_sub; + assign instr_sub = !set_im && !use_im && stack_shrinks_by_1 && + instruction[11:0] == 12'd1; + + reg halt; /* Set once a halt instruction is encountered */ assign finished = halt; @@ -446,7 +451,10 @@ module stack_machine_new /* Instructions, that shrink stack */ if (instr_add && first_execution_tick) - r1 <= r1 + r0; + r1 <= r0 + r1; + + if (instr_sub && first_execution_tick) + r1 <= r0 - r1; end // case: STEP_EXECUTING endcase // case (step) end // else: !if(RST_I) |