ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
cutOracle.c File Reference
#include "cutInt.h"
Include dependency graph for cutOracle.c:

Go to the source code of this file.

Classes

struct  Cut_OracleStruct_t_
 DECLARATIONS ///. More...
 

Functions

Cut_Oracle_tCut_OracleStart (Cut_Man_t *pMan)
 FUNCTION DEFINITIONS ///.
 
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_OracleFreeCuts (Cut_Oracle_t *p, int Node)
 
void Cut_OracleTryDroppingCuts (Cut_Oracle_t *p, int Node)
 

Function Documentation

◆ Cut_OracleComputeCuts()

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 );
370p->timeTotal += Abc_Clock() - clk;
371 return pList;
372}
ABC_INT64_T abctime
Definition abc_global.h:332
#define Cut_ListForEachCut(pList, pCut)
Definition cutInt.h:104
void Cut_TruthComputeOld(Cut_Cut_t *pCut, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1, int fCompl0, int fCompl1)
Definition cutTruth.c:126
struct Cut_CutStruct_t_ Cut_Cut_t
Definition cut.h:50
Cube * p
Definition exorList.c:222
unsigned fSimul
Definition cut.h:81
Cut_Cut_t * pNext
Definition cut.h:88
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cut_OracleFreeCuts()

void Cut_OracleFreeCuts ( Cut_Oracle_t * p,
int Node )

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

Synopsis [Deallocates the cuts at the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 385 of file cutOracle.c.

386{
387 Cut_Cut_t * pList, * pCut, * pCut2;
388 pList = (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node );
389 if ( pList == NULL )
390 return;
391 Cut_ListForEachCutSafe( pList, pCut, pCut2 )
392 Extra_MmFixedEntryRecycle( p->pMmCuts, (char *)pCut );
393 Vec_PtrWriteEntry( p->vCutsNew, Node, pList );
394}
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
Definition cutInt.h:112
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cut_OracleNodeSetTriv()

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}
Here is the caller graph for this function:

◆ Cut_OracleReadDrop()

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}
Here is the caller graph for this function:

◆ Cut_OracleSetFanoutCounts()

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}
Here is the caller graph for this function:

◆ Cut_OracleStart()

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{
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
92 p->vCutsNew = Vec_PtrAlloc( p->pParams->nIdsMax );
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 {
108 p->nTruthWords = Cut_TruthWords( p->pParams->nVarsMax );
109 p->EntrySize += p->nTruthWords * sizeof(unsigned);
110 }
111 }
112 // memory for cuts
113 p->pMmCuts = Extra_MmFixedStart( p->EntrySize );
114 return p;
115}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define CUT_SIZE_MAX
Definition cut.h:39
struct Cut_OracleStruct_t_ Cut_Oracle_t
Definition cut.h:49
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
Vec_Int_t * vNodeCuts
Definition cutInt.h:75
Vec_Int_t * vCutPairs
Definition cutInt.h:77
Cut_Params_t * pParams
Definition cutInt.h:51
Vec_Int_t * vNodeStarts
Definition cutInt.h:76
char * memset()
Here is the call graph for this function:

◆ Cut_OracleStop()

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
145 Extra_MmFixedStop( p->pMmCuts );
146 ABC_FREE( p );
147}
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_FREE(obj)
Definition abc_global.h:267
void Extra_MmFixedStop(Extra_MmFixed_t *p)
Here is the call graph for this function:

◆ Cut_OracleTryDroppingCuts()

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}
void Cut_OracleFreeCuts(Cut_Oracle_t *p, int Node)
Definition cutOracle.c:385
Here is the call graph for this function:
Here is the caller graph for this function: