ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcLut.c File Reference
#include "base/abc/abc.h"
#include "opt/cut/cut.h"
Include dependency graph for abcLut.c:

Go to the source code of this file.

Classes

struct  Abc_ManScl_t_
 

Macros

#define LARGE_LEVEL   1000000
 
#define SCL_LUT_MAX   6
 DECLARATIONS ///.
 
#define SCL_VARS_MAX   15
 
#define SCL_NODE_MAX   1000
 

Typedefs

typedef struct Abc_ManScl_t_ Abc_ManScl_t
 

Functions

int Abc_NtkSuperChoiceLut (Abc_Ntk_t *pNtk, int nLutSize, int nCutSizeMax, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
unsigned * Abc_NodeSuperChoiceTruth (Abc_ManScl_t *pManScl)
 
void Abc_NodeSuperChoiceCollect2_rec (Abc_Obj_t *pObj, Vec_Ptr_t *vVolume)
 
void Abc_NodeSuperChoiceCollect2 (Abc_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVolume)
 
void Abc_NodeSuperChoiceCollect_rec (Abc_Obj_t *pObj, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVolume)
 
void Abc_NodeSuperChoiceCollect (Abc_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVolume)
 
void Abc_NodeLeavesRemove (Vec_Ptr_t *vLeaves, unsigned uPhase, int nVars)
 
int Abc_NodeGetLevel (Abc_Obj_t *pObj)
 
int Abc_NodeCompareLevelsInc (int *pp1, int *pp2)
 
void Abc_NodeDecomposeSort (Abc_Obj_t **pLeaves, int nVars, int *pBSet, int nLutSize)
 
word Abc_ObjComputeTruth (Abc_Obj_t *pObj, Vec_Int_t *vSupp)
 
Abc_Obj_tAbc_NtkSpecialMap_rec (Abc_Ntk_t *pNew, Abc_Obj_t *pObj, Vec_Wec_t *vSupps, Vec_Int_t *vCover)
 
Abc_Ntk_tAbc_NtkSpecialMapping (Abc_Ntk_t *pNtk, int fVerbose)
 

Macro Definition Documentation

◆ LARGE_LEVEL

#define LARGE_LEVEL   1000000

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

FileName [abcLut.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Superchoicing for K-LUTs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 26 of file abcLut.c.

◆ SCL_LUT_MAX

#define SCL_LUT_MAX   6

DECLARATIONS ///.

Definition at line 32 of file abcLut.c.

◆ SCL_NODE_MAX

#define SCL_NODE_MAX   1000

Definition at line 34 of file abcLut.c.

◆ SCL_VARS_MAX

#define SCL_VARS_MAX   15

Definition at line 33 of file abcLut.c.

Typedef Documentation

◆ Abc_ManScl_t

typedef struct Abc_ManScl_t_ Abc_ManScl_t

Definition at line 36 of file abcLut.c.

Function Documentation

◆ Abc_NodeCompareLevelsInc()

int Abc_NodeCompareLevelsInc ( int * pp1,
int * pp2 )

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

Synopsis [Procedure used for sorting the nodes in increasing order of levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 601 of file abcLut.c.

602{
603 Abc_Obj_t * pNode1, * pNode2;
604 pNode1 = (Abc_Obj_t *)Vec_PtrEntry(s_pLeaves, *pp1);
605 pNode2 = (Abc_Obj_t *)Vec_PtrEntry(s_pLeaves, *pp2);
606 if ( pNode1->Level < pNode2->Level )
607 return -1;
608 if ( pNode1->Level > pNode2->Level )
609 return 1;
610 return 0;
611}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
unsigned Level
Definition abc.h:142

◆ Abc_NodeDecomposeSort()

void Abc_NodeDecomposeSort ( Abc_Obj_t ** pLeaves,
int nVars,
int * pBSet,
int nLutSize )

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

Synopsis [Selects the earliest arriving nodes from the array.]

Description []

SideEffects []

SeeAlso []

Definition at line 624 of file abcLut.c.

625{
626 Abc_Obj_t * pTemp[SCL_VARS_MAX];
627 int i, k, kBest, LevelMin;
628 assert( nLutSize < nVars );
629 assert( nVars <= SCL_VARS_MAX );
630 // copy nodes into the internal storage
631// printf( "(" );
632 for ( i = 0; i < nVars; i++ )
633 {
634 pTemp[i] = pLeaves[i];
635// printf( " %d", pLeaves[i]->Level );
636 }
637// printf( " )\n" );
638 // choose one node at a time
639 for ( i = 0; i < nLutSize; i++ )
640 {
641 kBest = -1;
642 LevelMin = LARGE_LEVEL;
643 for ( k = 0; k < nVars; k++ )
644 if ( pTemp[k] && LevelMin > (int)pTemp[k]->Level )
645 {
646 LevelMin = pTemp[k]->Level;
647 kBest = k;
648 }
649 pBSet[i] = kBest;
650 pTemp[kBest] = NULL;
651 }
652}
#define LARGE_LEVEL
Definition abcLut.c:26
#define SCL_VARS_MAX
Definition abcLut.c:33
#define assert(ex)
Definition util_old.h:213

◆ Abc_NodeGetLevel()

int Abc_NodeGetLevel ( Abc_Obj_t * pObj)

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

Synopsis [Performs superchoicing for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 512 of file abcLut.c.

513{
514 Abc_Obj_t * pFanin;
515 int i, Level;
516 Level = 0;
517 Abc_ObjForEachFanin( pObj, pFanin, i )
518 Level = Abc_MaxInt( Level, (int)pFanin->Level );
519 return Level + 1;
520}
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527

◆ Abc_NodeLeavesRemove()

void Abc_NodeLeavesRemove ( Vec_Ptr_t * vLeaves,
unsigned uPhase,
int nVars )

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

Synopsis [Performs superchoicing for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 493 of file abcLut.c.

494{
495 int i;
496 for ( i = nVars - 1; i >= 0; i-- )
497 if ( uPhase & (1 << i) )
498 Vec_PtrRemove( vLeaves, Vec_PtrEntry(vLeaves, i) );
499}

◆ Abc_NodeSuperChoiceCollect()

void Abc_NodeSuperChoiceCollect ( Abc_Obj_t * pRoot,
Vec_Ptr_t * vLeaves,
Vec_Ptr_t * vVolume )

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

Synopsis [Performs superchoicing for one node.]

Description [Orders the leaves topologically.]

SideEffects []

SeeAlso []

Definition at line 465 of file abcLut.c.

466{
467 Abc_Obj_t * pObj;
468 int i, nLeaves;
469 nLeaves = Vec_PtrSize(vLeaves);
470 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pObj, i )
471 pObj->fMarkB = pObj->fMarkC = 1;
472 Vec_PtrClear( vVolume );
473 Vec_PtrClear( vLeaves );
474 Abc_NodeSuperChoiceCollect_rec( pRoot, vLeaves, vVolume );
475 assert( Vec_PtrSize(vLeaves) == nLeaves );
476 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pObj, i )
477 pObj->fMarkC = 0;
478 Vec_PtrForEachEntry( Abc_Obj_t *, vVolume, pObj, i )
479 pObj->fMarkC = 0;
480}
void Abc_NodeSuperChoiceCollect_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVolume)
Definition abcLut.c:438
unsigned fMarkC
Definition abc.h:136
unsigned fMarkB
Definition abc.h:135
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:

◆ Abc_NodeSuperChoiceCollect2()

void Abc_NodeSuperChoiceCollect2 ( Abc_Obj_t * pRoot,
Vec_Ptr_t * vLeaves,
Vec_Ptr_t * vVolume )

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

Synopsis [Performs superchoicing for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 413 of file abcLut.c.

414{
415 Abc_Obj_t * pObj;
416 int i;
417 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pObj, i )
418 pObj->fMarkC = 1;
419 Vec_PtrClear( vVolume );
420 Abc_NodeSuperChoiceCollect2_rec( pRoot, vVolume );
421 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pObj, i )
422 pObj->fMarkC = 0;
423 Vec_PtrForEachEntry( Abc_Obj_t *, vVolume, pObj, i )
424 pObj->fMarkC = 0;
425}
void Abc_NodeSuperChoiceCollect2_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vVolume)
Definition abcLut.c:391
Here is the call graph for this function:

◆ Abc_NodeSuperChoiceCollect2_rec()

void Abc_NodeSuperChoiceCollect2_rec ( Abc_Obj_t * pObj,
Vec_Ptr_t * vVolume )

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

Synopsis [Performs superchoicing for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 391 of file abcLut.c.

392{
393 if ( pObj->fMarkC )
394 return;
395 pObj->fMarkC = 1;
396 assert( Abc_ObjFaninNum(pObj) == 2 );
397 Abc_NodeSuperChoiceCollect2_rec( Abc_ObjFanin0(pObj), vVolume );
398 Abc_NodeSuperChoiceCollect2_rec( Abc_ObjFanin1(pObj), vVolume );
399 Vec_PtrPush( vVolume, pObj );
400}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NodeSuperChoiceCollect_rec()

void Abc_NodeSuperChoiceCollect_rec ( Abc_Obj_t * pObj,
Vec_Ptr_t * vLeaves,
Vec_Ptr_t * vVolume )

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

Synopsis [Performs superchoicing for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 438 of file abcLut.c.

439{
440 if ( pObj->fMarkB )
441 {
442 Vec_PtrPush( vLeaves, pObj );
443 pObj->fMarkB = 0;
444 }
445 if ( pObj->fMarkC )
446 return;
447 pObj->fMarkC = 1;
448 assert( Abc_ObjFaninNum(pObj) == 2 );
449 Abc_NodeSuperChoiceCollect_rec( Abc_ObjFanin0(pObj), vLeaves, vVolume );
450 Abc_NodeSuperChoiceCollect_rec( Abc_ObjFanin1(pObj), vLeaves, vVolume );
451 Vec_PtrPush( vVolume, pObj );
452}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NodeSuperChoiceTruth()

unsigned * Abc_NodeSuperChoiceTruth ( Abc_ManScl_t * pManScl)

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

Synopsis [Performs superchoicing for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 344 of file abcLut.c.

345{
346 Abc_Obj_t * pObj;
347 unsigned * puData0, * puData1, * puData = NULL;
348 char * pSop;
349 int i, k;
350 // set elementary truth tables
351 Vec_PtrForEachEntry( Abc_Obj_t *, pManScl->vLeaves, pObj, i )
352 pObj->pNext = (Abc_Obj_t *)pManScl->uVars[i];
353 // compute truth tables for internal nodes
354 Vec_PtrForEachEntry( Abc_Obj_t *, pManScl->vVolume, pObj, i )
355 {
356 // set storage for the node's simulation info
357 pObj->pNext = (Abc_Obj_t *)pManScl->uSims[i];
358 // get pointer to the simulation info
359 puData = (unsigned *)pObj->pNext;
360 puData0 = (unsigned *)Abc_ObjFanin0(pObj)->pNext;
361 puData1 = (unsigned *)Abc_ObjFanin1(pObj)->pNext;
362 // simulate
363 pSop = (char *)pObj->pData;
364 if ( pSop[0] == '0' && pSop[1] == '0' )
365 for ( k = 0; k < pManScl->nWords; k++ )
366 puData[k] = ~puData0[k] & ~puData1[k];
367 else if ( pSop[0] == '0' )
368 for ( k = 0; k < pManScl->nWords; k++ )
369 puData[k] = ~puData0[k] & puData1[k];
370 else if ( pSop[1] == '0' )
371 for ( k = 0; k < pManScl->nWords; k++ )
372 puData[k] = puData0[k] & ~puData1[k];
373 else
374 for ( k = 0; k < pManScl->nWords; k++ )
375 puData[k] = puData0[k] & puData1[k];
376 }
377 return puData;
378}
unsigned ** uSims
Definition abcLut.c:52
unsigned ** uVars
Definition abcLut.c:51
Vec_Ptr_t * vLeaves
Definition abcLut.c:45
Vec_Ptr_t * vVolume
Definition abcLut.c:46
Abc_Obj_t * pNext
Definition abc.h:131

◆ Abc_NtkSpecialMap_rec()

Abc_Obj_t * Abc_NtkSpecialMap_rec ( Abc_Ntk_t * pNew,
Abc_Obj_t * pObj,
Vec_Wec_t * vSupps,
Vec_Int_t * vCover )

Definition at line 820 of file abcLut.c.

821{
822 if ( pObj->pCopy )
823 return pObj->pCopy;
824 if ( Abc_ObjFaninNum(pObj) == 0 )
825 return NULL;
826 assert( Abc_ObjFaninNum(pObj) == 3 );
827 if ( pObj->fMarkA || pObj->fMarkB )
828 {
829 Abc_Obj_t * pFan0 = Abc_NtkSpecialMap_rec( pNew, Abc_ObjFanin(pObj, 2), vSupps, vCover );
830 Abc_Obj_t * pFan1 = Abc_NtkSpecialMap_rec( pNew, Abc_ObjFanin(pObj, 1), vSupps, vCover );
831 Abc_Obj_t * pFanC = Abc_NtkSpecialMap_rec( pNew, Abc_ObjFanin(pObj, 0), vSupps, vCover );
832 if ( pFan0 == NULL )
833 pFan0 = Abc_NodeIsConst0(Abc_ObjFanin(pObj, 2)) ? Abc_NtkCreateNodeConst0(pNew) : Abc_NtkCreateNodeConst1(pNew);
834 if ( pFan1 == NULL )
835 pFan1 = Abc_NodeIsConst0(Abc_ObjFanin(pObj, 1)) ? Abc_NtkCreateNodeConst0(pNew) : Abc_NtkCreateNodeConst1(pNew);
836 pObj->pCopy = Abc_NtkCreateNodeMux( pNew, pFanC, pFan1, pFan0 );
837 pObj->pCopy->fMarkA = pObj->fMarkA;
838 pObj->pCopy->fMarkB = pObj->fMarkB;
839 }
840 else
841 {
842 Abc_Obj_t * pTemp; int i; word Truth;
843 Vec_Int_t * vSupp = Vec_WecEntry( vSupps, Abc_ObjId(pObj) );
844 Abc_NtkForEachObjVec( vSupp, pObj->pNtk, pTemp, i )
845 Abc_NtkSpecialMap_rec( pNew, pTemp, vSupps, vCover );
846 pObj->pCopy = Abc_NtkCreateNode( pNew );
847 Abc_NtkForEachObjVec( vSupp, pObj->pNtk, pTemp, i )
848 Abc_ObjAddFanin( pObj->pCopy, pTemp->pCopy );
849 Truth = Abc_ObjComputeTruth( pObj, vSupp );
850 pObj->pCopy->pData = Abc_SopCreateFromTruthIsop( (Mem_Flex_t *)pNew->pManFunc, Vec_IntSize(vSupp), &Truth, vCover );
851 assert( Abc_SopGetVarNum((char *)pObj->pCopy->pData) == Vec_IntSize(vSupp) );
852 }
853 return pObj->pCopy;
854}
Abc_Obj_t * Abc_NtkSpecialMap_rec(Abc_Ntk_t *pNew, Abc_Obj_t *pObj, Vec_Wec_t *vSupps, Vec_Int_t *vCover)
Definition abcLut.c:820
word Abc_ObjComputeTruth(Abc_Obj_t *pObj, Vec_Int_t *vSupp)
Definition abcLut.c:805
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition abcObj.c:643
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition abcObj.c:612
ABC_DLL char * Abc_SopCreateFromTruthIsop(Mem_Flex_t *pMan, int nVars, word *pTruth, Vec_Int_t *vCover)
Definition abcSop.c:462
ABC_DLL int Abc_NodeIsConst0(Abc_Obj_t *pNode)
Definition abcObj.c:884
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeMux(Abc_Ntk_t *pNtk, Abc_Obj_t *pNodeC, Abc_Obj_t *pNode1, Abc_Obj_t *pNode0)
Definition abcObj.c:834
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition abcSop.c:584
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition abc.h:455
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
struct Mem_Flex_t_ Mem_Flex_t
Definition mem.h:34
void * pManFunc
Definition abc.h:191
void * pData
Definition abc.h:145
Abc_Ntk_t * pNtk
Definition abc.h:130
Abc_Obj_t * pCopy
Definition abc.h:148
unsigned fMarkA
Definition abc.h:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkSpecialMapping()

Abc_Ntk_t * Abc_NtkSpecialMapping ( Abc_Ntk_t * pNtk,
int fVerbose )

Definition at line 855 of file abcLut.c.

856{
857 Abc_Ntk_t * pNtkNew;
858 Vec_Int_t * vCover = Vec_IntAlloc( 1 << 16 );
859 Vec_Wec_t * vSupps = Vec_WecStart( Abc_NtkObjNumMax(pNtk) );
860 Abc_Obj_t * pObj, * pFan0, * pFan1, * pFanC; int i, Count[2] = {0};
861 Abc_NtkForEachCi( pNtk, pObj, i )
862 Vec_IntPush( Vec_WecEntry(vSupps, i), i );
863 Abc_NtkForEachNode( pNtk, pObj, i )
864 {
865 Vec_Int_t * vSupp = Vec_WecEntry(vSupps, i);
866 if ( Abc_ObjFaninNum(pObj) == 0 )
867 continue;
868 assert( Abc_ObjFaninNum(pObj) == 3 );
869 pFan0 = Abc_ObjFanin( pObj, 2 );
870 pFan1 = Abc_ObjFanin( pObj, 1 );
871 pFanC = Abc_ObjFanin0( pObj );
872 assert( Abc_ObjIsCi(pFanC) );
873 if ( pFan0->fMarkA && pFan1->fMarkA )
874 {
875 pObj->fMarkB = 1;
876 Vec_IntPush( vSupp, Abc_ObjId(pObj) );
877 continue;
878 }
879 Vec_IntTwoMerge2( Vec_WecEntry(vSupps, Abc_ObjId(pFan0)), Vec_WecEntry(vSupps, Abc_ObjId(pFan1)), vSupp );
880 assert( Vec_IntFind(vSupp, Abc_ObjId(pFanC)) == -1 );
881 Vec_IntPushOrder( vSupp, Abc_ObjId(pFanC) );
882 if ( Vec_IntSize(vSupp) <= 6 )
883 continue;
884 Vec_IntClear( vSupp );
885 if ( !pFan0->fMarkA && !pFan1->fMarkA )
886 {
887 pObj->fMarkA = 1;
888 Vec_IntPush( vSupp, Abc_ObjId(pObj) );
889 }
890 else
891 {
892 Vec_IntPushOrder( vSupp, Abc_ObjId(pFan0) );
893 Vec_IntPushOrder( vSupp, Abc_ObjId(pFan1) );
894 Vec_IntPushOrder( vSupp, Abc_ObjId(pFanC) );
895 }
896 }
897
898 if ( fVerbose )
899 {
900 Abc_NtkForEachNode( pNtk, pObj, i )
901 {
902 printf( "Node %4d : ", i );
903 if ( pObj->fMarkA )
904 printf( " MarkA " );
905 else
906 printf( " " );
907 if ( pObj->fMarkB )
908 printf( " MarkB " );
909 else
910 printf( " " );
911 Vec_IntPrint( Vec_WecEntry(vSupps, i) );
912 }
913 }
914
915 Abc_NtkCleanCopy( pNtk );
916 pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
917 Abc_NtkForEachCo( pNtk, pObj, i )
918 if ( Abc_ObjFaninNum(Abc_ObjFanin0(pObj)) == 0 )
919 Abc_ObjFanin0(pObj)->pCopy = Abc_NodeIsConst0(Abc_ObjFanin0(pObj)) ? Abc_NtkCreateNodeConst0(pNtkNew) : Abc_NtkCreateNodeConst1(pNtkNew);
920 else
921 Abc_NtkSpecialMap_rec( pNtkNew, Abc_ObjFanin0(pObj), vSupps, vCover );
922 Abc_NtkFinalize( pNtk, pNtkNew );
923 Abc_NtkCleanMarkAB( pNtk );
924 Vec_WecFree( vSupps );
925 Vec_IntFree( vCover );
926
927 Abc_NtkForEachNode( pNtkNew, pObj, i )
928 {
929 Count[0] += pObj->fMarkA,
930 Count[1] += pObj->fMarkB;
931 pObj->fPersist = pObj->fMarkA | pObj->fMarkB;
932 pObj->fMarkA = pObj->fMarkB = 0;
933 }
934 //printf( "Total = %3d. Nodes = %3d. MarkA = %3d. MarkB = %3d.\n", Abc_NtkNodeNum(pNtkNew),
935 // Abc_NtkNodeNum(pNtkNew) - Count[0] - Count[1], Count[0], Count[1] );
936
937 if ( !Abc_NtkCheck( pNtkNew ) )
938 {
939 printf( "Abc_NtkSpecialMapping: The network check has failed.\n" );
940 Abc_NtkDelete( pNtkNew );
941 return NULL;
942 }
943 return pNtkNew;
944}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition abcNtk.c:355
@ ABC_NTK_LOGIC
Definition abc.h:57
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:540
@ ABC_FUNC_SOP
Definition abc.h:65
ABC_DLL void Abc_NtkCleanMarkAB(Abc_Ntk_t *pNtk)
Definition abcUtil.c:753
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:157
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
unsigned fPersist
Definition abc.h:139
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:

◆ Abc_NtkSuperChoiceLut()

int Abc_NtkSuperChoiceLut ( Abc_Ntk_t * pNtk,
int nLutSize,
int nCutSizeMax,
int fVerbose )

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs superchoicing for K-LUTs.]

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file abcLut.c.

82{
83 ProgressBar * pProgress;
84 Abc_ManCut_t * pManCut;
85 Abc_ManScl_t * pManScl;
86 Cut_Man_t * pManCuts;
87 Abc_Obj_t * pObj, * pFanin, * pObjTop;
88 int i, LevelMax, nNodes;
89 int nNodesTried, nNodesDec, nNodesExist, nNodesUsed;
90
91 assert( Abc_NtkIsSopLogic(pNtk) );
92 if ( nLutSize < 3 || nLutSize > SCL_LUT_MAX )
93 {
94 printf( "LUT size (%d) does not belong to the interval: 3 <= LUT size <= %d\n", nLutSize, SCL_LUT_MAX );
95 return 0;
96 }
97 if ( nCutSizeMax <= nLutSize || nCutSizeMax > SCL_VARS_MAX )
98 {
99 printf( "Cut size (%d) does not belong to the interval: LUT size (%d) < Cut size <= %d\n", nCutSizeMax, nLutSize, SCL_VARS_MAX );
100 return 0;
101 }
102
103 assert( nLutSize <= SCL_LUT_MAX );
104 assert( nCutSizeMax <= SCL_VARS_MAX );
105 nNodesTried = nNodesDec = nNodesExist = nNodesUsed = 0;
106
107 // set the delays of the CIs
108 Abc_NtkForEachCi( pNtk, pObj, i )
109 pObj->Level = 0;
110
111//Abc_NtkLevel( pNtk );
112
113 // start the managers
114 pManScl = Abc_ManSclStart( nLutSize, nCutSizeMax, 1000 );
115 pManCuts = Abc_NtkStartCutManForScl( pNtk, nLutSize );
116 pManCut = Abc_NtkManCutStart( nCutSizeMax, 100000, 100000, 100000 );
117 s_pLeaves = Abc_NtkManCutReadCutSmall( pManCut );
118 pManScl->vVolume = Abc_NtkManCutReadVisited( pManCut );
119
120 // process each internal node (assuming topological order of nodes!!!)
121 nNodes = Abc_NtkObjNumMax(pNtk);
122 pProgress = Extra_ProgressBarStart( stdout, nNodes );
123 Abc_NtkForEachObj( pNtk, pObj, i )
124 {
125// if ( i != nNodes-1 )
126// continue;
127 Extra_ProgressBarUpdate( pProgress, i, NULL );
128 if ( i >= nNodes )
129 break;
130 if ( Abc_ObjFaninNum(pObj) != 2 )
131 continue;
132 nNodesTried++;
133
134 // map this node using regular cuts
135// pObj->Level = 0;
136 Abc_NodeLutMap( pManCuts, pObj );
137 // compute the cut
138 pManScl->vLeaves = Abc_NodeFindCut( pManCut, pObj, 0 );
139 if ( Vec_PtrSize(pManScl->vLeaves) <= nLutSize )
140 continue;
141 // get the volume of the cut
142 if ( Vec_PtrSize(pManScl->vVolume) > SCL_NODE_MAX )
143 continue;
144 nNodesDec++;
145
146 // decompose the cut
147 pObjTop = Abc_NodeSuperChoiceLut( pManScl, pObj );
148 if ( pObjTop == NULL )
149 continue;
150 nNodesExist++;
151
152 // if there is no delay improvement, skip; otherwise, update level
153 if ( pObjTop->Level >= pObj->Level )
154 {
155 Abc_NtkDeleteObj_rec( pObjTop, 1 );
156 continue;
157 }
158 pObj->Level = pObjTop->Level;
159 nNodesUsed++;
160 }
161 Extra_ProgressBarStop( pProgress );
162
163 // delete the managers
164 Abc_ManSclStop( pManScl );
165 Abc_NtkManCutStop( pManCut );
166 Cut_ManStop( pManCuts );
167
168 // get the largest arrival time
169 LevelMax = 0;
170 Abc_NtkForEachCo( pNtk, pObj, i )
171 {
172 pFanin = Abc_ObjFanin0( pObj );
173 // skip inv/buf
174 if ( Abc_ObjFaninNum(pFanin) == 1 )
175 pFanin = Abc_ObjFanin0( pFanin );
176 // get the new level
177 LevelMax = Abc_MaxInt( LevelMax, (int)pFanin->Level );
178 }
179
180 if ( fVerbose )
181 printf( "Try = %d. Dec = %d. Exist = %d. Use = %d. SUPER = %d levels of %d-LUTs.\n",
182 nNodesTried, nNodesDec, nNodesExist, nNodesUsed, LevelMax, nLutSize );
183// if ( fVerbose )
184// printf( "The network is superchoiced for %d levels of %d-LUTs.\n", LevelMax, nLutSize );
185
186 // clean the data field
187 Abc_NtkForEachObj( pNtk, pObj, i )
188 pObj->pNext = NULL;
189
190 // check
191 if ( !Abc_NtkCheck( pNtk ) )
192 {
193 printf( "Abc_NtkSuperChoiceLut: The network check has failed.\n" );
194 return 0;
195 }
196 return 1;
197}
#define SCL_NODE_MAX
Definition abcLut.c:34
struct Abc_ManScl_t_ Abc_ManScl_t
Definition abcLut.c:36
#define SCL_LUT_MAX
DECLARATIONS ///.
Definition abcLut.c:32
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
struct Abc_ManCut_t_ Abc_ManCut_t
Definition abc.h:119
ABC_DLL void Abc_NtkManCutStop(Abc_ManCut_t *p)
Definition abcReconv.c:623
ABC_DLL void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
Definition abcObj.c:278
ABC_DLL Vec_Ptr_t * Abc_NodeFindCut(Abc_ManCut_t *p, Abc_Obj_t *pRoot, int fContain)
Definition abcReconv.c:256
ABC_DLL Vec_Ptr_t * Abc_NtkManCutReadVisited(Abc_ManCut_t *p)
Definition abcReconv.c:676
ABC_DLL Vec_Ptr_t * Abc_NtkManCutReadCutSmall(Abc_ManCut_t *p)
Definition abcReconv.c:660
ABC_DLL Abc_ManCut_t * Abc_NtkManCutStart(int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop)
Definition abcReconv.c:595
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
struct Cut_ManStruct_t_ Cut_Man_t
BASIC TYPES ///.
Definition cut.h:48
void Cut_ManStop(Cut_Man_t *p)
Definition cutMan.c:124
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Here is the call graph for this function:

◆ Abc_ObjComputeTruth()

word Abc_ObjComputeTruth ( Abc_Obj_t * pObj,
Vec_Int_t * vSupp )

Definition at line 805 of file abcLut.c.

806{
807 int Index; word t0, t1, tc;
808 assert( Vec_IntSize(vSupp) <= 6 );
809 if ( (Index = Vec_IntFind(vSupp, Abc_ObjId(pObj))) >= 0 )
810 return s__Truths6[Index];
811 assert( Abc_ObjIsNode(pObj) );
812 if ( Abc_ObjFaninNum(pObj) == 0 )
813 return Abc_NodeIsConst0(pObj) ? (word)0 : ~(word)0;
814 assert( Abc_ObjFaninNum(pObj) == 3 );
815 t0 = Abc_ObjComputeTruth( Abc_ObjFanin(pObj, 2), vSupp );
816 t1 = Abc_ObjComputeTruth( Abc_ObjFanin(pObj, 1), vSupp );
817 tc = Abc_ObjComputeTruth( Abc_ObjFanin(pObj, 0), vSupp );
818 return (tc & t1) | (~tc & t0);
819}
Here is the call graph for this function:
Here is the caller graph for this function: