src/misc/espresso/cvrmisc.c File Reference

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

Go to the source code of this file.

Functions

void cover_cost (IN pcover F, INOUT pcost cost)
char * fmt_cost (IN pcost cost)
char * print_cost (IN pcover F)
void copy_cost (pcost s, pcost d)
void size_stamp (IN pcover T, IN char *name)
void print_trace (pcover T, char *name, long time)
void totals (long time, int i, pcover T, pcost cost)
void fatal (char *s)

Function Documentation

void copy_cost ( pcost  s,
pcost  d 
)

Definition at line 83 of file cvrmisc.c.

00085 {
00086     d->cubes = s->cubes;
00087     d->in = s->in;
00088     d->out = s->out;
00089     d->mv = s->mv;
00090     d->total = s->total;
00091     d->primes = s->primes;
00092 }

void cover_cost ( IN pcover  F,
INOUT pcost  cost 
)

Definition at line 14 of file cvrmisc.c.

00017 {
00018     register pcube p, last;
00019     pcube *T;
00020     int var;
00021 
00022     /* use the routine used by cofactor to decide splitting variables */
00023     massive_count(T = cube1list(F));
00024     free_cubelist(T);
00025 
00026     cost->cubes = F->count;
00027     cost->total = cost->in = cost->out = cost->mv = cost->primes = 0;
00028 
00029     /* Count transistors (zeros) for each binary variable (inputs) */
00030     for(var = 0; var < cube.num_binary_vars; var++)
00031         cost->in += cdata.var_zeros[var];
00032 
00033     /* Count transistors for each mv variable based on sparse/dense */
00034     for(var = cube.num_binary_vars; var < cube.num_vars - 1; var++)
00035         if (cube.sparse[var])
00036             cost->mv += F->count * cube.part_size[var] - cdata.var_zeros[var];
00037         else
00038             cost->mv += cdata.var_zeros[var];
00039 
00040     /* Count the transistors (ones) for the output variable */
00041     if (cube.num_binary_vars != cube.num_vars) {
00042         var = cube.num_vars - 1;
00043         cost->out = F->count * cube.part_size[var] - cdata.var_zeros[var];
00044     }
00045 
00046     /* Count the number of nonprime cubes */
00047     foreach_set(F, last, p)
00048         cost->primes += TESTP(p, PRIME) != 0;
00049 
00050     /* Count the total number of literals */
00051     cost->total = cost->in + cost->out + cost->mv;
00052 }

void fatal ( char *  s  ) 

Definition at line 137 of file cvrmisc.c.

00139 {
00140     (void) fprintf(stderr, "espresso: %s\n", s);
00141     exit(1);
00142 }

char* fmt_cost ( IN pcost  cost  ) 

Definition at line 56 of file cvrmisc.c.

00058 {
00059     static char s[200];
00060 
00061     if (cube.num_binary_vars == cube.num_vars - 1)
00062         (void) sprintf(s, "c=%d(%d) in=%d out=%d tot=%d",
00063             cost->cubes, cost->cubes - cost->primes, cost->in,
00064             cost->out, cost->total);
00065     else
00066         (void) sprintf(s, "c=%d(%d) in=%d mv=%d out=%d",
00067            cost->cubes, cost->cubes - cost->primes, cost->in,
00068            cost->mv, cost->out);
00069     return s;
00070 }

char* print_cost ( IN pcover  F  ) 

Definition at line 73 of file cvrmisc.c.

00075 {
00076     cost_t cost;
00077     cover_cost(F, &cost);
00078     return fmt_cost(&cost);
00079 }

void print_trace ( pcover  T,
char *  name,
long  time 
)

Definition at line 106 of file cvrmisc.c.

00110 {
00111     (void) printf("# %s\tTime was %s, cost is %s\n",
00112         name, print_time(time), print_cost(T));
00113     (void) fflush(stdout);
00114 }

void size_stamp ( IN pcover  T,
IN char *  name 
)

Definition at line 96 of file cvrmisc.c.

00099 {
00100     (void) printf("# %s\tCost is %s\n", name, print_cost(T));
00101     (void) fflush(stdout);
00102 }

void totals ( long  time,
int  i,
pcover  T,
pcost  cost 
)

Definition at line 118 of file cvrmisc.c.

00123 {
00124     time = ptime() - time;
00125     total_time[i] += time;
00126     total_calls[i]++;
00127     cover_cost(T, cost);
00128     if (trace) {
00129         (void) printf("# %s\tTime was %s, cost is %s\n",
00130             total_name[i], print_time(time), fmt_cost(cost));
00131         (void) fflush(stdout);
00132     }
00133 }


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