Beispiel #1
0
Datei: verify.c Projekt: spl/ivy
/*
 *  check_consistency -- test that the ON-set, OFF-set and DC-set form
 *  a partition of the boolean space.
 */
bool check_consistency(pPLA PLA)
{
    bool verify_error = FALSE;
    pcover T;

    T = cv_intersect(PLA->F, PLA->D);
    if (T->count == 0)
	printf("ON-SET and DC-SET are disjoint\n");
    else {
	printf("Some minterm(s) belong to both the ON-SET and DC-SET !\n");
	if (verbose_debug)
	    cprint(T);
	verify_error = TRUE;
    }
    (void) fflush(stdout);
    free_cover(T);

    T = cv_intersect(PLA->F, PLA->R);
    if (T->count == 0)
	printf("ON-SET and OFF-SET are disjoint\n");
    else {
	printf("Some minterm(s) belong to both the ON-SET and OFF-SET !\n");
	if (verbose_debug)
	    cprint(T);
	verify_error = TRUE;
    }
    (void) fflush(stdout);
    free_cover(T);

    T = cv_intersect(PLA->D, PLA->R);
    if (T->count == 0)
	printf("DC-SET and OFF-SET are disjoint\n");
    else {
	printf("Some minterm(s) belong to both the OFF-SET and DC-SET !\n");
	if (verbose_debug)
	    cprint(T);
	verify_error = TRUE;
    }
    (void) fflush(stdout);
    free_cover(T);

    if (tautology(cube3list(PLA->F, PLA->D, PLA->R)))
	printf("Union of ON-SET, OFF-SET and DC-SET is the universe\n");
    else {
	T = complement(cube3list(PLA->F, PLA->D, PLA->R));
	printf("There are minterms left unspecified !\n");
	if (verbose_debug)
	    cprint(T);
	verify_error = TRUE;
	free_cover(T);
    }
    (void) fflush(stdout);
    return verify_error;
}
Beispiel #2
0
void find_equiv_outputs(pPLA PLA)
{
  int i, j, ipart, jpart, some_equiv;
  pcover *R, *F;

  some_equiv = FALSE;

  makeup_labels(PLA);

  F = ALLOC(pcover, cube.part_size[cube.output]);
  R = ALLOC(pcover, cube.part_size[cube.output]);

  for(i = 0; i < cube.part_size[cube.output]; i++) {
    ipart = cube.first_part[cube.output] + i;
    R[i] = cof_output(PLA->R, ipart);
    F[i] = complement(cube1list(R[i]));
  }

  for(i = 0; i < cube.part_size[cube.output]-1; i++) {
    for(j = i+1; j < cube.part_size[cube.output]; j++) {
      ipart = cube.first_part[cube.output] + i;
      jpart = cube.first_part[cube.output] + j;

      if (check_equiv(F[i], F[j])) {
        printf("# Outputs %d and %d (%s and %s) are equivalent\n",
            i, j, PLA->label[ipart], PLA->label[jpart]);
        some_equiv = TRUE;
      } else if (check_equiv(F[i], R[j])) {
        printf("# Outputs %d and NOT %d (%s and %s) are equivalent\n",
            i, j, PLA->label[ipart], PLA->label[jpart]);
        some_equiv = TRUE;
      } else if (check_equiv(R[i], F[j])) {
        printf("# Outputs NOT %d and %d (%s and %s) are equivalent\n",
            i, j, PLA->label[ipart], PLA->label[jpart]);
        some_equiv = TRUE;
      } else if (check_equiv(R[i], R[j])) {
        printf("# Outputs NOT %d and NOT %d (%s and %s) are equivalent\n",
            i, j, PLA->label[ipart], PLA->label[jpart]);
        some_equiv = TRUE;
      }
    }
  }

  if (! some_equiv) {
    printf("# No outputs are equivalent\n");
  }

  for(i = 0; i < cube.part_size[cube.output]; i++) {
    free_cover(F[i]);
    free_cover(R[i]);
  }
  FREE(F);
  FREE(R);
}
Beispiel #3
0
pcover espresso(pset_family F, pset_family D1, pset_family R)
{
    pcover E, D, Fsave;
    pset last, p;
    cost_t cost, best_cost;

begin:
    Fsave = sf_save(F);		/* save original function */
    D = sf_save(D1);		/* make a scratch copy of D */

    /* Setup has always been a problem */
    if (recompute_onset) {
	EXEC(E = simplify(cube1list(F)),     "SIMPLIFY   ", E);
	free_cover(F);
	F = E;
    }
    cover_cost(F, &cost);
    if (unwrap_onset && (cube.part_size[cube.num_vars - 1] > 1)
      && (cost.out != cost.cubes*cube.part_size[cube.num_vars-1])
      && (cost.out < 5000))
	EXEC(F = sf_contain(unravel(F, cube.num_vars - 1)), "SETUP      ", F);

    /* Initial expand and irredundant */
    foreach_set(F, last, p) {
	RESET(p, PRIME);
    }