23 #define INIT_X 123456789
24 #define INIT_Y 362436069
25 #define INIT_Z 521288629
26 #define INIT_W 88675123
29 static uint32_t x =
INIT_X;
30 static uint32_t y =
INIT_Y;
31 static uint32_t z =
INIT_Z;
32 static uint32_t w =
INIT_W;
33 uint32_t t = x ^ (x << 11);
35 w ^= (w >> 19) ^ t ^ (t >> 8);
39 void xorshift128_sat(
ezSAT &sat, std::vector<int> &x, std::vector<int> &y, std::vector<int> &z, std::vector<int> &w)
50 std::vector<int> vx = sat.
vec_var(
"x", 32);
51 std::vector<int> vy = sat.
vec_var(
"y", 32);
52 std::vector<int> vz = sat.
vec_var(
"z", 32);
53 std::vector<int> vw = sat.
vec_var(
"w", 32);
67 std::vector<int> modelExpressions;
68 std::vector<bool> modelValues;
77 if (!sat.
solve(modelExpressions, modelValues)) {
78 fprintf(stderr,
"SAT solver failed to find a model!\n");
100 printf(
"x = %9u (%s)\n", (
unsigned int)x, x ==
INIT_X ?
"ok" :
"ERROR");
101 printf(
"y = %9u (%s)\n", (
unsigned int)y, y ==
INIT_Y ?
"ok" :
"ERROR");
102 printf(
"z = %9u (%s)\n", (
unsigned int)z, z ==
INIT_Z ?
"ok" :
"ERROR");
103 printf(
"w = %9u (%s)\n", (
unsigned int)w, w ==
INIT_W ?
"ok" :
"ERROR");
void xorshift128_sat(ezSAT &sat, std::vector< int > &x, std::vector< int > &y, std::vector< int > &z, std::vector< int > &w)
std::vector< int > vec_var(int numBits)
void find_xorshift128_init_state(uint32_t &x, uint32_t &y, uint32_t &z, uint32_t &w, uint32_t w1, uint32_t w2, uint32_t w3, uint32_t w4)
std::vector< int > vec_shl(const std::vector< int > &vec1, int shift, bool signExtend=false)
void vec_set_unsigned(const std::vector< int > &vec1, uint64_t value)
uint64_t vec_model_get_unsigned(const std::vector< int > &modelExpressions, const std::vector< bool > &modelValues, const std::vector< int > &vec1) const
std::vector< int > vec_shr(const std::vector< int > &vec1, int shift, bool signExtend=false)
bool solve(const std::vector< int > &modelExpressions, std::vector< bool > &modelValues, const std::vector< int > &assumptions)
std::vector< int > vec_xor(const std::vector< int > &vec1, const std::vector< int > &vec2)
void vec_append(std::vector< int > &vec, const std::vector< int > &vec1) const