src/opt/rwr/rwrDec.c File Reference

#include "rwr.h"
#include "dec.h"
Include dependency graph for rwrDec.c:

Go to the source code of this file.

Functions

static Dec_Graph_tRwr_NodePreprocess (Rwr_Man_t *p, Rwr_Node_t *pNode)
static Dec_Edge_t Rwr_TravCollect_rec (Rwr_Man_t *p, Rwr_Node_t *pNode, Dec_Graph_t *pGraph)
void Rwr_ManPreprocess (Rwr_Man_t *p)

Function Documentation

void Rwr_ManPreprocess ( Rwr_Man_t p  ) 

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

Synopsis [Preprocesses computed library of subgraphs.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file rwrDec.c.

00047 {
00048     Dec_Graph_t * pGraph;
00049     Rwr_Node_t * pNode;
00050     int i, k;
00051     // put the nodes into the structure
00052     p->pMapInv  = ALLOC( unsigned short, 222 );
00053     memset( p->pMapInv, 0, sizeof(unsigned short) * 222 );
00054     p->vClasses = Vec_VecStart( 222 );
00055     for ( i = 0; i < p->nFuncs; i++ )
00056     {
00057         if ( p->pTable[i] == NULL )
00058             continue;
00059         // consider all implementations of this function
00060         for ( pNode = p->pTable[i]; pNode; pNode = pNode->pNext )
00061         {
00062             assert( pNode->uTruth == p->pTable[i]->uTruth );
00063             assert( p->pMap[pNode->uTruth] >= 0 && p->pMap[pNode->uTruth] < 222 );
00064             Vec_VecPush( p->vClasses, p->pMap[pNode->uTruth], pNode );
00065             p->pMapInv[ p->pMap[pNode->uTruth] ] = p->puCanons[pNode->uTruth];
00066         }
00067     }
00068     // compute decomposition forms for each node and verify them
00069     Vec_VecForEachEntry( p->vClasses, pNode, i, k )
00070     {
00071         pGraph = Rwr_NodePreprocess( p, pNode );
00072         pNode->pNext = (Rwr_Node_t *)pGraph;
00073         assert( pNode->uTruth == (Dec_GraphDeriveTruth(pGraph) & 0xFFFF) );
00074     }
00075 }

Dec_Graph_t * Rwr_NodePreprocess ( Rwr_Man_t p,
Rwr_Node_t pNode 
) [static]

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

FileName [rwrDec.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [DAG-aware AIG rewriting package.]

Synopsis [Evaluation and decomposition procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

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

Synopsis [Preprocesses subgraphs rooted at this node.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file rwrDec.c.

00089 {
00090     Dec_Graph_t * pGraph;
00091     Dec_Edge_t eRoot;
00092     assert( !Rwr_IsComplement(pNode) );
00093     // consider constant
00094     if ( pNode->uTruth == 0 )
00095         return Dec_GraphCreateConst0();
00096     // consider the case of elementary var
00097     if ( pNode->uTruth == 0x00FF )
00098         return Dec_GraphCreateLeaf( 3, 4, 1 );
00099     // start the subgraphs
00100     pGraph = Dec_GraphCreate( 4 );
00101     // collect the nodes
00102     Rwr_ManIncTravId( p );
00103     eRoot = Rwr_TravCollect_rec( p, pNode, pGraph );
00104     Dec_GraphSetRoot( pGraph, eRoot );
00105     return pGraph;
00106 }

Dec_Edge_t Rwr_TravCollect_rec ( Rwr_Man_t p,
Rwr_Node_t pNode,
Dec_Graph_t pGraph 
) [static]

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

Synopsis [Adds one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 119 of file rwrDec.c.

00120 {
00121     Dec_Edge_t eNode0, eNode1, eNode;
00122     // elementary variable
00123     if ( pNode->fUsed )
00124         return Dec_EdgeCreate( pNode->Id - 1, 0 );
00125     // previously visited node
00126     if ( pNode->TravId == p->nTravIds )
00127         return Dec_IntToEdge( pNode->Volume );
00128     pNode->TravId = p->nTravIds;
00129     // solve for children
00130     eNode0 = Rwr_TravCollect_rec( p, Rwr_Regular(pNode->p0), pGraph );
00131     if ( Rwr_IsComplement(pNode->p0) )    
00132         eNode0.fCompl = !eNode0.fCompl;
00133     eNode1 = Rwr_TravCollect_rec( p, Rwr_Regular(pNode->p1), pGraph );
00134     if ( Rwr_IsComplement(pNode->p1) )    
00135         eNode1.fCompl = !eNode1.fCompl;
00136     // create the decomposition node(s)
00137     if ( pNode->fExor )
00138         eNode = Dec_GraphAddNodeXor( pGraph, eNode0, eNode1, 0 );
00139     else
00140         eNode = Dec_GraphAddNodeAnd( pGraph, eNode0, eNode1 );
00141     // save the result
00142     pNode->Volume = Dec_EdgeToInt( eNode );
00143     return eNode;
00144 }


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