mirror of https://github.com/YosysHQ/abc.git
Adding a callback feature to Satoko.
This commit is contained in:
parent
cf427690a5
commit
b39b55e885
|
|
@ -639,7 +639,7 @@ char solver_search(solver_t *s)
|
|||
/* No conflict */
|
||||
unsigned next_lit;
|
||||
|
||||
if (solver_rst(s) || solver_check_limits(s) == 0) {
|
||||
if (solver_rst(s) || solver_check_limits(s) == 0 || solver_stop(s)) {
|
||||
b_queue_clean(s->bq_lbd);
|
||||
solver_cancel_until(s, 0);
|
||||
return SATOKO_UNDEC;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@ struct solver_t_ {
|
|||
|
||||
/* Temporary data used for solving cones */
|
||||
vec_char_t *marks;
|
||||
|
||||
/* Callback to stop the solver */
|
||||
int * pstop;
|
||||
|
||||
struct satoko_stats stats;
|
||||
struct satoko_opts opts;
|
||||
|
|
@ -223,6 +226,14 @@ static inline int solver_has_marks(solver_t *s)
|
|||
{
|
||||
return (int)(s->marks != NULL);
|
||||
}
|
||||
static inline int solver_stop(solver_t *s)
|
||||
{
|
||||
return s->pstop && *s->pstop;
|
||||
}
|
||||
static inline void solver_set_stop(solver_t *s, int * pstop)
|
||||
{
|
||||
s->pstop = pstop;
|
||||
}
|
||||
|
||||
//===------------------------------------------------------------------------===
|
||||
// Inline clause functions
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ int satoko_solve(solver_t *s)
|
|||
|
||||
while (status == SATOKO_UNDEC) {
|
||||
status = solver_search(s);
|
||||
if (solver_check_limits(s) == 0)
|
||||
if (solver_check_limits(s) == 0 || solver_stop(s))
|
||||
break;
|
||||
}
|
||||
if (s->opts.verbose)
|
||||
|
|
|
|||
Loading…
Reference in New Issue