CONSTANTBV::BitVector_Destroy(d);
}
-///////// Signed operations.
+// Fast exit. Without creating min/max.
+bool
+fast_exit(FixedBits& c0, FixedBits& c1)
+{
+ for (int i = c0.getWidth() - 1; i >= 0; i--)
+ {
+ const char c_0 = c0[i];
+ const char c_1 = c1[i];
+
+ if (c_0 == '0')
+ {
+ if (c_1 == '0')
+ continue;
+ }
+ else if (c_0 == '1')
+ {
+ if (c_1 == '1')
+ continue;
+ }
+ else if (c_0 == '*' && c_1 == '*')
+ {
+ return true;
+ }
+ return false;
+ }
+}
+///////// Signed operations.
Result bvSignedLessThanBothWays(FixedBits& c0, FixedBits& c1, FixedBits& output)
assert(c0.getWidth() == c1.getWidth());
+ if (!output.isFixed(0) && fast_exit(c0,c1))
+ return NO_CHANGE;
+
CBV c0_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c0_max = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c1_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
return NOT_IMPLEMENTED;
}
+
Result bvSignedLessThanEqualsBothWays(FixedBits& c0, FixedBits &c1, FixedBits& output)
{
Result r = NO_CHANGE;
assert(c0.getWidth() == c1.getWidth());
+ if (!output.isFixed(0) && fast_exit(c0,c1))
+ return NO_CHANGE;
+
CBV c0_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c0_max = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c1_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
return bvSignedGreaterThanBothWays(c0, c1, t);
}
- const int msb = c0.getWidth() - 1;
+ const int msb = c0.getWidth() - 1;
if (output.isFixed(0) && output.getValue(0))
{
assert(c0.getWidth() == c1.getWidth());
+ if (!output.isFixed(0) && fast_exit(c0,c1))
+ return NO_CHANGE;
+
CBV c0_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c0_max = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c1_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
assert(c0.getWidth() == c1.getWidth());
+ if (!output.isFixed(0) && fast_exit(c0,c1))
+ return NO_CHANGE;
+
CBV c0_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c0_max = CONSTANTBV::BitVector_Create(c0.getWidth(), true);
CBV c1_min = CONSTANTBV::BitVector_Create(c0.getWidth(), true);