diff options
author | Wojciech Kosior <kwojtus@protonmail.com> | 2020-11-23 11:22:19 +0100 |
---|---|---|
committer | Wojciech Kosior <kwojtus@protonmail.com> | 2020-11-23 11:22:19 +0100 |
commit | a0e9d28f2a21cc42dff7ed2fce3e52cb04bc5170 (patch) | |
tree | 276893fc299d83ceea85c2176c45b00134379270 /design | |
parent | b44a3a201ee2b524f31aa93abfe4abd8b756a533 (diff) | |
download | AGH-engineering-thesis-a0e9d28f2a21cc42dff7ed2fce3e52cb04bc5170.tar.gz AGH-engineering-thesis-a0e9d28f2a21cc42dff7ed2fce3e52cb04bc5170.zip |
add unsigned division remainder instruction
Diffstat (limited to 'design')
-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 f68421e..13e55c1 100644 --- a/design/stack_machine.v +++ b/design/stack_machine.v @@ -286,6 +286,10 @@ module stack_machine_new assign instr_uge = !set_im && !use_im && stack_shrinks_by_1 && instruction[11:0] == 12'd15; + wire instr_urem; + assign instr_urem = !set_im && !use_im && stack_shrinks_by_1 && + instruction[11:0] == 12'd16; + wire instr_ret; assign instr_ret = !set_im && !use_im && stack_shrinks_by_1 && instruction[11:0] == 12'b000010000000; @@ -326,7 +330,7 @@ module stack_machine_new reg arithmetic_uncompleted; wire arithmetic_completes; - assign arithmetic_completes = instr_udiv ? div_done : + assign arithmetic_completes = instr_udiv || instr_urem ? div_done : instr_halt ? 0 : 1; @@ -611,6 +615,9 @@ module stack_machine_new if (instr_udiv && arithmetic_uncompleted) r1 <= div_quotient; + if (instr_urem && arithmetic_uncompleted) + r1 <= div_remainder; + if (instr_mul && arithmetic_uncompleted) r1 <= r0 * r1; @@ -687,6 +694,7 @@ module stack_machine_new instr_ugt ? "ugt" : instr_ge ? "ge" : instr_uge ? "uge" : + instr_urem ? "urem" : instr_ret ? "ret" : instr_cond_jump ? "cond_jump" : instr_cond_jump_n ? "cond_jump_n" : |