aboutsummaryrefslogtreecommitdiff
path: root/design
diff options
context:
space:
mode:
Diffstat (limited to 'design')
-rw-r--r--design/stack_machine.v7
1 files changed, 7 insertions, 0 deletions
diff --git a/design/stack_machine.v b/design/stack_machine.v
index 868a103..0ccc1c6 100644
--- a/design/stack_machine.v
+++ b/design/stack_machine.v
@@ -182,6 +182,10 @@ module stack_machine_new
assign instr_nop = !set_im && !use_im && stack_same_size &&
instruction[11:0] == 12'd1;
+ wire instr_swap;
+ assign instr_swap = !set_im && !use_im && stack_same_size &&
+ instruction[11:0] == 12'd2;
+
wire instr_set_sp;
assign instr_set_sp = use_im && stack_same_size &&
instruction[11:7] == 5'd0;
@@ -439,6 +443,9 @@ module stack_machine_new
if (instr_nop)
r1 <= r1;
+ if (instr_swap)
+ {r0, r1} <= {r1, r0};
+
if (instr_set_sp)
`SET_SP(im_effective);