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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START Cut_Cut_tCut_CutAlloc (Cut_Man_t *p)
 DECLARATIONS ///.
 
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)
 
int Cut_CutCountList (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_CutPrint (Cut_Cut_t *pCut, int fSeq)
 
void Cut_CutPrintList (Cut_Cut_t *pList, int fSeq)
 
void Cut_CutPrintMerge (Cut_Cut_t *pCut, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
 

Function Documentation

◆ Cut_CutAlloc()

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
49 pCut = (Cut_Cut_t *)Extra_MmFixedEntryFetch( p->pMmCuts );
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}
struct Cut_CutStruct_t_ Cut_Cut_t
Definition cut.h:50
Cube * p
Definition exorList.c:222
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
unsigned nVarsMax
Definition cut.h:83
unsigned fSimul
Definition cut.h:81
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cut_CutCompare()

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

◆ Cut_CutCountList()

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}
#define Cut_ListForEachCut(pList, pCut)
Definition cutInt.h:104
Here is the caller graph for this function:

◆ Cut_CutCreateTriv()

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
#define CUT_SHIFT
Definition cut.h:41
unsigned uSign
Definition cut.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cut_CutDupList()

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, (size_t)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()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cut_CutMergeLists()

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}
int Cut_CutCompare(Cut_Cut_t *pCut1, Cut_Cut_t *pCut2)
Definition cutCut.c:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cut_CutNumberList()

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}
unsigned Num0
Definition cut.h:79
Here is the caller graph for this function:

◆ Cut_CutPrint()

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}
#define CUT_MASK
Definition cut.h:42
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Cut_CutPrintList()

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

◆ Cut_CutPrintMerge()

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}

◆ Cut_CutRecycle()

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}
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_CutRecycleList()

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