src/misc/espresso/essen.c File Reference

#include "espresso.h"
Include dependency graph for essen.c:

Go to the source code of this file.

Functions

pcover essential (IN pcover *Fp, IN pcover *Dp)
bool essen_cube (IN pcover F, IN pcover D, IN pcube c)
pcover cb_consensus (pcover T, pcube c)
pcover cb_consensus_dist0 (pcover R, pcube p, pcube c)

Function Documentation

pcover cb_consensus ( pcover  T,
pcube  c 
)

Definition at line 106 of file essen.c.

00109 {
00110     register pcube temp, last, p;
00111     register pcover R;
00112 
00113     R = new_cover(T->count*2);
00114     temp = new_cube();
00115     foreach_set(T, last, p) {
00116         if (p != c) {
00117             switch (cdist01(p, c)) {
00118                 case 0:
00119                     /* distance-0 needs special care */
00120                     R = cb_consensus_dist0(R, p, c);
00121                     break;
00122 
00123                 case 1:
00124                     /* distance-1 is easy because no sharping required */
00125                     consensus(temp, p, c);
00126                     R = sf_addset(R, temp);
00127                     break;
00128             }
00129         }
00130     }
00131     set_free(temp);
00132     return R;
00133 }

pcover cb_consensus_dist0 ( pcover  R,
pcube  p,
pcube  c 
)

Definition at line 140 of file essen.c.

00143 {
00144     int var;
00145     bool got_one;
00146     register pcube temp, mask;
00147     register pcube p_diff_c=cube.temp[0], p_and_c=cube.temp[1];
00148 
00149     /* If c contains p, then this gives us no information for essential test */
00150     if (setp_implies(p, c)) {
00151         return R;
00152     }
00153 
00154     /* For the multiple-valued variables */
00155     temp = new_cube();
00156     got_one = FALSE;
00157     INLINEset_diff(p_diff_c, p, c);
00158     INLINEset_and(p_and_c, p, c);
00159 
00160     for(var = cube.num_binary_vars; var < cube.num_vars; var++) {
00161         /* Check if c(var) is contained in p(var) -- if so, no news */
00162         mask = cube.var_mask[var];
00163         if (! setp_disjoint(p_diff_c, mask)) {
00164             INLINEset_merge(temp, c, p_and_c, mask);
00165             R = sf_addset(R, temp);
00166             got_one = TRUE;
00167         }
00168     }
00169 
00170     /* if no cube so far, add one for the intersection */
00171     if (! got_one && cube.num_binary_vars > 0) {
00172         /* Add a single cube for the intersection of p and c */
00173         INLINEset_and(temp, p, c);
00174         R = sf_addset(R, temp);
00175     }
00176 
00177     set_free(temp);
00178     return R;
00179 }

bool essen_cube ( IN pcover  F,
IN pcover  D,
IN pcube  c 
)

Definition at line 80 of file essen.c.

00083 {
00084     pcover H, FD;
00085     pcube *H1;
00086     bool essen;
00087 
00088     /* Append F and D together, and take the sharp-consensus with c */
00089     FD = sf_join(F, D);
00090     H = cb_consensus(FD, c);
00091     free_cover(FD);
00092 
00093     /* Add the don't care set, and see if this covers c */
00094     H1 = cube2list(H, D);
00095     essen = ! cube_is_covered(H1, c);
00096     free_cubelist(H1);
00097 
00098     free_cover(H);
00099     return essen;
00100 }

pcover essential ( IN pcover *  Fp,
IN pcover *  Dp 
)

Definition at line 36 of file essen.c.

00038 {
00039     register pcube last, p;
00040     pcover E, F = *Fp, D = *Dp;
00041 
00042     /* set all cubes in F active */
00043     (void) sf_active(F);
00044 
00045     /* Might as well start out with some cubes in E */
00046     E = new_cover(10);
00047 
00048     foreach_set(F, last, p) {
00049         /* don't test a prime which EXPAND says is nonessential */
00050         if (! TESTP(p, NONESSEN)) {
00051             /* only test a prime which was relatively essential */
00052             if (TESTP(p, RELESSEN)) {
00053                 /* Check essentiality */
00054                 if (essen_cube(F, D, p)) {
00055                     if (debug & ESSEN)
00056                         printf("ESSENTIAL: %s\n", pc1(p));
00057                     E = sf_addset(E, p);
00058                     RESET(p, ACTIVE);
00059                     F->active_count--;
00060                 }
00061             }
00062         }
00063     }
00064 
00065     *Fp = sf_inactive(F);               /* delete the inactive cubes from F */
00066     *Dp = sf_join(D, E);                /* add the essentials to D */
00067     sf_free(D);
00068     return E;
00069 }


Generated on Tue Jan 5 12:19:10 2010 for abc70930 by  doxygen 1.6.1