abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cut.h File Reference

Go to the source code of this file.

Data Structures

struct  Cut_ParamsStruct_t_
 
struct  Cut_CutStruct_t_
 

Macros

#define CUT_SIZE_MIN   3
 INCLUDES ///. More...
 
#define CUT_SIZE_MAX   12
 
#define CUT_SHIFT   8
 
#define CUT_MASK   0xFF
 

Typedefs

typedef struct Cut_ManStruct_t_ Cut_Man_t
 BASIC TYPES ///. More...
 
typedef struct Cut_OracleStruct_t_ Cut_Oracle_t
 
typedef struct Cut_CutStruct_t_ Cut_Cut_t
 
typedef struct Cut_ParamsStruct_t_ Cut_Params_t
 

Functions

static int Cut_CutReadLeaveNum (Cut_Cut_t *p)
 
static int * Cut_CutReadLeaves (Cut_Cut_t *p)
 
static unsigned * Cut_CutReadTruth (Cut_Cut_t *p)
 
static void Cut_CutWriteTruth (Cut_Cut_t *p, unsigned *puTruth)
 
Cut_Cut_tCut_NodeReadCutsNew (Cut_Man_t *p, int Node)
 MACRO DEFINITIONS ///. More...
 
Cut_Cut_tCut_NodeReadCutsOld (Cut_Man_t *p, int Node)
 
Cut_Cut_tCut_NodeReadCutsTemp (Cut_Man_t *p, int Node)
 
void Cut_NodeWriteCutsNew (Cut_Man_t *p, int Node, Cut_Cut_t *pList)
 
void Cut_NodeWriteCutsOld (Cut_Man_t *p, int Node, Cut_Cut_t *pList)
 
void Cut_NodeWriteCutsTemp (Cut_Man_t *p, int Node, Cut_Cut_t *pList)
 
void Cut_NodeSetTriv (Cut_Man_t *p, int Node)
 
void Cut_NodeTryDroppingCuts (Cut_Man_t *p, int Node)
 
void Cut_NodeFreeCuts (Cut_Man_t *p, int Node)
 
void Cut_CutPrint (Cut_Cut_t *pCut, int fSeq)
 
void Cut_CutPrintList (Cut_Cut_t *pList, int fSeq)
 
int Cut_CutCountList (Cut_Cut_t *pList)
 
Cut_Man_tCut_ManStart (Cut_Params_t *pParams)
 FUNCTION DEFINITIONS ///. More...
 
void Cut_ManStop (Cut_Man_t *p)
 
void Cut_ManPrintStats (Cut_Man_t *p)
 
void Cut_ManPrintStatsToFile (Cut_Man_t *p, char *pFileName, abctime TimeTotal)
 
void Cut_ManSetFanoutCounts (Cut_Man_t *p, Vec_Int_t *vFanCounts)
 
void Cut_ManSetNodeAttrs (Cut_Man_t *p, Vec_Int_t *vFanCounts)
 
int Cut_ManReadVarsMax (Cut_Man_t *p)
 
Cut_Params_tCut_ManReadParams (Cut_Man_t *p)
 
Vec_Int_tCut_ManReadNodeAttrs (Cut_Man_t *p)
 
void Cut_ManIncrementDagNodes (Cut_Man_t *p)
 
Cut_Cut_tCut_NodeComputeCuts (Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int fTriv, int TreeCode)
 
Cut_Cut_tCut_NodeUnionCuts (Cut_Man_t *p, Vec_Int_t *vNodes)
 
Cut_Cut_tCut_NodeUnionCutsSeq (Cut_Man_t *p, Vec_Int_t *vNodes, int CutSetNum, int fFirst)
 
int Cut_ManMappingArea_rec (Cut_Man_t *p, int Node)
 
void Cut_NodeComputeCutsSeq (Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int nLat0, int nLat1, int fTriv, int CutSetNum)
 
void Cut_NodeNewMergeWithOld (Cut_Man_t *p, int Node)
 
int Cut_NodeTempTransferToNew (Cut_Man_t *p, int Node, int CutSetNum)
 
void Cut_NodeOldTransferToNew (Cut_Man_t *p, int Node)
 
Cut_Oracle_tCut_OracleStart (Cut_Man_t *pMan)
 FUNCTION DEFINITIONS ///. More...
 
void Cut_OracleStop (Cut_Oracle_t *p)
 
void Cut_OracleSetFanoutCounts (Cut_Oracle_t *p, Vec_Int_t *vFanCounts)
 
int Cut_OracleReadDrop (Cut_Oracle_t *p)
 
void Cut_OracleNodeSetTriv (Cut_Oracle_t *p, int Node)
 
Cut_Cut_tCut_OracleComputeCuts (Cut_Oracle_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1)
 
void Cut_OracleTryDroppingCuts (Cut_Oracle_t *p, int Node)
 
void Cut_TruthNCanonicize (Cut_Cut_t *pCut)
 
void Cut_CellPrecompute ()
 
void Cut_CellLoad ()
 FUNCTION DEFINITIONS ///. More...
 
int Cut_CellIsRunning ()
 
void Cut_CellDumpToFile ()
 
int Cut_CellTruthLookup (unsigned *pTruth, int nVars)
 

Macro Definition Documentation

#define CUT_MASK   0xFF

Definition at line 42 of file cut.h.

#define CUT_SHIFT   8

Definition at line 41 of file cut.h.

#define CUT_SIZE_MAX   12

Definition at line 39 of file cut.h.

#define CUT_SIZE_MIN   3

INCLUDES ///.

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

FileName [cut.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:
.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///

Definition at line 38 of file cut.h.

Typedef Documentation

typedef struct Cut_CutStruct_t_ Cut_Cut_t

Definition at line 50 of file cut.h.

typedef struct Cut_ManStruct_t_ Cut_Man_t

BASIC TYPES ///.

Definition at line 48 of file cut.h.

Definition at line 49 of file cut.h.

Definition at line 51 of file cut.h.

Function Documentation

void Cut_CellDumpToFile ( )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 835 of file cutPre22.c.

836 {
837  FILE * pFile;
838  Cut_CMan_t * p = s_pCMan;
839  Cut_Cell_t * pTemp;
840  char * pFileName = "celllib22.txt";
841  int NumUsed[10][5] = {{0}};
842  int BoxUsed[22][5] = {{0}};
843  int i, k, Counter;
844  abctime clk = Abc_Clock();
845 
846  if ( p == NULL )
847  {
848  printf( "Cut_CellDumpToFile: Cell manager is not defined.\n" );
849  return;
850  }
851 
852  // count the number of cells used
853  for ( k = CUT_CELL_MVAR; k >= 0; k-- )
854  {
855  for ( pTemp = p->pSameVar[k]; pTemp; pTemp = pTemp->pNextVar )
856  {
857  if ( pTemp->nUsed == 0 )
858  NumUsed[k][0]++;
859  else if ( pTemp->nUsed < 10 )
860  NumUsed[k][1]++;
861  else if ( pTemp->nUsed < 100 )
862  NumUsed[k][2]++;
863  else if ( pTemp->nUsed < 1000 )
864  NumUsed[k][3]++;
865  else
866  NumUsed[k][4]++;
867 
868  for ( i = 0; i < 4; i++ )
869  if ( pTemp->nUsed == 0 )
870  BoxUsed[ (int)pTemp->Box[i] ][0]++;
871  else if ( pTemp->nUsed < 10 )
872  BoxUsed[ (int)pTemp->Box[i] ][1]++;
873  else if ( pTemp->nUsed < 100 )
874  BoxUsed[ (int)pTemp->Box[i] ][2]++;
875  else if ( pTemp->nUsed < 1000 )
876  BoxUsed[ (int)pTemp->Box[i] ][3]++;
877  else
878  BoxUsed[ (int)pTemp->Box[i] ][4]++;
879  }
880  }
881 
882  printf( "Functions found = %10d. Functions not found = %10d.\n", p->nCellFound, p->nCellNotFound );
883  for ( k = 0; k <= CUT_CELL_MVAR; k++ )
884  {
885  printf( "%3d : ", k );
886  for ( i = 0; i < 5; i++ )
887  printf( "%8d ", NumUsed[k][i] );
888  printf( "\n" );
889  }
890  printf( "Box usage:\n" );
891  for ( k = 0; k < 22; k++ )
892  {
893  printf( "%3d : ", k );
894  for ( i = 0; i < 5; i++ )
895  printf( "%8d ", BoxUsed[k][i] );
896  printf( " %s", s_NP3Names[k] );
897  printf( "\n" );
898  }
899 
900  pFile = fopen( pFileName, "w" );
901  if ( pFile == NULL )
902  {
903  printf( "Cut_CellDumpToFile: Cannout open output file.\n" );
904  return;
905  }
906 
907  Counter = 0;
908  for ( k = 0; k <= CUT_CELL_MVAR; k++ )
909  {
910  for ( pTemp = p->pSameVar[k]; pTemp; pTemp = pTemp->pNextVar )
911  if ( pTemp->nUsed > 0 )
912  {
913  Extra_PrintHexadecimal( pFile, pTemp->uTruth, (k <= 5? 5 : k) );
914  fprintf( pFile, "\n" );
915  Counter++;
916  }
917  fprintf( pFile, "\n" );
918  }
919  fclose( pFile );
920 
921  printf( "Library composed of %d functions is written into file \"%s\". ", Counter, pFileName );
922 
923  ABC_PRT( "Time", Abc_Clock() - clk );
924 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nUsed
Definition: cutPre22.c:40
Cut_Cell_t * pNextVar
Definition: cutPre22.c:38
static abctime Abc_Clock()
Definition: abc_global.h:279
static char * s_NP3Names[22]
Definition: cutPre22.c:106
for(p=first;p->value< newval;p=p->next)
static Cut_CMan_t * s_pCMan
Definition: cutPre22.c:152
#define CUT_CELL_MVAR
DECLARATIONS ///.
Definition: cutPre22.c:30
char Box[4]
Definition: cutPre22.c:41
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Counter
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Cut_Cell_t * pSameVar[CUT_CELL_MVAR+1]
Definition: cutPre22.c:57
unsigned uTruth[1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:49
void Extra_PrintHexadecimal(FILE *pFile, unsigned Sign[], int nVars)
ABC_INT64_T abctime
Definition: abc_global.h:278
int Cut_CellIsRunning ( )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 819 of file cutPre22.c.

820 {
821  return s_pCMan != NULL;
822 }
static Cut_CMan_t * s_pCMan
Definition: cutPre22.c:152
void Cut_CellLoad ( )

FUNCTION DEFINITIONS ///.

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

Synopsis [Start the precomputation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file cutPre22.c.

170 {
171  FILE * pFile;
172  char * pFileName = "cells22_daomap_iwls.txt";
173  char pString[1000];
174  Cut_CMan_t * p;
175  Cut_Cell_t * pCell;
176  int Length; //, i;
177  pFile = fopen( pFileName, "r" );
178  if ( pFile == NULL )
179  {
180  printf( "Cannot open file \"%s\".\n", pFileName );
181  return;
182  }
183  // start the manager
184  p = Cut_CManStart();
185  // load truth tables
186  while ( fgets(pString, 1000, pFile) )
187  {
188  Length = strlen(pString);
189  pString[Length--] = 0;
190  if ( Length == 0 )
191  continue;
192  // derive the cell
193  pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
194  memset( pCell, 0, sizeof(Cut_Cell_t) );
195  pCell->nVars = Abc_Base2Log(Length*4);
196  pCell->nUsed = 1;
197 // Extra_TruthCopy( pCell->uTruth, pTruth, nVars );
198  Extra_ReadHexadecimal( pCell->uTruth, pString, pCell->nVars );
199  Cut_CellSuppMin( pCell );
200 /*
201  // set the elementary permutation
202  for ( i = 0; i < (int)pCell->nVars; i++ )
203  pCell->CanonPerm[i] = i;
204  // canonicize
205  pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
206 */
207  // add to the table
208  p->nTotal++;
209 
210 // Extra_PrintHexadecimal( stdout, pCell->uTruth, pCell->nVars ); printf( "\n" );
211 // if ( p->nTotal == 500 )
212 // break;
213 
214  if ( !Cut_CellTableLookup( p, pCell ) ) // new cell
215  p->nGood++;
216  }
217  printf( "Read %d cells from file \"%s\". Added %d cells to the table.\n", p->nTotal, pFileName, p->nGood );
218  fclose( pFile );
219 // return p;
220 }
char * memset()
static void Cut_CellSuppMin(Cut_Cell_t *pCell)
Definition: cutPre22.c:553
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nUsed
Definition: cutPre22.c:40
Extra_MmFixed_t * pMem
Definition: cutPre22.c:55
unsigned nVars
Definition: cutPre22.c:42
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
static int Cut_CellTableLookup(Cut_CMan_t *p, Cut_Cell_t *pCell)
Definition: cutPre22.c:519
int nGood
Definition: cutPre22.c:68
int Extra_ReadHexadecimal(unsigned Sign[], char *pString, int nVars)
int nTotal
Definition: cutPre22.c:67
static Cut_CMan_t * Cut_CManStart()
Definition: cutPre22.c:771
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
int strlen()
unsigned uTruth[1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:49
void Cut_CellPrecompute ( )

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

Synopsis [Precomputes truth tables for the 2x2 macro cell.]

Description []

SideEffects []

SeeAlso []

Definition at line 233 of file cutPre22.c.

234 {
235  Cut_CMan_t * p;
236  Cut_Cell_t * pCell, * pTemp;
237  int i1, i2, i3, i, j, k, c;
238  abctime clk = Abc_Clock(); //, clk2 = Abc_Clock();
239 
240  p = Cut_CManStart();
241 
242  // precompute truth tables
243  for ( i = 0; i < 22; i++ )
244  Cut_CellTruthElem( p->uInputs[0], p->uInputs[1], p->uInputs[2], p->uTemp1[i], 9, i );
245  for ( i = 0; i < 22; i++ )
246  Cut_CellTruthElem( p->uInputs[3], p->uInputs[4], p->uInputs[5], p->uTemp2[i], 9, i );
247  for ( i = 0; i < 22; i++ )
248  Cut_CellTruthElem( p->uInputs[6], p->uInputs[7], p->uInputs[8], p->uTemp3[i], 9, i );
249 /*
250  if ( k == 8 && ((i1 == 6 && i2 == 14 && i3 == 20) || (i1 == 20 && i2 == 6 && i3 == 14)) )
251  {
252  Extra_PrintBinary( stdout, &pCell->CanonPhase, pCell->nVars+1 ); printf( " : " );
253  for ( i = 0; i < pCell->nVars; i++ )
254  printf( "%d=%d/%d ", pCell->CanonPerm[i], pCell->Store[2*i], pCell->Store[2*i+1] );
255  Extra_PrintHexadecimal( stdout, pCell->uTruth, pCell->nVars );
256  printf( "\n" );
257  }
258 */
259 /*
260  // go through symmetric roots
261  for ( k = 0; k < 5; k++ )
262  for ( i1 = 0; i1 < 22; i1++ )
263  for ( i2 = i1; i2 < 22; i2++ )
264  for ( i3 = i2; i3 < 22; i3++ )
265  {
266  // derive the cell
267  pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
268  memset( pCell, 0, sizeof(Cut_Cell_t) );
269  pCell->nVars = 9;
270  pCell->Box[0] = s_NPNe3s[k];
271  pCell->Box[1] = i1;
272  pCell->Box[2] = i2;
273  pCell->Box[3] = i3;
274  // fill in the truth table
275  Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, s_NPNe3s[k] );
276  // canonicize
277  Cut_CellCanonicize( pCell );
278 
279  // add to the table
280  p->nTotal++;
281  if ( Cut_CellTableLookup( p, pCell ) ) // already exists
282  Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
283  else
284  p->nGood++;
285  }
286 
287  // go through partially symmetric roots
288  for ( k = 0; k < 4; k++ )
289  for ( i1 = 0; i1 < 22; i1++ )
290  for ( i2 = 0; i2 < 22; i2++ )
291  for ( i3 = i2; i3 < 22; i3++ )
292  {
293  // derive the cell
294  pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
295  memset( pCell, 0, sizeof(Cut_Cell_t) );
296  pCell->nVars = 9;
297  pCell->Box[0] = s_NPNe3p[k];
298  pCell->Box[1] = i1;
299  pCell->Box[2] = i2;
300  pCell->Box[3] = i3;
301  // fill in the truth table
302  Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, s_NPNe3p[k] );
303  // canonicize
304  Cut_CellCanonicize( pCell );
305 
306  // add to the table
307  p->nTotal++;
308  if ( Cut_CellTableLookup( p, pCell ) ) // already exists
309  Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
310  else
311  p->nGood++;
312  }
313 
314  // go through non-symmetric functions
315  for ( i1 = 0; i1 < 22; i1++ )
316  for ( i2 = 0; i2 < 22; i2++ )
317  for ( i3 = 0; i3 < 22; i3++ )
318  {
319  // derive the cell
320  pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
321  memset( pCell, 0, sizeof(Cut_Cell_t) );
322  pCell->nVars = 9;
323  pCell->Box[0] = 17;
324  pCell->Box[1] = i1;
325  pCell->Box[2] = i2;
326  pCell->Box[3] = i3;
327  // fill in the truth table
328  Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, 17 );
329  // canonicize
330  Cut_CellCanonicize( pCell );
331 
332  // add to the table
333  p->nTotal++;
334  if ( Cut_CellTableLookup( p, pCell ) ) // already exists
335  Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
336  else
337  p->nGood++;
338  }
339 */
340 
341  // go through non-symmetric functions
342  for ( k = 0; k < 10; k++ )
343  for ( i1 = 0; i1 < 22; i1++ )
344  for ( i2 = 0; i2 < 22; i2++ )
345  for ( i3 = 0; i3 < 22; i3++ )
346  {
347  // derive the cell
348  pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
349  memset( pCell, 0, sizeof(Cut_Cell_t) );
350  pCell->nVars = 9;
351  pCell->Box[0] = s_NPNe3[k];
352  pCell->Box[1] = i1;
353  pCell->Box[2] = i2;
354  pCell->Box[3] = i3;
355  // set the elementary permutation
356  for ( i = 0; i < (int)pCell->nVars; i++ )
357  pCell->CanonPerm[i] = i;
358  // fill in the truth table
359  Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, s_NPNe3[k] );
360  // minimize the support
361  Cut_CellSuppMin( pCell );
362 
363  // canonicize
364  pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
365 
366  // add to the table
367  p->nTotal++;
368  if ( Cut_CellTableLookup( p, pCell ) ) // already exists
369  Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
370  else
371  {
372  p->nGood++;
373  p->nVarCounts[pCell->nVars]++;
374 
375  if ( pCell->nVars )
376  for ( i = 0; i < (int)pCell->nVars-1; i++ )
377  {
378  if ( pCell->Store[2*i] != pCell->Store[2*(i+1)] ) // i and i+1 cannot be symmetric
379  continue;
380  // i and i+1 can be symmetric
381  // find the end of this group
382  for ( j = i+1; j < (int)pCell->nVars; j++ )
383  if ( pCell->Store[2*i] != pCell->Store[2*j] )
384  break;
385 
386  if ( pCell->Store[2*i] == pCell->Store[2*i+1] )
387  p->nSymGroupsE[j-i]++;
388  else
389  p->nSymGroups[j-i]++;
390  i = j - 1;
391  }
392 /*
393  if ( pCell->nVars == 3 )
394  {
395  Extra_PrintBinary( stdout, pCell->uTruth, 32 ); printf( "\n" );
396  for ( i = 0; i < (int)pCell->nVars; i++ )
397  printf( "%d=%d/%d ", pCell->CanonPerm[i], pCell->Store[2*i], pCell->Store[2*i+1] );
398  printf( "\n" );
399  }
400 */
401  }
402  }
403 
404  printf( "BASIC: Total = %d. Good = %d. Entry = %d. ", (int)p->nTotal, (int)p->nGood, (int)sizeof(Cut_Cell_t) );
405  ABC_PRT( "Time", Abc_Clock() - clk );
406  printf( "Cells: " );
407  for ( i = 0; i <= 9; i++ )
408  printf( "%d=%d ", i, p->nVarCounts[i] );
409  printf( "\nDiffs: " );
410  for ( i = 0; i <= 9; i++ )
411  printf( "%d=%d ", i, p->nSymGroups[i] );
412  printf( "\nEquals: " );
413  for ( i = 0; i <= 9; i++ )
414  printf( "%d=%d ", i, p->nSymGroupsE[i] );
415  printf( "\n" );
416 
417  // continue adding new cells using support
418  for ( k = CUT_CELL_MVAR; k > 3; k-- )
419  {
420  for ( pTemp = p->pSameVar[k]; pTemp; pTemp = pTemp->pNextVar )
421  for ( i1 = 0; i1 < k; i1++ )
422  for ( i2 = i1+1; i2 < k; i2++ )
423  for ( c = 0; c < 3; c++ )
424  {
425  // derive the cell
426  pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
427  memset( pCell, 0, sizeof(Cut_Cell_t) );
428  pCell->nVars = pTemp->nVars;
429  pCell->pParent = pTemp;
430  // set the elementary permutation
431  for ( i = 0; i < (int)pCell->nVars; i++ )
432  pCell->CanonPerm[i] = i;
433  // fill in the truth table
434  Extra_TruthCopy( pCell->uTruth, pTemp->uTruth, pTemp->nVars );
435  // create the cross-bar
436  pCell->CrossBar0 = i1;
437  pCell->CrossBar1 = i2;
438  pCell->CrossBarPhase = c;
439  Cut_CellCrossBar( pCell );
440  // minimize the support
441 //clk2 = Abc_Clock();
442  Cut_CellSuppMin( pCell );
443 //p->timeSupp += Abc_Clock() - clk2;
444  // canonicize
445 //clk2 = Abc_Clock();
446  pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
447 //p->timeCanon += Abc_Clock() - clk2;
448 
449  // add to the table
450 //clk2 = Abc_Clock();
451  p->nTotal++;
452  if ( Cut_CellTableLookup( p, pCell ) ) // already exists
453  Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
454  else
455  {
456  p->nGood++;
457  p->nVarCounts[pCell->nVars]++;
458 
459  for ( i = 0; i < (int)pCell->nVars-1; i++ )
460  {
461  if ( pCell->Store[2*i] != pCell->Store[2*(i+1)] ) // i and i+1 cannot be symmetric
462  continue;
463  // i and i+1 can be symmetric
464  // find the end of this group
465  for ( j = i+1; j < (int)pCell->nVars; j++ )
466  if ( pCell->Store[2*i] != pCell->Store[2*j] )
467  break;
468 
469  if ( pCell->Store[2*i] == pCell->Store[2*i+1] )
470  p->nSymGroupsE[j-i]++;
471  else
472  p->nSymGroups[j-i]++;
473  i = j - 1;
474  }
475 /*
476  if ( pCell->nVars == 3 )
477  {
478  Extra_PrintBinary( stdout, pCell->uTruth, 32 ); printf( "\n" );
479  for ( i = 0; i < (int)pCell->nVars; i++ )
480  printf( "%d=%d/%d ", pCell->CanonPerm[i], pCell->Store[2*i], pCell->Store[2*i+1] );
481  printf( "\n" );
482  }
483 */
484  }
485 //p->timeTable += Abc_Clock() - clk2;
486  }
487 
488  printf( "VAR %d: Total = %d. Good = %d. Entry = %d. ", k, p->nTotal, p->nGood, (int)sizeof(Cut_Cell_t) );
489  ABC_PRT( "Time", Abc_Clock() - clk );
490  printf( "Cells: " );
491  for ( i = 0; i <= 9; i++ )
492  printf( "%d=%d ", i, p->nVarCounts[i] );
493  printf( "\nDiffs: " );
494  for ( i = 0; i <= 9; i++ )
495  printf( "%d=%d ", i, p->nSymGroups[i] );
496  printf( "\nEquals: " );
497  for ( i = 0; i <= 9; i++ )
498  printf( "%d=%d ", i, p->nSymGroupsE[i] );
499  printf( "\n" );
500  }
501 // printf( "\n" );
502  ABC_PRT( "Supp ", p->timeSupp );
503  ABC_PRT( "Canon", p->timeCanon );
504  ABC_PRT( "Table", p->timeTable );
505 // Cut_CManStop( p );
506 }
char * memset()
unsigned CanonPhase
Definition: cutPre22.c:46
static void Cut_CellTruthElem(unsigned *InA, unsigned *InB, unsigned *InC, unsigned *pOut, int nVars, int Type)
Definition: cutPre22.c:638
abctime timeTable
Definition: cutPre22.c:74
static void Cut_CellSuppMin(Cut_Cell_t *pCell)
Definition: cutPre22.c:553
unsigned CrossBarPhase
Definition: cutPre22.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nSymGroupsE[CUT_CELL_MVAR+1]
Definition: cutPre22.c:71
abctime timeCanon
Definition: cutPre22.c:72
Cut_Cell_t * pNextVar
Definition: cutPre22.c:38
Extra_MmFixed_t * pMem
Definition: cutPre22.c:55
unsigned puAux[1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:65
static abctime Abc_Clock()
Definition: abc_global.h:279
unsigned nVars
Definition: cutPre22.c:42
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
abctime timeSupp
Definition: cutPre22.c:73
unsigned uTemp3[22][1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:63
#define CUT_CELL_MVAR
DECLARATIONS ///.
Definition: cutPre22.c:30
static int Cut_CellTableLookup(Cut_CMan_t *p, Cut_Cell_t *pCell)
Definition: cutPre22.c:519
static int s_NPNe3[10]
Definition: cutPre22.c:135
unsigned uTemp1[22][1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:61
int nVarCounts[CUT_CELL_MVAR+1]
Definition: cutPre22.c:69
unsigned CrossBar0
Definition: cutPre22.c:43
int nGood
Definition: cutPre22.c:68
char Box[4]
Definition: cutPre22.c:41
int nTotal
Definition: cutPre22.c:67
static Cut_CMan_t * Cut_CManStart()
Definition: cutPre22.c:771
unsigned uTemp2[22][1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:62
unsigned CrossBar1
Definition: cutPre22.c:44
#define ABC_PRT(a, t)
Definition: abc_global.h:220
unsigned uInputs[CUT_CELL_MVAR][1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:59
unsigned Extra_TruthSemiCanonicize(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm, short *pStore)
short Store[2 *CUT_CELL_MVAR]
Definition: cutPre22.c:48
Cut_Cell_t * pParent
Definition: cutPre22.c:39
Cut_Cell_t * pSameVar[CUT_CELL_MVAR+1]
Definition: cutPre22.c:57
static void Cut_CellCrossBar(Cut_Cell_t *pCell)
Definition: cutPre22.c:596
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
unsigned uTruth[1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:49
ABC_INT64_T abctime
Definition: abc_global.h:278
char CanonPerm[CUT_CELL_MVAR+3]
Definition: cutPre22.c:47
static void Extra_TruthCopy(unsigned *pOut, unsigned *pIn, int nVars)
Definition: extra.h:302
int nSymGroups[CUT_CELL_MVAR+1]
Definition: cutPre22.c:70
int Cut_CellTruthLookup ( unsigned *  pTruth,
int  nVars 
)

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

Synopsis [Looks up if the given function exists in the hash table.]

Description [If the function exists, returns 1, meaning that it can be implemented using two levels of 3-input LUTs. If the function does not exist, return 0.]

SideEffects []

SeeAlso []

Definition at line 940 of file cutPre22.c.

941 {
942  Cut_CMan_t * p = s_pCMan;
943  Cut_Cell_t * pTemp;
944  Cut_Cell_t Cell, * pCell = &Cell;
945  unsigned Hash;
946  int i;
947 
948  // cell manager is not defined
949  if ( p == NULL )
950  {
951  printf( "Cut_CellTruthLookup: Cell manager is not defined.\n" );
952  return 0;
953  }
954 
955  // canonicize
956  memset( pCell, 0, sizeof(Cut_Cell_t) );
957  pCell->nVars = nVars;
958  Extra_TruthCopy( pCell->uTruth, pTruth, nVars );
959  Cut_CellSuppMin( pCell );
960  // set the elementary permutation
961  for ( i = 0; i < (int)pCell->nVars; i++ )
962  pCell->CanonPerm[i] = i;
963  // canonicize
964  pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
965 
966 
967  // check if the cell exists
968  Hash = Extra_TruthHash( pCell->uTruth, Extra_TruthWordNum(pCell->nVars) );
969  if ( st__lookup( p->tTable, (char *)(ABC_PTRUINT_T)Hash, (char **)&pTemp ) )
970  {
971  for ( ; pTemp; pTemp = pTemp->pNext )
972  {
973  if ( pTemp->nVars != pCell->nVars )
974  continue;
975  if ( Extra_TruthIsEqual(pTemp->uTruth, pCell->uTruth, pCell->nVars) )
976  {
977  pTemp->nUsed++;
978  p->nCellFound++;
979  return 1;
980  }
981  }
982  }
983  p->nCellNotFound++;
984  return 0;
985 }
char * memset()
unsigned CanonPhase
Definition: cutPre22.c:46
Cut_Cell_t * pNext
Definition: cutPre22.c:37
static void Cut_CellSuppMin(Cut_Cell_t *pCell)
Definition: cutPre22.c:553
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nUsed
Definition: cutPre22.c:40
unsigned puAux[1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:65
int nCellFound
Definition: cutPre22.c:75
unsigned nVars
Definition: cutPre22.c:42
static Cut_CMan_t * s_pCMan
Definition: cutPre22.c:152
unsigned Extra_TruthHash(unsigned *pIn, int nWords)
st__table * tTable
Definition: cutPre22.c:56
int nCellNotFound
Definition: cutPre22.c:76
static int Extra_TruthWordNum(int nVars)
Definition: extra.h:249
static int Extra_TruthIsEqual(unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:270
int st__lookup(st__table *table, const char *key, char **value)
Definition: st.c:114
unsigned Extra_TruthSemiCanonicize(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm, short *pStore)
short Store[2 *CUT_CELL_MVAR]
Definition: cutPre22.c:48
unsigned uTruth[1<<(CUT_CELL_MVAR-5)]
Definition: cutPre22.c:49
char CanonPerm[CUT_CELL_MVAR+3]
Definition: cutPre22.c:47
static void Extra_TruthCopy(unsigned *pOut, unsigned *pIn, int nVars)
Definition: extra.h:302
int Cut_CutCountList ( Cut_Cut_t pList)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file cutCut.c.

167 {
168  int Counter = 0;
169  Cut_ListForEachCut( pList, pList )
170  Counter++;
171  return Counter;
172 }
static int Counter
#define Cut_ListForEachCut(pList, pCut)
Definition: cutInt.h:104
void Cut_CutPrint ( Cut_Cut_t pCut,
int  fSeq 
)

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

Synopsis [Print the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 276 of file cutCut.c.

277 {
278  int i;
279  assert( pCut->nLeaves > 0 );
280  printf( "%d : {", pCut->nLeaves );
281  for ( i = 0; i < (int)pCut->nLeaves; i++ )
282  {
283  if ( fSeq )
284  {
285  printf( " %d", pCut->pLeaves[i] >> CUT_SHIFT );
286  if ( pCut->pLeaves[i] & CUT_MASK )
287  printf( "(%d)", pCut->pLeaves[i] & CUT_MASK );
288  }
289  else
290  printf( " %d", pCut->pLeaves[i] );
291  }
292  printf( " }" );
293 // printf( "\nSign = " );
294 // Extra_PrintBinary( stdout, &pCut->uSign, 32 );
295 }
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
#define CUT_SHIFT
Definition: cut.h:41
#define CUT_MASK
Definition: cut.h:42
#define assert(ex)
Definition: util_old.h:213
void Cut_CutPrintList ( Cut_Cut_t pList,
int  fSeq 
)

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

Synopsis [Print the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file cutCut.c.

309 {
310  Cut_Cut_t * pCut;
311  for ( pCut = pList; pCut; pCut = pCut->pNext )
312  Cut_CutPrint( pCut, fSeq ), printf( "\n" );
313 }
void Cut_CutPrint(Cut_Cut_t *pCut, int fSeq)
Definition: cutCut.c:276
Cut_Cut_t * pNext
Definition: cut.h:88
static int Cut_CutReadLeaveNum ( Cut_Cut_t p)
inlinestatic

Definition at line 92 of file cut.h.

92 { return p->nLeaves; }
unsigned nLeaves
Definition: cut.h:84
static int* Cut_CutReadLeaves ( Cut_Cut_t p)
inlinestatic

Definition at line 93 of file cut.h.

93 { return p->pLeaves; }
int pLeaves[0]
Definition: cut.h:89
static unsigned* Cut_CutReadTruth ( Cut_Cut_t p)
inlinestatic

Definition at line 94 of file cut.h.

94 { return (unsigned *)(p->pLeaves + p->nVarsMax); }
int pLeaves[0]
Definition: cut.h:89
unsigned nVarsMax
Definition: cut.h:83
static void Cut_CutWriteTruth ( Cut_Cut_t p,
unsigned *  puTruth 
)
inlinestatic

Definition at line 95 of file cut.h.

95  {
96  int i;
97  for ( i = (p->nVarsMax <= 5) ? 0 : ((1 << (p->nVarsMax - 5)) - 1); i >= 0; i-- )
98  p->pLeaves[p->nVarsMax + i] = (int)puTruth[i];
99 }
int pLeaves[0]
Definition: cut.h:89
unsigned nVarsMax
Definition: cut.h:83
void Cut_ManIncrementDagNodes ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 309 of file cutMan.c.

310 {
311  p->nNodesDag++;
312 }
int Cut_ManMappingArea_rec ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Computes area after mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 544 of file cutNode.c.

545 {
546  Cut_Cut_t * pCut;
547  int i, Counter;
548  if ( p->vCutsMax == NULL )
549  return 0;
550  pCut = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsMax, Node );
551  if ( pCut == NULL || pCut->nLeaves == 1 )
552  return 0;
553  Counter = 0;
554  for ( i = 0; i < (int)pCut->nLeaves; i++ )
555  Counter += Cut_ManMappingArea_rec( p, pCut->pLeaves[i] );
556  Vec_PtrWriteEntry( p->vCutsMax, Node, NULL );
557  return 1 + Counter;
558 }
Vec_Ptr_t * vCutsMax
Definition: cutInt.h:79
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
static int Counter
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
int Cut_ManMappingArea_rec(Cut_Man_t *p, int Node)
Definition: cutNode.c:544
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Cut_ManPrintStats ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file cutMan.c.

156 {
157  if ( p->pReady )
158  {
159  Cut_CutRecycle( p, p->pReady );
160  p->pReady = NULL;
161  }
162  printf( "Cut computation statistics:\n" );
163  printf( "Current cuts = %8d. (Trivial = %d.)\n", p->nCutsCur-p->nCutsTriv, p->nCutsTriv );
164  printf( "Peak cuts = %8d.\n", p->nCutsPeak );
165  printf( "Total allocated = %8d.\n", p->nCutsAlloc );
166  printf( "Total deallocated = %8d.\n", p->nCutsDealloc );
167  printf( "Cuts filtered = %8d.\n", p->nCutsFilter );
168  printf( "Nodes saturated = %8d. (Max cuts = %d.)\n", p->nCutsLimit, p->pParams->nKeepMax );
169  printf( "Cuts per node = %8.1f\n", ((float)(p->nCutsCur-p->nCutsTriv))/p->nNodes );
170  printf( "The cut size = %8d bytes.\n", p->EntrySize );
171  printf( "Peak memory = %8.2f MB.\n", (float)p->nCutsPeak * p->EntrySize / (1<<20) );
172  printf( "Total nodes = %8d.\n", p->nNodes );
173  if ( p->pParams->fDag || p->pParams->fTree )
174  {
175  printf( "DAG nodes = %8d.\n", p->nNodesDag );
176  printf( "Tree nodes = %8d.\n", p->nNodes - p->nNodesDag );
177  }
178  printf( "Nodes w/o cuts = %8d.\n", p->nNodesNoCuts );
179  if ( p->pParams->fMap && !p->pParams->fSeq )
180  printf( "Mapping delay = %8d.\n", p->nDelayMin );
181 
182  ABC_PRT( "Merge ", p->timeMerge );
183  ABC_PRT( "Union ", p->timeUnion );
184  ABC_PRT( "Filter", p->timeFilter );
185  ABC_PRT( "Truth ", p->timeTruth );
186  ABC_PRT( "Map ", p->timeMap );
187 // printf( "Nodes = %d. Multi = %d. Cuts = %d. Multi = %d.\n",
188 // p->nNodes, p->nNodesMulti, p->nCutsCur-p->nCutsTriv, p->nCutsMulti );
189 // printf( "Count0 = %d. Count1 = %d. Count2 = %d.\n\n", p->Count0, p->Count1, p->Count2 );
190 }
abctime timeTruth
Definition: cutInt.h:97
int nCutsDealloc
Definition: cutInt.h:86
int nNodesNoCuts
Definition: cutInt.h:93
abctime timeMerge
Definition: cutInt.h:95
Cut_Cut_t * pReady
Definition: cutInt.h:63
int nCutsAlloc
Definition: cutInt.h:85
abctime timeFilter
Definition: cutInt.h:98
void Cut_CutRecycle(Cut_Man_t *p, Cut_Cut_t *pCut)
Definition: cutCut.c:72
#define ABC_PRT(a, t)
Definition: abc_global.h:220
abctime timeUnion
Definition: cutInt.h:96
Cut_Params_t * pParams
Definition: cutInt.h:51
int nCutsFilter
Definition: cutInt.h:89
abctime timeMap
Definition: cutInt.h:100
int nCutsLimit
Definition: cutInt.h:90
void Cut_ManPrintStatsToFile ( Cut_Man_t p,
char *  pFileName,
abctime  TimeTotal 
)

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

Synopsis [Prints some interesting stats.]

Description []

SideEffects []

SeeAlso []

Definition at line 204 of file cutMan.c.

205 {
206  FILE * pTable;
207  pTable = fopen( "cut_stats.txt", "a+" );
208  fprintf( pTable, "%-20s ", pFileName );
209  fprintf( pTable, "%8d ", p->nNodes );
210  fprintf( pTable, "%6.1f ", ((float)(p->nCutsCur))/p->nNodes );
211  fprintf( pTable, "%6.2f ", ((float)(100.0 * p->nCutsLimit))/p->nNodes );
212  fprintf( pTable, "%6.2f ", (float)p->nCutsPeak * p->EntrySize / (1<<20) );
213  fprintf( pTable, "%6.2f ", (float)(TimeTotal)/(float)(CLOCKS_PER_SEC) );
214  fprintf( pTable, "\n" );
215  fclose( pTable );
216 }
int nCutsLimit
Definition: cutInt.h:90
Vec_Int_t* Cut_ManReadNodeAttrs ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file cutMan.c.

294 {
295  return p->vNodeAttrs;
296 }
Vec_Int_t * vNodeAttrs
Definition: cutInt.h:53
Cut_Params_t* Cut_ManReadParams ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file cutMan.c.

278 {
279  return p->pParams;
280 }
Cut_Params_t * pParams
Definition: cutInt.h:51
int Cut_ManReadVarsMax ( Cut_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file cutMan.c.

262 {
263  return p->pParams->nVarsMax;
264 }
Cut_Params_t * pParams
Definition: cutInt.h:51
void Cut_ManSetFanoutCounts ( Cut_Man_t p,
Vec_Int_t vFanCounts 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file cutMan.c.

230 {
231  p->vFanCounts = vFanCounts;
232 }
Vec_Int_t * vFanCounts
Definition: cutInt.h:52
void Cut_ManSetNodeAttrs ( Cut_Man_t p,
Vec_Int_t vNodeAttrs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file cutMan.c.

246 {
247  p->vNodeAttrs = vNodeAttrs;
248 }
Vec_Int_t * vNodeAttrs
Definition: cutInt.h:53
Cut_Man_t* Cut_ManStart ( Cut_Params_t pParams)

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the cut manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file cutMan.c.

48 {
49  Cut_Man_t * p;
50 // extern int nTruthDsd;
51 // nTruthDsd = 0;
52  assert( pParams->nVarsMax >= 3 && pParams->nVarsMax <= CUT_SIZE_MAX );
53  p = ABC_ALLOC( Cut_Man_t, 1 );
54  memset( p, 0, sizeof(Cut_Man_t) );
55  // set and correct parameters
56  p->pParams = pParams;
57  // prepare storage for cuts
58  p->vCutsNew = Vec_PtrAlloc( pParams->nIdsMax );
59  Vec_PtrFill( p->vCutsNew, pParams->nIdsMax, NULL );
60  // prepare storage for sequential cuts
61  if ( pParams->fSeq )
62  {
63  p->pParams->fFilter = 1;
64  p->vCutsOld = Vec_PtrAlloc( pParams->nIdsMax );
65  Vec_PtrFill( p->vCutsOld, pParams->nIdsMax, NULL );
66  p->vCutsTemp = Vec_PtrAlloc( pParams->nCutSet );
67  Vec_PtrFill( p->vCutsTemp, pParams->nCutSet, NULL );
68  if ( pParams->fTruth && pParams->nVarsMax > 5 )
69  {
70  pParams->fTruth = 0;
71  printf( "Skipping computation of truth tables for sequential cuts with more than 5 inputs.\n" );
72  }
73  }
74  // entry size
75  p->EntrySize = sizeof(Cut_Cut_t) + pParams->nVarsMax * sizeof(int);
76  if ( pParams->fTruth )
77  {
78  if ( pParams->nVarsMax > 14 )
79  {
80  pParams->fTruth = 0;
81  printf( "Skipping computation of truth table for more than %d inputs.\n", 14 );
82  }
83  else
84  {
85  p->nTruthWords = Cut_TruthWords( pParams->nVarsMax );
86  p->EntrySize += p->nTruthWords * sizeof(unsigned);
87  }
88  p->puTemp[0] = ABC_ALLOC( unsigned, 4 * p->nTruthWords );
89  p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
90  p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
91  p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
92  }
93  // enable cut computation recording
94  if ( pParams->fRecord )
95  {
96  p->vNodeCuts = Vec_IntStart( pParams->nIdsMax );
97  p->vNodeStarts = Vec_IntStart( pParams->nIdsMax );
98  p->vCutPairs = Vec_IntAlloc( 0 );
99  }
100  // allocate storage for delays
101  if ( pParams->fMap && !p->pParams->fSeq )
102  {
103  p->vDelays = Vec_IntStart( pParams->nIdsMax );
104  p->vDelays2 = Vec_IntStart( pParams->nIdsMax );
105  p->vCutsMax = Vec_PtrStart( pParams->nIdsMax );
106  }
107  // memory for cuts
109  p->vTemp = Vec_PtrAlloc( 100 );
110  return p;
111 }
char * memset()
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Vec_Ptr_t * vCutsMax
Definition: cutInt.h:79
Vec_Ptr_t * vTemp
Definition: cutInt.h:64
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFill(Vec_Ptr_t *p, int nSize, void *Entry)
Definition: vecPtr.h:449
static int Cut_TruthWords(int nVarsMax)
Definition: cutInt.h:125
int nTruthWords
Definition: cutInt.h:61
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Int_t * vNodeStarts
Definition: cutInt.h:76
#define CUT_SIZE_MAX
Definition: cut.h:39
struct Cut_CutStruct_t_ Cut_Cut_t
Definition: cut.h:50
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
Extra_MmFixed_t * pMmCuts
Definition: cutInt.h:59
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * vCutPairs
Definition: cutInt.h:77
Vec_Int_t * vDelays
Definition: cutInt.h:80
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
Vec_Ptr_t * vCutsTemp
Definition: cutInt.h:57
Vec_Ptr_t * vCutsOld
Definition: cutInt.h:56
Vec_Int_t * vDelays2
Definition: cutInt.h:81
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Int_t * vNodeCuts
Definition: cutInt.h:75
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
unsigned * puTemp[4]
Definition: cutInt.h:73
Vec_Ptr_t * vCutsNew
Definition: cutInt.h:55
void Cut_ManStop ( Cut_Man_t p)

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

Synopsis [Stops the cut manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 124 of file cutMan.c.

125 {
126  if ( p->vCutsNew ) Vec_PtrFree( p->vCutsNew );
127  if ( p->vCutsOld ) Vec_PtrFree( p->vCutsOld );
128  if ( p->vCutsTemp ) Vec_PtrFree( p->vCutsTemp );
129  if ( p->vFanCounts ) Vec_IntFree( p->vFanCounts );
130  if ( p->vTemp ) Vec_PtrFree( p->vTemp );
131 
132  if ( p->vCutsMax ) Vec_PtrFree( p->vCutsMax );
133  if ( p->vDelays ) Vec_IntFree( p->vDelays );
134  if ( p->vDelays2 ) Vec_IntFree( p->vDelays2 );
135  if ( p->vNodeCuts ) Vec_IntFree( p->vNodeCuts );
136  if ( p->vNodeStarts ) Vec_IntFree( p->vNodeStarts );
137  if ( p->vCutPairs ) Vec_IntFree( p->vCutPairs );
138  if ( p->puTemp[0] ) ABC_FREE( p->puTemp[0] );
139 
141  ABC_FREE( p );
142 }
Vec_Int_t * vFanCounts
Definition: cutInt.h:52
Vec_Ptr_t * vCutsMax
Definition: cutInt.h:79
Vec_Ptr_t * vTemp
Definition: cutInt.h:64
void Extra_MmFixedStop(Extra_MmFixed_t *p)
Vec_Int_t * vNodeStarts
Definition: cutInt.h:76
Extra_MmFixed_t * pMmCuts
Definition: cutInt.h:59
Vec_Int_t * vCutPairs
Definition: cutInt.h:77
Vec_Int_t * vDelays
Definition: cutInt.h:80
Vec_Ptr_t * vCutsTemp
Definition: cutInt.h:57
Vec_Ptr_t * vCutsOld
Definition: cutInt.h:56
Vec_Int_t * vDelays2
Definition: cutInt.h:81
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Int_t * vNodeCuts
Definition: cutInt.h:75
unsigned * puTemp[4]
Definition: cutInt.h:73
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t * vCutsNew
Definition: cutInt.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Cut_Cut_t* Cut_NodeComputeCuts ( Cut_Man_t p,
int  Node,
int  Node0,
int  Node1,
int  fCompl0,
int  fCompl1,
int  fTriv,
int  TreeCode 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 369 of file cutNode.c.

370 {
371  Cut_List_t Super, * pSuper = &Super;
372  Cut_Cut_t * pList, * pCut;
373  abctime clk;
374  // start the number of cuts at the node
375  p->nNodes++;
376  p->nNodeCuts = 0;
377  // prepare information for recording
378  if ( p->pParams->fRecord )
379  {
382  }
383  // compute the cuts
384 clk = Abc_Clock();
385  Cut_ListStart( pSuper );
386  Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, Cut_NodeReadCutsNew(p, Node0), Cut_NodeReadCutsNew(p, Node1), fTriv, TreeCode );
387  pList = Cut_ListFinish( pSuper );
388 p->timeMerge += Abc_Clock() - clk;
389  // verify the result of cut computation
390 // Cut_CutListVerify( pList );
391  // performing the recording
392  if ( p->pParams->fRecord )
393  {
395  Cut_ListForEachCut( pList, pCut )
396  Vec_IntPush( p->vCutPairs, ((pCut->Num1 << 16) | pCut->Num0) );
397  Vec_IntWriteEntry( p->vNodeCuts, Node, Vec_IntSize(p->vCutPairs) - Vec_IntEntry(p->vNodeStarts, Node) );
398  }
399  if ( p->pParams->fRecordAig )
400  {
401  extern void Aig_RManRecord( unsigned * pTruth, int nVarsInit );
402  Cut_ListForEachCut( pList, pCut )
403  if ( Cut_CutReadLeaveNum(pCut) > 4 )
405  }
406  // check if the node is over the list
407  if ( p->nNodeCuts == p->pParams->nKeepMax )
408  p->nCutsLimit++;
409  // set the list at the node
410  Vec_PtrFillExtra( p->vCutsNew, Node + 1, NULL );
411  assert( Cut_NodeReadCutsNew(p, Node) == NULL );
412  /////
413 // pList->pNext = NULL;
414  /////
415  Cut_NodeWriteCutsNew( p, Node, pList );
416  // filter the cuts
417 //clk = Abc_Clock();
418 // if ( p->pParams->fFilter )
419 // Cut_CutFilter( p, pList0 );
420 //p->timeFilter += Abc_Clock() - clk;
421  // perform mapping of this node with these cuts
422 clk = Abc_Clock();
423  if ( p->pParams->fMap && !p->pParams->fSeq )
424  {
425 // int Delay1, Delay2;
426 // Delay1 = Cut_NodeMapping( p, pList, Node, Node0, Node1 );
427 // Delay2 = Cut_NodeMapping2( p, pList, Node, Node0, Node1 );
428 // assert( Delay1 >= Delay2 );
429  Cut_NodeMapping( p, pList, Node, Node0, Node1 );
430  }
431 p->timeMap += Abc_Clock() - clk;
432  return pList;
433 }
static Cut_Cut_t * Cut_ListFinish(Cut_List_t *p)
Definition: cutList.h:191
typedefABC_NAMESPACE_HEADER_START struct Cut_ListStruct_t_ Cut_List_t
INCLUDES ///.
Definition: cutList.h:40
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
Definition: cut.h:94
static void Vec_PtrFillExtra(Vec_Ptr_t *p, int nSize, void *Fill)
Definition: vecPtr.h:469
static abctime Abc_Clock()
Definition: abc_global.h:279
Vec_Int_t * vNodeStarts
Definition: cutInt.h:76
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Cut_CutReadLeaveNum(Cut_Cut_t *p)
Definition: cut.h:92
void Aig_RManRecord(unsigned *pTruth, int nVarsInit)
Definition: aigCanon.c:598
abctime timeMerge
Definition: cutInt.h:95
Vec_Int_t * vCutPairs
Definition: cutInt.h:77
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static ABC_NAMESPACE_IMPL_START int Cut_NodeMapping(Cut_Man_t *p, Cut_Cut_t *pCuts, int Node, int Node0, int Node1)
DECLARATIONS ///.
Definition: cutNode.c:489
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Cut_CutNumberList(Cut_Cut_t *pList)
Definition: cutCut.c:219
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)
Definition: cutNode.c:572
static void Cut_ListStart(Cut_List_t *p)
MACRO DEFINITIONS ///.
Definition: cutList.h:66
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
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
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
abctime timeMap
Definition: cutInt.h:100
void Cut_NodeComputeCutsSeq ( Cut_Man_t p,
int  Node,
int  Node0,
int  Node1,
int  fCompl0,
int  fCompl1,
int  nLat0,
int  nLat1,
int  fTriv,
int  CutSetNum 
)

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

Synopsis [Computes sequential cuts for the node from its fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file cutSeq.c.

73 {
74  Cut_List_t Super, * pSuper = &Super;
75  Cut_Cut_t * pListNew;
76  abctime clk;
77 
78  // get the number of cuts at the node
80  if ( p->nNodeCuts >= p->pParams->nKeepMax )
81  return;
82 
83  // count only the first visit
84  if ( p->nNodeCuts == 0 )
85  p->nNodes++;
86 
87  // store the fanin lists
88  p->pStore0[0] = Cut_NodeReadCutsOld( p, Node0 );
89  p->pStore0[1] = Cut_NodeReadCutsNew( p, Node0 );
90  p->pStore1[0] = Cut_NodeReadCutsOld( p, Node1 );
91  p->pStore1[1] = Cut_NodeReadCutsNew( p, Node1 );
92 
93  // duplicate the cut lists if fanin nodes are non-standard
94  if ( Node == Node0 || Node == Node1 || Node0 == Node1 )
95  {
96  p->pStore0[0] = Cut_CutDupList( p, p->pStore0[0] );
97  p->pStore0[1] = Cut_CutDupList( p, p->pStore0[1] );
98  p->pStore1[0] = Cut_CutDupList( p, p->pStore1[0] );
99  p->pStore1[1] = Cut_CutDupList( p, p->pStore1[1] );
100  }
101 
102  // shift the cuts by as many latches and recompute signatures
103  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[0], nLat0 );
104  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[1], nLat0 );
105  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[0], nLat1 );
106  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[1], nLat1 );
107 
108  // store the original lists for comparison
109  p->pCompareOld = Cut_NodeReadCutsOld( p, Node );
110  p->pCompareNew = Cut_NodeReadCutsNew( p, Node );
111 
112  // merge the old and the new
113 clk = Abc_Clock();
114  Cut_ListStart( pSuper );
115  Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[0], p->pStore1[1], 0, 0 );
116  Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[1], p->pStore1[0], 0, 0 );
117  Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[1], p->pStore1[1], fTriv, 0 );
118  pListNew = Cut_ListFinish( pSuper );
119 p->timeMerge += Abc_Clock() - clk;
120 
121  // shift the cuts by as many latches and recompute signatures
122  if ( Node == Node0 || Node == Node1 || Node0 == Node1 )
123  {
124  Cut_CutRecycleList( p, p->pStore0[0] );
125  Cut_CutRecycleList( p, p->pStore0[1] );
126  Cut_CutRecycleList( p, p->pStore1[0] );
127  Cut_CutRecycleList( p, p->pStore1[1] );
128  }
129  else
130  {
131  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[0], -nLat0 );
132  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[1], -nLat0 );
133  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[0], -nLat1 );
134  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[1], -nLat1 );
135  }
136 
137  // set the lists at the node
138  if ( CutSetNum >= 0 )
139  {
140  assert( Cut_NodeReadCutsTemp(p, CutSetNum) == NULL );
141  Cut_NodeWriteCutsTemp( p, CutSetNum, pListNew );
142  }
143  else
144  {
145  assert( Cut_NodeReadCutsNew(p, Node) == NULL );
146  Cut_NodeWriteCutsNew( p, Node, pListNew );
147  }
148 
149  // mark the node if we exceeded the number of cuts
150  if ( p->nNodeCuts >= p->pParams->nKeepMax )
151  p->nCutsLimit++;
152 }
void Cut_CutRecycleList(Cut_Man_t *p, Cut_Cut_t *pList)
Definition: cutCut.c:148
static Cut_Cut_t * Cut_ListFinish(Cut_List_t *p)
Definition: cutList.h:191
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition: cutApi.c:80
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
typedefABC_NAMESPACE_HEADER_START struct Cut_ListStruct_t_ Cut_List_t
INCLUDES ///.
Definition: cutList.h:40
Cut_Cut_t * Cut_CutDupList(Cut_Man_t *p, Cut_Cut_t *pList)
Definition: cutCut.c:120
int Cut_CutCountList(Cut_Cut_t *pList)
Definition: cutCut.c:166
static abctime Abc_Clock()
Definition: abc_global.h:279
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:129
abctime timeMerge
Definition: cutInt.h:95
Cut_Cut_t * pStore1[2]
Definition: cutInt.h:70
Cut_Cut_t * pCompareNew
Definition: cutInt.h:72
Cut_Cut_t * pStore0[2]
Definition: cutInt.h:69
Cut_Cut_t * pCompareOld
Definition: cutInt.h:71
static void Cut_ListStart(Cut_List_t *p)
MACRO DEFINITIONS ///.
Definition: cutList.h:66
static ABC_NAMESPACE_IMPL_START void Cut_NodeShiftCutLeaves(Cut_Cut_t *pList, int nLat)
DECLARATIONS ///.
Definition: cutSeq.c:45
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
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)
Definition: cutNode.c:572
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
int nCutsLimit
Definition: cutInt.h:90
void Cut_NodeFreeCuts ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Deallocates the cuts at the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file cutApi.c.

185 {
186  Cut_Cut_t * pList, * pCut, * pCut2;
187  pList = Cut_NodeReadCutsNew( p, Node );
188  if ( pList == NULL )
189  return;
190  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
191  Cut_CutRecycle( p, pCut );
192  Cut_NodeWriteCutsNew( p, Node, NULL );
193 }
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
Definition: cutInt.h:112
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
void Cut_CutRecycle(Cut_Man_t *p, Cut_Cut_t *pCut)
Definition: cutCut.c:72
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
DECLARATIONS ///.
Definition: cutApi.c:45
void Cut_NodeNewMergeWithOld ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Merges the new cuts with the old cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file cutSeq.c.

166 {
167  Cut_Cut_t * pListOld, * pListNew, * pList;
168  // get the new cuts
169  pListNew = Cut_NodeReadCutsNew( p, Node );
170  if ( pListNew == NULL )
171  return;
172  Cut_NodeWriteCutsNew( p, Node, NULL );
173  // get the old cuts
174  pListOld = Cut_NodeReadCutsOld( p, Node );
175  if ( pListOld == NULL )
176  {
177  Cut_NodeWriteCutsOld( p, Node, pListNew );
178  return;
179  }
180  // merge the lists
181  pList = Cut_CutMergeLists( pListOld, pListNew );
182  Cut_NodeWriteCutsOld( p, Node, pList );
183 }
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
void Cut_NodeWriteCutsOld(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:113
Cut_Cut_t * Cut_CutMergeLists(Cut_Cut_t *pList1, Cut_Cut_t *pList2)
Definition: cutCut.c:185
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
void Cut_NodeOldTransferToNew ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Transfers the old cuts to be the new cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 217 of file cutSeq.c.

218 {
219  Cut_Cut_t * pList;
220  pList = Cut_NodeReadCutsOld( p, Node );
221  Cut_NodeWriteCutsOld( p, Node, NULL );
222  Cut_NodeWriteCutsNew( p, Node, pList );
223 // Cut_CutListVerify( pList );
224 }
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
void Cut_NodeWriteCutsOld(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:113
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t* Cut_NodeReadCutsNew ( Cut_Man_t p,
int  Node 
)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

MACRO DEFINITIONS ///.

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 [Returns the pointer to the linked list of cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cutApi.c.

46 {
47  if ( Node >= p->vCutsNew->nSize )
48  return NULL;
49  return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node );
50 }
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Vec_Ptr_t * vCutsNew
Definition: cutInt.h:55
Cut_Cut_t* Cut_NodeReadCutsOld ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Returns the pointer to the linked list of cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file cutApi.c.

64 {
65  assert( Node < p->vCutsOld->nSize );
66  return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsOld, Node );
67 }
Vec_Ptr_t * vCutsOld
Definition: cutInt.h:56
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
Cut_Cut_t* Cut_NodeReadCutsTemp ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Returns the pointer to the linked list of cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file cutApi.c.

81 {
82  assert( Node < p->vCutsTemp->nSize );
83  return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsTemp, Node );
84 }
Vec_Ptr_t * vCutsTemp
Definition: cutInt.h:57
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
void Cut_NodeSetTriv ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Sets the trivial cut for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 145 of file cutApi.c.

146 {
147  assert( Cut_NodeReadCutsNew(p, Node) == NULL );
148  Cut_NodeWriteCutsNew( p, Node, Cut_CutCreateTriv(p, Node) );
149 }
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t * Cut_CutCreateTriv(Cut_Man_t *p, int Node)
Definition: cutCut.c:238
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
DECLARATIONS ///.
Definition: cutApi.c:45
int Cut_NodeTempTransferToNew ( Cut_Man_t p,
int  Node,
int  CutSetNum 
)

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

Synopsis [Transfers the temporary cuts to be the new cuts.]

Description [Returns 1 if something was transferred.]

SideEffects []

SeeAlso []

Definition at line 197 of file cutSeq.c.

198 {
199  Cut_Cut_t * pList;
200  pList = Cut_NodeReadCutsTemp( p, CutSetNum );
201  Cut_NodeWriteCutsTemp( p, CutSetNum, NULL );
202  Cut_NodeWriteCutsNew( p, Node, pList );
203  return pList != NULL;
204 }
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition: cutApi.c:80
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:129
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
void Cut_NodeTryDroppingCuts ( Cut_Man_t p,
int  Node 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file cutApi.c.

163 {
164  int nFanouts;
165  assert( p->vFanCounts );
166  nFanouts = Vec_IntEntry( p->vFanCounts, Node );
167  assert( nFanouts > 0 );
168  if ( --nFanouts == 0 )
169  Cut_NodeFreeCuts( p, Node );
170  Vec_IntWriteEntry( p->vFanCounts, Node, nFanouts );
171 }
Vec_Int_t * vFanCounts
Definition: cutInt.h:52
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:184
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define assert(ex)
Definition: util_old.h:213
Cut_Cut_t* Cut_NodeUnionCuts ( Cut_Man_t p,
Vec_Int_t vNodes 
)

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

Synopsis [Computes the cuts by unioning cuts at a choice node.]

Description []

SideEffects []

SeeAlso []

Definition at line 678 of file cutNode.c.

679 {
680  Cut_List_t Super, * pSuper = &Super;
681  Cut_Cut_t * pList, * pListStart, * pCut, * pCut2;
682  Cut_Cut_t * pTop = NULL; // Suppress "might be used uninitialized"
683  int i, k, Node, Root, Limit = p->pParams->nVarsMax;
684  abctime clk = Abc_Clock();
685 
686  // start the new list
687  Cut_ListStart( pSuper );
688 
689  // remember the root node to save the resulting cuts
690  Root = Vec_IntEntry( vNodes, 0 );
691  p->nNodeCuts = 1;
692 
693  // collect small cuts first
694  Vec_PtrClear( p->vTemp );
695  Vec_IntForEachEntry( vNodes, Node, i )
696  {
697  // get the cuts of this node
698  pList = Cut_NodeReadCutsNew( p, Node );
699  Cut_NodeWriteCutsNew( p, Node, NULL );
700  assert( pList );
701  // remember the starting point
702  pListStart = pList->pNext;
703  pList->pNext = NULL;
704  // save or recycle the elementary cut
705  if ( i == 0 )
706  Cut_ListAdd( pSuper, pList ), pTop = pList;
707  else
708  Cut_CutRecycle( p, pList );
709  // save all the cuts that are smaller than the limit
710  Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
711  {
712  if ( pCut->nLeaves == (unsigned)Limit )
713  {
714  Vec_PtrPush( p->vTemp, pCut );
715  break;
716  }
717  // check containment
718  if ( p->pParams->fFilter && Cut_CutFilterOne( p, pSuper, pCut ) )
719  continue;
720  // set the complemented bit by comparing the first cut with the current cut
721  pCut->fCompl = pTop->fSimul ^ pCut->fSimul;
722  pListStart = pCut->pNext;
723  pCut->pNext = NULL;
724  // add to the list
725  Cut_ListAdd( pSuper, pCut );
726  if ( ++p->nNodeCuts == p->pParams->nKeepMax )
727  {
728  // recycle the rest of the cuts of this node
729  Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
730  Cut_CutRecycle( p, pCut );
731  // recycle all cuts of other nodes
732  Vec_IntForEachEntryStart( vNodes, Node, k, i+1 )
733  Cut_NodeFreeCuts( p, Node );
734  // recycle the saved cuts of other nodes
735  Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, k )
736  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
737  Cut_CutRecycle( p, pCut );
738  goto finish;
739  }
740  }
741  }
742  // collect larger cuts next
743  Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, i )
744  {
745  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
746  {
747  // check containment
748  if ( p->pParams->fFilter && Cut_CutFilterOne( p, pSuper, pCut ) )
749  continue;
750  // set the complemented bit
751  pCut->fCompl = pTop->fSimul ^ pCut->fSimul;
752  pListStart = pCut->pNext;
753  pCut->pNext = NULL;
754  // add to the list
755  Cut_ListAdd( pSuper, pCut );
756  if ( ++p->nNodeCuts == p->pParams->nKeepMax )
757  {
758  // recycle the rest of the cuts
759  Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
760  Cut_CutRecycle( p, pCut );
761  // recycle the saved cuts of other nodes
762  Vec_PtrForEachEntryStart( Cut_Cut_t *, p->vTemp, pList, k, i+1 )
763  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
764  Cut_CutRecycle( p, pCut );
765  goto finish;
766  }
767  }
768  }
769 finish :
770  // set the cuts at the node
771  assert( Cut_NodeReadCutsNew(p, Root) == NULL );
772  pList = Cut_ListFinish( pSuper );
773  Cut_NodeWriteCutsNew( p, Root, pList );
774 p->timeUnion += Abc_Clock() - clk;
775  // filter the cuts
776 //clk = Abc_Clock();
777 // if ( p->pParams->fFilter )
778 // Cut_CutFilter( p, pList );
779 //p->timeFilter += Abc_Clock() - clk;
780  p->nNodes -= vNodes->nSize - 1;
781  return pList;
782 }
static Cut_Cut_t * Cut_ListFinish(Cut_List_t *p)
Definition: cutList.h:191
static void Cut_ListAdd(Cut_List_t *p, Cut_Cut_t *pCut)
Definition: cutList.h:87
Vec_Ptr_t * vTemp
Definition: cutInt.h:64
typedefABC_NAMESPACE_HEADER_START struct Cut_ListStruct_t_ Cut_List_t
INCLUDES ///.
Definition: cutList.h:40
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
static int Cut_CutFilterOne(Cut_Man_t *p, Cut_List_t *pSuperList, Cut_Cut_t *pCut)
Definition: cutNode.c:152
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
Definition: cutInt.h:112
Cut_Cut_t * pNext
Definition: cut.h:88
unsigned fSimul
Definition: cut.h:81
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
unsigned nLeaves
Definition: cut.h:84
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:184
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
void Cut_CutRecycle(Cut_Man_t *p, Cut_Cut_t *pCut)
Definition: cutCut.c:72
static void Cut_ListStart(Cut_List_t *p)
MACRO DEFINITIONS ///.
Definition: cutList.h:66
unsigned fCompl
Definition: cut.h:82
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
Cut_Cut_t* Cut_NodeUnionCutsSeq ( Cut_Man_t p,
Vec_Int_t vNodes,
int  CutSetNum,
int  fFirst 
)

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

Synopsis [Computes the cuts by unioning cuts at a choice node.]

Description []

SideEffects []

SeeAlso []

Definition at line 795 of file cutNode.c.

796 {
797  Cut_List_t Super, * pSuper = &Super;
798  Cut_Cut_t * pList, * pListStart, * pCut, * pCut2, * pTop;
799  int i, k, Node, Root, Limit = p->pParams->nVarsMax;
800  abctime clk = Abc_Clock();
801 
802  // start the new list
803  Cut_ListStart( pSuper );
804 
805  // remember the root node to save the resulting cuts
806  Root = Vec_IntEntry( vNodes, 0 );
807  p->nNodeCuts = 1;
808 
809  // store the original lists for comparison
810  p->pCompareOld = Cut_NodeReadCutsOld( p, Root );
811  p->pCompareNew = (CutSetNum >= 0)? Cut_NodeReadCutsNew( p, Root ) : NULL;
812 
813  // get the topmost cut
814  pTop = NULL;
815  if ( (pTop = Cut_NodeReadCutsOld( p, Root )) == NULL )
816  pTop = Cut_NodeReadCutsNew( p, Root );
817  assert( pTop != NULL );
818 
819  // collect small cuts first
820  Vec_PtrClear( p->vTemp );
821  Vec_IntForEachEntry( vNodes, Node, i )
822  {
823  // get the cuts of this node
824  if ( i == 0 && CutSetNum >= 0 )
825  {
826  pList = Cut_NodeReadCutsTemp( p, CutSetNum );
827  Cut_NodeWriteCutsTemp( p, CutSetNum, NULL );
828  }
829  else
830  {
831  pList = Cut_NodeReadCutsNew( p, Node );
832  Cut_NodeWriteCutsNew( p, Node, NULL );
833  }
834  if ( pList == NULL )
835  continue;
836 
837  // process the cuts
838  if ( fFirst )
839  {
840  // remember the starting point
841  pListStart = pList->pNext;
842  pList->pNext = NULL;
843  // save or recycle the elementary cut
844  if ( i == 0 )
845  Cut_ListAdd( pSuper, pList );
846  else
847  Cut_CutRecycle( p, pList );
848  }
849  else
850  pListStart = pList;
851 
852  // save all the cuts that are smaller than the limit
853  Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
854  {
855  if ( pCut->nLeaves == (unsigned)Limit )
856  {
857  Vec_PtrPush( p->vTemp, pCut );
858  break;
859  }
860  // check containment
861 // if ( p->pParams->fFilter && Cut_CutFilterOne( p, pSuper, pCut ) )
862 // continue;
863  if ( p->pParams->fFilter )
864  {
865  if ( Cut_CutFilterOne(p, pSuper, pCut) )
866  continue;
867  if ( p->pParams->fSeq )
868  {
869  if ( p->pCompareOld && Cut_CutFilterOld(p, p->pCompareOld, pCut) )
870  continue;
871  if ( p->pCompareNew && Cut_CutFilterOld(p, p->pCompareNew, pCut) )
872  continue;
873  }
874  }
875 
876  // set the complemented bit by comparing the first cut with the current cut
877  pCut->fCompl = pTop->fSimul ^ pCut->fSimul;
878  pListStart = pCut->pNext;
879  pCut->pNext = NULL;
880  // add to the list
881  Cut_ListAdd( pSuper, pCut );
882  if ( ++p->nNodeCuts == p->pParams->nKeepMax )
883  {
884  // recycle the rest of the cuts of this node
885  Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
886  Cut_CutRecycle( p, pCut );
887  // recycle all cuts of other nodes
888  Vec_IntForEachEntryStart( vNodes, Node, k, i+1 )
889  Cut_NodeFreeCuts( p, Node );
890  // recycle the saved cuts of other nodes
891  Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, k )
892  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
893  Cut_CutRecycle( p, pCut );
894  goto finish;
895  }
896  }
897  }
898  // collect larger cuts next
899  Vec_PtrForEachEntry( Cut_Cut_t *, p->vTemp, pList, i )
900  {
901  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
902  {
903  // check containment
904 // if ( p->pParams->fFilter && Cut_CutFilterOne( p, pSuper, pCut ) )
905 // continue;
906  if ( p->pParams->fFilter )
907  {
908  if ( Cut_CutFilterOne(p, pSuper, pCut) )
909  continue;
910  if ( p->pParams->fSeq )
911  {
912  if ( p->pCompareOld && Cut_CutFilterOld(p, p->pCompareOld, pCut) )
913  continue;
914  if ( p->pCompareNew && Cut_CutFilterOld(p, p->pCompareNew, pCut) )
915  continue;
916  }
917  }
918 
919  // set the complemented bit
920  pCut->fCompl = pTop->fSimul ^ pCut->fSimul;
921  pListStart = pCut->pNext;
922  pCut->pNext = NULL;
923  // add to the list
924  Cut_ListAdd( pSuper, pCut );
925  if ( ++p->nNodeCuts == p->pParams->nKeepMax )
926  {
927  // recycle the rest of the cuts
928  Cut_ListForEachCutSafe( pListStart, pCut, pCut2 )
929  Cut_CutRecycle( p, pCut );
930  // recycle the saved cuts of other nodes
931  Vec_PtrForEachEntryStart( Cut_Cut_t *, p->vTemp, pList, k, i+1 )
932  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
933  Cut_CutRecycle( p, pCut );
934  goto finish;
935  }
936  }
937  }
938 finish :
939  // set the cuts at the node
940  pList = Cut_ListFinish( pSuper );
941 
942  // set the lists at the node
943 // assert( Cut_NodeReadCutsNew(p, Root) == NULL );
944 // Cut_NodeWriteCutsNew( p, Root, pList );
945  if ( CutSetNum >= 0 )
946  {
947  assert( Cut_NodeReadCutsTemp(p, CutSetNum) == NULL );
948  Cut_NodeWriteCutsTemp( p, CutSetNum, pList );
949  }
950  else
951  {
952  assert( Cut_NodeReadCutsNew(p, Root) == NULL );
953  Cut_NodeWriteCutsNew( p, Root, pList );
954  }
955 
956 p->timeUnion += Abc_Clock() - clk;
957  // filter the cuts
958 //clk = Abc_Clock();
959 // if ( p->pParams->fFilter )
960 // Cut_CutFilter( p, pList );
961 //p->timeFilter += Abc_Clock() - clk;
962 // if ( fFirst )
963 // p->nNodes -= vNodes->nSize - 1;
964  return pList;
965 }
static Cut_Cut_t * Cut_ListFinish(Cut_List_t *p)
Definition: cutList.h:191
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition: cutApi.c:80
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
static void Cut_ListAdd(Cut_List_t *p, Cut_Cut_t *pCut)
Definition: cutList.h:87
Vec_Ptr_t * vTemp
Definition: cutInt.h:64
typedefABC_NAMESPACE_HEADER_START struct Cut_ListStruct_t_ Cut_List_t
INCLUDES ///.
Definition: cutList.h:40
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
static int Cut_CutFilterOne(Cut_Man_t *p, Cut_List_t *pSuperList, Cut_Cut_t *pCut)
Definition: cutNode.c:152
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
Definition: cutInt.h:112
Cut_Cut_t * pNext
Definition: cut.h:88
unsigned fSimul
Definition: cut.h:81
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:129
unsigned nLeaves
Definition: cut.h:84
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:184
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Cut_Cut_t * pCompareNew
Definition: cutInt.h:72
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
void Cut_CutRecycle(Cut_Man_t *p, Cut_Cut_t *pCut)
Definition: cutCut.c:72
Cut_Cut_t * pCompareOld
Definition: cutInt.h:71
static void Cut_ListStart(Cut_List_t *p)
MACRO DEFINITIONS ///.
Definition: cutList.h:66
unsigned fCompl
Definition: cut.h:82
static int Cut_CutFilterOld(Cut_Man_t *p, Cut_Cut_t *pList, Cut_Cut_t *pCut)
Definition: cutNode.c:250
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
void Cut_NodeWriteCutsNew ( Cut_Man_t p,
int  Node,
Cut_Cut_t pList 
)

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

Synopsis [Returns the pointer to the linked list of cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file cutApi.c.

98 {
99  Vec_PtrWriteEntry( p->vCutsNew, Node, pList );
100 }
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Vec_Ptr_t * vCutsNew
Definition: cutInt.h:55
void Cut_NodeWriteCutsOld ( Cut_Man_t p,
int  Node,
Cut_Cut_t pList 
)

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

Synopsis [Returns the pointer to the linked list of cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file cutApi.c.

114 {
115  Vec_PtrWriteEntry( p->vCutsOld, Node, pList );
116 }
Vec_Ptr_t * vCutsOld
Definition: cutInt.h:56
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
void Cut_NodeWriteCutsTemp ( Cut_Man_t p,
int  Node,
Cut_Cut_t pList 
)

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

Synopsis [Returns the pointer to the linked list of cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file cutApi.c.

130 {
131  Vec_PtrWriteEntry( p->vCutsTemp, Node, pList );
132 }
Vec_Ptr_t * vCutsTemp
Definition: cutInt.h:57
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Cut_Cut_t* Cut_OracleComputeCuts ( Cut_Oracle_t p,
int  Node,
int  Node0,
int  Node1,
int  fCompl0,
int  fCompl1 
)

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

Synopsis [Reconstruct the cuts of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file cutOracle.c.

321 {
322  Cut_Cut_t * pList = NULL, ** ppTail = &pList;
323  Cut_Cut_t * pCut, * pCut0, * pCut1, * pList0, * pList1;
324  int iCutStart, nCuts, i, Entry;
325  abctime clk = Abc_Clock();
326 
327  // get the cuts of the children
328  pList0 = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node0 );
329  pList1 = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node1 );
330  assert( pList0 && pList1 );
331 
332  // get the complemented attribute of the cut
333  p->fSimul = (fCompl0 ^ pList0->fSimul) & (fCompl1 ^ pList1->fSimul);
334 
335  // collect the cuts
336  Vec_PtrClear( p->vCuts0 );
337  Cut_ListForEachCut( pList0, pCut )
338  Vec_PtrPush( p->vCuts0, pCut );
339  Vec_PtrClear( p->vCuts1 );
340  Cut_ListForEachCut( pList1, pCut )
341  Vec_PtrPush( p->vCuts1, pCut );
342 
343  // get the first and last cuts of this node
344  nCuts = Vec_IntEntry(p->vNodeCuts, Node);
345  iCutStart = Vec_IntEntry(p->vNodeStarts, Node);
346 
347  // create trivial cut
348  assert( Vec_IntEntry(p->vCutPairs, iCutStart) == 0 );
349  pCut = Cut_CutTriv( p, Node );
350  *ppTail = pCut;
351  ppTail = &pCut->pNext;
352  // create other cuts
353  for ( i = 1; i < nCuts; i++ )
354  {
355  Entry = Vec_IntEntry( p->vCutPairs, iCutStart + i );
356  pCut0 = (Cut_Cut_t *)Vec_PtrEntry( p->vCuts0, Entry & 0xFFFF );
357  pCut1 = (Cut_Cut_t *)Vec_PtrEntry( p->vCuts1, Entry >> 16 );
358  pCut = Cut_CutMerge( p, pCut0, pCut1 );
359  *ppTail = pCut;
360  ppTail = &pCut->pNext;
361  // compute the truth table
362  if ( p->pParams->fTruth )
363  Cut_TruthComputeOld( pCut, pCut0, pCut1, fCompl0, fCompl1 );
364  }
365  *ppTail = NULL;
366 
367  // write the new cut
368  assert( Vec_PtrEntry( p->vCutsNew, Node ) == NULL );
369  Vec_PtrWriteEntry( p->vCutsNew, Node, pList );
370 p->timeTotal += Abc_Clock() - clk;
371  return pList;
372 }
void Cut_TruthComputeOld(Cut_Cut_t *pCut, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1, int fCompl0, int fCompl1)
Definition: cutTruth.c:126
static Cut_Cut_t * Cut_CutMerge(Cut_Oracle_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
Definition: cutOracle.c:262
unsigned fSimul
Definition: cut.h:81
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
for(p=first;p->value< newval;p=p->next)
static Cut_Cut_t * Cut_CutTriv(Cut_Oracle_t *p, int Node)
Definition: cutOracle.c:234
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Ptr_t * vCutsNew
Definition: cutOracle.c:37
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Cut_ListForEachCut(pList, pCut)
Definition: cutInt.h:104
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Ptr_t * vCuts0
Definition: cutOracle.c:38
void Cut_OracleNodeSetTriv ( Cut_Oracle_t p,
int  Node 
)

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

Synopsis [Sets the trivial cut for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file cutOracle.c.

193 {
194  assert( Vec_PtrEntry( p->vCutsNew, Node ) == NULL );
195  Vec_PtrWriteEntry( p->vCutsNew, Node, Cut_CutTriv(p, Node) );
196 }
static Cut_Cut_t * Cut_CutTriv(Cut_Oracle_t *p, int Node)
Definition: cutOracle.c:234
Vec_Ptr_t * vCutsNew
Definition: cutOracle.c:37
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
int Cut_OracleReadDrop ( Cut_Oracle_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 176 of file cutOracle.c.

177 {
178  return p->pParams->fDrop;
179 }
Cut_Params_t * pParams
Definition: cutOracle.c:33
void Cut_OracleSetFanoutCounts ( Cut_Oracle_t p,
Vec_Int_t vFanCounts 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 160 of file cutOracle.c.

161 {
162  p->vFanCounts = vFanCounts;
163 }
Vec_Int_t * vFanCounts
Definition: cutOracle.c:34
Cut_Oracle_t* Cut_OracleStart ( Cut_Man_t pMan)

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the cut oracle.]

Description []

SideEffects []

SeeAlso []

Definition at line 73 of file cutOracle.c.

74 {
75  Cut_Oracle_t * p;
76 
77  assert( pMan->pParams->nVarsMax >= 3 && pMan->pParams->nVarsMax <= CUT_SIZE_MAX );
78  assert( pMan->pParams->fRecord );
79 
80  p = ABC_ALLOC( Cut_Oracle_t, 1 );
81  memset( p, 0, sizeof(Cut_Oracle_t) );
82 
83  // set and correct parameters
84  p->pParams = pMan->pParams;
85 
86  // transfer the recording info
87  p->vNodeCuts = pMan->vNodeCuts; pMan->vNodeCuts = NULL;
88  p->vNodeStarts = pMan->vNodeStarts; pMan->vNodeStarts = NULL;
89  p->vCutPairs = pMan->vCutPairs; pMan->vCutPairs = NULL;
90 
91  // prepare storage for cuts
93  Vec_PtrFill( p->vCutsNew, p->pParams->nIdsMax, NULL );
94  p->vCuts0 = Vec_PtrAlloc( 100 );
95  p->vCuts1 = Vec_PtrAlloc( 100 );
96 
97  // entry size
98  p->EntrySize = sizeof(Cut_Cut_t) + p->pParams->nVarsMax * sizeof(int);
99  if ( p->pParams->fTruth )
100  {
101  if ( p->pParams->nVarsMax > 8 )
102  {
103  p->pParams->fTruth = 0;
104  printf( "Skipping computation of truth table for more than 8 inputs.\n" );
105  }
106  else
107  {
109  p->EntrySize += p->nTruthWords * sizeof(unsigned);
110  }
111  }
112  // memory for cuts
114  return p;
115 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFill(Vec_Ptr_t *p, int nSize, void *Entry)
Definition: vecPtr.h:449
Extra_MmFixed_t * pMmCuts
Definition: cutOracle.c:45
static int Cut_TruthWords(int nVarsMax)
Definition: cutInt.h:125
Cut_Params_t * pParams
Definition: cutOracle.c:33
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Int_t * vNodeCuts
Definition: cutOracle.c:41
Vec_Int_t * vNodeStarts
Definition: cutInt.h:76
#define CUT_SIZE_MAX
Definition: cut.h:39
struct Cut_CutStruct_t_ Cut_Cut_t
Definition: cut.h:50
Vec_Int_t * vCutPairs
Definition: cutInt.h:77
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
Vec_Ptr_t * vCutsNew
Definition: cutOracle.c:37
Vec_Int_t * vNodeStarts
Definition: cutOracle.c:42
Vec_Int_t * vCutPairs
Definition: cutOracle.c:43
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Int_t * vNodeCuts
Definition: cutInt.h:75
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
DECLARATIONS ///.
Definition: cutOracle.c:30
Vec_Ptr_t * vCuts1
Definition: cutOracle.c:39
Vec_Ptr_t * vCuts0
Definition: cutOracle.c:38
void Cut_OracleStop ( Cut_Oracle_t p)

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

Synopsis [Stop the cut oracle.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file cutOracle.c.

128 {
129 // if ( p->pParams->fVerbose )
130  {
131  printf( "Cut computation statistics with oracle:\n" );
132  printf( "Current cuts = %8d. (Trivial = %d.)\n", p->nCuts-p->nCutsTriv, p->nCutsTriv );
133  ABC_PRT( "Total time ", p->timeTotal );
134  }
135 
136  if ( p->vCuts0 ) Vec_PtrFree( p->vCuts0 );
137  if ( p->vCuts1 ) Vec_PtrFree( p->vCuts1 );
138  if ( p->vCutsNew ) Vec_PtrFree( p->vCutsNew );
139  if ( p->vFanCounts ) Vec_IntFree( p->vFanCounts );
140 
141  if ( p->vNodeCuts ) Vec_IntFree( p->vNodeCuts );
142  if ( p->vNodeStarts ) Vec_IntFree( p->vNodeStarts );
143  if ( p->vCutPairs ) Vec_IntFree( p->vCutPairs );
144 
146  ABC_FREE( p );
147 }
Extra_MmFixed_t * pMmCuts
Definition: cutOracle.c:45
void Extra_MmFixedStop(Extra_MmFixed_t *p)
Vec_Int_t * vNodeCuts
Definition: cutOracle.c:41
Vec_Ptr_t * vCutsNew
Definition: cutOracle.c:37
Vec_Int_t * vNodeStarts
Definition: cutOracle.c:42
Vec_Int_t * vCutPairs
Definition: cutOracle.c:43
Vec_Int_t * vFanCounts
Definition: cutOracle.c:34
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t * vCuts1
Definition: cutOracle.c:39
Vec_Ptr_t * vCuts0
Definition: cutOracle.c:38
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Cut_OracleTryDroppingCuts ( Cut_Oracle_t p,
int  Node 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 407 of file cutOracle.c.

408 {
409  int nFanouts;
410  assert( p->vFanCounts );
411  nFanouts = Vec_IntEntry( p->vFanCounts, Node );
412  assert( nFanouts > 0 );
413  if ( --nFanouts == 0 )
414  Cut_OracleFreeCuts( p, Node );
415  Vec_IntWriteEntry( p->vFanCounts, Node, nFanouts );
416 }
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vFanCounts
Definition: cutOracle.c:34
#define assert(ex)
Definition: util_old.h:213
void Cut_OracleFreeCuts(Cut_Oracle_t *p, int Node)
Definition: cutOracle.c:385
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