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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Fxu_MatrixPrint (FILE *pFile, Fxu_Matrix *p)
 DECLARATIONS ///. More...
 
void Fxu_MatrixPrintDivisorProfile (FILE *pFile, Fxu_Matrix *p)
 

Function Documentation

ABC_NAMESPACE_IMPL_START void Fxu_MatrixPrint ( FILE *  pFile,
Fxu_Matrix p 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [fxuPrint.c]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Various printing procedures.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id:
fxuPrint.c,v 1.0 2003/02/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file fxuPrint.c.

44 {
45  Fxu_Var * pVar;
46  Fxu_Cube * pCube;
47  Fxu_Double * pDiv;
48  Fxu_Single * pSingle;
49  Fxu_Lit * pLit;
50  Fxu_Pair * pPair;
51  int i, LastNum;
52  int fStdout;
53 
54  fStdout = 1;
55  if ( pFile == NULL )
56  {
57  pFile = fopen( "matrix.txt", "w" );
58  fStdout = 0;
59  }
60 
61  fprintf( pFile, "Matrix has %d vars, %d cubes, %d literals, %d divisors.\n",
62  p->lVars.nItems, p->lCubes.nItems, p->nEntries, p->nDivs );
63  fprintf( pFile, "Divisors selected so far: single = %d, double = %d.\n",
64  p->nDivs1, p->nDivs2 );
65  fprintf( pFile, "\n" );
66 
67  // print the numbers on top of the matrix
68  for ( i = 0; i < 12; i++ )
69  fprintf( pFile, " " );
71  fprintf( pFile, "%d", pVar->iVar % 10 );
72  fprintf( pFile, "\n" );
73 
74  // print the rows
75  Fxu_MatrixForEachCube( p, pCube )
76  {
77  fprintf( pFile, "%4d", pCube->iCube );
78  fprintf( pFile, " " );
79  fprintf( pFile, "%4d", pCube->pVar->iVar );
80  fprintf( pFile, " " );
81 
82  // print the literals
83  LastNum = -1;
84  Fxu_CubeForEachLiteral( pCube, pLit )
85  {
86  for ( i = LastNum + 1; i < pLit->pVar->iVar; i++ )
87  fprintf( pFile, "." );
88  fprintf( pFile, "1" );
89  LastNum = i;
90  }
91  for ( i = LastNum + 1; i < p->lVars.nItems; i++ )
92  fprintf( pFile, "." );
93  fprintf( pFile, "\n" );
94  }
95  fprintf( pFile, "\n" );
96 
97  // print the double-cube divisors
98  fprintf( pFile, "The double divisors are:\n" );
99  Fxu_MatrixForEachDouble( p, pDiv, i )
100  {
101  fprintf( pFile, "Divisor #%3d (lit=%d,%d) (w=%2d): ",
102  pDiv->Num, pDiv->lPairs.pHead->nLits1,
103  pDiv->lPairs.pHead->nLits2, pDiv->Weight );
104  Fxu_DoubleForEachPair( pDiv, pPair )
105  fprintf( pFile, " <%d, %d> (b=%d)",
106  pPair->pCube1->iCube, pPair->pCube2->iCube, pPair->nBase );
107  fprintf( pFile, "\n" );
108  }
109  fprintf( pFile, "\n" );
110 
111  // print the divisors associated with each cube
112  fprintf( pFile, "The cubes are:\n" );
113  Fxu_MatrixForEachCube( p, pCube )
114  {
115  fprintf( pFile, "Cube #%3d: ", pCube->iCube );
116  if ( pCube->pVar->ppPairs )
117  {
118  Fxu_CubeForEachPair( pCube, pPair, i )
119  fprintf( pFile, " <%d %d> (d=%d) (b=%d)",
120  pPair->iCube1, pPair->iCube2, pPair->pDiv->Num, pPair->nBase );
121  }
122  fprintf( pFile, "\n" );
123  }
124  fprintf( pFile, "\n" );
125 
126  // print the single-cube divisors
127  fprintf( pFile, "The single divisors are:\n" );
128  Fxu_MatrixForEachSingle( p, pSingle )
129  {
130  fprintf( pFile, "Single-cube divisor #%5d: Var1 = %4d. Var2 = %4d. Weight = %2d\n",
131  pSingle->Num, pSingle->pVar1->iVar, pSingle->pVar2->iVar, pSingle->Weight );
132  }
133  fprintf( pFile, "\n" );
134 
135 /*
136  {
137  int Index;
138  fprintf( pFile, "Distribution of divisors in the hash table:\n" );
139  for ( Index = 0; Index < p->nTableSize; Index++ )
140  fprintf( pFile, " %d", p->pTable[Index].nItems );
141  fprintf( pFile, "\n" );
142  }
143 */
144  if ( !fStdout )
145  fclose( pFile );
146 }
Definition: fxuInt.h:213
Fxu_Pair * pHead
Definition: fxuInt.h:117
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iVar
Definition: fxuInt.h:215
Fxu_ListPair lPairs
Definition: fxuInt.h:260
#define Fxu_MatrixForEachSingle(Matrix, Single)
Definition: fxuInt.h:312
#define Fxu_MatrixForEachVariable(Matrix, Var)
Definition: fxuInt.h:303
#define Fxu_DoubleForEachPair(Div, Pair)
Definition: fxuInt.h:357
int Num
Definition: fxuInt.h:256
#define Fxu_CubeForEachLiteral(Cube, Lit)
Definition: fxuInt.h:338
int nLits2
Definition: fxuInt.h:242
int Weight
Definition: fxuInt.h:258
#define Fxu_MatrixForEachCube(Matrix, Cube)
Definition: fxuInt.h:294
Fxu_Var * pVar
Definition: fxuInt.h:231
int nLits1
Definition: fxuInt.h:241
Definition: fxuInt.h:226
#define Fxu_MatrixForEachDouble(Matrix, Div, Index)
Definition: fxuInt.h:330
#define Fxu_CubeForEachPair(pCube, pPair, i)
Definition: fxuInt.h:368
void Fxu_MatrixPrintDivisorProfile ( FILE *  pFile,
Fxu_Matrix p 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file fxuPrint.c.

160 {
161  Fxu_Double * pDiv;
162  int WeightMax;
163  int * pProfile;
164  int Counter1; // the number of -1 weight
165  int CounterL; // the number of less than -1 weight
166  int i;
167 
168  WeightMax = Fxu_HeapDoubleReadMaxWeight( p->pHeapDouble );
169  pProfile = ABC_ALLOC( int, (WeightMax + 1) );
170  memset( pProfile, 0, sizeof(int) * (WeightMax + 1) );
171 
172  Counter1 = 0;
173  CounterL = 0;
174  Fxu_MatrixForEachDouble( p, pDiv, i )
175  {
176  assert( pDiv->Weight <= WeightMax );
177  if ( pDiv->Weight == -1 )
178  Counter1++;
179  else if ( pDiv->Weight < 0 )
180  CounterL++;
181  else
182  pProfile[ pDiv->Weight ]++;
183  }
184 
185  fprintf( pFile, "The double divisors profile:\n" );
186  fprintf( pFile, "Weight < -1 divisors = %6d\n", CounterL );
187  fprintf( pFile, "Weight -1 divisors = %6d\n", Counter1 );
188  for ( i = 0; i <= WeightMax; i++ )
189  if ( pProfile[i] )
190  fprintf( pFile, "Weight %3d divisors = %6d\n", i, pProfile[i] );
191  fprintf( pFile, "End of divisor profile printout\n" );
192  ABC_FREE( pProfile );
193 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int Fxu_HeapDoubleReadMaxWeight(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:319
int Weight
Definition: fxuInt.h:258
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
#define Fxu_MatrixForEachDouble(Matrix, Div, Index)
Definition: fxuInt.h:330