diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-08-15 11:09:30 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-08-15 11:09:30 +0200 |
commit | d0e93e04d1cc196264b0bbcf1aafcfba0adb2ea0 (patch) | |
tree | 290f64df772019689dc85f24ba32d91fa813c4c2 /kernel | |
parent | 759852914df00609f8797315c6cec76f1c8a3981 (diff) | |
download | yosys-d0e93e04d1cc196264b0bbcf1aafcfba0adb2ea0.tar.gz yosys-d0e93e04d1cc196264b0bbcf1aafcfba0adb2ea0.tar.bz2 yosys-d0e93e04d1cc196264b0bbcf1aafcfba0adb2ea0.zip |
Added eval -brute_force_equiv_checker_x mode
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/calc.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/kernel/calc.cc b/kernel/calc.cc index f4623a65b..8034ed2ce 100644 --- a/kernel/calc.cc +++ b/kernel/calc.cc @@ -362,15 +362,21 @@ RTLIL::Const RTLIL::const_mul(const RTLIL::Const &arg1, const RTLIL::Const &arg2 RTLIL::Const RTLIL::const_div(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len) { int undef_bit_pos = -1; - BigInteger y = const2big(arg1, signed1, undef_bit_pos) / const2big(arg2, signed2, undef_bit_pos); - return big2const(y, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0)); + BigInteger a = const2big(arg1, signed1, undef_bit_pos); + BigInteger b = const2big(arg2, signed2, undef_bit_pos); + if (b.isZero()) + return RTLIL::Const(RTLIL::State::Sx, result_len); + return big2const(a / b, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0)); } RTLIL::Const RTLIL::const_mod(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len) { int undef_bit_pos = -1; - BigInteger y = const2big(arg1, signed1, undef_bit_pos) % const2big(arg2, signed2, undef_bit_pos); - return big2const(y, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0)); + BigInteger a = const2big(arg1, signed1, undef_bit_pos); + BigInteger b = const2big(arg2, signed2, undef_bit_pos); + if (b.isZero()) + return RTLIL::Const(RTLIL::State::Sx, result_len); + return big2const(a % b, result_len >= 0 ? result_len : std::max(arg1.bits.size(), arg2.bits.size()), std::min(undef_bit_pos, 0)); } RTLIL::Const RTLIL::const_pow(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len) |