ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
reluctant.c
Go to the documentation of this file.
1#include "internal.h"
2#include "logging.h"
3
5
7 uint64_t limit) {
8 if (limit && period > limit)
9 period = limit;
10 reluctant->limited = (limit > 0);
11 reluctant->trigger = false;
12 reluctant->period = period;
13 reluctant->wait = period;
14 reluctant->u = reluctant->v = 1;
15 reluctant->limit = limit;
16}
17
21
23 if (!reluctant->period)
24 return;
25
26 if (reluctant->trigger)
27 return;
28
30 if (--reluctant->wait)
31 return;
32
33 uint64_t u = reluctant->u;
34 uint64_t v = reluctant->v;
35
36 if ((u & -u) == v) {
37 u++;
38 v = 1;
39 } else {
40 KISSAT_assert (UINT64_MAX / 2 >= v);
41 v *= 2;
42 }
43
44 KISSAT_assert (v);
45 KISSAT_assert (UINT64_MAX / v >= reluctant->period);
46 uint64_t wait = v * reluctant->period;
47
48 if (reluctant->limited && wait > reluctant->limit) {
49 u = v = 1;
50 wait = reluctant->period;
51 }
52
53 reluctant->trigger = true;
54 reluctant->wait = wait;
55 reluctant->u = u;
56 reluctant->v = v;
57}
58
60 if (GET_OPTION (reluctant)) {
61 LOG ("enable reluctant doubling with period %d limit %d",
62 GET_OPTION (reluctantint), GET_OPTION (reluctantlim));
63 kissat_enable_reluctant (&solver->reluctant, GET_OPTION (reluctantint),
64 GET_OPTION (reluctantlim));
65 } else {
66 LOG ("reluctant doubling disabled and thus no stable restarts");
67 kissat_disable_reluctant (&solver->reluctant);
68 }
69}
70
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define LOG(...)
#define KISSAT_assert(ignore)
Definition global.h:13
#define solver
Definition kitten.c:211
#define GET_OPTION(N)
Definition options.h:295
ABC_NAMESPACE_IMPL_START void kissat_enable_reluctant(reluctant *reluctant, uint64_t period, uint64_t limit)
Definition reluctant.c:6
void kissat_tick_reluctant(reluctant *reluctant)
Definition reluctant.c:22
void kissat_disable_reluctant(reluctant *reluctant)
Definition reluctant.c:18
void kissat_init_reluctant(kissat *solver)
Definition reluctant.c:59
uint64_t u
Definition reluctant.h:17
uint64_t wait
Definition reluctant.h:16
bool trigger
Definition reluctant.h:14
uint64_t limit
Definition reluctant.h:18
uint64_t period
Definition reluctant.h:15
uint64_t v
Definition reluctant.h:17
bool limited
Definition reluctant.h:13