abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cutInt.h File Reference
#include <stdio.h>
#include "misc/extra/extra.h"
#include "misc/vec/vec.h"
#include "cut.h"
#include "cutList.h"

Go to the source code of this file.

Data Structures

struct  Cut_ManStruct_t_
 

Macros

#define Cut_ListForEachCut(pList, pCut)
 
#define Cut_ListForEachCutStop(pList, pCut, pStop)
 
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Cut_HashTableStruct_t_ 
Cut_HashTable_t
 INCLUDES ///. More...
 

Functions

static unsigned Cut_NodeSign (int Node)
 MACRO DEFINITIONS ///. More...
 
static int Cut_TruthWords (int nVarsMax)
 
Cut_Cut_tCut_CutAlloc (Cut_Man_t *p)
 FUNCTION DECLARATIONS ///. More...
 
void Cut_CutRecycle (Cut_Man_t *p, Cut_Cut_t *pCut)
 
int Cut_CutCompare (Cut_Cut_t *pCut1, Cut_Cut_t *pCut2)
 
Cut_Cut_tCut_CutDupList (Cut_Man_t *p, Cut_Cut_t *pList)
 
void Cut_CutRecycleList (Cut_Man_t *p, Cut_Cut_t *pList)
 
Cut_Cut_tCut_CutMergeLists (Cut_Cut_t *pList1, Cut_Cut_t *pList2)
 
void Cut_CutNumberList (Cut_Cut_t *pList)
 
Cut_Cut_tCut_CutCreateTriv (Cut_Man_t *p, int Node)
 
void Cut_CutPrintMerge (Cut_Cut_t *pCut, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
 
Cut_Cut_tCut_CutMergeTwo (Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
 
void Cut_NodeDoComputeCuts (Cut_Man_t *p, Cut_List_t *pSuper, int Node, int fCompl0, int fCompl1, Cut_Cut_t *pList0, Cut_Cut_t *pList1, int fTriv, int TreeCode)
 
int Cut_CutListVerify (Cut_Cut_t *pList)
 
Cut_HashTable_tCut_TableStart (int Size)
 
void Cut_TableStop (Cut_HashTable_t *pTable)
 
int Cut_TableLookup (Cut_HashTable_t *pTable, Cut_Cut_t *pCut, int fStore)
 
void Cut_TableClear (Cut_HashTable_t *pTable)
 
int Cut_TableReadTime (Cut_HashTable_t *pTable)
 
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)
 

Macro Definition Documentation

#define Cut_ListForEachCut (   pList,
  pCut 
)
Value:
for ( pCut = pList; \
pCut; \
pCut = pCut->pNext )

Definition at line 104 of file cutInt.h.

#define Cut_ListForEachCutSafe (   pList,
  pCut,
  pCut2 
)
Value:
for ( pCut = pList, \
pCut2 = pCut? pCut->pNext: NULL; \
pCut; \
pCut = pCut2, \
pCut2 = pCut? pCut->pNext: NULL )

Definition at line 112 of file cutInt.h.

#define Cut_ListForEachCutStop (   pList,
  pCut,
  pStop 
)
Value:
for ( pCut = pList; \
pCut != pStop; \
pCut = pCut->pNext )

Definition at line 108 of file cutInt.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Cut_HashTableStruct_t_ Cut_HashTable_t

INCLUDES ///.

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

FileName [cutInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [K-feasible cut computation package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
cutInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 46 of file cutInt.h.

Function Documentation

Cut_Cut_t* Cut_CutAlloc ( Cut_Man_t p)

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

FileName [cutNode.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [K-feasible cut computation package.]

Synopsis [Procedures to compute cuts for a node.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Allocates the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cutCut.c.

46 {
47  Cut_Cut_t * pCut;
48  // cut allocation
50  memset( pCut, 0, sizeof(Cut_Cut_t) );
51  pCut->nVarsMax = p->pParams->nVarsMax;
52  pCut->fSimul = p->fSimul;
53  // statistics
54  p->nCutsAlloc++;
55  p->nCutsCur++;
56  if ( p->nCutsPeak < p->nCutsAlloc - p->nCutsDealloc )
57  p->nCutsPeak = p->nCutsAlloc - p->nCutsDealloc;
58  return pCut;
59 }
char * memset()
unsigned fSimul
Definition: cut.h:81
int nCutsDealloc
Definition: cutInt.h:86
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
Extra_MmFixed_t * pMmCuts
Definition: cutInt.h:59
int nCutsAlloc
Definition: cutInt.h:85
Cut_Params_t * pParams
Definition: cutInt.h:51
unsigned nVarsMax
Definition: cut.h:83
int Cut_CutCompare ( Cut_Cut_t pCut1,
Cut_Cut_t pCut2 
)

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

Synopsis [Compares two cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file cutCut.c.

93 {
94  int i;
95  if ( pCut1->nLeaves < pCut2->nLeaves )
96  return -1;
97  if ( pCut1->nLeaves > pCut2->nLeaves )
98  return 1;
99  for ( i = 0; i < (int)pCut1->nLeaves; i++ )
100  {
101  if ( pCut1->pLeaves[i] < pCut2->pLeaves[i] )
102  return -1;
103  if ( pCut1->pLeaves[i] > pCut2->pLeaves[i] )
104  return 1;
105  }
106  return 0;
107 }
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
Cut_Cut_t* Cut_CutCreateTriv ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Creates the trivial cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 238 of file cutCut.c.

239 {
240  Cut_Cut_t * pCut;
241  if ( p->pParams->fSeq )
242  Node <<= CUT_SHIFT;
243  pCut = Cut_CutAlloc( p );
244  pCut->nLeaves = 1;
245  pCut->pLeaves[0] = Node;
246  pCut->uSign = Cut_NodeSign( Node );
247  if ( p->pParams->fTruth )
248  {
249 /*
250  if ( pCut->nVarsMax == 4 )
251  Cut_CutWriteTruth( pCut, p->uTruthVars[0] );
252  else
253  Extra_BitCopy( pCut->nLeaves, p->uTruths[0], (uint8*)Cut_CutReadTruth(pCut) );
254 */
255  unsigned * pTruth = Cut_CutReadTruth(pCut);
256  int i;
257  for ( i = 0; i < p->nTruthWords; i++ )
258  pTruth[i] = 0xAAAAAAAA;
259  }
260  p->nCutsTriv++;
261  return pCut;
262 }
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_CutAlloc(Cut_Man_t *p)
DECLARATIONS ///.
Definition: cutCut.c:45
int nTruthWords
Definition: cutInt.h:61
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
Definition: cut.h:94
static unsigned Cut_NodeSign(int Node)
MACRO DEFINITIONS ///.
Definition: cutInt.h:124
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
unsigned uSign
Definition: cut.h:85
#define CUT_SHIFT
Definition: cut.h:41
Cut_Params_t * pParams
Definition: cutInt.h:51
Cut_Cut_t* Cut_CutDupList ( Cut_Man_t p,
Cut_Cut_t pList 
)

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

Synopsis [Duplicates the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file cutCut.c.

121 {
122  Cut_Cut_t * pHead = NULL, ** ppTail = &pHead;
123  Cut_Cut_t * pTemp, * pCopy;
124  if ( pList == NULL )
125  return NULL;
126  Cut_ListForEachCut( pList, pTemp )
127  {
128  pCopy = (Cut_Cut_t *)Extra_MmFixedEntryFetch( p->pMmCuts );
129  memcpy( pCopy, pTemp, p->EntrySize );
130  *ppTail = pCopy;
131  ppTail = &pCopy->pNext;
132  }
133  *ppTail = NULL;
134  return pHead;
135 }
Cut_Cut_t * pNext
Definition: cut.h:88
char * memcpy()
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
Extra_MmFixed_t * pMmCuts
Definition: cutInt.h:59
#define Cut_ListForEachCut(pList, pCut)
Definition: cutInt.h:104
int Cut_CutListVerify ( Cut_Cut_t pList)

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

Synopsis [Verifies that the list contains only non-dominated cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 979 of file cutNode.c.

980 {
981  Cut_Cut_t * pCut, * pDom;
982  Cut_ListForEachCut( pList, pCut )
983  {
984  Cut_ListForEachCutStop( pList, pDom, pCut )
985  {
986  if ( Cut_CutCheckDominance( pDom, pCut ) )
987  {
988  printf( "******************* These are contained cuts:\n" );
989  Cut_CutPrint( pDom, 1 );
990  Cut_CutPrint( pDom, 1 );
991  return 0;
992  }
993  }
994  }
995  return 1;
996 }
static int Cut_CutCheckDominance(Cut_Cut_t *pDom, Cut_Cut_t *pCut)
FUNCTION DEFINITIONS ///.
Definition: cutNode.c:48
#define Cut_ListForEachCutStop(pList, pCut, pStop)
Definition: cutInt.h:108
void Cut_CutPrint(Cut_Cut_t *pCut, int fSeq)
Definition: cutCut.c:276
#define Cut_ListForEachCut(pList, pCut)
Definition: cutInt.h:104
Cut_Cut_t* Cut_CutMergeLists ( Cut_Cut_t pList1,
Cut_Cut_t pList2 
)

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

Synopsis [Merges two NULL-terminated linked lists.]

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file cutCut.c.

186 {
187  Cut_Cut_t * pList = NULL, ** ppTail = &pList;
188  Cut_Cut_t * pCut;
189  while ( pList1 && pList2 )
190  {
191  if ( Cut_CutCompare(pList1, pList2) < 0 )
192  {
193  pCut = pList1;
194  pList1 = pList1->pNext;
195  }
196  else
197  {
198  pCut = pList2;
199  pList2 = pList2->pNext;
200  }
201  *ppTail = pCut;
202  ppTail = &pCut->pNext;
203  }
204  *ppTail = pList1? pList1: pList2;
205  return pList;
206 }
Cut_Cut_t * pNext
Definition: cut.h:88
int Cut_CutCompare(Cut_Cut_t *pCut1, Cut_Cut_t *pCut2)
Definition: cutCut.c:92
Cut_Cut_t* Cut_CutMergeTwo ( Cut_Man_t p,
Cut_Cut_t pCut0,
Cut_Cut_t pCut1 
)

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

Synopsis [Merges two cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file cutMerge.c.

171 {
172  Cut_Cut_t * pRes;
173  int * pLeaves;
174  int Limit, nLeaves0, nLeaves1;
175  int i, k, c;
176 
177  assert( pCut0->nLeaves >= pCut1->nLeaves );
178 
179  // consider two cuts
180  nLeaves0 = pCut0->nLeaves;
181  nLeaves1 = pCut1->nLeaves;
182 
183  // the case of the largest cut sizes
184  Limit = p->pParams->nVarsMax;
185  if ( nLeaves0 == Limit && nLeaves1 == Limit )
186  {
187  for ( i = 0; i < nLeaves0; i++ )
188  if ( pCut0->pLeaves[i] != pCut1->pLeaves[i] )
189  return NULL;
190  pRes = Cut_CutAlloc( p );
191  for ( i = 0; i < nLeaves0; i++ )
192  pRes->pLeaves[i] = pCut0->pLeaves[i];
193  pRes->nLeaves = pCut0->nLeaves;
194  return pRes;
195  }
196  // the case when one of the cuts is the largest
197  if ( nLeaves0 == Limit )
198  {
199  for ( i = 0; i < nLeaves1; i++ )
200  {
201  for ( k = nLeaves0 - 1; k >= 0; k-- )
202  if ( pCut0->pLeaves[k] == pCut1->pLeaves[i] )
203  break;
204  if ( k == -1 ) // did not find
205  return NULL;
206  }
207  pRes = Cut_CutAlloc( p );
208  for ( i = 0; i < nLeaves0; i++ )
209  pRes->pLeaves[i] = pCut0->pLeaves[i];
210  pRes->nLeaves = pCut0->nLeaves;
211  return pRes;
212  }
213 
214  // prepare the cut
215  if ( p->pReady == NULL )
216  p->pReady = Cut_CutAlloc( p );
217  pLeaves = p->pReady->pLeaves;
218 
219  // compare two cuts with different numbers
220  i = k = 0;
221  for ( c = 0; c < Limit; c++ )
222  {
223  if ( k == nLeaves1 )
224  {
225  if ( i == nLeaves0 )
226  {
227  p->pReady->nLeaves = c;
228  pRes = p->pReady; p->pReady = NULL;
229  return pRes;
230  }
231  pLeaves[c] = pCut0->pLeaves[i++];
232  continue;
233  }
234  if ( i == nLeaves0 )
235  {
236  if ( k == nLeaves1 )
237  {
238  p->pReady->nLeaves = c;
239  pRes = p->pReady; p->pReady = NULL;
240  return pRes;
241  }
242  pLeaves[c] = pCut1->pLeaves[k++];
243  continue;
244  }
245  if ( pCut0->pLeaves[i] < pCut1->pLeaves[k] )
246  {
247  pLeaves[c] = pCut0->pLeaves[i++];
248  continue;
249  }
250  if ( pCut0->pLeaves[i] > pCut1->pLeaves[k] )
251  {
252  pLeaves[c] = pCut1->pLeaves[k++];
253  continue;
254  }
255  pLeaves[c] = pCut0->pLeaves[i++];
256  k++;
257  }
258  if ( i < nLeaves0 || k < nLeaves1 )
259  return NULL;
260  p->pReady->nLeaves = c;
261  pRes = p->pReady; p->pReady = NULL;
262  return pRes;
263 }
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_CutAlloc(Cut_Man_t *p)
DECLARATIONS ///.
Definition: cutCut.c:45
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
Cut_Cut_t * pReady
Definition: cutInt.h:63
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
void Cut_CutNumberList ( Cut_Cut_t pList)

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

Synopsis [Sets the number of the cuts in the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 219 of file cutCut.c.

220 {
221  Cut_Cut_t * pCut;
222  int i = 0;
223  Cut_ListForEachCut( pList, pCut )
224  pCut->Num0 = i++;
225 }
#define Cut_ListForEachCut(pList, pCut)
Definition: cutInt.h:104
void Cut_CutPrintMerge ( Cut_Cut_t pCut,
Cut_Cut_t pCut0,
Cut_Cut_t pCut1 
)

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

Synopsis [Consider dropping cuts if they are useless by now.]

Description []

SideEffects []

SeeAlso []

Definition at line 326 of file cutCut.c.

327 {
328  printf( "\n" );
329  printf( "%d : %5d %5d %5d %5d %5d\n",
330  pCut0->nLeaves,
331  pCut0->nLeaves > 0 ? pCut0->pLeaves[0] : -1,
332  pCut0->nLeaves > 1 ? pCut0->pLeaves[1] : -1,
333  pCut0->nLeaves > 2 ? pCut0->pLeaves[2] : -1,
334  pCut0->nLeaves > 3 ? pCut0->pLeaves[3] : -1,
335  pCut0->nLeaves > 4 ? pCut0->pLeaves[4] : -1
336  );
337  printf( "%d : %5d %5d %5d %5d %5d\n",
338  pCut1->nLeaves,
339  pCut1->nLeaves > 0 ? pCut1->pLeaves[0] : -1,
340  pCut1->nLeaves > 1 ? pCut1->pLeaves[1] : -1,
341  pCut1->nLeaves > 2 ? pCut1->pLeaves[2] : -1,
342  pCut1->nLeaves > 3 ? pCut1->pLeaves[3] : -1,
343  pCut1->nLeaves > 4 ? pCut1->pLeaves[4] : -1
344  );
345  if ( pCut == NULL )
346  printf( "Cannot merge\n" );
347  else
348  printf( "%d : %5d %5d %5d %5d %5d\n",
349  pCut->nLeaves,
350  pCut->nLeaves > 0 ? pCut->pLeaves[0] : -1,
351  pCut->nLeaves > 1 ? pCut->pLeaves[1] : -1,
352  pCut->nLeaves > 2 ? pCut->pLeaves[2] : -1,
353  pCut->nLeaves > 3 ? pCut->pLeaves[3] : -1,
354  pCut->nLeaves > 4 ? pCut->pLeaves[4] : -1
355  );
356 }
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
void Cut_CutRecycle ( Cut_Man_t p,
Cut_Cut_t pCut 
)

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

Synopsis [Recybles the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file cutCut.c.

73 {
74  p->nCutsDealloc++;
75  p->nCutsCur--;
76  if ( pCut->nLeaves == 1 )
77  p->nCutsTriv--;
78  Extra_MmFixedEntryRecycle( p->pMmCuts, (char *)pCut );
79 }
int nCutsDealloc
Definition: cutInt.h:86
unsigned nLeaves
Definition: cut.h:84
Extra_MmFixed_t * pMmCuts
Definition: cutInt.h:59
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
void Cut_CutRecycleList ( Cut_Man_t p,
Cut_Cut_t pList 
)

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

Synopsis [Recycles the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 148 of file cutCut.c.

149 {
150  Cut_Cut_t * pCut, * pCut2;
151  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
152  Extra_MmFixedEntryRecycle( p->pMmCuts, (char *)pCut );
153 }
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
Definition: cutInt.h:112
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
void Cut_NodeDoComputeCuts ( Cut_Man_t p,
Cut_List_t pSuper,
int  Node,
int  fCompl0,
int  fCompl1,
Cut_Cut_t pList0,
Cut_Cut_t pList1,
int  fTriv,
int  TreeCode 
)

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

Synopsis [Computes the cuts by merging cuts at two nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 572 of file cutNode.c.

573 {
574  Cut_Cut_t * pStop0, * pStop1, * pTemp0, * pTemp1;
575  Cut_Cut_t * pStore0 = NULL, * pStore1 = NULL; // Suppress "might be used uninitialized"
576  int i, nCutsOld, Limit;
577  // start with the elementary cut
578  if ( fTriv )
579  {
580 // printf( "Creating trivial cut %d.\n", Node );
581  pTemp0 = Cut_CutCreateTriv( p, Node );
582  Cut_ListAdd( pSuper, pTemp0 );
583  p->nNodeCuts++;
584  }
585  // get the cut lists of children
586  if ( pList0 == NULL || pList1 == NULL || (p->pParams->fLocal && TreeCode) )
587  return;
588 
589  // remember the old number of cuts
590  nCutsOld = p->nCutsCur;
591  Limit = p->pParams->nVarsMax;
592  // get the simultation bit of the node
593  p->fSimul = (fCompl0 ^ pList0->fSimul) & (fCompl1 ^ pList1->fSimul);
594  // set temporary variables
595  p->fCompl0 = fCompl0;
596  p->fCompl1 = fCompl1;
597  // if tree cuts are computed, make sure only the unit cuts propagate over the DAG nodes
598  if ( TreeCode & 1 )
599  {
600  assert( pList0->nLeaves == 1 );
601  pStore0 = pList0->pNext;
602  pList0->pNext = NULL;
603  }
604  if ( TreeCode & 2 )
605  {
606  assert( pList1->nLeaves == 1 );
607  pStore1 = pList1->pNext;
608  pList1->pNext = NULL;
609  }
610  // find the point in the list where the max-var cuts begin
611  Cut_ListForEachCut( pList0, pStop0 )
612  if ( pStop0->nLeaves == (unsigned)Limit )
613  break;
614  Cut_ListForEachCut( pList1, pStop1 )
615  if ( pStop1->nLeaves == (unsigned)Limit )
616  break;
617 
618  // small by small
619  Cut_ListForEachCutStop( pList0, pTemp0, pStop0 )
620  Cut_ListForEachCutStop( pList1, pTemp1, pStop1 )
621  {
622  if ( Cut_CutProcessTwo( p, pTemp0, pTemp1, pSuper ) )
623  goto Quits;
624  }
625  // small by large
626  Cut_ListForEachCutStop( pList0, pTemp0, pStop0 )
627  Cut_ListForEachCut( pStop1, pTemp1 )
628  {
629  if ( (pTemp0->uSign & pTemp1->uSign) != pTemp0->uSign )
630  continue;
631  if ( Cut_CutProcessTwo( p, pTemp0, pTemp1, pSuper ) )
632  goto Quits;
633  }
634  // small by large
635  Cut_ListForEachCutStop( pList1, pTemp1, pStop1 )
636  Cut_ListForEachCut( pStop0, pTemp0 )
637  {
638  if ( (pTemp0->uSign & pTemp1->uSign) != pTemp1->uSign )
639  continue;
640  if ( Cut_CutProcessTwo( p, pTemp0, pTemp1, pSuper ) )
641  goto Quits;
642  }
643  // large by large
644  Cut_ListForEachCut( pStop0, pTemp0 )
645  Cut_ListForEachCut( pStop1, pTemp1 )
646  {
647  assert( pTemp0->nLeaves == (unsigned)Limit && pTemp1->nLeaves == (unsigned)Limit );
648  if ( pTemp0->uSign != pTemp1->uSign )
649  continue;
650  for ( i = 0; i < Limit; i++ )
651  if ( pTemp0->pLeaves[i] != pTemp1->pLeaves[i] )
652  break;
653  if ( i < Limit )
654  continue;
655  if ( Cut_CutProcessTwo( p, pTemp0, pTemp1, pSuper ) )
656  goto Quits;
657  }
658  if ( p->nNodeCuts == 0 )
659  p->nNodesNoCuts++;
660 Quits:
661  if ( TreeCode & 1 )
662  pList0->pNext = pStore0;
663  if ( TreeCode & 2 )
664  pList1->pNext = pStore1;
665 }
static void Cut_ListAdd(Cut_List_t *p, Cut_Cut_t *pCut)
Definition: cutList.h:87
#define Cut_ListForEachCutStop(pList, pCut, pStop)
Definition: cutInt.h:108
static int Cut_CutProcessTwo(Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1, Cut_List_t *pSuperList)
Definition: cutNode.c:312
Cut_Cut_t * pNext
Definition: cut.h:88
unsigned fSimul
Definition: cut.h:81
int nNodesNoCuts
Definition: cutInt.h:93
unsigned nLeaves
Definition: cut.h:84
if(last==0)
Definition: sparse_int.h:34
Cut_Cut_t * Cut_CutCreateTriv(Cut_Man_t *p, int Node)
Definition: cutCut.c:238
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
#define Cut_ListForEachCut(pList, pCut)
Definition: cutInt.h:104
static unsigned Cut_NodeSign ( int  Node)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 124 of file cutInt.h.

124 { return (1 << (Node % 31)); }
void Cut_TableClear ( Cut_HashTable_t pTable)
int Cut_TableLookup ( Cut_HashTable_t pTable,
Cut_Cut_t pCut,
int  fStore 
)
int Cut_TableReadTime ( Cut_HashTable_t pTable)
Cut_HashTable_t* Cut_TableStart ( int  Size)
void Cut_TableStop ( Cut_HashTable_t pTable)
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
static int Cut_TruthWords ( int  nVarsMax)
inlinestatic

Definition at line 125 of file cutInt.h.

125 { return nVarsMax <= 5 ? 1 : (1 << (nVarsMax - 5)); }