src/map/mapper/mapperSwitch.c File Reference

#include "mapperInt.h"
Include dependency graph for mapperSwitch.c:

Go to the source code of this file.

Functions

static float Map_SwitchCutRefDeref (Map_Node_t *pNode, Map_Cut_t *pCut, int fPhase, int fReference)
float Map_SwitchCutGetDerefed (Map_Node_t *pNode, Map_Cut_t *pCut, int fPhase)
float Map_SwitchCutRef (Map_Node_t *pNode, Map_Cut_t *pCut, int fPhase)
float Map_SwitchCutDeref (Map_Node_t *pNode, Map_Cut_t *pCut, int fPhase)
float Map_MappingGetSwitching (Map_Man_t *pMan, Map_NodeVec_t *vMapping)

Function Documentation

float Map_MappingGetSwitching ( Map_Man_t pMan,
Map_NodeVec_t vMapping 
)

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

Synopsis [Computes the array of mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file mapperSwitch.c.

00185 {
00186     Map_Node_t * pNode;
00187     float Switch;
00188     int i;
00189     Switch = 0.0;
00190     for ( i = 0; i < vMapping->nSize; i++ )
00191     {
00192         pNode = vMapping->pArray[i];
00193         // at least one phase has the best cut assigned
00194         assert( pNode->pCutBest[0] != NULL || pNode->pCutBest[1] != NULL );
00195         // at least one phase is used in the mapping
00196         assert( pNode->nRefAct[0] > 0 || pNode->nRefAct[1] > 0 );
00197         // compute the array due to the supergate
00198         if ( Map_NodeIsAnd(pNode) )
00199         {
00200             // count switching of the negative phase
00201             if ( pNode->pCutBest[0] && (pNode->nRefAct[0] > 0 || pNode->pCutBest[1] == NULL) )
00202                 Switch += pNode->Switching;
00203             // count switching of the positive phase
00204             if ( pNode->pCutBest[1] && (pNode->nRefAct[1] > 0 || pNode->pCutBest[0] == NULL) )
00205                 Switch += pNode->Switching;
00206         }
00207         // count switching of the interver if we need to implement one phase with another phase
00208         if ( (pNode->pCutBest[0] == NULL && pNode->nRefAct[0] > 0) || 
00209              (pNode->pCutBest[1] == NULL && pNode->nRefAct[1] > 0) )
00210             Switch += pNode->Switching; // inverter switches the same as the node
00211     }
00212     // add buffers for each CO driven by a CI
00213     for ( i = 0; i < pMan->nOutputs; i++ )
00214         if ( Map_NodeIsVar(pMan->pOutputs[i]) && !Map_IsComplement(pMan->pOutputs[i]) )
00215             Switch += pMan->pOutputs[i]->Switching;
00216     return Switch;
00217 }

float Map_SwitchCutDeref ( Map_Node_t pNode,
Map_Cut_t pCut,
int  fPhase 
)

function*************************************************************

synopsis [References the cut.]

description []

sideeffects []

seealso []

Definition at line 79 of file mapperSwitch.c.

00080 {
00081     return Map_SwitchCutRefDeref( pNode, pCut, fPhase, 0 ); // dereference
00082 }

float Map_SwitchCutGetDerefed ( Map_Node_t pNode,
Map_Cut_t pCut,
int  fPhase 
)

FUNCTION DEFINITIONS ///function*************************************************************

synopsis [Computes the exact area associated with the cut.]

description []

sideeffects []

seealso []

Definition at line 42 of file mapperSwitch.c.

00043 {
00044     float aResult, aResult2;
00045 //    assert( pNode->Switching > 0 );
00046     aResult2 = Map_SwitchCutRefDeref( pNode, pCut, fPhase, 1 ); // reference
00047     aResult  = Map_SwitchCutRefDeref( pNode, pCut, fPhase, 0 ); // dereference
00048 //    assert( aResult == aResult2 );
00049     return aResult;
00050 }

float Map_SwitchCutRef ( Map_Node_t pNode,
Map_Cut_t pCut,
int  fPhase 
)

function*************************************************************

synopsis [References the cut.]

description []

sideeffects []

seealso []

Definition at line 63 of file mapperSwitch.c.

00064 {
00065     return Map_SwitchCutRefDeref( pNode, pCut, fPhase, 1 ); // reference
00066 }

float Map_SwitchCutRefDeref ( Map_Node_t pNode,
Map_Cut_t pCut,
int  fPhase,
int  fReference 
) [static]

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

FileName [mapperSwitch.c]

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

Synopsis [Generic technology mapping engine.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 8, 2003.]

Revision [

Id
mapperSwitch.h,v 1.0 2003/09/08 00:00:00 alanmi Exp

] DECLARATIONS ///

function*************************************************************

synopsis [References or dereferences the cut.]

description [This reference part is similar to Cudd_NodeReclaim(). The dereference part is similar to Cudd_RecursiveDeref().]

sideeffects []

seealso []

Definition at line 96 of file mapperSwitch.c.

00097 {
00098     Map_Node_t * pNodeChild;
00099     Map_Cut_t * pCutChild;
00100     float aSwitchActivity;
00101     int i, fPhaseChild;
00102 
00103     // start switching activity for the node
00104     aSwitchActivity = pNode->Switching;
00105     // consider the elementary variable
00106     if ( pCut->nLeaves == 1 )
00107         return aSwitchActivity;
00108 
00109     // go through the children
00110     assert( pCut->M[fPhase].pSuperBest );
00111     for ( i = 0; i < pCut->nLeaves; i++ )
00112     {
00113         pNodeChild  = pCut->ppLeaves[i];
00114         fPhaseChild = Map_CutGetLeafPhase( pCut, fPhase, i );
00115         // get the reference counter of the child
00116 
00117         if ( fReference )
00118         {
00119             if ( pNodeChild->pCutBest[0] && pNodeChild->pCutBest[1] ) // both phases are present
00120             {
00121                 // if this phase of the node is referenced, there is no recursive call
00122                 pNodeChild->nRefAct[2]++;
00123                 if ( pNodeChild->nRefAct[fPhaseChild]++ > 0 )
00124                     continue;
00125             }
00126             else // only one phase is present
00127             {
00128                 // inverter should be added if the phase
00129                 // (a) has no reference and (b) is implemented using other phase
00130                 if ( pNodeChild->nRefAct[fPhaseChild]++ == 0 && pNodeChild->pCutBest[fPhaseChild] == NULL )
00131                     aSwitchActivity += pNodeChild->Switching; // inverter switches the same as the node
00132                 // if the node is referenced, there is no recursive call
00133                 if ( pNodeChild->nRefAct[2]++ > 0 )
00134                     continue;
00135             }
00136         }
00137         else
00138         {
00139             if ( pNodeChild->pCutBest[0] && pNodeChild->pCutBest[1] ) // both phases are present
00140             {
00141                 // if this phase of the node is referenced, there is no recursive call
00142                 --pNodeChild->nRefAct[2];
00143                 if ( --pNodeChild->nRefAct[fPhaseChild] > 0 )
00144                     continue;
00145             }
00146             else // only one phase is present
00147             {
00148                 // inverter should be added if the phase
00149                 // (a) has no reference and (b) is implemented using other phase
00150                 if ( --pNodeChild->nRefAct[fPhaseChild] == 0 && pNodeChild->pCutBest[fPhaseChild] == NULL )
00151                     aSwitchActivity += pNodeChild->Switching; // inverter switches the same as the node
00152                 // if the node is referenced, there is no recursive call
00153                 if ( --pNodeChild->nRefAct[2] > 0 )
00154                     continue;
00155             }
00156             assert( pNodeChild->nRefAct[fPhaseChild] >= 0 );
00157         }
00158 
00159         // get the child cut
00160         pCutChild = pNodeChild->pCutBest[fPhaseChild];
00161         // if the child does not have this phase mapped, take the opposite phase
00162         if ( pCutChild == NULL )
00163         {
00164             fPhaseChild = !fPhaseChild;
00165             pCutChild   = pNodeChild->pCutBest[fPhaseChild];
00166         }
00167         // reference and compute area recursively
00168         aSwitchActivity += Map_SwitchCutRefDeref( pNodeChild, pCutChild, fPhaseChild, fReference );
00169     }
00170     return aSwitchActivity;
00171 }


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