mirror of
https://github.com/openhwgroup/cvw.git
synced 2025-06-28 09:36:01 -04:00
Merge branch 'dev' of https://github.com/davidharrishmc/cvw into dev
This commit is contained in:
commit
c6ea1223b0
1 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ trap_handler:
|
||||||
|
|
||||||
# check if instruction is mul (op = 0110011, funct3 = 000, funct7 = 0000001)
|
# check if instruction is mul (op = 0110011, funct3 = 000, funct7 = 0000001)
|
||||||
csrr t0, mtval # fetch instruction that caused trap
|
csrr t0, mtval # fetch instruction that caused trap
|
||||||
andi t1, t0, 127 # get op field (instr[7:0])
|
andi t1, t0, 127 # get op field (instr[6:0])
|
||||||
xori t1, t1, 0b0110011 # set to 0 if op is 0110011
|
xori t1, t1, 0b0110011 # set to 0 if op is 0110011
|
||||||
srli t2, t0, 12 # get funct3 field (instr[14:12])
|
srli t2, t0, 12 # get funct3 field (instr[14:12])
|
||||||
andi t2, t2, 7 # mask off other bits. Should be 0 if funct3 = 000
|
andi t2, t2, 7 # mask off other bits. Should be 0 if funct3 = 000
|
||||||
|
@ -96,7 +96,7 @@ mulloop:
|
||||||
beqz t2, muldone # done if y == 0
|
beqz t2, muldone # done if y == 0
|
||||||
andi t4, t2, 1 # t4 = y % 2
|
andi t4, t2, 1 # t4 = y % 2
|
||||||
beqz t4, skipadd # don't increment p if y%2 == 0
|
beqz t4, skipadd # don't increment p if y%2 == 0
|
||||||
add t3, t3, t1 # otherwise p = p + x0
|
add t3, t3, t1 # otherwise p = p + x
|
||||||
skipadd:
|
skipadd:
|
||||||
srli t2, t2, 1 # y = y >> 1
|
srli t2, t2, 1 # y = y >> 1
|
||||||
slli t1, t1, 1 # x = x << 1
|
slli t1, t1, 1 # x = x << 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue