mirror of https://github.com/YosysHQ/picorv32.git
Fixed signed division by zero handling
This commit is contained in:
parent
094783dcf8
commit
2cab981862
|
@ -1638,7 +1638,7 @@ module picorv32_pcpi_div (
|
||||||
running <= 1;
|
running <= 1;
|
||||||
dividend <= (instr_div || instr_rem) && pcpi_rs1[31] ? -pcpi_rs1 : pcpi_rs1;
|
dividend <= (instr_div || instr_rem) && pcpi_rs1[31] ? -pcpi_rs1 : pcpi_rs1;
|
||||||
divisor <= ((instr_div || instr_rem) && pcpi_rs2[31] ? -pcpi_rs2 : pcpi_rs2) << 31;
|
divisor <= ((instr_div || instr_rem) && pcpi_rs2[31] ? -pcpi_rs2 : pcpi_rs2) << 31;
|
||||||
outsign <= (instr_div && (pcpi_rs1[31] != pcpi_rs2[31])) || (instr_rem && pcpi_rs1[31]);
|
outsign <= (instr_div && (pcpi_rs1[31] != pcpi_rs2[31]) && |pcpi_rs2) || (instr_rem && pcpi_rs1[31]);
|
||||||
quotient <= 0;
|
quotient <= 0;
|
||||||
quotient_msk <= 1 << 31;
|
quotient_msk <= 1 << 31;
|
||||||
end else
|
end else
|
||||||
|
|
Loading…
Reference in New Issue