Fix incorrect division overflow handling
Whilst correct wrt. the ISA specification, the violating line will,
when compiled in release mode, be evaluated as "0" due to overflow.
Hence, hardcore the overflow response.
MODIFY
src/processors/ss/alu.h
src/processors/ss/alu.h
@@ -38,7 +38,7 @@ public:
return static_cast<uint32_t>(-1);
} else if (op1.sValue() == static_cast<int64_t>(-(std::pow(2, 32 - 1))) && op2.sValue() == -1) {
// Overflow
- return static_cast<uint32_t>(-(std::pow(2, 32 - 1)));
+ return static_cast<uint32_t>(0x80000000); // -2^(32-1)
} else {
return static_cast<uint32_t>(op1.sValue() / op2.sValue());
}

Fix incorrect division overflow handling

Whilst correct wrt. the ISA specification, the violating line will,
when compiled in release mode, be evaluated as "0" due to overflow.
Hence, hardcore the overflow response.