Fixed signed division by zero handling

This commit is contained in:
Clifford Wolf 2016-04-10 17:15:17 +02:00
parent 094783dcf8
commit 2cab981862
1 changed files with 1 additions and 1 deletions

View File

@ -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