aboutsummaryrefslogtreecommitdiff
path: root/design
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-09-05 17:20:38 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-09-05 17:20:38 +0200
commitd5c877247834fc25689ca6cf7530cd8d1b870d3a (patch)
tree261c4382f22f4a0918a60f4e899b0e41850b4636 /design
parentba4d97ddc2133c905e668c2f916cf3b14be4e35d (diff)
downloadAGH-engineering-thesis-d5c877247834fc25689ca6cf7530cd8d1b870d3a.tar.gz
AGH-engineering-thesis-d5c877247834fc25689ca6cf7530cd8d1b870d3a.zip
add swap instruction together with bench
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);