abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cutTruth.c File Reference
#include "cutInt.h"

Go to the source code of this file.

Functions

static unsigned Cut_TruthPhase (Cut_Cut_t *pCut, Cut_Cut_t *pCut1)
 FUNCTION DEFINITIONS ///. More...
 
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

ABC_NAMESPACE_IMPL_START int nTotal = 0
 DECLARATIONS ///. More...
 
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 177 of file cutTruth.c.

178 {
179  // permute the first table
180  if ( fCompl0 )
181  Extra_TruthNot( p->puTemp[0], Cut_CutReadTruth(pCut0), pCut->nVarsMax );
182  else
183  Extra_TruthCopy( p->puTemp[0], Cut_CutReadTruth(pCut0), pCut->nVarsMax );
184  Extra_TruthStretch( p->puTemp[2], p->puTemp[0], pCut0->nLeaves, pCut->nVarsMax, Cut_TruthPhase(pCut, pCut0) );
185  // permute the second table
186  if ( fCompl1 )
187  Extra_TruthNot( p->puTemp[1], Cut_CutReadTruth(pCut1), pCut->nVarsMax );
188  else
189  Extra_TruthCopy( p->puTemp[1], Cut_CutReadTruth(pCut1), pCut->nVarsMax );
190  Extra_TruthStretch( p->puTemp[3], p->puTemp[1], pCut1->nLeaves, pCut->nVarsMax, Cut_TruthPhase(pCut, pCut1) );
191  // produce the resulting table
192  if ( pCut->fCompl )
193  Extra_TruthNand( Cut_CutReadTruth(pCut), p->puTemp[2], p->puTemp[3], pCut->nVarsMax );
194  else
195  Extra_TruthAnd( Cut_CutReadTruth(pCut), p->puTemp[2], p->puTemp[3], pCut->nVarsMax );
196 
197 // Ivy_TruthTestOne( *Cut_CutReadTruth(pCut) );
198 
199  // quit if no fancy computation is needed
200  if ( !p->pParams->fFancy )
201  return;
202 
203  if ( pCut->nLeaves != 7 )
204  return;
205 
206  // count the total number of truth tables computed
207  nTotal++;
208 
209  // MAPPING INTO ALTERA 6-2 LOGIC BLOCKS
210  // call this procedure to find the minimum number of common variables in the cofactors
211  // if this number is less or equal than 3, the cut can be implemented using the 6-2 logic block
212  if ( Extra_TruthMinCofSuppOverlap( Cut_CutReadTruth(pCut), pCut->nVarsMax, NULL ) <= 4 )
213  nGood++;
214 
215  // MAPPING INTO ACTEL 2x2 CELLS
216  // call this procedure to see if a semi-canonical form can be found in the lookup table
217  // (if it exists, then a two-level 3-input LUT implementation of the cut exists)
218  // Before this procedure is called, cell manager should be defined by calling
219  // Cut_CellLoad (make sure file "cells22_daomap_iwls.txt" is available in the working dir)
220 // if ( Cut_CellIsRunning() && pCut->nVarsMax <= 9 )
221 // nGood += Cut_CellTruthLookup( Cut_CutReadTruth(pCut), pCut->nVarsMax );
222 }
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
Definition: cut.h:94
static unsigned Cut_TruthPhase(Cut_Cut_t *pCut, Cut_Cut_t *pCut1)
FUNCTION DEFINITIONS ///.
Definition: cutTruth.c:56
ABC_NAMESPACE_IMPL_START int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
unsigned nLeaves
Definition: cut.h:84
static void Extra_TruthAnd(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:326
void Extra_TruthStretch(unsigned *pOut, unsigned *pIn, int nVars, int nVarsAll, unsigned Phase)
int Extra_TruthMinCofSuppOverlap(unsigned *pTruth, int nVars, int *pVarMin)
int nGood
Definition: cutTruth.c:38
unsigned fCompl
Definition: cut.h:82
Cut_Params_t * pParams
Definition: cutInt.h:51
unsigned * puTemp[4]
Definition: cutInt.h:73
static void Extra_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
Definition: extra.h:320
unsigned nVarsMax
Definition: cut.h:83
static void Extra_TruthCopy(unsigned *pOut, unsigned *pIn, int nVars)
Definition: extra.h:302
static void Extra_TruthNand(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:344
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 126 of file cutTruth.c.

127 {
128  static unsigned uTruth0[8], uTruth1[8];
129  int nTruthWords = Cut_TruthWords( pCut->nVarsMax );
130  unsigned * pTruthRes;
131  int i, uPhase;
132 
133  // permute the first table
134  uPhase = Cut_TruthPhase( pCut, pCut0 );
135  Extra_TruthExpand( pCut->nVarsMax, nTruthWords, Cut_CutReadTruth(pCut0), uPhase, uTruth0 );
136  if ( fCompl0 )
137  {
138  for ( i = 0; i < nTruthWords; i++ )
139  uTruth0[i] = ~uTruth0[i];
140  }
141 
142  // permute the second table
143  uPhase = Cut_TruthPhase( pCut, pCut1 );
144  Extra_TruthExpand( pCut->nVarsMax, nTruthWords, Cut_CutReadTruth(pCut1), uPhase, uTruth1 );
145  if ( fCompl1 )
146  {
147  for ( i = 0; i < nTruthWords; i++ )
148  uTruth1[i] = ~uTruth1[i];
149  }
150 
151  // write the resulting table
152  pTruthRes = Cut_CutReadTruth(pCut);
153 
154  if ( pCut->fCompl )
155  {
156  for ( i = 0; i < nTruthWords; i++ )
157  pTruthRes[i] = ~(uTruth0[i] & uTruth1[i]);
158  }
159  else
160  {
161  for ( i = 0; i < nTruthWords; i++ )
162  pTruthRes[i] = uTruth0[i] & uTruth1[i];
163  }
164 }
static int Cut_TruthWords(int nVarsMax)
Definition: cutInt.h:125
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
Definition: cut.h:94
static unsigned Cut_TruthPhase(Cut_Cut_t *pCut, Cut_Cut_t *pCut1)
FUNCTION DEFINITIONS ///.
Definition: cutTruth.c:56
void Extra_TruthExpand(int nVars, int nWords, unsigned *puTruth, unsigned uPhase, unsigned *puTruthR)
unsigned fCompl
Definition: cut.h:82
unsigned nVarsMax
Definition: cut.h:83
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 85 of file cutTruth.c.

86 {
87  unsigned uTruth;
88  unsigned * uCanon2;
89  char * pPhases2;
90  assert( pCut->nVarsMax < 6 );
91 
92  // get the direct truth table
93  uTruth = *Cut_CutReadTruth(pCut);
94 
95  // compute the direct truth table
96  Extra_TruthCanonFastN( pCut->nVarsMax, pCut->nLeaves, &uTruth, &uCanon2, &pPhases2 );
97 // uCanon[0] = uCanon2[0];
98 // uCanon[1] = (p->nVarsMax == 6)? uCanon2[1] : uCanon2[0];
99 // uPhases[0] = pPhases2[0];
100  pCut->uCanon0 = uCanon2[0];
101  pCut->Num0 = pPhases2[0];
102 
103  // get the complemented truth table
104  uTruth = ~*Cut_CutReadTruth(pCut);
105 
106  // compute the direct truth table
107  Extra_TruthCanonFastN( pCut->nVarsMax, pCut->nLeaves, &uTruth, &uCanon2, &pPhases2 );
108 // uCanon[0] = uCanon2[0];
109 // uCanon[1] = (p->nVarsMax == 6)? uCanon2[1] : uCanon2[0];
110 // uPhases[0] = pPhases2[0];
111  pCut->uCanon1 = uCanon2[0];
112  pCut->Num1 = pPhases2[0];
113 }
int Extra_TruthCanonFastN(int nVarsMax, int nVarsReal, unsigned *pt, unsigned **pptRes, char **ppfRes)
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
Definition: cut.h:94
unsigned uCanon1
Definition: cut.h:87
unsigned nLeaves
Definition: cut.h:84
unsigned Num0
Definition: cut.h:79
unsigned uCanon0
Definition: cut.h:86
#define assert(ex)
Definition: util_old.h:213
unsigned Num1
Definition: cut.h:80
unsigned nVarsMax
Definition: cut.h:83
static unsigned Cut_TruthPhase ( Cut_Cut_t pCut,
Cut_Cut_t pCut1 
)
inlinestatic

FUNCTION DEFINITIONS ///.

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file cutTruth.c.

57 {
58  unsigned uPhase = 0;
59  int i, k;
60  for ( i = k = 0; i < (int)pCut->nLeaves; i++ )
61  {
62  if ( k == (int)pCut1->nLeaves )
63  break;
64  if ( pCut->pLeaves[i] < pCut1->pLeaves[k] )
65  continue;
66  assert( pCut->pLeaves[i] == pCut1->pLeaves[k] );
67  uPhase |= (1 << i);
68  k++;
69  }
70  return uPhase;
71 }
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
#define assert(ex)
Definition: util_old.h:213

Variable Documentation

int nEqual = 0

Definition at line 39 of file cutTruth.c.

int nGood = 0

Definition at line 38 of file cutTruth.c.

ABC_NAMESPACE_IMPL_START int nTotal = 0

DECLARATIONS ///.

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

]

Definition at line 37 of file cutTruth.c.