abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cvrmisc.c File Reference
#include "espresso.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START 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 86 of file cvrmisc.c.

88 {
89  d->cubes = s->cubes;
90  d->in = s->in;
91  d->out = s->out;
92  d->mv = s->mv;
93  d->total = s->total;
94  d->primes = s->primes;
95 }
int primes
Definition: espresso.h:277
ABC_NAMESPACE_IMPL_START void cover_cost ( IN pcover  F,
INOUT pcost  cost 
)

Definition at line 17 of file cvrmisc.c.

20 {
21  register pcube p, last;
22  pcube *T;
23  int var;
24 
25  /* use the routine used by cofactor to decide splitting variables */
26  massive_count(T = cube1list(F));
27  free_cubelist(T);
28 
29  cost->cubes = F->count;
30  cost->total = cost->in = cost->out = cost->mv = cost->primes = 0;
31 
32  /* Count transistors (zeros) for each binary variable (inputs) */
33  for(var = 0; var < cube.num_binary_vars; var++)
34  cost->in += cdata.var_zeros[var];
35 
36  /* Count transistors for each mv variable based on sparse/dense */
37  for(var = cube.num_binary_vars; var < cube.num_vars - 1; var++)
38  if (cube.sparse[var])
39  cost->mv += F->count * cube.part_size[var] - cdata.var_zeros[var];
40  else
41  cost->mv += cdata.var_zeros[var];
42 
43  /* Count the transistors (ones) for the output variable */
44  if (cube.num_binary_vars != cube.num_vars) {
45  var = cube.num_vars - 1;
46  cost->out = F->count * cube.part_size[var] - cdata.var_zeros[var];
47  }
48 
49  /* Count the number of nonprime cubes */
50  foreach_set(F, last, p)
51  cost->primes += TESTP(p, PRIME) != 0;
52 
53  /* Count the total number of literals */
54  cost->total = cost->in + cost->out + cost->mv;
55 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int var(Lit p)
Definition: SolverTypes.h:62
#define PRIME
Definition: espresso.h:127
#define foreach_set(R, last, p)
Definition: espresso.h:135
#define free_cubelist(T)
Definition: espresso.h:267
#define TESTP(set, flag)
Definition: espresso.h:124
#define pcube
Definition: espresso.h:261
void massive_count(IN pcube *T)
Definition: cofactor.c:131
pcube * cube1list(pcover A)
Definition: cofactor.c:289
static const int primes[nprimes]
Definition: Map.h:49
void fatal ( char *  s)

Definition at line 140 of file cvrmisc.c.

142 {
143  (void) fprintf(stderr, "espresso: %s\n", s);
144  exit(1);
145 }
VOID_HACK exit()
char* fmt_cost ( IN pcost  cost)

Definition at line 59 of file cvrmisc.c.

61 {
62  static char s[200];
63 
64  if (cube.num_binary_vars == cube.num_vars - 1)
65  (void) sprintf(s, "c=%d(%d) in=%d out=%d tot=%d",
66  cost->cubes, cost->cubes - cost->primes, cost->in,
67  cost->out, cost->total);
68  else
69  (void) sprintf(s, "c=%d(%d) in=%d mv=%d out=%d",
70  cost->cubes, cost->cubes - cost->primes, cost->in,
71  cost->mv, cost->out);
72  return s;
73 }
char * sprintf()
char* print_cost ( IN pcover  F)

Definition at line 76 of file cvrmisc.c.

78 {
79  cost_t cost;
80  cover_cost(F, &cost);
81  return fmt_cost(&cost);
82 }
ABC_NAMESPACE_IMPL_START void cover_cost(IN pcover F, INOUT pcost cost)
Definition: cvrmisc.c:17
char * fmt_cost(IN pcost cost)
Definition: cvrmisc.c:59
void print_trace ( pcover  T,
char *  name,
long  time 
)

Definition at line 109 of file cvrmisc.c.

113 {
114  (void) printf("# %s\tTime was %s, cost is %s\n",
115  name, print_time(time), print_cost(T));
116  (void) fflush(stdout);
117 }
char * print_cost(IN pcover F)
Definition: cvrmisc.c:76
#define print_time(t)
Definition: espresso.h:22
char * name
void size_stamp ( IN pcover  T,
IN char *  name 
)

Definition at line 99 of file cvrmisc.c.

102 {
103  (void) printf("# %s\tCost is %s\n", name, print_cost(T));
104  (void) fflush(stdout);
105 }
char * print_cost(IN pcover F)
Definition: cvrmisc.c:76
char * name
void totals ( long  time,
int  i,
pcover  T,
pcost  cost 
)

Definition at line 121 of file cvrmisc.c.

126 {
127  time = ptime() - time;
128  total_time[i] += time;
129  total_calls[i]++;
130  cover_cost(T, cost);
131  if (trace) {
132  (void) printf("# %s\tTime was %s, cost is %s\n",
133  total_name[i], print_time(time), fmt_cost(cost));
134  (void) fflush(stdout);
135  }
136 }
ABC_NAMESPACE_IMPL_START void cover_cost(IN pcover F, INOUT pcost cost)
Definition: cvrmisc.c:17
long total_time[TIME_COUNT]
Definition: globals.c:22
bool trace
Definition: globals.c:36
char * total_name[TIME_COUNT]
Definition: globals.c:21
#define print_time(t)
Definition: espresso.h:22
int total_calls[TIME_COUNT]
Definition: globals.c:23
#define ptime()
Definition: util_old.h:283
char * fmt_cost(IN pcost cost)
Definition: cvrmisc.c:59