abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ifTruth.c File Reference
#include "if.h"
#include "bool/kit/kit.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void If_CutTruthPermute (word *pTruth, int nLeaves, int nVars, int nWords, float *pDelays, int *pVars)
 DECLARATIONS ///. More...
 
void If_CutRotatePins (If_Man_t *p, If_Cut_t *pCut)
 
int If_CutComputeTruth (If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)
 
int If_CutComputeTruthPerm_int (If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int iCutFunc0, int iCutFunc1)
 
int If_CutComputeTruthPerm (If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int iCutFunc0, int iCutFunc1)
 

Function Documentation

int If_CutComputeTruth ( If_Man_t p,
If_Cut_t pCut,
If_Cut_t pCut0,
If_Cut_t pCut1,
int  fCompl0,
int  fCompl1 
)

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

Synopsis [Truth table computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file ifTruth.c.

99 {
100  int fCompl, truthId, nLeavesNew, PrevSize, RetValue = 0;
101  word * pTruth0s = Vec_MemReadEntry( p->vTtMem[pCut0->nLeaves], Abc_Lit2Var(pCut0->iCutFunc) );
102  word * pTruth1s = Vec_MemReadEntry( p->vTtMem[pCut1->nLeaves], Abc_Lit2Var(pCut1->iCutFunc) );
103  word * pTruth0 = (word *)p->puTemp[0];
104  word * pTruth1 = (word *)p->puTemp[1];
105  word * pTruth = (word *)p->puTemp[2];
106  Abc_TtCopy( pTruth0, pTruth0s, p->nTruth6Words[pCut0->nLeaves], fCompl0 ^ pCut0->fCompl ^ Abc_LitIsCompl(pCut0->iCutFunc) );
107  Abc_TtCopy( pTruth1, pTruth1s, p->nTruth6Words[pCut1->nLeaves], fCompl1 ^ pCut1->fCompl ^ Abc_LitIsCompl(pCut1->iCutFunc) );
108  Abc_TtStretch6( pTruth0, pCut0->nLeaves, pCut->nLeaves );
109  Abc_TtStretch6( pTruth1, pCut1->nLeaves, pCut->nLeaves );
110  Abc_TtExpand( pTruth0, pCut->nLeaves, pCut0->pLeaves, pCut0->nLeaves, pCut->pLeaves, pCut->nLeaves );
111  Abc_TtExpand( pTruth1, pCut->nLeaves, pCut1->pLeaves, pCut1->nLeaves, pCut->pLeaves, pCut->nLeaves );
112  fCompl = (pTruth0[0] & pTruth1[0] & 1);
113  Abc_TtAnd( pTruth, pTruth0, pTruth1, p->nTruth6Words[pCut->nLeaves], fCompl );
114  if ( p->pPars->fCutMin && (pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || pCut0->nLeaves == 0 || pCut1->nLeaves == 0) )
115  {
116  nLeavesNew = Abc_TtMinBase( pTruth, pCut->pLeaves, pCut->nLeaves, pCut->nLeaves );
117  if ( nLeavesNew < If_CutLeaveNum(pCut) )
118  {
119  pCut->nLeaves = nLeavesNew;
120  pCut->uSign = If_ObjCutSignCompute( pCut );
121  RetValue = 1;
122  }
123  }
124  PrevSize = Vec_MemEntryNum( p->vTtMem[pCut->nLeaves] );
125  truthId = Vec_MemHashInsert( p->vTtMem[pCut->nLeaves], pTruth );
126  pCut->iCutFunc = Abc_Var2Lit( truthId, fCompl );
127  assert( (pTruth[0] & 1) == 0 );
128 #ifdef IF_TRY_NEW
129  {
130  word pCopy[1024];
131  char pCanonPerm[16];
132  memcpy( pCopy, If_CutTruthW(pCut), sizeof(word) * p->nTruth6Words[pCut->nLeaves] );
133  Abc_TtCanonicize( pCopy, pCut->nLeaves, pCanonPerm );
134  }
135 #endif
136  if ( p->vTtIsops[pCut->nLeaves] && PrevSize != Vec_MemEntryNum(p->vTtMem[pCut->nLeaves]) )
137  {
138  Vec_Int_t * vLevel = Vec_WecPushLevel( p->vTtIsops[pCut->nLeaves] );
139  fCompl = Kit_TruthIsop( (unsigned *)pTruth, pCut->nLeaves, p->vCover, 1 );
140  if ( fCompl >= 0 )
141  {
142  Vec_IntGrow( vLevel, Vec_IntSize(p->vCover) );
143  Vec_IntAppend( vLevel, p->vCover );
144  if ( fCompl )
145  vLevel->nCap ^= (1<<16); // hack to remember complemented attribute
146  }
147  assert( Vec_WecSize(p->vTtIsops[pCut->nLeaves]) == Vec_MemEntryNum(p->vTtMem[pCut->nLeaves]) );
148  }
149  return RetValue;
150 }
int nTruth6Words[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:226
unsigned nLeaves
Definition: if.h:289
static int Abc_TtMinBase(word *pTruth, int *pVars, int nVars, int nVarsAll)
Definition: utilTruth.h:1395
Vec_Wec_t * vTtIsops[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:245
Vec_Mem_t * vTtMem[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:244
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
static Vec_Int_t * Vec_WecPushLevel(Vec_Wec_t *p)
Definition: vecWec.h:284
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
char * memcpy()
static int Vec_MemEntryNum(Vec_Mem_t *p)
Definition: vecMem.h:151
static int Vec_WecSize(Vec_Wec_t *p)
Definition: vecWec.h:193
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: bblif.c:336
static word * If_CutTruthW(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:421
int pLeaves[0]
Definition: if.h:290
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static unsigned If_ObjCutSignCompute(If_Cut_t *p)
Definition: if.h:403
unsigned * puTemp[4]
Definition: if.h:203
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
FUNCTION DEFINITIONS ///.
Definition: kitIsop.c:55
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Abc_TtStretch6(word *pInOut, int nVarS, int nVarB)
Definition: utilTruth.h:693
static void Vec_IntAppend(Vec_Int_t *vVec1, Vec_Int_t *vVec2)
Vec_Int_t * vCover
Definition: if.h:214
If_Par_t * pPars
Definition: if.h:184
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Abc_TtExpand(word *pTruth0, int nVars, int *pCut0, int nCutSize0, int *pCut, int nCutSize)
Definition: utilTruth.h:1360
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
Definition: dauCanon.c:895
unsigned uSign
Definition: if.h:283
int fCutMin
Definition: if.h:120
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
Definition: vecMem.h:351
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl
Definition: if.h:285
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)
Definition: vecMem.h:191
static void Abc_TtAnd(word *pOut, word *pIn1, word *pIn2, int nWords, int fCompl)
Definition: utilTruth.h:231
int iCutFunc
Definition: if.h:281
int If_CutComputeTruthPerm ( If_Man_t p,
If_Cut_t pCut,
If_Cut_t pCut0,
If_Cut_t pCut1,
int  iCutFunc0,
int  iCutFunc1 
)

Definition at line 263 of file ifTruth.c.

264 {
265  abctime clk = 0;
266  int i, Num, nEntriesOld, RetValue;
267  if ( pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || iCutFunc0 < 2 || iCutFunc1 < 2 )
268  {
269 if ( p->pPars->fVerbose )
270 clk = Abc_Clock();
271  RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 );
272 if ( p->pPars->fVerbose )
273 p->timeCache[0] += Abc_Clock() - clk;
274  return RetValue;
275  }
276  assert( pCut0->nLeaves + pCut1->nLeaves == pCut->nLeaves );
277  nEntriesOld = Hash_IntManEntryNum(p->vPairHash);
278  Num = Hash_Int2ManInsert( p->vPairHash, (iCutFunc0 << 5)|pCut0->nLeaves, (iCutFunc1 << 5)|pCut1->nLeaves, -1 );
279  assert( Num > 0 );
280  if ( nEntriesOld == Hash_IntManEntryNum(p->vPairHash) )
281  {
282  char * pCanonPerm;
283  int v, pPerm[IF_MAX_LUTSIZE];
284  pCut->iCutFunc = Vec_IntEntry( p->vPairRes, Num );
285  // move complements from the fanin cuts
286  for ( v = 0; v < (int)pCut->nLeaves; v++ )
287  if ( v < (int)pCut0->nLeaves )
288  pCut->pLeaves[v] = Abc_Var2Lit( pCut->pLeaves[v], If_CutLeafBit(pCut0, v) );
289  else
290  pCut->pLeaves[v] = Abc_Var2Lit( pCut->pLeaves[v], If_CutLeafBit(pCut1, v-(int)pCut0->nLeaves) );
291  // reorder the cut
292  pCanonPerm = Vec_StrEntryP( p->vPairPerms, Num * pCut->nLimit );
293  for ( v = 0; v < (int)pCut->nLeaves; v++ )
294  pPerm[v] = Abc_LitNotCond( pCut->pLeaves[Abc_Lit2Var((int)pCanonPerm[v])], Abc_LitIsCompl((int)pCanonPerm[v]) );
295  // generate the result
296  pCut->uMaskFunc = 0;
297  for ( v = 0; v < (int)pCut->nLeaves; v++ )
298  {
299  pCut->pLeaves[v] = Abc_Lit2Var(pPerm[v]);
300  if ( Abc_LitIsCompl(pPerm[v]) )
301  pCut->uMaskFunc |= (1 << v);
302  }
303 // printf( "Found: %d(%d) %d(%d) -> %d(%d)\n", iCutFunc0, pCut0->nLeaves, iCutFunc1, pCut0->nLeaves, pCut->iCutFunc, pCut->nLeaves );
304  p->nCacheHits++;
305 //p->timeCache[1] += Abc_Clock() - clk;
306  return 0;
307  }
308 if ( p->pPars->fVerbose )
309 clk = Abc_Clock();
310  p->nCacheMisses++;
311  RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 );
312  assert( RetValue == 0 );
313 // printf( "Added: %d(%d) %d(%d) -> %d(%d)\n", iCutFunc0, pCut0->nLeaves, iCutFunc1, pCut0->nLeaves, pCut->iCutFunc, pCut->nLeaves );
314  // save the result
315  assert( Num == Vec_IntSize(p->vPairRes) );
316  Vec_IntPush( p->vPairRes, pCut->iCutFunc );
317  // save the permutation
318  assert( Num * (int)pCut->nLimit == Vec_StrSize(p->vPairPerms) );
319  for ( i = 0; i < (int)pCut->nLeaves; i++ )
320  Vec_StrPush( p->vPairPerms, (char)Abc_Var2Lit((int)p->pCanonPerm[i], ((p->uCanonPhase>>i)&1)) );
321  for ( i = (int)pCut0->nLeaves + (int)pCut1->nLeaves; i < (int)pCut->nLimit; i++ )
322  Vec_StrPush( p->vPairPerms, (char)-1 );
323 if ( p->pPars->fVerbose )
324 p->timeCache[2] += Abc_Clock() - clk;
325  return 0;
326 }
unsigned nLeaves
Definition: if.h:289
static int Hash_IntManEntryNum(Hash_IntMan_t *p)
Definition: vecHash.h:101
unsigned nLimit
Definition: if.h:288
int fVerbose
Definition: if.h:140
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
Hash_IntMan_t * vPairHash
Definition: if.h:250
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
int nCacheMisses
Definition: if.h:256
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
int pLeaves[0]
Definition: if.h:290
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
#define IF_MAX_LUTSIZE
INCLUDES ///.
Definition: if.h:52
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
int If_CutComputeTruthPerm_int(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int iCutFunc0, int iCutFunc1)
Definition: ifTruth.c:163
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int pPerm[13719]
Definition: rwrTemp.c:32
static int Hash_Int2ManInsert(Hash_IntMan_t *p, int iData0, int iData1, int iData2)
Definition: vecHash.h:144
abctime timeCache[6]
Definition: if.h:257
int nCacheHits
Definition: if.h:255
Vec_Int_t * vPairRes
Definition: if.h:251
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
static int If_CutLeafBit(If_Cut_t *pCut, int i)
Definition: if.h:396
If_Par_t * pPars
Definition: if.h:184
int uMaskFunc
Definition: if.h:282
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
char pCanonPerm[IF_MAX_LUTSIZE]
Definition: if.h:253
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
int iCutFunc
Definition: if.h:281
Vec_Str_t * vPairPerms
Definition: if.h:252
static char * Vec_StrEntryP(Vec_Str_t *p, int i)
Definition: vecStr.h:353
unsigned uCanonPhase
Definition: if.h:254
int If_CutComputeTruthPerm_int ( If_Man_t p,
If_Cut_t pCut,
If_Cut_t pCut0,
If_Cut_t pCut1,
int  iCutFunc0,
int  iCutFunc1 
)

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

Synopsis [Truth table computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file ifTruth.c.

164 {
165  int fVerbose = 0;
166  abctime clk = 0;
167  int pPerm[IF_MAX_LUTSIZE];
168  int v, Place, fCompl, truthId, nLeavesNew, RetValue = 0;
169  word * pTruth0s = Vec_MemReadEntry( p->vTtMem[pCut0->nLeaves], Abc_Lit2Var(iCutFunc0) );
170  word * pTruth1s = Vec_MemReadEntry( p->vTtMem[pCut1->nLeaves], Abc_Lit2Var(iCutFunc1) );
171  word * pTruth0 = (word *)p->puTemp[0];
172  word * pTruth1 = (word *)p->puTemp[1];
173  word * pTruth = (word *)p->puTemp[2];
174  assert( pCut0->uMaskFunc >= 0 );
175  assert( pCut1->uMaskFunc >= 0 );
176  Abc_TtCopy( pTruth0, pTruth0s, p->nTruth6Words[pCut0->nLeaves], Abc_LitIsCompl(iCutFunc0) );
177  Abc_TtCopy( pTruth1, pTruth1s, p->nTruth6Words[pCut1->nLeaves], Abc_LitIsCompl(iCutFunc1) );
178  Abc_TtStretch6( pTruth0, pCut0->nLeaves, pCut->nLeaves );
179  Abc_TtStretch6( pTruth1, pCut1->nLeaves, pCut->nLeaves );
180 
181 if ( fVerbose )
182 {
183 //Kit_DsdPrintFromTruth( pTruth0, pCut0->nLeaves ); printf( "\n" );
184 //Kit_DsdPrintFromTruth( pTruth1, pCut1->nLeaves ); printf( "\n" );
185 }
186  // create literals
187  for ( v = 0; v < (int)pCut0->nLeaves; v++ )
188  pCut->pLeaves[v] = Abc_Var2Lit( pCut0->pLeaves[v], If_CutLeafBit(pCut0, v) );
189  for ( v = 0; v < (int)pCut1->nLeaves; v++ )
190  if ( p->pPerm[1][v] >= (int)pCut0->nLeaves )
191  pCut->pLeaves[p->pPerm[1][v]] = Abc_Var2Lit( pCut1->pLeaves[v], If_CutLeafBit(pCut1, v) );
192  else if ( If_CutLeafBit(pCut0, p->pPerm[1][v]) != If_CutLeafBit(pCut1, v) )
193  Abc_TtFlip( pTruth1, p->nTruth6Words[pCut1->nLeaves], v );
194  // permute variables
195  for ( v = (int)pCut1->nLeaves; v < (int)pCut->nLeaves; v++ )
196  p->pPerm[1][v] = -1;
197  for ( v = 0; v < (int)pCut1->nLeaves; v++ )
198  {
199  Place = p->pPerm[1][v];
200  if ( Place == v || Place == -1 )
201  continue;
202  Abc_TtSwapVars( pTruth1, pCut->nLeaves, v, Place );
203  p->pPerm[1][v] = p->pPerm[1][Place];
204  p->pPerm[1][Place] = Place;
205  v--;
206  }
207 
208 if ( fVerbose )
209 {
210 //Kit_DsdPrintFromTruth( pTruth0, pCut0->nLeaves ); printf( "\n" );
211 //Kit_DsdPrintFromTruth( pTruth1, pCut->nLeaves ); printf( "\n" );
212 }
213 
214  // perform operation
215  Abc_TtAnd( pTruth, pTruth0, pTruth1, p->nTruth6Words[pCut->nLeaves], 0 );
216  // minimize support
217  if ( p->pPars->fCutMin && (pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || pCut0->nLeaves == 0 || pCut1->nLeaves == 0) )
218  {
219  nLeavesNew = Abc_TtMinBase( pTruth, pCut->pLeaves, pCut->nLeaves, pCut->nLeaves );
220  if ( nLeavesNew < If_CutLeaveNum(pCut) )
221  {
222  pCut->nLeaves = nLeavesNew;
223  RetValue = 1;
224  }
225  }
226  // compute canonical form
227 if ( p->pPars->fVerbose )
228 clk = Abc_Clock();
229  p->uCanonPhase = Abc_TtCanonicize( pTruth, pCut->nLeaves, p->pCanonPerm );
230 if ( p->pPars->fVerbose )
231 p->timeCache[3] += Abc_Clock() - clk;
232  for ( v = 0; v < (int)pCut->nLeaves; v++ )
233  pPerm[v] = Abc_LitNotCond( pCut->pLeaves[(int)p->pCanonPerm[v]], ((p->uCanonPhase>>v)&1) );
234  pCut->uMaskFunc = 0;
235  for ( v = 0; v < (int)pCut->nLeaves; v++ )
236  {
237  pCut->pLeaves[v] = Abc_Lit2Var(pPerm[v]);
238  if ( Abc_LitIsCompl(pPerm[v]) )
239  pCut->uMaskFunc |= (1 << v);
240  }
241  // create signature after lowering literals
242  if ( RetValue )
243  pCut->uSign = If_ObjCutSignCompute( pCut );
244  else
245  assert( pCut->uSign == If_ObjCutSignCompute( pCut ) );
246 
247  // hash function
248  fCompl = ((p->uCanonPhase >> pCut->nLeaves) & 1);
249  truthId = Vec_MemHashInsert( p->vTtMem[pCut->nLeaves], pTruth );
250  pCut->iCutFunc = Abc_Var2Lit( truthId, fCompl );
251 
252 if ( fVerbose )
253 {
254 //Kit_DsdPrintFromTruth( pTruth, pCut->nLeaves ); printf( "\n" );
255 //If_CutPrint( pCut0 );
256 //If_CutPrint( pCut1 );
257 //If_CutPrint( pCut );
258 //printf( "%d\n\n", pCut->iCutFunc );
259 }
260 
261  return RetValue;
262 }
int nTruth6Words[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:226
unsigned nLeaves
Definition: if.h:289
static int Abc_TtMinBase(word *pTruth, int *pVars, int nVars, int nVarsAll)
Definition: utilTruth.h:1395
Vec_Mem_t * vTtMem[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:244
int pPerm[3][IF_MAX_LUTSIZE]
Definition: if.h:209
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
int fVerbose
Definition: if.h:140
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
int pLeaves[0]
Definition: if.h:290
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static unsigned If_ObjCutSignCompute(If_Cut_t *p)
Definition: if.h:403
unsigned * puTemp[4]
Definition: if.h:203
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
#define IF_MAX_LUTSIZE
INCLUDES ///.
Definition: if.h:52
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Abc_TtStretch6(word *pInOut, int nVarS, int nVarB)
Definition: utilTruth.h:693
static int pPerm[13719]
Definition: rwrTemp.c:32
static void Abc_TtFlip(word *pTruth, int nWords, int iVar)
Definition: utilTruth.h:1130
abctime timeCache[6]
Definition: if.h:257
static int If_CutLeafBit(If_Cut_t *pCut, int i)
Definition: if.h:396
If_Par_t * pPars
Definition: if.h:184
int uMaskFunc
Definition: if.h:282
char pCanonPerm[IF_MAX_LUTSIZE]
Definition: if.h:253
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
Definition: dauCanon.c:895
unsigned uSign
Definition: if.h:283
int fCutMin
Definition: if.h:120
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
Definition: vecMem.h:351
#define assert(ex)
Definition: util_old.h:213
static void Abc_TtSwapVars(word *pTruth, int nVars, int iVar, int jVar)
Definition: utilTruth.h:1228
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)
Definition: vecMem.h:191
static void Abc_TtAnd(word *pOut, word *pIn1, word *pIn2, int nWords, int fCompl)
Definition: utilTruth.h:231
ABC_INT64_T abctime
Definition: abc_global.h:278
int iCutFunc
Definition: if.h:281
unsigned uCanonPhase
Definition: if.h:254
void If_CutRotatePins ( If_Man_t p,
If_Cut_t pCut 
)

Definition at line 67 of file ifTruth.c.

68 {
69  If_Obj_t * pLeaf;
70  float PinDelays[IF_MAX_LUTSIZE];
71  int i, truthId;
72  assert( !p->pPars->fUseTtPerm );
73  If_CutForEachLeaf( p, pCut, pLeaf, i )
74  PinDelays[i] = If_ObjCutBest(pLeaf)->Delay;
75  if ( p->vTtMem[pCut->nLeaves] == NULL )
76  {
77  If_CutTruthPermute( NULL, If_CutLeaveNum(pCut), pCut->nLeaves, p->nTruth6Words[pCut->nLeaves], PinDelays, If_CutLeaves(pCut) );
78  return;
79  }
80  Abc_TtCopy( p->puTempW, If_CutTruthWR(p, pCut), p->nTruth6Words[pCut->nLeaves], 0 );
81  If_CutTruthPermute( p->puTempW, If_CutLeaveNum(pCut), pCut->nLeaves, p->nTruth6Words[pCut->nLeaves], PinDelays, If_CutLeaves(pCut) );
82  truthId = Vec_MemHashInsert( p->vTtMem[pCut->nLeaves], p->puTempW );
83  pCut->iCutFunc = Abc_Var2Lit( truthId, If_CutTruthIsCompl(pCut) );
84  assert( (p->puTempW[0] & 1) == 0 );
85 }
int nTruth6Words[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:226
unsigned nLeaves
Definition: if.h:289
ABC_NAMESPACE_IMPL_START void If_CutTruthPermute(word *pTruth, int nLeaves, int nVars, int nWords, float *pDelays, int *pVars)
DECLARATIONS ///.
Definition: ifTruth.c:48
Vec_Mem_t * vTtMem[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:244
Definition: if.h:303
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: if.h:474
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
static int If_CutTruthIsCompl(If_Cut_t *pCut)
Definition: if.h:418
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
static word * If_CutTruthWR(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:419
#define IF_MAX_LUTSIZE
INCLUDES ///.
Definition: if.h:52
static int * If_CutLeaves(If_Cut_t *pCut)
Definition: if.h:391
if(last==0)
Definition: sparse_int.h:34
word * puTempW
Definition: if.h:204
If_Par_t * pPars
Definition: if.h:184
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
Definition: vecMem.h:351
int fUseTtPerm
Definition: if.h:137
#define assert(ex)
Definition: util_old.h:213
int iCutFunc
Definition: if.h:281
ABC_NAMESPACE_IMPL_START void If_CutTruthPermute ( word pTruth,
int  nLeaves,
int  nVars,
int  nWords,
float *  pDelays,
int *  pVars 
)

DECLARATIONS ///.

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

FileName [ifTruth.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [FPGA mapping based on priority cuts.]

Synopsis [Computation of truth tables of the cuts.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 21, 2006.]

Revision [

Id:
ifTruth.c,v 1.00 2006/11/21 00:00:00 alanmi Exp

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

Synopsis [Sorts the pins in the decreasing order of delays.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file ifTruth.c.

49 {
50  while ( 1 )
51  {
52  int i, fChange = 0;
53  for ( i = 0; i < nLeaves - 1; i++ )
54  {
55  if ( pDelays[i] >= pDelays[i+1] )
56  continue;
57  ABC_SWAP( float, pDelays[i], pDelays[i+1] );
58  ABC_SWAP( int, pVars[i], pVars[i+1] );
59  if ( pTruth )
60  Abc_TtSwapAdjacent( pTruth, nWords, i );
61  fChange = 1;
62  }
63  if ( !fChange )
64  return;
65  }
66 }
int nWords
Definition: abcNpn.c:127
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static void Abc_TtSwapAdjacent(word *pTruth, int nWords, int iVar)
Definition: utilTruth.h:1190