summaryrefslogtreecommitdiff
path: root/kernel/calc.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-11-05 10:22:22 +0100
committerClifford Wolf <clifford@clifford.at>2013-11-05 10:22:22 +0100
commit27fec4e77c8d116deb90398400f5f2a1eb5cf785 (patch)
treea5958eaa97f66e29418a7f813aee0726cf2d1dcc /kernel/calc.cc
parent2b5f4d1df3cb4ff8e47eaf4d2e48829eedb4bead (diff)
Fixed sign handling in const eval of sshl and sshr
Diffstat (limited to 'kernel/calc.cc')
-rw-r--r--kernel/calc.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/calc.cc b/kernel/calc.cc
index 2e9be437..efb09c39 100644
--- a/kernel/calc.cc
+++ b/kernel/calc.cc
@@ -286,13 +286,17 @@ RTLIL::Const RTLIL::const_shr(const RTLIL::Const &arg1, const RTLIL::Const &arg2
return const_shift(arg1_ext, arg2, false, +1, result_len);
}
-RTLIL::Const RTLIL::const_sshl(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool, bool, int result_len)
+RTLIL::Const RTLIL::const_sshl(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len)
{
+ if (!signed1)
+ return const_shl(arg1, arg2, signed1, signed2, result_len);
return const_shift(arg1, arg2, true, -1, result_len);
}
-RTLIL::Const RTLIL::const_sshr(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool, bool, int result_len)
+RTLIL::Const RTLIL::const_sshr(const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool signed1, bool signed2, int result_len)
{
+ if (!signed1)
+ return const_shr(arg1, arg2, signed1, signed2, result_len);
return const_shift(arg1, arg2, true, +1, result_len);
}