src/opt/cut/cutTruth.c File Reference

#include "cutInt.h"
Include dependency graph for cutTruth.c:

Go to the source code of this file.

Functions

static unsigned Cut_TruthPhase (Cut_Cut_t *pCut, Cut_Cut_t *pCut1)
void Cut_TruthNCanonicize (Cut_Cut_t *pCut)
void Cut_TruthComputeOld (Cut_Cut_t *pCut, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1, int fCompl0, int fCompl1)
void Cut_TruthCompute (Cut_Man_t *p, Cut_Cut_t *pCut, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1, int fCompl0, int fCompl1)

Variables

int nTotal = 0
int nGood = 0
int nEqual = 0

Function Documentation

void Cut_TruthCompute ( Cut_Man_t p,
Cut_Cut_t pCut,
Cut_Cut_t pCut0,
Cut_Cut_t pCut1,
int  fCompl0,
int  fCompl1 
)

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

Synopsis [Performs truth table computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file cutTruth.c.

00174 {
00175     // permute the first table
00176     if ( fCompl0 ) 
00177         Extra_TruthNot( p->puTemp[0], Cut_CutReadTruth(pCut0), pCut->nVarsMax );
00178     else
00179         Extra_TruthCopy( p->puTemp[0], Cut_CutReadTruth(pCut0), pCut->nVarsMax );
00180     Extra_TruthStretch( p->puTemp[2], p->puTemp[0], pCut0->nLeaves, pCut->nVarsMax, Cut_TruthPhase(pCut, pCut0) );
00181     // permute the second table
00182     if ( fCompl1 ) 
00183         Extra_TruthNot( p->puTemp[1], Cut_CutReadTruth(pCut1), pCut->nVarsMax );
00184     else
00185         Extra_TruthCopy( p->puTemp[1], Cut_CutReadTruth(pCut1), pCut->nVarsMax );
00186     Extra_TruthStretch( p->puTemp[3], p->puTemp[1], pCut1->nLeaves, pCut->nVarsMax, Cut_TruthPhase(pCut, pCut1) );
00187     // produce the resulting table
00188     if ( pCut->fCompl )
00189         Extra_TruthNand( Cut_CutReadTruth(pCut), p->puTemp[2], p->puTemp[3], pCut->nVarsMax );
00190     else
00191         Extra_TruthAnd( Cut_CutReadTruth(pCut), p->puTemp[2], p->puTemp[3], pCut->nVarsMax );
00192 
00193 //    Ivy_TruthTestOne( *Cut_CutReadTruth(pCut) );
00194 
00195     // quit if no fancy computation is needed
00196     if ( !p->pParams->fFancy )
00197         return;
00198 
00199     if ( pCut->nLeaves != 7 )
00200         return;
00201 
00202     // count the total number of truth tables computed
00203     nTotal++;
00204 
00205     // MAPPING INTO ALTERA 6-2 LOGIC BLOCKS
00206     // call this procedure to find the minimum number of common variables in the cofactors
00207     // if this number is less or equal than 3, the cut can be implemented using the 6-2 logic block
00208     if ( Extra_TruthMinCofSuppOverlap( Cut_CutReadTruth(pCut), pCut->nVarsMax, NULL ) <= 4 )
00209         nGood++;
00210 
00211     // MAPPING INTO ACTEL 2x2 CELLS
00212     // call this procedure to see if a semi-canonical form can be found in the lookup table 
00213     // (if it exists, then a two-level 3-input LUT implementation of the cut exists)
00214     // Before this procedure is called, cell manager should be defined by calling
00215     // Cut_CellLoad (make sure file "cells22_daomap_iwls.txt" is available in the working dir)
00216 //    if ( Cut_CellIsRunning() && pCut->nVarsMax <= 9 )
00217 //        nGood += Cut_CellTruthLookup( Cut_CutReadTruth(pCut), pCut->nVarsMax );
00218 }

void Cut_TruthComputeOld ( Cut_Cut_t pCut,
Cut_Cut_t pCut0,
Cut_Cut_t pCut1,
int  fCompl0,
int  fCompl1 
)

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

Synopsis [Performs truth table computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file cutTruth.c.

00123 {
00124     static unsigned uTruth0[8], uTruth1[8];
00125     int nTruthWords = Cut_TruthWords( pCut->nVarsMax );
00126     unsigned * pTruthRes;
00127     int i, uPhase;
00128 
00129     // permute the first table
00130     uPhase = Cut_TruthPhase( pCut, pCut0 );
00131     Extra_TruthExpand( pCut->nVarsMax, nTruthWords, Cut_CutReadTruth(pCut0), uPhase, uTruth0 );
00132     if ( fCompl0 ) 
00133     {
00134         for ( i = 0; i < nTruthWords; i++ )
00135             uTruth0[i] = ~uTruth0[i];
00136     }
00137 
00138     // permute the second table
00139     uPhase = Cut_TruthPhase( pCut, pCut1 );
00140     Extra_TruthExpand( pCut->nVarsMax, nTruthWords, Cut_CutReadTruth(pCut1), uPhase, uTruth1 );
00141     if ( fCompl1 ) 
00142     {
00143         for ( i = 0; i < nTruthWords; i++ )
00144             uTruth1[i] = ~uTruth1[i];
00145     }
00146 
00147     // write the resulting table
00148     pTruthRes = Cut_CutReadTruth(pCut);
00149 
00150     if ( pCut->fCompl )
00151     {
00152         for ( i = 0; i < nTruthWords; i++ )
00153             pTruthRes[i] = ~(uTruth0[i] & uTruth1[i]);
00154     }
00155     else
00156     {
00157         for ( i = 0; i < nTruthWords; i++ )
00158             pTruthRes[i] = uTruth0[i] & uTruth1[i];
00159     }
00160 }

void Cut_TruthNCanonicize ( Cut_Cut_t pCut  ) 

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

Synopsis [Performs truth table computation.]

Description [This procedure cannot be used while recording oracle because it will overwrite Num0 and Num1.]

SideEffects []

SeeAlso []

Definition at line 81 of file cutTruth.c.

00082 {
00083     unsigned uTruth;
00084     unsigned * uCanon2;
00085     char * pPhases2;
00086     assert( pCut->nVarsMax < 6 );
00087 
00088     // get the direct truth table
00089     uTruth = *Cut_CutReadTruth(pCut);
00090 
00091     // compute the direct truth table
00092     Extra_TruthCanonFastN( pCut->nVarsMax, pCut->nLeaves, &uTruth, &uCanon2, &pPhases2 );
00093 //    uCanon[0] = uCanon2[0];
00094 //    uCanon[1] = (p->nVarsMax == 6)? uCanon2[1] : uCanon2[0];
00095 //    uPhases[0] = pPhases2[0];
00096     pCut->uCanon0 = uCanon2[0];
00097     pCut->Num0    = pPhases2[0];
00098 
00099     // get the complemented truth table
00100     uTruth = ~*Cut_CutReadTruth(pCut);
00101 
00102     // compute the direct truth table
00103     Extra_TruthCanonFastN( pCut->nVarsMax, pCut->nLeaves, &uTruth, &uCanon2, &pPhases2 );
00104 //    uCanon[0] = uCanon2[0];
00105 //    uCanon[1] = (p->nVarsMax == 6)? uCanon2[1] : uCanon2[0];
00106 //    uPhases[0] = pPhases2[0];
00107     pCut->uCanon1 = uCanon2[0];
00108     pCut->Num1    = pPhases2[0];
00109 }

static unsigned Cut_TruthPhase ( Cut_Cut_t pCut,
Cut_Cut_t pCut1 
) [inline, static]

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

Synopsis [Computes the stretching phase of the cut w.r.t. the merged cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file cutTruth.c.

00053 {
00054     unsigned uPhase = 0;
00055     int i, k;
00056     for ( i = k = 0; i < (int)pCut->nLeaves; i++ )
00057     {
00058         if ( k == (int)pCut1->nLeaves )
00059             break;
00060         if ( pCut->pLeaves[i] < pCut1->pLeaves[k] )
00061             continue;
00062         assert( pCut->pLeaves[i] == pCut1->pLeaves[k] );
00063         uPhase |= (1 << i);
00064         k++;
00065     }
00066     return uPhase;
00067 }


Variable Documentation

int nEqual = 0
int nGood = 0
int nTotal = 0

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

FileName [cutTruth.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [K-feasible cut computation package.]

Synopsis [Incremental truth table computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///


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