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

Go to the source code of this file.

Functions

void Rwt_ListAddToTail (Rwt_Node_t **ppList, Rwt_Node_t *pNode)
 FUNCTION DEFINITIONS ///.
 
Rwt_Node_tRwt_ManAddVar (Rwt_Man_t *p, unsigned uTruth, int fPrecompute)
 
Rwt_Node_tRwt_ManAddNode (Rwt_Man_t *p, Rwt_Node_t *p0, Rwt_Node_t *p1, int fExor, int Level, int Volume)
 
void Rwt_Trav_rec (Rwt_Man_t *p, Rwt_Node_t *pNode, int *pVolume)
 
void Rwt_ManIncTravId (Rwt_Man_t *p)
 
int Rwt_ManNodeVolume (Rwt_Man_t *p, Rwt_Node_t *p0, Rwt_Node_t *p1)
 
void Rwt_ManLoadFromArray (Rwt_Man_t *p, int fVerbose)
 
char * Rwt_ManGetPractical (Rwt_Man_t *p)
 

Function Documentation

◆ Rwt_ListAddToTail()

void Rwt_ListAddToTail ( Rwt_Node_t ** ppList,
Rwt_Node_t * pNode )

FUNCTION DEFINITIONS ///.

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

Synopsis [Adds the node to the end of the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 425 of file rwtUtil.c.

426{
427 Rwt_Node_t * pTemp;
428 // find the last one
429 for ( pTemp = *ppList; pTemp; pTemp = pTemp->pNext )
430 ppList = &pTemp->pNext;
431 // attach at the end
432 *ppList = pNode;
433}
struct Rwt_Node_t_ Rwt_Node_t
Definition rwt.h:56
Rwt_Node_t * pNext
Definition rwt.h:118
Here is the caller graph for this function:

◆ Rwt_ManAddNode()

Rwt_Node_t * Rwt_ManAddNode ( Rwt_Man_t * p,
Rwt_Node_t * p0,
Rwt_Node_t * p1,
int fExor,
int Level,
int Volume )

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

Synopsis [Adds one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 477 of file rwtUtil.c.

478{
479 Rwt_Node_t * pNew;
480 unsigned uTruth;
481 // compute truth table, leve, volume
482 p->nConsidered++;
483 if ( fExor )
484 uTruth = (p0->uTruth ^ p1->uTruth);
485 else
486 uTruth = (Rwt_IsComplement(p0)? ~Rwt_Regular(p0)->uTruth : Rwt_Regular(p0)->uTruth) &
487 (Rwt_IsComplement(p1)? ~Rwt_Regular(p1)->uTruth : Rwt_Regular(p1)->uTruth) & 0xFFFF;
488 // create the new node
489 pNew = (Rwt_Node_t *)Mem_FixedEntryFetch( p->pMmNode );
490 pNew->Id = p->vForest->nSize;
491 pNew->TravId = 0;
492 pNew->uTruth = uTruth;
493 pNew->Level = Level;
494 pNew->Volume = Volume;
495 pNew->fUsed = 0;
496 pNew->fExor = fExor;
497 pNew->p0 = p0;
498 pNew->p1 = p1;
499 pNew->pNext = NULL;
500 Vec_PtrPush( p->vForest, pNew );
501 // do not add if the node is not essential
502 if ( uTruth != p->puCanons[uTruth] )
503 return pNew;
504
505 // add to the list
506 p->nAdded++;
507 if ( p->pTable[uTruth] == NULL )
508 p->nClasses++;
509 Rwt_ListAddToTail( p->pTable + uTruth, pNew );
510 return pNew;
511}
Cube * p
Definition exorList.c:222
char * Mem_FixedEntryFetch(Mem_Fixed_t *p)
Definition mem.c:184
void Rwt_ListAddToTail(Rwt_Node_t **ppList, Rwt_Node_t *pNode)
FUNCTION DEFINITIONS ///.
Definition rwtUtil.c:425
unsigned Level
Definition rwt.h:113
unsigned uTruth
Definition rwt.h:111
int TravId
Definition rwt.h:110
unsigned fUsed
Definition rwt.h:114
unsigned Volume
Definition rwt.h:112
unsigned fExor
Definition rwt.h:115
Rwt_Node_t * p1
Definition rwt.h:117
Rwt_Node_t * p0
Definition rwt.h:116
int Id
Definition rwt.h:109
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwt_ManAddVar()

Rwt_Node_t * Rwt_ManAddVar ( Rwt_Man_t * p,
unsigned uTruth,
int fPrecompute )

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

Synopsis [Adds one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 446 of file rwtUtil.c.

447{
448 Rwt_Node_t * pNew;
449 pNew = (Rwt_Node_t *)Mem_FixedEntryFetch( p->pMmNode );
450 pNew->Id = p->vForest->nSize;
451 pNew->TravId = 0;
452 pNew->uTruth = uTruth;
453 pNew->Level = 0;
454 pNew->Volume = 0;
455 pNew->fUsed = 1;
456 pNew->fExor = 0;
457 pNew->p0 = NULL;
458 pNew->p1 = NULL;
459 pNew->pNext = NULL;
460 Vec_PtrPush( p->vForest, pNew );
461 if ( fPrecompute )
462 Rwt_ListAddToTail( p->pTable + uTruth, pNew );
463 return pNew;
464}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwt_ManGetPractical()

char * Rwt_ManGetPractical ( Rwt_Man_t * p)

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

Synopsis [Create practical classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 640 of file rwtUtil.c.

641{
642 char * pPractical;
643 int i;
644 pPractical = ABC_ALLOC( char, p->nFuncs );
645 memset( pPractical, 0, sizeof(char) * p->nFuncs );
646 pPractical[0] = 1;
647 for ( i = 1; ; i++ )
648 {
649 if ( s_RwtPracticalClasses[i] == 0 )
650 break;
651 pPractical[ s_RwtPracticalClasses[i] ] = 1;
652 }
653 return pPractical;
654}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwt_ManIncTravId()

void Rwt_ManIncTravId ( Rwt_Man_t * p)

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

Synopsis [Adds one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 547 of file rwtUtil.c.

548{
549 Rwt_Node_t * pNode;
550 int i;
551 if ( p->nTravIds++ < 0x8FFFFFFF )
552 return;
553 Vec_PtrForEachEntry( Rwt_Node_t *, p->vForest, pNode, i )
554 pNode->TravId = 0;
555 p->nTravIds = 1;
556}
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the caller graph for this function:

◆ Rwt_ManLoadFromArray()

void Rwt_ManLoadFromArray ( Rwt_Man_t * p,
int fVerbose )

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

Synopsis [Loads data.]

Description []

SideEffects []

SeeAlso []

Definition at line 589 of file rwtUtil.c.

590{
591 unsigned short * pArray = s_RwtAigSubgraphs;
592 Rwt_Node_t * p0, * p1;
593 unsigned Entry0, Entry1;
594 int Level, Volume, nEntries, fExor;
595 int i;
596 abctime clk = Abc_Clock();
597
598 // reconstruct the forest
599 for ( i = 0; ; i++ )
600 {
601 Entry0 = pArray[2*i + 0];
602 Entry1 = pArray[2*i + 1];
603 if ( Entry0 == 0 && Entry1 == 0 )
604 break;
605 // get EXOR flag
606 fExor = (Entry0 & 1);
607 Entry0 >>= 1;
608 // get the nodes
609 p0 = (Rwt_Node_t *)p->vForest->pArray[Entry0 >> 1];
610 p1 = (Rwt_Node_t *)p->vForest->pArray[Entry1 >> 1];
611 // compute the level and volume of the new nodes
612 Level = 1 + RWT_MAX( p0->Level, p1->Level );
613 Volume = 1 + Rwt_ManNodeVolume( p, p0, p1 );
614 // set the complemented attributes
615 p0 = Rwt_NotCond( p0, (Entry0 & 1) );
616 p1 = Rwt_NotCond( p1, (Entry1 & 1) );
617 // add the node
618// Rwt_ManTryNode( p, p0, p1, Level, Volume );
619 Rwt_ManAddNode( p, p0, p1, fExor, Level, Volume + fExor );
620 }
621 nEntries = i - 1;
622 if ( fVerbose )
623 {
624 printf( "The number of classes = %d. Canonical nodes = %d.\n", p->nClasses, p->nAdded );
625 printf( "The number of nodes loaded = %d. ", nEntries ); ABC_PRT( "Loading", Abc_Clock() - clk );
626 }
627}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
int Rwt_ManNodeVolume(Rwt_Man_t *p, Rwt_Node_t *p0, Rwt_Node_t *p1)
Definition rwtUtil.c:569
Rwt_Node_t * Rwt_ManAddNode(Rwt_Man_t *p, Rwt_Node_t *p0, Rwt_Node_t *p1, int fExor, int Level, int Volume)
Definition rwtUtil.c:477
#define RWT_MAX(a, b)
Definition rwt.h:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwt_ManNodeVolume()

int Rwt_ManNodeVolume ( Rwt_Man_t * p,
Rwt_Node_t * p0,
Rwt_Node_t * p1 )

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

Synopsis [Adds one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 569 of file rwtUtil.c.

570{
571 int Volume = 0;
573 Rwt_Trav_rec( p, p0, &Volume );
574 Rwt_Trav_rec( p, p1, &Volume );
575 return Volume;
576}
void Rwt_Trav_rec(Rwt_Man_t *p, Rwt_Node_t *pNode, int *pVolume)
Definition rwtUtil.c:524
void Rwt_ManIncTravId(Rwt_Man_t *p)
Definition rwtUtil.c:547
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rwt_Trav_rec()

void Rwt_Trav_rec ( Rwt_Man_t * p,
Rwt_Node_t * pNode,
int * pVolume )

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

Synopsis [Adds one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 524 of file rwtUtil.c.

525{
526 if ( pNode->fUsed || pNode->TravId == p->nTravIds )
527 return;
528 pNode->TravId = p->nTravIds;
529 (*pVolume)++;
530 if ( pNode->fExor )
531 (*pVolume)++;
532 Rwt_Trav_rec( p, Rwt_Regular(pNode->p0), pVolume );
533 Rwt_Trav_rec( p, Rwt_Regular(pNode->p1), pVolume );
534}
Here is the call graph for this function:
Here is the caller graph for this function: