Fix DIV negative values divided by zero

This commit is contained in:
Dolu1990 2018-10-11 22:18:21 +02:00
parent c26b7e15cf
commit 8c25e73b9d
1 changed files with 1 additions and 1 deletions

View File

@ -140,7 +140,7 @@ class MulDivIterativePlugin(genMul : Boolean = true, genDiv : Boolean = true, mu
rs1 := twoComplement(rs1Extended, rs1NeedRevert).resized rs1 := twoComplement(rs1Extended, rs1NeedRevert).resized
rs2 := twoComplement(execute.input(RS2), rs2NeedRevert) rs2 := twoComplement(execute.input(RS2), rs2NeedRevert)
if(genMul) mul.counter.clear() if(genMul) mul.counter.clear()
if(genDiv) div.needRevert := rs1NeedRevert ^ (rs2NeedRevert && !execute.input(INSTRUCTION)(13)) if(genDiv) div.needRevert := (rs1NeedRevert ^ (rs2NeedRevert && !execute.input(INSTRUCTION)(13))) && !(execute.input(RS2) === 0 && execute.input(IS_RS2_SIGNED) && !execute.input(INSTRUCTION)(13))
if(genDiv) div.counter.clear() if(genDiv) div.counter.clear()
} }
} }