예제 #1
0
파일: verify.c 프로젝트: spl/ivy
/*
 *  verify -- check that all minterms of F are contained in (Fold u Dold)
 *  and that all minterms of Fold are contained in (F u Dold).
 */
bool verify(pset_family F, pset_family Fold, pset_family Dold)
{
    pcube p, last, *FD;
    bool verify_error = FALSE;

    /* Make sure the function didn't grow too large */
    FD = cube2list(Fold, Dold);
    foreach_set(F, last, p)
	if (! cube_is_covered(FD, p)) {
	    printf("some minterm in F is not covered by Fold u Dold\n");
	    verify_error = TRUE;
	    if (verbose_debug) printf("%s\n", pc1(p)); else break;
	}
    free_cubelist(FD);

    /* Make sure minimized function covers the original function */
    FD = cube2list(F, Dold);
    foreach_set(Fold, last, p)
	if (! cube_is_covered(FD, p)) {
	    printf("some minterm in Fold is not covered by F u Dold\n");
	    verify_error = TRUE;
	    if (verbose_debug) printf("%s\n", pc1(p)); else break;
	}
    free_cubelist(FD);

    return verify_error;
}
예제 #2
0
int check_equiv(pset_family f1, pset_family f2)
{
register pset *f1list, *f2list;
register pset p, last;
f1list = cube1list(f1);
for( p=f2->data, last= p+f2->count*f2->wsize; p< last; p+=f2->wsize) {
if (! cube_is_covered(f1list, p)) {
return 0;
}
}
((f1list[0]) ? (free((char *) (f1list[0])), (f1list[0]) = 0) : 0); ((f1list) ? (free((char *) (f1list)), (f1list) = 0) : 0);;
f2list = cube1list(f2);
for( p=f1->data, last= p+f1->count*f1->wsize; p< last; p+=f1->wsize) {
if (! cube_is_covered(f2list, p)) {
return 0;
}
}
((f2list[0]) ? (free((char *) (f2list[0])), (f2list[0]) = 0) : 0); ((f2list) ? (free((char *) (f2list)), (f2list) = 0) : 0);;
return 1;
}
예제 #3
0
int check_equiv(pset_family f1, pset_family f2)
{
  register pcube *f1list, *f2list;
  register pcube p, last;

  f1list = cube1list(f1);
  foreach_set(f2, last, p) {
    if (! cube_is_covered(f1list, p)) {
      return FALSE;
    }
  }
  free_cubelist(f1list);

  f2list = cube1list(f2);
  foreach_set(f1, last, p) {
    if (! cube_is_covered(f2list, p)) {
      return FALSE;
    }
  }
  free_cubelist(f2list);

  return TRUE;
}