src/opt/fxu/fxuPrint.c File Reference

#include "fxuInt.h"
Include dependency graph for fxuPrint.c:

Go to the source code of this file.

Functions

void Fxu_MatrixPrint (FILE *pFile, Fxu_Matrix *p)
void Fxu_MatrixPrintDivisorProfile (FILE *pFile, Fxu_Matrix *p)

Function Documentation

void Fxu_MatrixPrint ( FILE *  pFile,
Fxu_Matrix p 
)

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 40 of file fxuPrint.c.

00041 {
00042         Fxu_Var * pVar;
00043         Fxu_Cube * pCube;
00044         Fxu_Double * pDiv;
00045     Fxu_Single * pSingle;
00046         Fxu_Lit * pLit;
00047         Fxu_Pair * pPair;
00048         int i, LastNum;
00049         int fStdout;
00050 
00051         fStdout = 1;
00052         if ( pFile == NULL )
00053         {
00054                 pFile = fopen( "matrix.txt", "w" );
00055                 fStdout = 0;
00056         }
00057 
00058         fprintf( pFile, "Matrix has %d vars, %d cubes, %d literals, %d divisors.\n", 
00059                 p->lVars.nItems, p->lCubes.nItems, p->nEntries, p->nDivs );
00060         fprintf( pFile, "Divisors selected so far: single = %d, double = %d.\n", 
00061                 p->nDivs1, p->nDivs2 );
00062         fprintf( pFile, "\n" );
00063 
00064         // print the numbers on top of the matrix
00065         for ( i = 0; i < 12; i++ )
00066                 fprintf( pFile, " " );
00067         Fxu_MatrixForEachVariable( p, pVar )
00068                 fprintf( pFile, "%d", pVar->iVar % 10 );
00069         fprintf( pFile, "\n" );
00070 
00071         // print the rows
00072         Fxu_MatrixForEachCube( p, pCube )
00073         {
00074                 fprintf( pFile, "%4d", pCube->iCube );
00075                 fprintf( pFile, "  " );
00076                 fprintf( pFile, "%4d", pCube->pVar->iVar );
00077                 fprintf( pFile, "  " );
00078 
00079                 // print the literals
00080                 LastNum = -1;
00081                 Fxu_CubeForEachLiteral( pCube, pLit )
00082                 {
00083                         for ( i = LastNum + 1; i < pLit->pVar->iVar; i++ )
00084                                 fprintf( pFile, "." );
00085                         fprintf( pFile, "1" );
00086                         LastNum = i;
00087                 }
00088                 for ( i = LastNum + 1; i < p->lVars.nItems; i++ )
00089                         fprintf( pFile, "." );
00090                 fprintf( pFile, "\n" );
00091         }
00092         fprintf( pFile, "\n" );
00093 
00094         // print the double-cube divisors
00095         fprintf( pFile, "The double divisors are:\n" );
00096         Fxu_MatrixForEachDouble( p, pDiv, i )
00097         {
00098                 fprintf( pFile, "Divisor #%3d (lit=%d,%d) (w=%2d):  ", 
00099                         pDiv->Num, pDiv->lPairs.pHead->nLits1, 
00100             pDiv->lPairs.pHead->nLits2, pDiv->Weight );
00101                 Fxu_DoubleForEachPair( pDiv, pPair )
00102                         fprintf( pFile, " <%d, %d> (b=%d)", 
00103                                 pPair->pCube1->iCube, pPair->pCube2->iCube, pPair->nBase );
00104                 fprintf( pFile, "\n" );
00105         }
00106     fprintf( pFile, "\n" );
00107 
00108         // print the divisors associated with each cube
00109         fprintf( pFile, "The cubes are:\n" );
00110         Fxu_MatrixForEachCube( p, pCube )
00111         {
00112                 fprintf( pFile, "Cube #%3d: ", pCube->iCube );
00113         if ( pCube->pVar->ppPairs )
00114                     Fxu_CubeForEachPair( pCube, pPair, i )
00115                                 fprintf( pFile, " <%d %d> (d=%d) (b=%d)", 
00116                                         pPair->iCube1, pPair->iCube2, pPair->pDiv->Num, pPair->nBase );
00117                 fprintf( pFile, "\n" );
00118         }
00119     fprintf( pFile, "\n" );
00120 
00121         // print the single-cube divisors
00122         fprintf( pFile, "The single divisors are:\n" );
00123         Fxu_MatrixForEachSingle( p, pSingle )
00124         {
00125                 fprintf( pFile, "Single-cube divisor #%5d: Var1 = %4d. Var2 = %4d. Weight = %2d\n", 
00126                         pSingle->Num, pSingle->pVar1->iVar, pSingle->pVar2->iVar, pSingle->Weight );
00127         }
00128     fprintf( pFile, "\n" );
00129 
00130 /*
00131     {
00132         int Index;
00133                 fprintf( pFile, "Distribution of divisors in the hash table:\n" );
00134         for ( Index = 0; Index < p->nTableSize; Index++ )
00135             fprintf( pFile, " %d", p->pTable[Index].nItems );
00136                 fprintf( pFile, "\n" );
00137     }
00138 */
00139         if ( !fStdout )
00140                 fclose( pFile );
00141 }

void Fxu_MatrixPrintDivisorProfile ( FILE *  pFile,
Fxu_Matrix p 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file fxuPrint.c.

00155 {
00156     Fxu_Double * pDiv;
00157     int WeightMax;
00158     int * pProfile;
00159     int Counter1; // the number of -1 weight
00160     int CounterL; // the number of less than -1 weight
00161     int i;
00162 
00163     WeightMax = Fxu_HeapDoubleReadMaxWeight( p->pHeapDouble );
00164     pProfile = ALLOC( int, (WeightMax + 1) );
00165     memset( pProfile, 0, sizeof(int) * (WeightMax + 1) );
00166 
00167     Counter1 = 0;
00168     CounterL = 0;
00169         Fxu_MatrixForEachDouble( p, pDiv, i )
00170     {
00171         assert( pDiv->Weight <= WeightMax );
00172         if ( pDiv->Weight == -1 )
00173             Counter1++;
00174         else if ( pDiv->Weight < 0 )
00175             CounterL++;
00176         else
00177             pProfile[ pDiv->Weight ]++;
00178     }
00179 
00180         fprintf( pFile, "The double divisors profile:\n" );
00181         fprintf( pFile, "Weight  < -1 divisors = %6d\n", CounterL );
00182         fprintf( pFile, "Weight    -1 divisors = %6d\n", Counter1 );
00183     for ( i = 0; i <= WeightMax; i++ )
00184         if ( pProfile[i] )
00185                 fprintf( pFile, "Weight   %3d divisors = %6d\n", i, pProfile[i] );
00186         fprintf( pFile, "End of divisor profile printout\n" );
00187     FREE( pProfile );
00188 }


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