src/base/abci/abcEspresso.c File Reference

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

Go to the source code of this file.

Functions

static void Abc_NodeEspresso (Abc_Obj_t *pNode)
static pset_family Abc_SopToEspresso (char *pSop)
static char * Abc_SopFromEspresso (Extra_MmFlex_t *pMan, pset_family Cover)
static pset_family Abc_EspressoMinimize (pset_family pOnset, pset_family pDcset)
void Abc_NtkEspresso (Abc_Ntk_t *pNtk, int fVerbose)

Function Documentation

pset_family Abc_EspressoMinimize ( pset_family  pOnset,
pset_family  pDcset 
) [static]

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

Synopsis [Minimizes the cover using Espresso.]

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file abcEspresso.c.

00208 {
00209     pset_family pOffset;
00210     int fNewDcset, i;
00211     int fSimple = 0;
00212     int fSparse = 0;
00213 
00214     if ( fSimple )
00215     {
00216         for ( i = 0; i < cube.num_vars; i++ )
00217             pOnset = d1merge( pOnset, i );
00218         pOnset = sf_contain( pOnset );
00219         return pOnset;
00220     }
00221 
00222     // create the dcset
00223     fNewDcset = (pDcset == NULL);
00224     if ( pDcset == NULL )
00225         pDcset = sf_new( 1, cube.size );
00226     pDcset->wsize   = pOnset->wsize;
00227     pDcset->sf_size = pOnset->sf_size;
00228 
00229     // derive the offset
00230     if ( pDcset->sf_size == 0 || pDcset->count == 0 )
00231         pOffset = complement(cube1list(pOnset));
00232     else
00233         pOffset = complement(cube2list(pOnset, pDcset)); 
00234 
00235     // perform minimization
00236     skip_make_sparse = !fSparse;
00237     pOnset = espresso( pOnset, pDcset, pOffset );
00238 
00239     // free covers
00240     sf_free( pOffset ); 
00241     if ( fNewDcset )
00242         sf_free( pDcset );
00243     return pOnset;
00244 }

void Abc_NodeEspresso ( Abc_Obj_t pNode  )  [static]

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

FileName [abcEspresso.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Procedures to minimize SOPs using Espresso.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
abcEspresso.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

] DECLARATIONS ///

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

Synopsis [Minimizes SOP representation of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file abcEspresso.c.

00081 {
00082     extern void define_cube_size( int n );
00083     pset_family Cover;
00084     int fCompl;
00085 
00086     assert( Abc_ObjIsNode(pNode) );
00087     // define the cube for this node
00088     define_cube_size( Abc_ObjFaninNum(pNode) );
00089     // create the Espresso cover
00090     fCompl = Abc_SopIsComplement( pNode->pData );
00091     Cover = Abc_SopToEspresso( pNode->pData );
00092     // perform minimization
00093     Cover = Abc_EspressoMinimize( Cover, NULL ); // deletes also cover
00094     // convert back onto the node's SOP representation
00095     pNode->pData = Abc_SopFromEspresso( pNode->pNtk->pManFunc, Cover );
00096     if ( fCompl ) Abc_SopComplement( pNode->pData );
00097     sf_free(Cover);
00098 }

void Abc_NtkEspresso ( Abc_Ntk_t pNtk,
int  fVerbose 
)

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

Synopsis [Minimizes SOP representations using Espresso.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file abcEspresso.c.

00049 {
00050     Abc_Obj_t * pNode;
00051     int i;
00052     assert( Abc_NtkIsLogic(pNtk) );
00053     // convert the network to have SOPs
00054     if ( Abc_NtkHasMapping(pNtk) )
00055         Abc_NtkMapToSop(pNtk);
00056     else if ( Abc_NtkHasBdd(pNtk) )
00057     {
00058         if ( !Abc_NtkBddToSop(pNtk, 0) )
00059         {
00060             printf( "Abc_NtkEspresso(): Converting to SOPs has failed.\n" );
00061             return;
00062         }
00063     }
00064     // minimize SOPs of all nodes
00065     Abc_NtkForEachNode( pNtk, pNode, i )
00066         if ( i ) Abc_NodeEspresso( pNode );
00067 }

char * Abc_SopFromEspresso ( Extra_MmFlex_t pMan,
pset_family  Cover 
) [static]

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

Synopsis [Converts SOP representation in Espresso into SOP in ABC.]

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file abcEspresso.c.

00168 {
00169     pset set;
00170     char * pSop, * pCube;
00171         int Lit, nVars, nCubes, i, k;
00172 
00173         nVars  = Cover->sf_size/2;
00174         nCubes = Cover->count;
00175 
00176     pSop = Abc_SopStart( pMan, nCubes, nVars );
00177 
00178         // go through the cubes
00179     i = 0;
00180     Abc_SopForEachCube( pSop, nVars, pCube )
00181         {
00182                 set = GETSET(Cover, i++);
00183                 for ( k = 0; k < nVars; k++ )
00184                 {
00185                         Lit = GETINPUT(set, k);
00186                         if ( Lit == ZERO )
00187                 pCube[k] = '0';
00188                         else if ( Lit == ONE )
00189                 pCube[k] = '1';
00190                 }
00191         }
00192     return pSop;
00193 }

pset_family Abc_SopToEspresso ( char *  pSop  )  [static]

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

Synopsis [Converts SOP in ABC into SOP representation in Espresso.]

Description []

SideEffects []

SeeAlso []

Definition at line 111 of file abcEspresso.c.

00112 {
00113     char *      pCube;
00114     pset_family Cover;
00115     pset        set;
00116     int         nCubes, nVars, Value, v;
00117     
00118     if ( pSop == NULL ) 
00119         return NULL;
00120     
00121     nVars  = Abc_SopGetVarNum(pSop);
00122     nCubes = Abc_SopGetCubeNum(pSop);
00123     assert( cube.size == 2 * nVars );
00124     
00125     if ( Abc_SopIsConst0(pSop) ) 
00126     {
00127         Cover = sf_new(0, cube.size);
00128         return Cover;
00129     }
00130     if ( Abc_SopIsConst1(pSop) ) 
00131     {
00132         Cover = sf_new(1, cube.size);
00133         set = GETSET(Cover, Cover->count++);
00134         set_copy( set, cube.fullset );
00135         return Cover;
00136     }
00137 
00138     // create the cover
00139     Cover = sf_new(nCubes, cube.size);
00140     // fill in the cubes
00141     Abc_SopForEachCube( pSop, nVars, pCube )
00142     {
00143         set = GETSET(Cover, Cover->count++);
00144         set_copy( set, cube.fullset );
00145         Abc_CubeForEachVar( pCube, Value, v )
00146         {
00147             if ( Value == '0' )
00148                 set_remove(set, 2*v+1);
00149             else if ( Value == '1' )
00150                 set_remove(set, 2*v);
00151         }
00152     }
00153     return Cover;
00154 }


Generated on Tue Jan 5 12:18:36 2010 for abc70930 by  doxygen 1.6.1