ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
espresso.c File Reference
#include "espresso.h"
Include dependency graph for espresso.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START pcover espresso (pcover F, pcover D1, pcover R)
 

Function Documentation

◆ espresso()

Definition at line 53 of file espresso.c.

55{
56 pcover E, D, Fsave;
57 pset last, p;
58 cost_t cost, best_cost;
59
60begin:
61 Fsave = sf_save(F); /* save original function */
62 D = sf_save(D1); /* make a scratch copy of D */
63
64 /* Setup has always been a problem */
65 if (recompute_onset) {
66 EXEC(E = simplify(cube1list(F)), "SIMPLIFY ", E);
67 free_cover(F);
68 F = E;
69 }
70 cover_cost(F, &cost);
71 if (unwrap_onset && (cube.part_size[cube.num_vars - 1] > 1)
72 && (cost.out != cost.cubes*cube.part_size[cube.num_vars-1])
73 && (cost.out < 5000))
74 EXEC(F = sf_contain(unravel(F, cube.num_vars - 1)), "SETUP ", F);
75
76 /* Initial expand and irredundant */
77 foreach_set(F, last, p) {
78 RESET(p, PRIME);
79 }
80 EXECUTE(F = expand(F, R, FALSE), EXPAND_TIME, F, cost);
81 EXECUTE(F = irredundant(F, D), IRRED_TIME, F, cost);
82
83 if (! single_expand) {
84 if (remove_essential) {
85 EXECUTE(E = essential(&F, &D), ESSEN_TIME, E, cost);
86 } else {
87 E = new_cover(0);
88 }
89
90 cover_cost(F, &cost);
91 do {
92
93 /* Repeat inner loop until solution becomes "stable" */
94 do {
95 copy_cost(&cost, &best_cost);
96 EXECUTE(F = reduce(F, D), REDUCE_TIME, F, cost);
97 EXECUTE(F = expand(F, R, FALSE), EXPAND_TIME, F, cost);
98 EXECUTE(F = irredundant(F, D), IRRED_TIME, F, cost);
99 } while (cost.cubes < best_cost.cubes);
100
101 /* Perturb solution to see if we can continue to iterate */
102 copy_cost(&cost, &best_cost);
103 if (use_super_gasp) {
104 F = super_gasp(F, D, R, &cost);
105 if (cost.cubes >= best_cost.cubes)
106 break;
107 } else {
108 F = last_gasp(F, D, R, &cost);
109 }
110
111 } while (cost.cubes < best_cost.cubes ||
112 (cost.cubes == best_cost.cubes && cost.total < best_cost.total));
113
114 /* Append the essential cubes to F */
115 F = sf_append(F, E); /* disposes of E */
116 if (trace) size_stamp(F, "ADJUST ");
117 }
118
119 /* Free the D which we used */
120 free_cover(D);
121
122 /* Attempt to make the PLA matrix sparse */
123 if (! skip_make_sparse) {
124 F = make_sparse(F, D1, R);
125 }
126
127 /*
128 * Check to make sure function is actually smaller !!
129 * This can only happen because of the initial unravel. If we fail,
130 * then run the whole thing again without the unravel.
131 */
132 if (Fsave->count < F->count) {
133 free_cover(F);
134 F = Fsave;
136 goto begin;
137 } else {
138 free_cover(Fsave);
139 }
140
141 return F;
142}
#define FALSE
Definition abcBm.c:37
#define pcover
Definition espresso.h:264
#define EXPAND_TIME
Definition espresso.h:376
pcover expand()
void copy_cost()
pcover make_sparse()
#define REDUCE_TIME
Definition espresso.h:378
struct cost_struct cost_t
bool recompute_onset
Definition globals.c:32
pset_family sf_contain()
#define ESSEN_TIME
Definition espresso.h:375
bool single_expand
Definition globals.c:34
#define EXECUTE(fct, i, S, cost)
Definition espresso.h:422
#define free_cover(r)
Definition espresso.h:266
pcover super_gasp()
bool trace
Definition globals.c:36
pcover unravel()
pcover essential()
pset_family sf_save()
bool skip_make_sparse
Definition globals.c:28
pcover reduce()
#define foreach_set(R, last, p)
Definition espresso.h:135
bool remove_essential
Definition globals.c:33
#define IRRED_TIME
Definition espresso.h:377
void cover_cost()
bool use_super_gasp
Definition globals.c:39
void size_stamp()
#define RESET(set, flag)
Definition espresso.h:123
#define PRIME
Definition espresso.h:127
pcover irredundant()
pcover last_gasp()
unsigned int * pset
Definition espresso.h:73
#define EXEC(fct, name, S)
Definition espresso.h:418
pset_family sf_append()
pcover simplify()
bool unwrap_onset
Definition globals.c:37
pcube * cube1list()
#define new_cover(i)
Definition espresso.h:265
Cube * p
Definition exorList.c:222
Definition exor.h:123
Here is the call graph for this function:
Here is the caller graph for this function: