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

Go to the source code of this file.

Functions

pcover expand_gasp (INOUT pcover F, IN pcover D, IN pcover R, IN pcover Foriginal)
 
void expand1_gasp (pcover F, pcover D, pcover R, pcover Foriginal, int c1index, pcover *G)
 
pcover irred_gasp (pcover F, pcover D, pcover G)
 
pcover last_gasp (pcover F, pcover D, pcover R, cost_t *cost)
 
pcover super_gasp (pcover F, pcover D, pcover R, cost_t *cost)
 

Function Documentation

◆ expand1_gasp()

void expand1_gasp ( pcover F,
pcover D,
pcover R,
pcover Foriginal,
int c1index,
pcover * G )

Definition at line 107 of file gasp.c.

114{
115 register int c2index;
116 register pcube p, last, c2under;
117 pcube RAISE, FREESET, temp, *FD, c2essential;
118 pcover F1;
119
120 if (debug & EXPAND1) {
121 printf("\nEXPAND1_GASP: \t%s\n", pc1(GETSET(F, c1index)));
122 }
123
124 RAISE = new_cube();
125 FREESET = new_cube();
126 temp = new_cube();
127
128 /* Initialize the OFF-set */
129 R->active_count = R->count;
130 foreach_set(R, last, p) {
131 SET(p, ACTIVE);
132 }
133 /* Initialize the reduced ON-set, all nonprime cubes become active */
134 F->active_count = F->count;
135 foreachi_set(F, c2index, c2under) {
136 if (c1index == c2index || TESTP(c2under, PRIME)) {
137 F->active_count--;
138 RESET(c2under, ACTIVE);
139 } else {
140 SET(c2under, ACTIVE);
141 }
142 }
143
144 /* Initialize the raising and unassigned sets */
145 (void) set_copy(RAISE, GETSET(F, c1index));
146 (void) set_diff(FREESET, cube.fullset, RAISE);
147
148 /* Determine parts which must be lowered */
149 essen_parts(R, F, RAISE, FREESET);
150
151 /* Determine parts which can always be raised */
152 essen_raising(R, RAISE, FREESET);
153
154 /* See which, if any, of the reduced cubes we can cover */
155 foreachi_set(F, c2index, c2under) {
156 if (TESTP(c2under, ACTIVE)) {
157 /* See if this cube can be covered by an expansion */
158 if (setp_implies(c2under, RAISE) ||
159 feasibly_covered(R, c2under, RAISE, temp)) {
160
161 /* See if c1under can expanded to cover c2 reduced against
162 * (F - c1) u c1under; if so, c2 can definitely be removed !
163 */
164
165 /* Copy F and replace c1 with c1under */
166 F1 = sf_save(Foriginal);
167 (void) set_copy(GETSET(F1, c1index), GETSET(F, c1index));
168
169 /* Reduce c2 against ((F - c1) u c1under) */
170 FD = cube2list(F1, D);
171 c2essential = reduce_cube(FD, GETSET(F1, c2index));
172 free_cubelist(FD);
173 sf_free(F1);
174
175 /* See if c2essential is covered by an expansion of c1under */
176 if (feasibly_covered(R, c2essential, RAISE, temp)) {
177 (void) set_or(temp, RAISE, c2essential);
178 RESET(temp, PRIME); /* cube not prime */
179 *G = sf_addset(*G, temp);
180 }
181 set_free(c2essential);
182 }
183 }
184 }
185
186 free_cube(RAISE);
187 free_cube(FREESET);
188 free_cube(temp);
189}
#define pcover
Definition espresso.h:264
pset_family sf_addset()
#define new_cube()
Definition espresso.h:262
char * pc1()
void essen_parts()
#define set_free(r)
Definition espresso.h:167
#define foreachi_set(R, i, p)
Definition espresso.h:143
#define TESTP(set, flag)
Definition espresso.h:124
#define ACTIVE
Definition espresso.h:129
void essen_raising()
#define EXPAND1
Definition espresso.h:354
pcube * cube2list()
void sf_free()
#define pcube
Definition espresso.h:261
#define GETSET(family, index)
Definition espresso.h:161
pset set_diff()
#define free_cube(r)
Definition espresso.h:263
pset_family sf_save()
#define foreach_set(R, last, p)
Definition espresso.h:135
unsigned int debug
Definition globals.c:19
#define SET(set, flag)
Definition espresso.h:122
pcube reduce_cube()
bool setp_implies()
#define RESET(set, flag)
Definition espresso.h:123
#define PRIME
Definition espresso.h:127
bool feasibly_covered()
pset set_or()
pset set_copy()
#define free_cubelist(T)
Definition espresso.h:267
Cube * p
Definition exorList.c:222
Definition exor.h:123
Here is the call graph for this function:

◆ expand_gasp()

pcover expand_gasp ( INOUT pcover F,
IN pcover D,
IN pcover R,
IN pcover Foriginal )

Definition at line 83 of file gasp.c.

88{
89 int c1index;
90 pcover G;
91
92 /* Try to expand each nonprime and noncovered cube */
93 G = new_cover(10);
94 for(c1index = 0; c1index < F->count; c1index++) {
95 expand1_gasp(F, D, R, Foriginal, c1index, &G);
96 }
97 G = sf_dupl(G);
98 G = expand(G, R, /*nonsparse*/ FALSE); /* Make them prime ! */
99 return G;
100}
#define FALSE
Definition abcBm.c:37
pcover expand()
pset_family sf_dupl()
void expand1_gasp()
#define new_cover(i)
Definition espresso.h:265
Here is the call graph for this function:

◆ irred_gasp()

pcover irred_gasp ( pcover F,
pcover D,
pcover G )

Definition at line 192 of file gasp.c.

194{
195 if (G->count != 0)
196 F = irredundant(sf_append(F, G), D);
197 else
198 free_cover(G);
199 return F;
200}
#define free_cover(r)
Definition espresso.h:266
pcover irredundant()
pset_family sf_append()
Here is the call graph for this function:

◆ last_gasp()

pcover last_gasp ( pcover F,
pcover D,
pcover R,
cost_t * cost )

Definition at line 204 of file gasp.c.

207{
208 pcover G, G1;
209
210 EXECUTE(G = reduce_gasp(F, D), GREDUCE_TIME, G, *cost);
211 EXECUTE(G1 = expand_gasp(G, D, R, F), GEXPAND_TIME, G1, *cost);
212 free_cover(G);
213 EXECUTE(F = irred_gasp(F, D, G1), GIRRED_TIME, F, *cost);
214 return F;
215}
#define GEXPAND_TIME
Definition espresso.h:379
pcover expand_gasp()
pcover irred_gasp()
#define EXECUTE(fct, i, S, cost)
Definition espresso.h:422
#define GREDUCE_TIME
Definition espresso.h:381
#define GIRRED_TIME
Definition espresso.h:380
Here is the call graph for this function:

◆ super_gasp()

pcover super_gasp ( pcover F,
pcover D,
pcover R,
cost_t * cost )

Definition at line 219 of file gasp.c.

222{
223 pcover G, G1;
224
225 EXECUTE(G = reduce_gasp(F, D), GREDUCE_TIME, G, *cost);
226 EXECUTE(G1 = all_primes(G, R), GEXPAND_TIME, G1, *cost);
227 free_cover(G);
228 EXEC(G = sf_dupl(sf_append(F, G1)), "NEWPRIMES", G);
229 EXECUTE(F = irredundant(G, D), IRRED_TIME, F, *cost);
230 return F;
231}
pcover all_primes()
#define IRRED_TIME
Definition espresso.h:377
#define EXEC(fct, name, S)
Definition espresso.h:418
Here is the call graph for this function: