mvcPrint.c 5.68 KB
Newer Older
Alan Mishchenko committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/**CFile****************************************************************

  FileName    [mvcPrint.c]

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

  Synopsis    [Printing cubes and covers.]

  Author      [MVSIS Group]
  
  Affiliation [UC Berkeley]

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

  Revision    [$Id: mvcPrint.c,v 1.6 2003/04/09 18:02:06 alanmi Exp $]

***********************************************************************/

#include "mvc.h"
//#include "vm.h"
//#include "vmInt.h"

23 24 25
ABC_NAMESPACE_IMPL_START


Alan Mishchenko committed
26 27 28 29 30 31 32
////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

static void Mvc_CubePrintBinary( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube );

////////////////////////////////////////////////////////////////////////
Alan Mishchenko committed
33
///                     FUNCTION DEFINITIONS                         ///
Alan Mishchenko committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
////////////////////////////////////////////////////////////////////////

/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CoverPrint( Mvc_Cover_t * pCover )
{
    Mvc_Cube_t * pCube;
    int i;
    // print general statistics
    printf( "The cover contains %d cubes (%d bits and %d words)\n", 
        pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
    // iterate through the cubes
    Mvc_CoverForEachCube( pCover, pCube )
        Mvc_CubePrint( pCover, pCube );

    if ( pCover->pLits )
    {
        for ( i = 0; i < pCover->nBits; i++ )
            printf( " %d", pCover->pLits[i] );
        printf( "\n" ); 
    }
    printf( "End of cover printout\n" ); 
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CubePrint( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
{
    int iBit, Value;
    // iterate through the literals
//    printf( "Size = %2d   ", Mvc_CubeReadSize(pCube) );
    Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
        printf( "%c", '0' + Value );
    printf( "\n" );
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CoverPrintBinary( Mvc_Cover_t * pCover )
{
    Mvc_Cube_t * pCube;
    int i;
    // print general statistics
    printf( "The cover contains %d cubes (%d bits and %d words)\n", 
        pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
    // iterate through the cubes
    Mvc_CoverForEachCube( pCover, pCube )
        Mvc_CubePrintBinary( pCover, pCube );

    if ( pCover->pLits )
    {
        for ( i = 0; i < pCover->nBits; i++ )
            printf( " %d", pCover->pLits[i] );
        printf( "\n" ); 
    }
    printf( "End of cover printout\n" ); 
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CubePrintBinary( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
{
    int iVar, Value;
    // iterate through the literals
//    printf( "Size = %2d   ", Mvc_CubeReadSize(pCube) );
    Mvc_CubeForEachVarValue( pCover, pCube, iVar, Value )
    {
        assert( Value != 0 );
        if ( Value == 3 )
            printf( "-" );
        else if ( Value == 1 )
            printf( "0" );
        else 
            printf( "1" );
    }
    printf( "\n" );
}

#if 0

/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CoverPrintMv( Mvc_Data_t * pData, Mvc_Cover_t * pCover )
{
    Mvc_Cube_t * pCube;
    int i;
    // print general statistics
    printf( "The cover contains %d cubes (%d bits and %d words)\n", 
        pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
    // iterate through the cubes
    Mvc_CoverForEachCube( pCover, pCube )
        Mvc_CubePrintMv( pData, pCover, pCube );

    if ( pCover->pLits )
    {
        for ( i = 0; i < pCover->nBits; i++ )
            printf( " %d", pCover->pLits[i] );
        printf( "\n" ); 
    }
    printf( "End of cover printout\n" ); 
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CubePrintMv( Mvc_Data_t * pData, Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
{
    int iLit, iVar;
    // iterate through the literals
    printf( "Size = %2d   ", Mvc_CubeReadSize(pCube) );
    iVar = 0;
    for ( iLit = 0; iLit < pData->pVm->nValuesIn; iLit++ )
    {
        if ( iLit == pData->pVm->pValuesFirst[iVar+1] )
        {
            printf( " " );
            iVar++;
        }
        if ( Mvc_CubeBitValue( pCube, iLit ) )
            printf( "%c", '0' + iLit - pData->pVm->pValuesFirst[iVar] );
        else
            printf( "-" );
    }
    printf( "\n" );
}

#endif

////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////


224 225
ABC_NAMESPACE_IMPL_END