ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaIf.c File Reference
#include "gia.h"
#include "aig/aig/aig.h"
#include "map/if/if.h"
#include "bool/kit/kit.h"
#include "base/main/main.h"
#include "sat/bsat/satSolver.h"
Include dependency graph for giaIf.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Kit_TruthToGia (Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
 DECLARATIONS ///.
 
int Abc_RecToGia3 (Gia_Man_t *pMan, If_Man_t *pIfMan, If_Cut_t *pCut, Vec_Int_t *vLeaves, int fHash)
 
void Gia_ManPrintGetMuxFanins (Gia_Man_t *p, Gia_Obj_t *pObj, int *pFanins)
 
void Gia_ManSetIfParsDefault (void *pp)
 FUNCTION DEFINITIONS ///.
 
int Gia_ManLutFaninCount (Gia_Man_t *p)
 
int Gia_ManLutSizeMax (Gia_Man_t *p)
 
int Gia_ManLutNum (Gia_Man_t *p)
 
int Gia_ManLutLevel (Gia_Man_t *p, int **ppLevels)
 
void Gia_ManLutParams (Gia_Man_t *p, int *pnCurLuts, int *pnCurEdges, int *pnCurLevels)
 
void Gia_ManSetRefsMapped (Gia_Man_t *p)
 
void Gia_ManSetLutRefs (Gia_Man_t *p)
 
int Gia_ManComputeOverlap2One_rec (Gia_Man_t *p, int iObj, Vec_Str_t *vLabel, Vec_Int_t *vVisit)
 
int Gia_ManComputeOverlap2One (Gia_Man_t *p, int iObj, Vec_Str_t *vLabel, Vec_Int_t *vVisit)
 
int Gia_ManComputeOverlap2 (Gia_Man_t *p)
 
int Gia_ManComputeOverlapOne_rec (Gia_Man_t *p, int iObj)
 
int Gia_ManComputeOverlapOne (Gia_Man_t *p, int iObj)
 
int Gia_ManComputeOverlap (Gia_Man_t *p)
 
int Gia_ManCountDupLut (Gia_Man_t *p)
 
void Gia_ManCollectLuts_rec (Gia_Man_t *p, int iObj, Vec_Int_t *vLuts)
 
int Gia_ManCountLutLevels (Gia_Man_t *p, Vec_Int_t *vLuts, Vec_Int_t *vLevel)
 
void Gia_ManPrintOutputLutStats (Gia_Man_t *p)
 
void Gia_ManPrintMappingStats (Gia_Man_t *p, char *pDumpFile)
 
void Gia_ManPrintPackingStats (Gia_Man_t *p)
 
void Gia_ManPrintNodeProfile (int *pCounts, int nSizeMax)
 
void Gia_ManPrintLutStats (Gia_Man_t *p)
 
void Gia_ManChoiceLevel_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
int Gia_ManChoiceLevel (Gia_Man_t *p)
 
void If_ManCheckChoices_rec (If_Man_t *pIfMan, If_Obj_t *pIfObj)
 
void If_ManCheckChoices (If_Man_t *pIfMan)
 
If_Man_tGia_ManToIf (Gia_Man_t *p, If_Par_t *pPars)
 
int Gia_ManBuildFromMiniInt (Gia_Man_t *pNew, Vec_Int_t *vLeaves, Vec_Int_t *vAig, int fHash)
 
int Gia_ManBuildFromMini (Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCut, Vec_Int_t *vLeaves, Vec_Int_t *vAig, int fHash, int fUseDsd)
 
int Gia_ManFromIfAig_rec (Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj)
 
Gia_Man_tGia_ManFromIfAig (If_Man_t *pIfMan)
 
int Gia_ManFromIfLogicCreateLut (Gia_Man_t *pNew, word *pRes, Vec_Int_t *vLeaves, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
 
int Gia_ManFromIfLogicCreateLutSpecial (Gia_Man_t *pNew, word *pRes, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking)
 
int Gia_ManFromIfLogicNode (void *pIfMan, Gia_Man_t *pNew, int iObj, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, word *pRes, char *pStr, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking, int fCheck75, int fCheck44e)
 
int Gia_ManFromIfLogicHop (Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
 
int Gia_ManNodeIfToGia_rec (Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Ptr_t *vVisited, int fHash)
 
int Gia_ManNodeIfToGia (Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Int_t *vLeaves, int fHash)
 
int Gia_ManFromIfLogicFindLut (If_Man_t *pIfMan, Gia_Man_t *pNew, If_Cut_t *pCutBest, sat_solver *pSat, Vec_Int_t *vLeaves, Vec_Int_t *vLits, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking)
 
void Gia_ManFromIfGetConfig (Vec_Int_t *vConfigs, If_Man_t *pIfMan, If_Cut_t *pCutBest, int iLit, Vec_Str_t *vConfigsStr)
 
int Gia_ManFromIfLogicFindCell (If_Man_t *pIfMan, Gia_Man_t *pNew, Gia_Man_t *pTemp, If_Cut_t *pCutBest, Ifn_Ntk_t *pNtkCell, int nLutMax, Vec_Int_t *vLeaves, Vec_Int_t *vLits, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vConfigs)
 
int Gia_ManFromIfLogicCofVars (Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeaves2, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
 
int Gia_ManFromIfLogicAndVars (Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeaves2, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
 
Gia_Man_tGia_ManFromIfLogic (If_Man_t *pIfMan)
 
int Gia_ManMappingVerify_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Gia_ManMappingVerify (Gia_Man_t *p)
 
void Gia_ManTransferMapping (Gia_Man_t *p, Gia_Man_t *pGia)
 
void Gia_ManTransferPacking (Gia_Man_t *p, Gia_Man_t *pGia)
 
void Gia_ManTransferTiming (Gia_Man_t *p, Gia_Man_t *pGia)
 
void Abc_FrameMiniAigSetCiArrivals (Abc_Frame_t *pAbc, int *pArrivals)
 
void Abc_FrameMiniAigSetCoRequireds (Abc_Frame_t *pAbc, int *pRequireds)
 
int * Abc_FrameMiniAigReadCoArrivals (Abc_Frame_t *pAbc)
 
void Abc_FrameMiniAigSetAndGateDelay (Abc_Frame_t *pAbc, int Delay)
 
Gia_Man_tGia_ManPerformMappingInt (Gia_Man_t *p, If_Par_t *pPars)
 
Gia_Man_tGia_ManPerformMapping (Gia_Man_t *p, void *pp)
 
Gia_Man_tGia_ManPerformSopBalance (Gia_Man_t *p, int nCutNum, int nRelaxRatio, int fVerbose)
 
Gia_Man_tGia_ManPerformDsdBalance (Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
 
void Gia_ManTestStruct (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupHashMapping (Gia_Man_t *p)
 

Function Documentation

◆ Abc_FrameMiniAigReadCoArrivals()

int * Abc_FrameMiniAigReadCoArrivals ( Abc_Frame_t * pAbc)

Definition at line 2447 of file giaIf.c.

2448{
2449 Vec_Int_t * vArrs; int * pArrs;
2450 Gia_Man_t * pGia;
2451 if ( pAbc == NULL )
2452 { printf( "ABC framework is not initialized by calling Abc_Start()\n" ); return NULL; }
2453 pGia = Abc_FrameReadGia( pAbc );
2454 if ( pGia == NULL )
2455 { printf( "Current network in ABC framework is not defined.\n" ); return NULL; }
2456 if ( pGia->vCoArrs == NULL )
2457 { printf( "Current network in ABC framework has no CO arrival times.\n" ); return NULL; }
2458 vArrs = Vec_IntDup( pGia->vCoArrs );
2459 pArrs = Vec_IntReleaseArray( vArrs );
2460 Vec_IntFree( vArrs );
2461 return pArrs;
2462}
ABC_DLL Gia_Man_t * Abc_FrameReadGia(Abc_Frame_t *p)
Definition mainFrame.c:343
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Vec_Int_t * vCoArrs
Definition gia.h:172
Here is the call graph for this function:

◆ Abc_FrameMiniAigSetAndGateDelay()

void Abc_FrameMiniAigSetAndGateDelay ( Abc_Frame_t * pAbc,
int Delay )

Definition at line 2463 of file giaIf.c.

2464{
2465 Gia_Man_t * pGia;
2466 if ( pAbc == NULL )
2467 printf( "ABC framework is not initialized by calling Abc_Start()\n" );
2468 pGia = Abc_FrameReadGia( pAbc );
2469 if ( pGia == NULL )
2470 printf( "Current network in ABC framework is not defined.\n" );
2471 pGia->And2Delay = Delay;
2472}
int And2Delay
Definition gia.h:175
Here is the call graph for this function:

◆ Abc_FrameMiniAigSetCiArrivals()

void Abc_FrameMiniAigSetCiArrivals ( Abc_Frame_t * pAbc,
int * pArrivals )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2421 of file giaIf.c.

2422{
2423 Gia_Man_t * pGia;
2424 if ( pArrivals == NULL )
2425 { printf( "Arrival times are not given.\n" ); return; }
2426 if ( pAbc == NULL )
2427 { printf( "ABC framework is not initialized by calling Abc_Start().\n" ); return; }
2428 pGia = Abc_FrameReadGia( pAbc );
2429 if ( pGia == NULL )
2430 { printf( "Current network in ABC framework is not defined.\n" ); return; }
2431 Vec_IntFreeP( &pGia->vCiArrs );
2432 pGia->vCiArrs = Vec_IntAllocArrayCopy( pArrivals, Gia_ManCiNum(pGia) );
2433}
Vec_Int_t * vCiArrs
Definition gia.h:170
Here is the call graph for this function:

◆ Abc_FrameMiniAigSetCoRequireds()

void Abc_FrameMiniAigSetCoRequireds ( Abc_Frame_t * pAbc,
int * pRequireds )

Definition at line 2434 of file giaIf.c.

2435{
2436 Gia_Man_t * pGia;
2437 if ( pRequireds == NULL )
2438 { printf( "Required times are not given.\n" ); return; }
2439 if ( pAbc == NULL )
2440 { printf( "ABC framework is not initialized by calling Abc_Start().\n" ); return; }
2441 pGia = Abc_FrameReadGia( pAbc );
2442 if ( pGia == NULL )
2443 { printf( "Current network in ABC framework is not defined.\n" ); return; }
2444 Vec_IntFreeP( &pGia->vCoReqs );
2445 pGia->vCoReqs = Vec_IntAllocArrayCopy( pRequireds, Gia_ManCoNum(pGia) );
2446}
Vec_Int_t * vCoReqs
Definition gia.h:171
Here is the call graph for this function:

◆ Abc_RecToGia3()

int Abc_RecToGia3 ( Gia_Man_t * pMan,
If_Man_t * pIfMan,
If_Cut_t * pCut,
Vec_Int_t * vLeaves,
int fHash )
extern

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

Synopsis [Reexpresses the best structure of the cut in the GIA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1105 of file abcRec3.c.

1106{
1107 Lms_Man_t * p = s_pMan3;
1108 char pCanonPerm[LMS_VAR_MAX];
1109 unsigned uCanonPhase = 0;
1110 int iFan0, iFan1, iGiaObj;
1111 Gia_Man_t * pGia = p->pGia;
1112 Gia_Obj_t * pGiaPo, * pGiaTemp = NULL;
1113 int i, uSupport, BestPo = -1, nLeaves = If_CutLeaveNum(pCut);
1114 assert( pIfMan->pPars->fCutMin == 1 );
1115 assert( nLeaves == Vec_IntSize(vLeaves) );
1116
1117 // compute support
1118 uSupport = Abc_TtSupport( If_CutTruthW(pIfMan, pCut), nLeaves );
1119 if ( uSupport == 0 )
1120 return Abc_LitNotCond( 0, If_CutTruthIsCompl(pCut) );
1121 if ( !Abc_TtSuppIsMinBase(uSupport) || uSupport == 1 )
1122 {
1123 assert( Abc_TtSuppOnlyOne(uSupport) );
1124 return Abc_LitNotCond( Vec_IntEntry(vLeaves, Abc_TtSuppFindFirst(uSupport)), If_CutTruthIsCompl(pCut) );
1125 }
1126 assert( Gia_WordCountOnes(uSupport) == nLeaves );
1127
1128 // get the best output for this node
1129 If_CutFindBestStruct( pIfMan, pCut, pCanonPerm, &uCanonPhase, &BestPo );
1130 assert( BestPo >= 0 );
1131 pGiaPo = Gia_ManCo( pGia, BestPo );
1132
1133 // collect internal nodes into pGia->vTtNodes
1134 if ( pGia->vTtNodes == NULL )
1135 pGia->vTtNodes = Vec_IntAlloc( 256 );
1136 assert( Gia_ObjIsAnd( Gia_ObjFanin0(pGiaPo) ) );
1137 Gia_ObjCollectInternal( pGia, Gia_ObjFanin0(pGiaPo) );
1138 assert( Vec_IntSize(pGia->vTtNodes) > 0 );
1139
1140 // collect GIA nodes for leaves
1141 Vec_IntClear( p->vLabels );
1142 for (i = 0; i < nLeaves; i++)
1143 Vec_IntPush( p->vLabels, Abc_LitNotCond(Vec_IntEntry(vLeaves, pCanonPerm[i]), (uCanonPhase >> i) & 1) );
1144
1145 // compute HOP nodes for internal nodes
1146 Gia_ManForEachObjVec( pGia->vTtNodes, pGia, pGiaTemp, i )
1147 {
1148 pGiaTemp->fMark0 = 0; // unmark node marked by Gia_ObjCollectInternal()
1149 if ( Gia_ObjIsAnd(Gia_ObjFanin0(pGiaTemp)) )
1150 iFan0 = Vec_IntEntry(p->vLabels, Gia_ObjNum(pGia, Gia_ObjFanin0(pGiaTemp)) + nLeaves);
1151 else
1152 iFan0 = Vec_IntEntry(p->vLabels, Gia_ObjCioId(Gia_ObjFanin0(pGiaTemp)));
1153 iFan0 = Abc_LitNotCond(iFan0, Gia_ObjFaninC0(pGiaTemp));
1154 if ( Gia_ObjIsAnd(Gia_ObjFanin1(pGiaTemp)) )
1155 iFan1 = Vec_IntEntry(p->vLabels, Gia_ObjNum(pGia, Gia_ObjFanin1(pGiaTemp)) + nLeaves);
1156 else
1157 iFan1 = Vec_IntEntry(p->vLabels, Gia_ObjCioId(Gia_ObjFanin1(pGiaTemp)));
1158 iFan1 = Abc_LitNotCond(iFan1, Gia_ObjFaninC1(pGiaTemp));
1159 if ( fHash )
1160 iGiaObj = Gia_ManHashAnd(pMan, iFan0, iFan1);
1161 else
1162 iGiaObj = Gia_ManAppendAnd(pMan, iFan0, iFan1);
1163 Vec_IntPush(p->vLabels, iGiaObj);
1164 }
1165 // get the final result
1166 assert( Gia_ObjIsAnd(pGiaTemp) );
1167 iGiaObj = Vec_IntEntry(p->vLabels, Gia_ObjNum(pGia, pGiaTemp) + nLeaves);
1168 // complement the result if needed
1169 return Abc_LitNotCond( iGiaObj, Gia_ObjFaninC0(pGiaPo) ^ ((uCanonPhase >> nLeaves) & 1) ^ pCut->fCompl );
1170}
struct Lms_Man_t_ Lms_Man_t
DECLARATIONS ///.
Definition abcRec3.c:48
#define LMS_VAR_MAX
Definition abcRec3.c:31
Cube * p
Definition exorList.c:222
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
void Gia_ObjCollectInternal(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaTruth.c:429
Vec_Int_t * vTtNodes
Definition gia.h:230
unsigned fMark0
Definition gia.h:81
unsigned fCompl
Definition if.h:311
If_Par_t * pPars
Definition if.h:201
int fCutMin
Definition if.h:125
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManBuildFromMini()

int Gia_ManBuildFromMini ( Gia_Man_t * pNew,
If_Man_t * pIfMan,
If_Cut_t * pCut,
Vec_Int_t * vLeaves,
Vec_Int_t * vAig,
int fHash,
int fUseDsd )

Definition at line 1000 of file giaIf.c.

1001{
1002 if ( fUseDsd )
1003 If_CutDsdBalanceEval( pIfMan, pCut, vAig );
1004 else
1005 If_CutSopBalanceEval( pIfMan, pCut, vAig );
1006 return Gia_ManBuildFromMiniInt( pNew, vLeaves, vAig, fHash );
1007}
int Gia_ManBuildFromMiniInt(Gia_Man_t *pNew, Vec_Int_t *vLeaves, Vec_Int_t *vAig, int fHash)
Definition giaIf.c:962
int If_CutDsdBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
Definition ifDsd.c:2322
int If_CutSopBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
Definition ifDelay.c:248
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManBuildFromMiniInt()

int Gia_ManBuildFromMiniInt ( Gia_Man_t * pNew,
Vec_Int_t * vLeaves,
Vec_Int_t * vAig,
int fHash )

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

Synopsis [Rebuilds GIA from mini AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 962 of file giaIf.c.

963{
964 assert( Vec_IntSize(vAig) > 0 );
965 assert( Vec_IntEntryLast(vAig) < 2 );
966 if ( Vec_IntSize(vAig) == 1 ) // const
967 return Vec_IntEntry(vAig, 0);
968 if ( Vec_IntSize(vAig) == 2 ) // variable
969 {
970 assert( Vec_IntEntry(vAig, 0) == 0 );
971 assert( Vec_IntSize(vLeaves) == 1 );
972 return Abc_LitNotCond( Vec_IntEntry(vLeaves, 0), Vec_IntEntry(vAig, 1) );
973 }
974 else
975 {
976 int nLeaves = Vec_IntSize(vLeaves);
977 int i, iVar0, iVar1, iLit0, iLit1, iLit = 0;
978 assert( Vec_IntSize(vAig) & 1 );
979 Vec_IntForEachEntryDouble( vAig, iLit0, iLit1, i )
980 {
981 iVar0 = Abc_Lit2Var( iLit0 );
982 iVar1 = Abc_Lit2Var( iLit1 );
983 iLit0 = Abc_LitNotCond( iVar0 < nLeaves ? Vec_IntEntry(vLeaves, iVar0) : Vec_IntEntry(vAig, iVar0 - nLeaves), Abc_LitIsCompl(iLit0) );
984 iLit1 = Abc_LitNotCond( iVar1 < nLeaves ? Vec_IntEntry(vLeaves, iVar1) : Vec_IntEntry(vAig, iVar1 - nLeaves), Abc_LitIsCompl(iLit1) );
985 if ( fHash )
986 iLit = Gia_ManHashAnd( pNew, iLit0, iLit1 );
987 else if ( iLit0 == iLit1 )
988 iLit = iLit0;
989 else
990 iLit = Gia_ManAppendAnd( pNew, iLit0, iLit1 );
991 assert( (i & 1) == 0 );
992 Vec_IntWriteEntry( vAig, Abc_Lit2Var(i), iLit ); // overwriting entries
993 }
994 assert( i == Vec_IntSize(vAig) - 1 );
995 iLit = Abc_LitNotCond( iLit, Vec_IntEntry(vAig, i) );
996 Vec_IntClear( vAig ); // useless
997 return iLit;
998 }
999}
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManChoiceLevel()

int Gia_ManChoiceLevel ( Gia_Man_t * p)

Definition at line 813 of file giaIf.c.

814{
815 Gia_Obj_t * pObj;
816 int i, LevelMax = 0;
817// assert( Gia_ManRegNum(p) == 0 );
818 Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
820 Gia_ManForEachCo( p, pObj, i )
821 {
822 Gia_ManChoiceLevel_rec( p, pObj );
823 if ( LevelMax < Gia_ObjLevel(p, pObj) )
824 LevelMax = Gia_ObjLevel(p, pObj);
825 }
826 // account for dangling boxes
827 Gia_ManForEachCi( p, pObj, i )
828 {
829 Gia_ManChoiceLevel_rec( p, pObj );
830 if ( LevelMax < Gia_ObjLevel(p, pObj) )
831 LevelMax = Gia_ObjLevel(p, pObj);
832// Abc_Print( 1, "%d ", Gia_ObjLevel(p, pObj) );
833 }
834// Abc_Print( 1, "\n" );
835 Gia_ManForEachAnd( p, pObj, i )
836 assert( Gia_ObjLevel(p, pObj) > 0 );
837// printf( "Max level %d\n", LevelMax );
838 return LevelMax;
839}
void Gia_ManChoiceLevel_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaIf.c:752
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManCleanLevels(Gia_Man_t *p, int Size)
Definition giaUtil.c:511
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManChoiceLevel_rec()

void Gia_ManChoiceLevel_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj )

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

Synopsis [Computes levels for AIG with choices and white boxes.]

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file giaIf.c.

753{
754 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
755 Gia_Obj_t * pNext;
756 int i, iBox, iTerm1, nTerms, LevelMax = 0;
757 if ( Gia_ObjIsTravIdCurrent( p, pObj ) )
758 return;
759 Gia_ObjSetTravIdCurrent( p, pObj );
760 if ( Gia_ObjIsCi(pObj) )
761 {
762 if ( pManTime )
763 {
764 iBox = Tim_ManBoxForCi( pManTime, Gia_ObjCioId(pObj) );
765 if ( iBox >= 0 ) // this is not a true PI
766 {
767 iTerm1 = Tim_ManBoxInputFirst( pManTime, iBox );
768 nTerms = Tim_ManBoxInputNum( pManTime, iBox );
769 for ( i = 0; i < nTerms; i++ )
770 {
771 pNext = Gia_ManCo( p, iTerm1 + i );
772 Gia_ManChoiceLevel_rec( p, pNext );
773 if ( LevelMax < Gia_ObjLevel(p, pNext) )
774 LevelMax = Gia_ObjLevel(p, pNext);
775 }
776 LevelMax++;
777 }
778 }
779// Abc_Print( 1, "%d ", pObj->Level );
780 }
781 else if ( Gia_ObjIsCo(pObj) )
782 {
783 pNext = Gia_ObjFanin0(pObj);
784 Gia_ManChoiceLevel_rec( p, pNext );
785 if ( LevelMax < Gia_ObjLevel(p, pNext) )
786 LevelMax = Gia_ObjLevel(p, pNext);
787 }
788 else if ( Gia_ObjIsAnd(pObj) )
789 {
790 // get the maximum level of the two fanins
791 pNext = Gia_ObjFanin0(pObj);
792 Gia_ManChoiceLevel_rec( p, pNext );
793 if ( LevelMax < Gia_ObjLevel(p, pNext) )
794 LevelMax = Gia_ObjLevel(p, pNext);
795 pNext = Gia_ObjFanin1(pObj);
796 Gia_ManChoiceLevel_rec( p, pNext );
797 if ( LevelMax < Gia_ObjLevel(p, pNext) )
798 LevelMax = Gia_ObjLevel(p, pNext);
799 LevelMax++;
800
801 // get the level of the nodes in the choice node
802 if ( (pNext = Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))) )
803 {
804 Gia_ManChoiceLevel_rec( p, pNext );
805 if ( LevelMax < Gia_ObjLevel(p, pNext) )
806 LevelMax = Gia_ObjLevel(p, pNext);
807 }
808 }
809 else if ( !Gia_ObjIsConst0(pObj) )
810 assert( 0 );
811 Gia_ObjSetLevel( p, pObj, LevelMax );
812}
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
Definition timBox.c:87
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition timBox.c:123
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:187
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCollectLuts_rec()

void Gia_ManCollectLuts_rec ( Gia_Man_t * p,
int iObj,
Vec_Int_t * vLuts )

Definition at line 473 of file giaIf.c.

474{
475 if ( Gia_ObjIsTravIdCurrentId( p, iObj ) || !Gia_ObjIsAnd(Gia_ManObj(p, iObj)) )
476 return;
477 Gia_ObjSetTravIdCurrentId( p, iObj );
478 int k, iFan;
479 Gia_LutForEachFanin( p, iObj, iFan, k )
480 Gia_ManCollectLuts_rec( p, iFan, vLuts );
481 Vec_IntPush( vLuts, iObj );
482}
void Gia_ManCollectLuts_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vLuts)
Definition giaIf.c:473
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition gia.h:1161
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeOverlap()

int Gia_ManComputeOverlap ( Gia_Man_t * p)

Definition at line 391 of file giaIf.c.

392{
393 int i, Count = -Gia_ManAndNum(p);
394 assert( Gia_ManHasMapping(p) );
395 Gia_ManForEachLut( p, i )
396 Count += Gia_ManComputeOverlapOne( p, i );
397 return Count;
398}
int Gia_ManComputeOverlapOne(Gia_Man_t *p, int iObj)
Definition giaIf.c:383
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
Here is the call graph for this function:

◆ Gia_ManComputeOverlap2()

int Gia_ManComputeOverlap2 ( Gia_Man_t * p)

Definition at line 346 of file giaIf.c.

347{
348 Vec_Int_t * vVisit;
349 Vec_Str_t * vLabel;
350 int i, Count = -Gia_ManAndNum(p);
351 assert( Gia_ManHasMapping(p) );
352 vVisit = Vec_IntAlloc( 100 );
353 vLabel = Vec_StrStart( Gia_ManObjNum(p) );
354 Gia_ManForEachLut( p, i )
355 Count += Gia_ManComputeOverlap2One( p, i, vLabel, vVisit );
356 Vec_StrFree( vLabel );
357 Vec_IntFree( vVisit );
358 return Count;
359}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
int Gia_ManComputeOverlap2One(Gia_Man_t *p, int iObj, Vec_Str_t *vLabel, Vec_Int_t *vVisit)
Definition giaIf.c:333
Here is the call graph for this function:

◆ Gia_ManComputeOverlap2One()

int Gia_ManComputeOverlap2One ( Gia_Man_t * p,
int iObj,
Vec_Str_t * vLabel,
Vec_Int_t * vVisit )

Definition at line 333 of file giaIf.c.

334{
335 int iFan, k, Counter;
336 Vec_IntClear( vVisit );
337 Gia_LutForEachFanin( p, iObj, iFan, k )
338 Vec_StrWriteEntry( vLabel, iFan, 1 );
339 Counter = Gia_ManComputeOverlap2One_rec( p, iObj, vLabel, vVisit );
340 Gia_LutForEachFanin( p, iObj, iFan, k )
341 Vec_StrWriteEntry( vLabel, iFan, 0 );
342 Vec_IntForEachEntry( vVisit, iFan, k )
343 Vec_StrWriteEntry( vLabel, iFan, 0 );
344 return Counter;
345}
int Gia_ManComputeOverlap2One_rec(Gia_Man_t *p, int iObj, Vec_Str_t *vLabel, Vec_Int_t *vVisit)
Definition giaIf.c:319
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeOverlap2One_rec()

int Gia_ManComputeOverlap2One_rec ( Gia_Man_t * p,
int iObj,
Vec_Str_t * vLabel,
Vec_Int_t * vVisit )

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

Synopsis [Calculate mapping overlap.]

Description []

SideEffects []

SeeAlso []

Definition at line 319 of file giaIf.c.

320{
321 Gia_Obj_t * pObj;
322 int Counter;
323 if ( Vec_StrEntry(vLabel, iObj) )
324 return 0;
325 Vec_StrWriteEntry( vLabel, iObj, 1 );
326 pObj = Gia_ManObj( p, iObj );
327 assert( Gia_ObjIsAnd(pObj) );
328 Counter = Gia_ManComputeOverlap2One_rec( p, Gia_ObjFaninId0(pObj, iObj), vLabel, vVisit );
329 Counter += Gia_ManComputeOverlap2One_rec( p, Gia_ObjFaninId1(pObj, iObj), vLabel, vVisit );
330 Vec_IntPush( vVisit, iObj );
331 return Counter + 1;
332}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeOverlapOne()

int Gia_ManComputeOverlapOne ( Gia_Man_t * p,
int iObj )

Definition at line 383 of file giaIf.c.

384{
385 int iFan, k;
387 Gia_LutForEachFanin( p, iObj, iFan, k )
388 Gia_ObjSetTravIdCurrentId( p, iFan );
389 return Gia_ManComputeOverlapOne_rec( p, iObj );
390}
int Gia_ManComputeOverlapOne_rec(Gia_Man_t *p, int iObj)
Definition giaIf.c:372
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeOverlapOne_rec()

int Gia_ManComputeOverlapOne_rec ( Gia_Man_t * p,
int iObj )

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

Synopsis [Calculate mapping overlap.]

Description []

SideEffects []

SeeAlso []

Definition at line 372 of file giaIf.c.

373{
374 Gia_Obj_t * pObj;
375 if ( Gia_ObjIsTravIdCurrentId(p, iObj) )
376 return 0;
377 Gia_ObjSetTravIdCurrentId( p, iObj );
378 pObj = Gia_ManObj( p, iObj );
379 assert( Gia_ObjIsAnd(pObj) );
380 return 1 + Gia_ManComputeOverlapOne_rec( p, Gia_ObjFaninId0(pObj, iObj) )
381 + Gia_ManComputeOverlapOne_rec( p, Gia_ObjFaninId1(pObj, iObj) );
382}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCountDupLut()

int Gia_ManCountDupLut ( Gia_Man_t * p)

Definition at line 419 of file giaIf.c.

420{
421 Gia_Obj_t * pObj, * pFanin;
422 int i, pFanins[3], nCountDup = 0, nCountPis = 0, nCountMux = 0;
424 Gia_ManForEachLut( p, i )
425 if ( Gia_ObjLutIsMux(p, i) )
426 {
427 pObj = Gia_ManObj( p, i );
428 pObj->fMark1 = 1;
429 if ( Gia_ObjLutSize(p, i) == 3 )
430 {
431 Gia_ManPrintGetMuxFanins( p, pObj, pFanins );
432
433 pFanin = Gia_ManObj(p, pFanins[1]);
434 nCountPis += Gia_ObjIsCi(pFanin);
435 nCountDup += pFanin->fMark0;
436 nCountMux += pFanin->fMark1;
437 pFanin->fMark0 = 1;
438
439 pFanin = Gia_ManObj(p, pFanins[2]);
440 nCountPis += Gia_ObjIsCi(pFanin);
441 nCountDup += pFanin->fMark0;
442 nCountMux += pFanin->fMark1;
443 pFanin->fMark0 = 1;
444 }
445 else if ( Gia_ObjLutSize(p, i) == 2 )
446 {
447 pFanin = Gia_ObjFanin0(pObj);
448 if ( pFanin->fMark0 || pFanin->fMark1 )
449 {
450 pFanin = Gia_ObjFanin1(pObj);
451 nCountPis += Gia_ObjIsCi(pFanin);
452 nCountDup += pFanin->fMark0;
453 nCountMux += pFanin->fMark1;
454 pFanin->fMark0 = 1;
455 }
456 else
457 {
458 nCountPis += Gia_ObjIsCi(pFanin);
459 nCountDup += pFanin->fMark0;
460 nCountMux += pFanin->fMark1;
461 pFanin->fMark0 = 1;
462 }
463 }
464 else assert( 0 );
465 }
467 if ( nCountDup + nCountPis + nCountMux )
468 printf( "Dup fanins = %d. CI fanins = %d. MUX fanins = %d. Total = %d. (%.2f %%)\n",
469 nCountDup, nCountPis, nCountMux, nCountDup + nCountPis, 100.0 * (nCountDup + nCountPis + nCountMux) / Gia_ManLutNum(p) );
470 return nCountDup + nCountPis;
471}
void Gia_ManPrintGetMuxFanins(Gia_Man_t *p, Gia_Obj_t *pObj, int *pFanins)
Definition giaIf.c:411
int Gia_ManLutNum(Gia_Man_t *p)
Definition giaIf.c:146
void Gia_ManCleanMark01(Gia_Man_t *p)
Definition giaUtil.c:218
unsigned fMark1
Definition gia.h:86
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCountLutLevels()

int Gia_ManCountLutLevels ( Gia_Man_t * p,
Vec_Int_t * vLuts,
Vec_Int_t * vLevel )

Definition at line 483 of file giaIf.c.

484{
485 int i, iObj, k, iFan, LevelMax = 0;
486 Vec_IntForEachEntry( vLuts, iObj, i ) {
487 int Level = 0;
488 Gia_LutForEachFanin( p, iObj, iFan, k )
489 Level = Abc_MaxInt( Level, Vec_IntEntry(vLevel, iFan) );
490 Vec_IntWriteEntry( vLevel, iObj, Level+1 );
491 LevelMax = Abc_MaxInt( LevelMax, Level+1 );
492 }
493 Vec_IntForEachEntry( vLuts, iObj, i )
494 Vec_IntWriteEntry( vLevel, iObj, 0 );
495 return LevelMax;
496}
Here is the caller graph for this function:

◆ Gia_ManDupHashMapping()

Gia_Man_t * Gia_ManDupHashMapping ( Gia_Man_t * p)

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

Synopsis [Performs hashing for a mapped AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 2772 of file giaIf.c.

2773{
2774 Gia_Man_t * pNew;
2775 Vec_Int_t * vMapping;
2776 Gia_Obj_t * pObj, * pFanin;
2777 int i, k;
2778 assert( Gia_ManHasMapping(p) );
2779 // copy the old manager with hashing
2780 pNew = Gia_ManStart( Gia_ManObjNum(p) );
2781 pNew->pName = Abc_UtilStrsav( p->pName );
2782 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2783 Gia_ManHashAlloc( pNew );
2785 Gia_ManConst0(p)->Value = 0;
2786 Gia_ManForEachCi( p, pObj, i )
2787 pObj->Value = Gia_ManAppendCi( pNew );
2788 Gia_ManForEachAnd( p, pObj, i )
2789 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2790 Gia_ManForEachCo( p, pObj, i )
2791 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
2792 Gia_ManHashStop( pNew );
2793 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2794 // recreate mapping
2795 vMapping = Vec_IntAlloc( Vec_IntSize(p->vMapping) );
2796 Vec_IntFill( vMapping, Gia_ManObjNum(p), 0 );
2797 Gia_ManForEachLut( p, i )
2798 {
2799 pObj = Gia_ManObj( p, i );
2800 Vec_IntWriteEntry( vMapping, Abc_Lit2Var(pObj->Value), Vec_IntSize(vMapping) );
2801 Vec_IntPush( vMapping, Gia_ObjLutSize(p, i) );
2802 Gia_LutForEachFaninObj( p, i, pFanin, k )
2803 Vec_IntPush( vMapping, Abc_Lit2Var(pFanin->Value) );
2804 Vec_IntPush( vMapping, Abc_Lit2Var(pObj->Value) );
2805 }
2806 pNew->vMapping = vMapping;
2807 return pNew;
2808}
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
#define Gia_LutForEachFaninObj(p, i, pFanin, k)
Definition gia.h:1165
char * pSpec
Definition gia.h:100
Vec_Int_t * vMapping
Definition gia.h:136
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfAig()

Gia_Man_t * Gia_ManFromIfAig ( If_Man_t * pIfMan)

Definition at line 1032 of file giaIf.c.

1033{
1034 int fHash = 0;
1035 Gia_Man_t * pNew, * pTemp;
1036 If_Obj_t * pIfObj, * pIfLeaf;
1037 If_Cut_t * pCutBest;
1038 Vec_Int_t * vLeaves;
1039 Vec_Int_t * vAig;
1040 int i, k;
1041 assert( pIfMan->pPars->pLutStruct == NULL );
1042 assert( pIfMan->pPars->fDelayOpt || pIfMan->pPars->fDsdBalance || pIfMan->pPars->fUserRecLib || pIfMan->pPars->fUserSesLib );
1043 // create new manager
1044 pNew = Gia_ManStart( If_ManObjNum(pIfMan) );
1045 Gia_ManHashAlloc( pNew );
1046 // iterate through nodes used in the mapping
1047 vAig = Vec_IntAlloc( 1 << 16 );
1048 vLeaves = Vec_IntAlloc( 16 );
1049// If_ManForEachObj( pIfMan, pIfObj, i )
1050// pIfObj->iCopy = 0;
1051 If_ManForEachObj( pIfMan, pIfObj, i )
1052 {
1053 if ( pIfObj->nRefs == 0 && !If_ObjIsTerm(pIfObj) )
1054 continue;
1055 if ( If_ObjIsAnd(pIfObj) )
1056 {
1057 pCutBest = If_ObjCutBest( pIfObj );
1058 // if the cut does not offer delay improvement
1059// if ( (int)pIfObj->Level <= (int)pCutBest->Delay )
1060// {
1061// Gia_ManFromIfAig_rec( pNew, pIfMan, pIfObj );
1062// continue;
1063// }
1064 // collect leaves of the best cut
1065 Vec_IntClear( vLeaves );
1066 If_CutForEachLeaf( pIfMan, pCutBest, pIfLeaf, k )
1067 Vec_IntPush( vLeaves, pIfLeaf->iCopy );
1068 // get the functionality
1069 if ( pIfMan->pPars->fDelayOpt )
1070 pIfObj->iCopy = Gia_ManBuildFromMini( pNew, pIfMan, pCutBest, vLeaves, vAig, fHash, 0 );
1071 else if ( pIfMan->pPars->fDsdBalance )
1072 pIfObj->iCopy = Gia_ManBuildFromMini( pNew, pIfMan, pCutBest, vLeaves, vAig, fHash, 1 );
1073 else if ( pIfMan->pPars->fUserRecLib )
1074 pIfObj->iCopy = Abc_RecToGia3( pNew, pIfMan, pCutBest, vLeaves, fHash );
1075 else assert( 0 );
1076 }
1077 else if ( If_ObjIsCi(pIfObj) )
1078 pIfObj->iCopy = Gia_ManAppendCi(pNew);
1079 else if ( If_ObjIsCo(pIfObj) )
1080 pIfObj->iCopy = Gia_ManAppendCo( pNew, Abc_LitNotCond(If_ObjFanin0(pIfObj)->iCopy, If_ObjFaninC0(pIfObj)) );
1081 else if ( If_ObjIsConst1(pIfObj) )
1082 pIfObj->iCopy = 1;
1083 else assert( 0 );
1084 }
1085 Vec_IntFree( vAig );
1086 Vec_IntFree( vLeaves );
1087 pNew = Gia_ManRehash( pTemp = pNew, 0 );
1088 Gia_ManStop( pTemp );
1089 return pNew;
1090}
int Gia_ManBuildFromMini(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCut, Vec_Int_t *vLeaves, Vec_Int_t *vAig, int fHash, int fUseDsd)
Definition giaIf.c:1000
int Abc_RecToGia3(Gia_Man_t *pMan, If_Man_t *pIfMan, If_Cut_t *pCut, Vec_Int_t *vLeaves, int fHash)
Definition abcRec3.c:1105
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManRehash(Gia_Man_t *p, int fAddStrash)
Definition giaHash.c:739
#define If_ManForEachObj(p, pObj, i)
Definition if.h:491
struct If_Cut_t_ If_Cut_t
Definition if.h:80
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition if.h:503
struct If_Obj_t_ If_Obj_t
Definition if.h:79
int nRefs
Definition if.h:346
int iCopy
Definition if.h:357
int fDelayOpt
Definition if.h:126
int fUserSesLib
Definition if.h:130
int fDsdBalance
Definition if.h:128
int fUserRecLib
Definition if.h:129
char * pLutStruct
Definition if.h:154
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfAig_rec()

int Gia_ManFromIfAig_rec ( Gia_Man_t * pNew,
If_Man_t * pIfMan,
If_Obj_t * pIfObj )

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

Synopsis [Converts IF into GIA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1020 of file giaIf.c.

1021{
1022 int iLit0, iLit1;
1023 if ( pIfObj->iCopy )
1024 return pIfObj->iCopy;
1025 iLit0 = Gia_ManFromIfAig_rec( pNew, pIfMan, pIfObj->pFanin0 );
1026 iLit1 = Gia_ManFromIfAig_rec( pNew, pIfMan, pIfObj->pFanin1 );
1027 iLit0 = Abc_LitNotCond( iLit0, pIfObj->fCompl0 );
1028 iLit1 = Abc_LitNotCond( iLit1, pIfObj->fCompl1 );
1029 pIfObj->iCopy = Gia_ManHashAnd( pNew, iLit0, iLit1 );
1030 return pIfObj->iCopy;
1031}
int Gia_ManFromIfAig_rec(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj)
Definition giaIf.c:1020
If_Obj_t * pFanin1
Definition if.h:350
If_Obj_t * pFanin0
Definition if.h:349
unsigned fCompl1
Definition if.h:335
unsigned fCompl0
Definition if.h:334
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfGetConfig()

void Gia_ManFromIfGetConfig ( Vec_Int_t * vConfigs,
If_Man_t * pIfMan,
If_Cut_t * pCutBest,
int iLit,
Vec_Str_t * vConfigsStr )

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

Synopsis [Converts IF into GIA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1747 of file giaIf.c.

1748{
1749 If_Obj_t * pIfObj = NULL;
1750 word * pPerm = If_DsdManGetFuncConfig( pIfMan->pIfDsdMan, If_CutDsdLit(pIfMan, pCutBest) ); // cell input -> DSD input
1751 char * pCutPerm = If_CutDsdPerm( pIfMan, pCutBest ); // DSD input -> cut input
1752 word * pArray; int v, i, Lit, Var;
1753 int nVarNum = If_DsdManVarNum(pIfMan->pIfDsdMan);
1754 int nTtBitNum = If_DsdManTtBitNum(pIfMan->pIfDsdMan);
1755 int nPermBitNum = If_DsdManPermBitNum(pIfMan->pIfDsdMan);
1756 int nPermBitOne = nPermBitNum / nVarNum;
1757 // prepare storage
1758 int nIntNum = Vec_IntEntry( vConfigs, 1 );
1759 for ( i = 0; i < nIntNum; i++ )
1760 Vec_IntPush( vConfigs, 0 );
1761 pArray = (word *)Vec_IntEntryP( vConfigs, Vec_IntSize(vConfigs) - nIntNum );
1762 assert( nPermBitNum % nVarNum == 0 );
1763 // set truth table bits
1764 for ( i = 0; i < nTtBitNum; i++ )
1765 if ( Abc_TtGetBit(pPerm + 1, i) )
1766 Abc_TtSetBit( pArray, i );
1767 // set permutation bits
1768 for ( v = 0; v < nVarNum; v++ )
1769 {
1770 // get DSD variable
1771 Var = ((pPerm[0] >> (v * 4)) & 0xF);
1772 assert( Var < (int)pCutBest->nLeaves );
1773 // get AIG literal
1774 Lit = (int)pCutPerm[Var];
1775 assert( Abc_Lit2Var(Lit) < (int)pCutBest->nLeaves );
1776 // complement if polarity has changed
1777 pIfObj = If_ManObj( pIfMan, pCutBest->pLeaves[Abc_Lit2Var(Lit)] );
1778 Lit = Abc_LitNotCond( Lit, Abc_LitIsCompl(pIfObj->iCopy) );
1779 // create config literal
1780 for ( i = 0; i < nPermBitOne; i++ )
1781 if ( (Lit >> i) & 1 )
1782 Abc_TtSetBit( pArray, nTtBitNum + v * nPermBitOne + i );
1783 }
1784 // remember complementation
1785 assert( nTtBitNum + nPermBitNum < 32 * nIntNum );
1786 if ( Abc_LitIsCompl(If_CutDsdLit(pIfMan, pCutBest)) ^ pCutBest->fCompl ^ Abc_LitIsCompl(iLit) )
1787 Abc_TtSetBit( pArray, nTtBitNum + nPermBitNum );
1788 // update count
1789 Vec_IntAddToEntry( vConfigs, 0, 1 );
1790 // write configs
1791 if ( vConfigsStr )
1792 {
1793 Vec_StrPrintF( vConfigsStr, "%d", Abc_Lit2Var(iLit) );
1794 Vec_StrPush( vConfigsStr, ' ' );
1795 for ( i = 0; i < nTtBitNum; i++ )
1796 Vec_StrPush( vConfigsStr, (char)(Abc_TtGetBit(pArray, i) ? '1' : '0') );
1797 Vec_StrPush( vConfigsStr, ' ' );
1798 Vec_StrPush( vConfigsStr, ' ' );
1799 for ( v = 0; v < nVarNum; v++ )
1800 {
1801 for ( i = 0; i < nPermBitOne; i++ )
1802 {
1803 Vec_StrPush( vConfigsStr, (char)(Abc_TtGetBit(pArray, nTtBitNum + v * nPermBitOne + i) ? '1' : '0') );
1804 if ( i == 0 )
1805 Vec_StrPush( vConfigsStr, ' ' );
1806 }
1807 Vec_StrPush( vConfigsStr, ' ' );
1808 Vec_StrPush( vConfigsStr, ' ' );
1809 }
1810 Vec_StrPush( vConfigsStr, (char)(Abc_TtGetBit(pArray, nTtBitNum + nPermBitNum) ? '1' : '0') );
1811 Vec_StrPush( vConfigsStr, '\n' );
1812 }
1813}
int Var
Definition exorList.c:228
int If_DsdManVarNum(If_DsdMan_t *p)
Definition ifDsd.c:173
word * If_DsdManGetFuncConfig(If_DsdMan_t *p, int iDsd)
Definition ifDsd.c:215
int If_DsdManPermBitNum(If_DsdMan_t *p)
Definition ifDsd.c:189
int If_DsdManTtBitNum(If_DsdMan_t *p)
Definition ifDsd.c:185
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
int pLeaves[0]
Definition if.h:318
unsigned nLeaves
Definition if.h:316
If_DsdMan_t * pIfDsdMan
Definition if.h:260
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogic()

Gia_Man_t * Gia_ManFromIfLogic ( If_Man_t * pIfMan)

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

Synopsis [Converts IF into GIA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 2000 of file giaIf.c.

2001{
2002 int fWriteConfigs = 1;
2003 Gia_Man_t * pNew, * pHashed = NULL;
2004 If_Cut_t * pCutBest;
2005 If_Obj_t * pIfObj, * pIfLeaf;
2006 Vec_Int_t * vMapping, * vMapping2, * vPacking = NULL, * vConfigs = NULL;
2007 Vec_Int_t * vLeaves, * vLeaves2, * vCover, * vLits;
2008 Vec_Str_t * vConfigsStr = NULL;
2009 Ifn_Ntk_t * pNtkCell = NULL;
2010 sat_solver * pSat = NULL;
2011 int i, k, Entry;
2012 assert( !pIfMan->pPars->fDeriveLuts || pIfMan->pPars->fTruth );
2013// if ( pIfMan->pPars->fEnableCheck07 )
2014// pIfMan->pPars->fDeriveLuts = 0;
2015 // start mapping and packing
2016 vMapping = Vec_IntStart( If_ManObjNum(pIfMan) );
2017 vMapping2 = Vec_IntStart( 1 );
2018 if ( pIfMan->pPars->fDeriveLuts && (pIfMan->pPars->pLutStruct || pIfMan->pPars->fEnableCheck75 || pIfMan->pPars->fEnableCheck75u || pIfMan->pPars->fEnableCheck07) )
2019 {
2020 vPacking = Vec_IntAlloc( 1000 );
2021 Vec_IntPush( vPacking, 0 );
2022 }
2023 if ( pIfMan->pPars->fUseDsdTune )
2024 {
2025 int nTtBitNum = If_DsdManTtBitNum(pIfMan->pIfDsdMan);
2026 int nPermBitNum = If_DsdManPermBitNum(pIfMan->pIfDsdMan);
2027 int nConfigInts = Abc_BitWordNum(nTtBitNum + nPermBitNum + 1);
2028 vConfigs = Vec_IntAlloc( 1000 );
2029 Vec_IntPush( vConfigs, 0 );
2030 Vec_IntPush( vConfigs, nConfigInts );
2031 if ( fWriteConfigs )
2032 vConfigsStr = Vec_StrAlloc( 1000 );
2033 }
2034 // create new manager
2035 pNew = Gia_ManStart( If_ManObjNum(pIfMan) );
2036 // iterate through nodes used in the mapping
2037 vLits = Vec_IntAlloc( 1000 );
2038 vCover = Vec_IntAlloc( 1 << 16 );
2039 vLeaves = Vec_IntAlloc( 16 );
2040 vLeaves2 = Vec_IntAlloc( 16 );
2041 If_ManCleanCutData( pIfMan );
2042 If_ManForEachObj( pIfMan, pIfObj, i )
2043 {
2044 if ( pIfObj->nRefs == 0 && !If_ObjIsTerm(pIfObj) )
2045 continue;
2046 if ( If_ObjIsAnd(pIfObj) )
2047 {
2048 pCutBest = If_ObjCutBest( pIfObj );
2049 // perform sorting of cut leaves by delay, so that the slowest pin drives the fastest input of the LUT
2050 if ( !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->fDelayOptLut && !pIfMan->pPars->fDsdBalance &&
2051 !pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->fUserSesLib && !pIfMan->pPars->nGateSize &&
2052 !pIfMan->pPars->fEnableCheck75 && !pIfMan->pPars->fEnableCheck75u && !pIfMan->pPars->fEnableCheck07 && !pIfMan->pPars->fUseDsdTune &&
2053 !pIfMan->pPars->fUseCofVars && !pIfMan->pPars->fUseAndVars && !pIfMan->pPars->fUseCheck1 && !pIfMan->pPars->fUseCheck2 && !pIfMan->pPars->fUserLutDec )
2054 If_CutRotatePins( pIfMan, pCutBest );
2055 // collect leaves of the best cut
2056 Vec_IntClear( vLeaves );
2057 If_CutForEachLeaf( pIfMan, pCutBest, pIfLeaf, k )
2058 Vec_IntPush( vLeaves, pIfLeaf->iCopy );
2059 // perform one of the two types of mapping: with and without structures
2060 if ( pIfMan->pPars->fUseDsd && pIfMan->pPars->pLutStruct )
2061 {
2062 if ( pSat == NULL )
2063 pSat = (sat_solver *)If_ManSatBuildXY( (int)(pIfMan->pPars->pLutStruct[0] - '0') );
2064 if ( pIfMan->pPars->pLutStruct && pIfMan->pPars->fDeriveLuts )
2065 pIfObj->iCopy = Gia_ManFromIfLogicFindLut( pIfMan, pNew, pCutBest, pSat, vLeaves, vLits, vCover, vMapping, vMapping2, vPacking );
2066 else
2067 pIfObj->iCopy = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 );
2068 pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl );
2069 }
2070/*
2071 else if ( pIfMan->pPars->fUseDsd && pIfMan->pPars->fUseDsdTune && pIfMan->pPars->fDeriveLuts )
2072 {
2073 if ( pNtkCell == NULL )
2074 {
2075 assert( If_DsdManGetCellStr(pIfMan->pIfDsdMan) != NULL );
2076 pNtkCell = Ifn_NtkParse( If_DsdManGetCellStr(pIfMan->pIfDsdMan) );
2077 nLutMax = Ifn_NtkLutSizeMax( pNtkCell );
2078 pHashed = Gia_ManStart( 10000 );
2079 Vec_IntFillExtra( &pHashed->vCopies, 10000, -1 );
2080 for ( k = 0; k < pIfMan->pPars->nLutSize; k++ )
2081 Gia_ManAppendCi( pHashed );
2082 Gia_ManHashAlloc( pHashed );
2083 }
2084 pIfObj->iCopy = Gia_ManFromIfLogicFindCell( pIfMan, pNew, pHashed, pCutBest, pNtkCell, nLutMax, vLeaves, vLits, vCover, vMapping, vMapping2, vConfigs );
2085 pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl );
2086 }
2087*/
2088 else if ( pIfMan->pPars->fUseAndVars && pIfMan->pPars->fUseCofVars && pIfMan->pPars->fDeriveLuts && (int)pCutBest->nLeaves > pIfMan->pPars->nLutSize/2 )
2089 {
2090 int truthId = Abc_Lit2Var(pCutBest->iCutFunc);
2091 int Mask = Vec_IntEntry(pIfMan->vTtDecs[pCutBest->nLeaves], truthId);
2092 if ( Mask )
2093 pIfObj->iCopy = Gia_ManFromIfLogicAndVars( pNew, pIfMan, pCutBest, vLeaves, vLeaves2, vCover, vMapping, vMapping2 );
2094 else
2095 pIfObj->iCopy = Gia_ManFromIfLogicCofVars( pNew, pIfMan, pCutBest, vLeaves, vLeaves2, vCover, vMapping, vMapping2 );
2096 }
2097 else if ( pIfMan->pPars->fUseAndVars && pIfMan->pPars->fDeriveLuts && (int)pCutBest->nLeaves > pIfMan->pPars->nLutSize/2 )
2098 {
2099 pIfObj->iCopy = Gia_ManFromIfLogicAndVars( pNew, pIfMan, pCutBest, vLeaves, vLeaves2, vCover, vMapping, vMapping2 );
2100 }
2101 else if ( pIfMan->pPars->fUseCofVars && pIfMan->pPars->fDeriveLuts && (int)pCutBest->nLeaves > pIfMan->pPars->nLutSize/2 )
2102 {
2103 pIfObj->iCopy = Gia_ManFromIfLogicCofVars( pNew, pIfMan, pCutBest, vLeaves, vLeaves2, vCover, vMapping, vMapping2 );
2104 }
2105 else if ( pIfMan->pPars->fUserLutDec && (int)pCutBest->nLeaves > pIfMan->pPars->nLutDecSize )
2106 {
2107 pIfObj->iCopy = Gia_ManFromIfLogicHop( pNew, pIfMan, pCutBest, vLeaves, vLeaves2, vCover, vMapping, vMapping2 );
2108 }
2109 else if ( (pIfMan->pPars->fDeriveLuts && pIfMan->pPars->fTruth) || pIfMan->pPars->fUseDsd || pIfMan->pPars->fUseTtPerm || pIfMan->pPars->pFuncCell2 )
2110 {
2111 word * pTruth = If_CutTruthW(pIfMan, pCutBest);
2112 if ( pIfMan->pPars->fUseTtPerm )
2113 for ( k = 0; k < (int)pCutBest->nLeaves; k++ )
2114 if ( If_CutLeafBit(pCutBest, k) )
2115 Abc_TtFlip( pTruth, Abc_TtWordNum(pCutBest->nLeaves), k );
2116 // perform decomposition of the cut
2117 pIfObj->iCopy = Gia_ManFromIfLogicNode( pIfMan, pNew, i, vLeaves, vLeaves2, pTruth, pIfMan->pPars->pLutStruct, vCover, vMapping, vMapping2, vPacking, (pIfMan->pPars->fEnableCheck75 || pIfMan->pPars->fEnableCheck75u), pIfMan->pPars->fEnableCheck07 );
2118 pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl );
2119 if ( vConfigs && Vec_IntSize(vLeaves) > 1 && !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(pIfObj->iCopy))) && pIfObj->iCopy > 1 )
2120 Gia_ManFromIfGetConfig( vConfigs, pIfMan, pCutBest, pIfObj->iCopy, vConfigsStr );
2121 }
2122 else
2123 {
2124 pIfObj->iCopy = Gia_ManNodeIfToGia( pNew, pIfMan, pIfObj, vLeaves, 0 );
2125 // write mapping
2126 Vec_IntSetEntry( vMapping, Abc_Lit2Var(pIfObj->iCopy), Vec_IntSize(vMapping2) );
2127 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
2128 Vec_IntForEachEntry( vLeaves, Entry, k )
2129 assert( Abc_Lit2Var(Entry) < Abc_Lit2Var(pIfObj->iCopy) );
2130 Vec_IntForEachEntry( vLeaves, Entry, k )
2131 Vec_IntPush( vMapping2, Abc_Lit2Var(Entry) );
2132 Vec_IntPush( vMapping2, Abc_Lit2Var(pIfObj->iCopy) );
2133 }
2134 }
2135 else if ( If_ObjIsCi(pIfObj) )
2136 pIfObj->iCopy = Gia_ManAppendCi(pNew);
2137 else if ( If_ObjIsCo(pIfObj) )
2138 pIfObj->iCopy = Gia_ManAppendCo( pNew, Abc_LitNotCond(If_ObjFanin0(pIfObj)->iCopy, If_ObjFaninC0(pIfObj)) );
2139 else if ( If_ObjIsConst1(pIfObj) )
2140 {
2141 pIfObj->iCopy = 1;
2142 // create const LUT
2143 Vec_IntWriteEntry( vMapping, 0, Vec_IntSize(vMapping2) );
2144 Vec_IntPush( vMapping2, 0 );
2145 Vec_IntPush( vMapping2, 0 );
2146 }
2147 else assert( 0 );
2148 }
2149 Vec_IntFree( vLits );
2150 Vec_IntFree( vCover );
2151 Vec_IntFree( vLeaves );
2152 Vec_IntFree( vLeaves2 );
2153 if ( pNtkCell )
2154 ABC_FREE( pNtkCell );
2155 if ( pSat )
2156 sat_solver_delete(pSat);
2157 if ( pHashed )
2158 Gia_ManStop( pHashed );
2159// printf( "Mapping array size: IfMan = %d. Gia = %d. Increase = %.2f\n",
2160// If_ManObjNum(pIfMan), Gia_ManObjNum(pNew), 1.0 * Gia_ManObjNum(pNew) / If_ManObjNum(pIfMan) );
2161 // finish mapping
2162 if ( Vec_IntSize(vMapping) > Gia_ManObjNum(pNew) )
2163 Vec_IntShrink( vMapping, Gia_ManObjNum(pNew) );
2164 else
2165 Vec_IntFillExtra( vMapping, Gia_ManObjNum(pNew), 0 );
2166 assert( Vec_IntSize(vMapping) == Gia_ManObjNum(pNew) );
2167 Vec_IntForEachEntry( vMapping, Entry, i )
2168 if ( Entry > 0 )
2169 Vec_IntAddToEntry( vMapping, i, Gia_ManObjNum(pNew) );
2170 Vec_IntAppend( vMapping, vMapping2 );
2171 Vec_IntFree( vMapping2 );
2172 // attach mapping and packing
2173 assert( pNew->vMapping == NULL );
2174 assert( pNew->vPacking == NULL );
2175 assert( pNew->vConfigs == NULL );
2176 assert( pNew->pCellStr == NULL );
2177 pNew->vMapping = vMapping;
2178 pNew->vPacking = vPacking;
2179 pNew->vConfigs = vConfigs;
2180 pNew->pCellStr = vConfigs ? Abc_UtilStrsav( If_DsdManGetCellStr(pIfMan->pIfDsdMan) ) : NULL;
2181 assert( !vConfigs || Vec_IntSize(vConfigs) == 2 + Vec_IntEntry(vConfigs, 0) * Vec_IntEntry(vConfigs, 1) );
2182 // verify that COs have mapping
2183 {
2184 Gia_Obj_t * pObj;
2185 Gia_ManForEachCo( pNew, pObj, i )
2186 assert( !Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) || Gia_ObjIsLut(pNew, Gia_ObjFaninId0p(pNew, pObj)) );
2187 }
2188 // verify that internal nodes have mapping
2189 {
2190 Gia_Obj_t * pFanin;
2191 Gia_ManForEachLut( pNew, i )
2192 Gia_LutForEachFaninObj( pNew, i, pFanin, k )
2193 assert( !Gia_ObjIsAnd(pFanin) || Gia_ObjIsLut(pNew, Gia_ObjId(pNew, pFanin)) );
2194 }
2195 // verify that CIs have no mapping
2196 {
2197 Gia_Obj_t * pObj;
2198 Gia_ManForEachCi( pNew, pObj, i )
2199 assert( !Gia_ObjIsLut(pNew, Gia_ObjId(pNew, pObj)) );
2200 }
2201 // dump configuration strings
2202 if ( vConfigsStr )
2203 {
2204 FILE * pFile; int status;
2205 char * pStr, Buffer[1000] = {0};
2206 const char * pNameGen = pIfMan->pName? Extra_FileNameGeneric( pIfMan->pName ) : "nameless_";
2207 sprintf( Buffer, "%s_configs.txt", pNameGen );
2208 ABC_FREE( pNameGen );
2209 pFile = fopen( Buffer, "wb" );
2210 if ( pFile == NULL )
2211 {
2212 Vec_StrFree( vConfigsStr );
2213 printf( "Cannot open file \"%s\".\n", Buffer );
2214 return pNew;
2215 }
2216 Vec_StrPush( vConfigsStr, '\0' );
2217 pStr = Vec_StrArray(vConfigsStr);
2218 status = fwrite( pStr, strlen(pStr), 1, pFile );
2219 Vec_StrFree( vConfigsStr );
2220 fclose( pFile );
2221 printf( "Finished dumping configs into file \"%s\".\n", Buffer );
2222 }
2223 return pNew;
2224}
#define ABC_FREE(obj)
Definition abc_global.h:267
#define sat_solver
Definition cecSatG2.c:34
char * Extra_FileNameGeneric(char *FileName)
int Gia_ManFromIfLogicNode(void *pIfMan, Gia_Man_t *pNew, int iObj, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, word *pRes, char *pStr, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking, int fCheck75, int fCheck44e)
Definition giaIf.c:1189
int Gia_ManFromIfLogicHop(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
Definition giaIf.c:1497
int Gia_ManFromIfLogicAndVars(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeaves2, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
Definition giaIf.c:1944
int Gia_ManNodeIfToGia(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Int_t *vLeaves, int fHash)
Definition giaIf.c:1619
int Gia_ManFromIfLogicCreateLut(Gia_Man_t *pNew, word *pRes, Vec_Int_t *vLeaves, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
Definition giaIf.c:1104
int Gia_ManFromIfLogicCofVars(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Cut_t *pCutBest, Vec_Int_t *vLeaves, Vec_Int_t *vLeaves2, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
Definition giaIf.c:1868
int Gia_ManFromIfLogicFindLut(If_Man_t *pIfMan, Gia_Man_t *pNew, If_Cut_t *pCutBest, sat_solver *pSat, Vec_Int_t *vLeaves, Vec_Int_t *vLits, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking)
Definition giaIf.c:1657
void Gia_ManFromIfGetConfig(Vec_Int_t *vConfigs, If_Man_t *pIfMan, If_Cut_t *pCutBest, int iLit, Vec_Str_t *vConfigsStr)
Definition giaIf.c:1747
void If_ManCleanCutData(If_Man_t *p)
Definition ifUtil.c:64
char * If_DsdManGetCellStr(If_DsdMan_t *p)
Definition ifDsd.c:219
void If_CutRotatePins(If_Man_t *p, If_Cut_t *pCut)
Definition ifTruth.c:68
void * If_ManSatBuildXY(int nLutSize)
DECLARATIONS ///.
Definition ifSat.c:45
struct Ifn_Ntk_t_ Ifn_Ntk_t
Definition if.h:85
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Vec_Int_t * vPacking
Definition gia.h:141
char * pCellStr
Definition gia.h:143
Vec_Int_t * vConfigs
Definition gia.h:142
int iCutFunc
Definition if.h:307
char * pName
Definition if.h:199
Vec_Int_t * vTtDecs[IF_MAX_FUNC_LUTSIZE+1]
Definition if.h:266
int fUseDsd
Definition if.h:140
int nGateSize
Definition if.h:108
int fEnableCheck75
Definition if.h:138
int fDeriveLuts
Definition if.h:147
int fUseAndVars
Definition if.h:143
int fTruth
Definition if.h:160
int fUserLutDec
Definition if.h:150
int nLutSize
Definition if.h:104
int fUseCofVars
Definition if.h:142
int nLutDecSize
Definition if.h:116
int fUseTtPerm
Definition if.h:144
int fEnableCheck07
Definition if.h:135
int fUseDsdTune
Definition if.h:141
int fEnableCheck75u
Definition if.h:139
int(* pFuncCell2)(If_Man_t *, word *, int, Vec_Str_t *, char **)
Definition if.h:181
int fDelayOptLut
Definition if.h:127
int fUseCheck2
Definition if.h:146
int fUseCheck1
Definition if.h:145
int strlen()
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogicAndVars()

int Gia_ManFromIfLogicAndVars ( Gia_Man_t * pNew,
If_Man_t * pIfMan,
If_Cut_t * pCutBest,
Vec_Int_t * vLeaves,
Vec_Int_t * vLeaves2,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2 )

Definition at line 1944 of file giaIf.c.

1945{
1946 word pFunc[64], uTruth[2];
1947 int nLeaves = pCutBest->nLeaves;
1948 int truthId = Abc_Lit2Var(pCutBest->iCutFunc);
1949 int c, k, Mask = Vec_IntEntry(pIfMan->vTtDecs[nLeaves], truthId);
1950 int MaskOne[2] = { Mask & 0xFFFF, (Mask >> 16) & 0x3FFF };
1951 int iLitCofs[2], iTemp, fOrDec = (Mask >> 30) & 1, RetValue = -1;
1952 assert( Mask > 0 && nLeaves <= 2 * (pIfMan->pPars->nLutSize/2) && pIfMan->pPars->nLutSize <= 13 );
1953 Abc_TtCopy( pFunc, If_CutTruthWR(pIfMan, pCutBest), pIfMan->nTruth6Words[nLeaves], fOrDec );
1954 Abc_TtDeriveBiDec( pFunc, nLeaves, MaskOne[0], MaskOne[1], pIfMan->pPars->nLutSize/2, &uTruth[0], &uTruth[1] );
1955 uTruth[0] = fOrDec ? ~uTruth[0] : uTruth[0];
1956 uTruth[1] = fOrDec ? ~uTruth[1] : uTruth[1];
1957 for ( c = 0; c < 2; c++ )
1958 {
1959 Vec_IntClear( vLeaves2 );
1960 for ( k = 0; k < nLeaves; k++ )
1961 if ( (MaskOne[c] >> k) & 1 )
1962 Vec_IntPush( vLeaves2, Vec_IntEntry(vLeaves, k) );
1963 assert( Vec_IntSize(vLeaves2) >= 1 );
1964 iLitCofs[c] = Kit_TruthToGia( pNew, (unsigned *)&uTruth[c], Vec_IntSize(vLeaves2), vCover, vLeaves2, 0 );
1965 if ( Vec_IntSize(vLeaves2) == 1 )
1966 continue;
1967 // create mapping
1968 assert( Gia_ObjIsAnd(Gia_ManObj(pNew, Abc_Lit2Var(iLitCofs[c]))) );
1969 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLitCofs[c]), Vec_IntSize(vMapping2) );
1970 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) );
1971 Vec_IntForEachEntry( vLeaves2, iTemp, k )
1972 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1973 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[c]) );
1974 }
1975 iLitCofs[0] = Abc_LitNotCond( iLitCofs[0], fOrDec );
1976 iLitCofs[1] = Abc_LitNotCond( iLitCofs[1], fOrDec );
1977 RetValue = Gia_ManAppendAnd( pNew, iLitCofs[0], iLitCofs[1] );
1978 RetValue = Abc_LitNotCond( RetValue, fOrDec ^ Abc_LitIsCompl(pCutBest->iCutFunc) );
1979 // create mapping
1980 Vec_IntSetEntry( vMapping, Abc_Lit2Var(RetValue), Vec_IntSize(vMapping2) );
1981 Vec_IntPush( vMapping2, 2 );
1982 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[0]) );
1983 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[1]) );
1984 Vec_IntPush( vMapping2, -Abc_Lit2Var(RetValue) );
1985 RetValue = Abc_LitNotCond( RetValue, pCutBest->fCompl );
1986 return RetValue;
1987}
ABC_NAMESPACE_IMPL_START int Kit_TruthToGia(Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
DECLARATIONS ///.
Definition kitHop.c:80
int nTruth6Words[IF_MAX_FUNC_LUTSIZE+1]
Definition if.h:243
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogicCofVars()

int Gia_ManFromIfLogicCofVars ( Gia_Man_t * pNew,
If_Man_t * pIfMan,
If_Cut_t * pCutBest,
Vec_Int_t * vLeaves,
Vec_Int_t * vLeaves2,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2 )

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

Synopsis [Converts IF into GIA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1868 of file giaIf.c.

1869{
1870 word pTruthCof[128], * pTruth = If_CutTruthW(pIfMan, pCutBest);
1871 int pVarsNew[16], nVarsNew, iLitCofs[3];
1872 int nLeaves = pCutBest->nLeaves;
1873 int nWords = Abc_Truth6WordNum(nLeaves);
1874 int truthId = Abc_Lit2Var(pCutBest->iCutFunc);
1875 int c, iVar = Vec_StrEntry(pIfMan->vTtVars[nLeaves], truthId), iTemp, iTopLit;
1876 int k, RetValue = -1;
1877 assert( iVar >= 0 && iVar < nLeaves && pIfMan->pPars->nLutSize <= 13 );
1878 for ( c = 0; c < 2; c++ )
1879 {
1880 for ( k = 0; k < nLeaves; k++ )
1881 pVarsNew[k] = k;
1882 if ( c )
1883 Abc_TtCofactor1p( pTruthCof, pTruth, nWords, iVar );
1884 else
1885 Abc_TtCofactor0p( pTruthCof, pTruth, nWords, iVar );
1886 nVarsNew = Abc_TtMinBase( pTruthCof, pVarsNew, pCutBest->nLeaves, Abc_MaxInt(6, pCutBest->nLeaves) );
1887 // derive LUT
1888 Vec_IntClear( vLeaves2 );
1889 for ( k = 0; k < nVarsNew; k++ )
1890 Vec_IntPush( vLeaves2, Vec_IntEntry(vLeaves, pVarsNew[k]) );
1891 iLitCofs[c] = Kit_TruthToGia( pNew, (unsigned *)pTruthCof, nVarsNew, vCover, vLeaves2, 0 );
1892 if ( nVarsNew < 2 )
1893 continue;
1894 // create mapping
1895 assert( Gia_ObjIsAnd(Gia_ManObj(pNew, Abc_Lit2Var(iLitCofs[c]))) );
1896 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLitCofs[c]), Vec_IntSize(vMapping2) );
1897 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) );
1898 Vec_IntForEachEntry( vLeaves2, iTemp, k )
1899 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1900 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[c]) );
1901 }
1902 iLitCofs[2] = Vec_IntEntry(vLeaves, iVar);
1903 // derive MUX
1904 if ( iLitCofs[0] > 1 && iLitCofs[1] > 1 )
1905 {
1906 pTruthCof[0] = ABC_CONST(0xCACACACACACACACA);
1907 Vec_IntClear( vLeaves2 );
1908 Vec_IntPush( vLeaves2, iLitCofs[0] );
1909 Vec_IntPush( vLeaves2, iLitCofs[1] );
1910 Vec_IntPush( vLeaves2, iLitCofs[2] );
1911 RetValue = Kit_TruthToGia( pNew, (unsigned *)pTruthCof, Vec_IntSize(vLeaves2), vCover, vLeaves2, 0 );
1912 iTopLit = RetValue;
1913 }
1914 else
1915 {
1916 assert( iLitCofs[0] > 1 || iLitCofs[1] > 1 );
1917 // collect leaves
1918 Vec_IntClear( vLeaves2 );
1919 for ( k = 0; k < 3; k++ )
1920 if ( iLitCofs[k] > 1 )
1921 Vec_IntPush( vLeaves2, iLitCofs[k] );
1922 assert( Vec_IntSize(vLeaves2) == 2 );
1923 // consider three possibilities
1924 if ( iLitCofs[0] == 0 )
1925 RetValue = Gia_ManAppendAnd( pNew, iLitCofs[2], iLitCofs[1] );
1926 else if ( iLitCofs[0] == 1 )
1927 RetValue = Gia_ManAppendOr( pNew, Abc_LitNot(iLitCofs[2]), iLitCofs[1] );
1928 else if ( iLitCofs[1] == 0 )
1929 RetValue = Gia_ManAppendAnd( pNew, Abc_LitNot(iLitCofs[2]), iLitCofs[0] );
1930 else if ( iLitCofs[1] == 1 )
1931 RetValue = Gia_ManAppendOr( pNew, iLitCofs[2], iLitCofs[0] );
1932 else assert( 0 );
1933 iTopLit = iLitCofs[2];
1934 }
1935 // create mapping
1936 Vec_IntSetEntry( vMapping, Abc_Lit2Var(RetValue), Vec_IntSize(vMapping2) );
1937 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves2) );
1938 Vec_IntForEachEntry( vLeaves2, iTemp, k )
1939 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1940 Vec_IntPush( vMapping2, -Abc_Lit2Var(iTopLit) );
1941 RetValue = Abc_LitNotCond( RetValue, pCutBest->fCompl );
1942 return RetValue;
1943}
int nWords
Definition abcNpn.c:127
#define ABC_CONST(number)
PARAMETERS ///.
Definition abc_global.h:240
Vec_Str_t * vTtVars[IF_MAX_FUNC_LUTSIZE+1]
Definition if.h:265
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogicCreateLut()

int Gia_ManFromIfLogicCreateLut ( Gia_Man_t * pNew,
word * pRes,
Vec_Int_t * vLeaves,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2 )

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

Synopsis [Write mapping for LUT with given fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 1104 of file giaIf.c.

1105{
1106 int i, iLit, iObjLit1;
1107 iObjLit1 = Kit_TruthToGia( pNew, (unsigned *)pRes, Vec_IntSize(vLeaves), vCover, vLeaves, 0 );
1108 // do not create LUT in the simple case
1109 if ( Abc_Lit2Var(iObjLit1) == 0 )
1110 return iObjLit1;
1111 Vec_IntForEachEntry( vLeaves, iLit, i )
1112 if ( Abc_Lit2Var(iObjLit1) == Abc_Lit2Var(iLit) )
1113 return iObjLit1;
1114 // write mapping
1115 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iObjLit1), Vec_IntSize(vMapping2) );
1116 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
1117// Vec_IntForEachEntry( vLeaves, iLit, i )
1118// assert( Abc_Lit2Var(iLit) < Abc_Lit2Var(iObjLit1) );
1119 Vec_IntForEachEntry( vLeaves, iLit, i )
1120 Vec_IntPush( vMapping2, Abc_Lit2Var(iLit) );
1121 Vec_IntPush( vMapping2, Abc_Lit2Var(iObjLit1) );
1122 return iObjLit1;
1123}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogicCreateLutSpecial()

int Gia_ManFromIfLogicCreateLutSpecial ( Gia_Man_t * pNew,
word * pRes,
Vec_Int_t * vLeaves,
Vec_Int_t * vLeavesTemp,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2,
Vec_Int_t * vPacking )

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

Synopsis [Write mapping for LUT with given fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 1136 of file giaIf.c.

1137{
1138 word z = If_CutPerformDerive07( NULL, (unsigned *)pRes, Vec_IntSize(vLeaves), Vec_IntSize(vLeaves), NULL );
1139 word Truth;
1140 int i, iObjLit1, iObjLit2;
1141 // create first LUT
1142 Vec_IntClear( vLeavesTemp );
1143 for ( i = 0; i < 4; i++ )
1144 {
1145 int v = (int)((z >> (16+(i<<2))) & 7);
1146 if ( v == 6 && Vec_IntSize(vLeaves) == 5 )
1147 continue;
1148 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, v) );
1149 }
1150 Truth = (z & 0xffff);
1151 Truth |= (Truth << 16);
1152 Truth |= (Truth << 32);
1153 iObjLit1 = Gia_ManFromIfLogicCreateLut( pNew, &Truth, vLeavesTemp, vCover, vMapping, vMapping2 );
1154 // create second LUT
1155 Vec_IntClear( vLeavesTemp );
1156 for ( i = 0; i < 4; i++ )
1157 {
1158 int v = (int)((z >> (48+(i<<2))) & 7);
1159 if ( v == 6 && Vec_IntSize(vLeaves) == 5 )
1160 continue;
1161 if ( v == 7 )
1162 Vec_IntPush( vLeavesTemp, iObjLit1 );
1163 else
1164 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, v) );
1165 }
1166 Truth = ((z >> 32) & 0xffff);
1167 Truth |= (Truth << 16);
1168 Truth |= (Truth << 32);
1169 iObjLit2 = Gia_ManFromIfLogicCreateLut( pNew, &Truth, vLeavesTemp, vCover, vMapping, vMapping2 );
1170 // write packing
1171 Vec_IntPush( vPacking, 2 );
1172 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1173 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit2) );
1174 Vec_IntAddToEntry( vPacking, 0, 1 );
1175 return iObjLit2;
1176}
word If_CutPerformDerive07(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
Definition ifDec07.c:1018
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogicFindCell()

int Gia_ManFromIfLogicFindCell ( If_Man_t * pIfMan,
Gia_Man_t * pNew,
Gia_Man_t * pTemp,
If_Cut_t * pCutBest,
Ifn_Ntk_t * pNtkCell,
int nLutMax,
Vec_Int_t * vLeaves,
Vec_Int_t * vLits,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2,
Vec_Int_t * vConfigs )

Definition at line 1814 of file giaIf.c.

1815{
1816 int iLit;
1817 assert( 0 );
1818 if ( Vec_IntSize(vLeaves) <= nLutMax )
1819 iLit = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 );
1820 else
1821 {
1822 Gia_Obj_t * pObj;
1823 int i, Id, iLitTemp;
1824 // extract variable permutation
1825 //char * pCutPerm = If_CutDsdPerm( pIfMan, pCutBest ); // DSD input -> cut input
1826 word * pPerm = If_DsdManGetFuncConfig( pIfMan->pIfDsdMan, If_CutDsdLit(pIfMan, pCutBest) ); // cell input -> DSD input
1827 //int nBits = If_DsdManTtBitNum( pIfMan->pIfDsdMan );
1828 // use config bits to generate the network
1829 iLit = If_ManSatDeriveGiaFromBits( pTemp, pNtkCell, pPerm + 1, vLeaves, vCover );
1830 // copy GIA back into the manager
1831 Vec_IntFillExtra( &pTemp->vCopies, Gia_ManObjNum(pTemp), -1 );
1832 Gia_ObjSetCopyArray( pTemp, 0, 0 );
1833 Vec_IntForEachEntry( vLeaves, iLitTemp, i )
1834 Gia_ObjSetCopyArray( pTemp, Gia_ManCiIdToId(pTemp, i), iLitTemp );
1835 // collect nodes
1836 Gia_ManIncrementTravId( pTemp );
1837 Id = Abc_Lit2Var( iLit );
1838 Gia_ManCollectAnds( pTemp, &Id, 1, vCover, NULL );
1839 Vec_IntPrint( vCover );
1840 Gia_ManForEachObjVec( vCover, pTemp, pObj, i )
1841 Gia_ObjPrint( pTemp, pObj );
1842 // copy GIA
1843 Gia_ManForEachObjVec( vCover, pTemp, pObj, i )
1844 {
1845 iLit = Gia_ManAppendAnd( pNew, Gia_ObjFanin0CopyArray(pTemp, pObj), Gia_ObjFanin1CopyArray(pTemp, pObj) );
1846 Gia_ObjSetCopyArray( pTemp, Gia_ObjId(pTemp, pObj), iLit );
1847 }
1848 iLit = Abc_LitNotCond( Gia_ObjCopyArray(pTemp, Id), Abc_LitIsCompl(iLit) );
1849 }
1850 // write packing
1851// if ( vConfigs && !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(iLit))) && iLit > 1 )
1852// Gia_ManFromIfGetConfig( vConfigs, pIfMan, pCutBest );
1853 return iLit;
1854}
void Gia_ObjPrint(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaUtil.c:1456
void Gia_ManCollectAnds(Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
Definition giaDfs.c:125
int If_ManSatDeriveGiaFromBits(void *pNew, Ifn_Ntk_t *p, word *pTtData, Vec_Int_t *vLeaves, Vec_Int_t *vValues)
Definition ifTune.c:742
Vec_Int_t vCopies
Definition gia.h:152
Here is the call graph for this function:

◆ Gia_ManFromIfLogicFindLut()

int Gia_ManFromIfLogicFindLut ( If_Man_t * pIfMan,
Gia_Man_t * pNew,
If_Cut_t * pCutBest,
sat_solver * pSat,
Vec_Int_t * vLeaves,
Vec_Int_t * vLits,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2,
Vec_Int_t * vPacking )

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

Synopsis [Converts IF into GIA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1657 of file giaIf.c.

1658{
1659 word uBound, uFree;
1660 int nLutSize = (int)(pIfMan->pPars->pLutStruct[0] - '0');
1661 int nVarsF = 0, pVarsF[IF_MAX_FUNC_LUTSIZE];
1662 int nVarsB = 0, pVarsB[IF_MAX_FUNC_LUTSIZE];
1663 int nVarsS = 0, pVarsS[IF_MAX_FUNC_LUTSIZE];
1664 unsigned uSetNew, uSetOld;
1665 int RetValue, RetValue2, k;
1666 char * pPerm;
1667 if ( Vec_IntSize(vLeaves) <= nLutSize )
1668 {
1669 RetValue = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 );
1670 // write packing
1671 if ( !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(RetValue))) && RetValue > 1 )
1672 {
1673 Vec_IntPush( vPacking, 1 );
1674 Vec_IntPush( vPacking, Abc_Lit2Var(RetValue) );
1675 Vec_IntAddToEntry( vPacking, 0, 1 );
1676 }
1677 return RetValue;
1678 }
1679 assert( If_DsdManSuppSize(pIfMan->pIfDsdMan, If_CutDsdLit(pIfMan, pCutBest)) == (int)pCutBest->nLeaves );
1680 // find the bound set
1681 if ( pIfMan->pPars->fDelayOptLut )
1682 uSetOld = pCutBest->uMaskFunc;
1683 else
1684 uSetOld = If_DsdManCheckXY( pIfMan->pIfDsdMan, If_CutDsdLit(pIfMan, pCutBest), nLutSize, 1, 0, 1, 0 );
1685 // remap bound set
1686 uSetNew = 0;
1687 pPerm = If_CutDsdPerm( pIfMan, pCutBest );
1688 for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ )
1689 {
1690 int iVar = Abc_Lit2Var((int)pPerm[k]);
1691 int Value = ((uSetOld >> (k << 1)) & 3);
1692 if ( Value == 1 )
1693 uSetNew |= (1 << (2*iVar));
1694 else if ( Value == 3 )
1695 uSetNew |= (3 << (2*iVar));
1696 else assert( Value == 0 );
1697 }
1698 RetValue = If_ManSatCheckXY( pSat, nLutSize, If_CutTruthW(pIfMan, pCutBest), pCutBest->nLeaves, uSetNew, &uBound, &uFree, vLits );
1699 assert( RetValue );
1700 // collect variables
1701 for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ )
1702 {
1703 int Value = ((uSetNew >> (k << 1)) & 3);
1704 if ( Value == 0 )
1705 pVarsF[nVarsF++] = k;
1706 else if ( Value == 1 )
1707 pVarsB[nVarsB++] = k;
1708 else if ( Value == 3 )
1709 pVarsS[nVarsS++] = k;
1710 else assert( Value == 0 );
1711 }
1712 // collect bound set variables
1713 Vec_IntClear( vLits );
1714 for ( k = 0; k < nVarsS; k++ )
1715 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsS[k]) );
1716 for ( k = 0; k < nVarsB; k++ )
1717 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsB[k]) );
1718 RetValue = Gia_ManFromIfLogicCreateLut( pNew, &uBound, vLits, vCover, vMapping, vMapping2 );
1719 // collecct free set variables
1720 Vec_IntClear( vLits );
1721 Vec_IntPush( vLits, RetValue );
1722 for ( k = 0; k < nVarsS; k++ )
1723 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsS[k]) );
1724 for ( k = 0; k < nVarsF; k++ )
1725 Vec_IntPush( vLits, Vec_IntEntry(vLeaves, pVarsF[k]) );
1726 // add packing
1727 RetValue2 = Gia_ManFromIfLogicCreateLut( pNew, &uFree, vLits, vCover, vMapping, vMapping2 );
1728 // write packing
1729 Vec_IntPush( vPacking, 2 );
1730 Vec_IntPush( vPacking, Abc_Lit2Var(RetValue) );
1731 Vec_IntPush( vPacking, Abc_Lit2Var(RetValue2) );
1732 Vec_IntAddToEntry( vPacking, 0, 1 );
1733 return RetValue2;
1734}
unsigned If_DsdManCheckXY(If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fHighEffort, int fVerbose)
Definition ifDsd.c:2017
int If_DsdManSuppSize(If_DsdMan_t *p, int iDsd)
Definition ifDsd.c:197
#define IF_MAX_FUNC_LUTSIZE
Definition if.h:55
int If_ManSatCheckXY(void *pSat, int nLutSize, word *pTruth, int nVars, unsigned uSet, word *pTBound, word *pTFree, Vec_Int_t *vLits)
Definition ifSat.c:151
int uMaskFunc
Definition if.h:308
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogicHop()

int Gia_ManFromIfLogicHop ( Gia_Man_t * pNew,
If_Man_t * pIfMan,
If_Cut_t * pCutBest,
Vec_Int_t * vLeaves,
Vec_Int_t * vLeavesTemp,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2 )

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

Synopsis [Implements delay-driven decomposition of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1497 of file giaIf.c.

1498{
1499 word * pTruth = If_CutTruthW(pIfMan, pCutBest);
1500 unsigned char decompArray[92];
1501 int val;
1502
1503 assert( pCutBest->nLeaves > pIfMan->pPars->nLutDecSize );
1504
1505 unsigned delayProfile = pCutBest->decDelay;
1506 val = acd_decompose( pTruth, pCutBest->nLeaves, pIfMan->pPars->nLutDecSize, &(delayProfile), decompArray );
1507 assert( val == 0 );
1508
1509 // convert the LUT-structure into a set of logic nodes in Gia_Man_t
1510 unsigned char bytes_check = decompArray[0];
1511 assert( bytes_check <= 92 );
1512
1513 int byte_p = 2;
1514 unsigned char i, j, k, num_fanins, num_words, num_bytes;
1515 int iObjLits[5];
1516 int fanin;
1517 word *tt;
1518
1519 for ( i = 0; i < decompArray[1]; ++i )
1520 {
1521 num_fanins = decompArray[byte_p++];
1522 Vec_IntClear( vLeavesTemp );
1523 for ( j = 0; j < num_fanins; ++j )
1524 {
1525 fanin = (int)decompArray[byte_p++];
1526 if ( fanin < If_CutLeaveNum(pCutBest) )
1527 {
1528 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, fanin) );
1529 }
1530 else
1531 {
1532 Vec_IntPush( vLeavesTemp, iObjLits[fanin - If_CutLeaveNum(pCutBest)] );
1533 }
1534 }
1535
1536 /* extract the truth table */
1537 tt = pIfMan->puTempW;
1538 num_words = ( num_fanins <= 6 ) ? 1 : ( 1 << ( num_fanins - 6 ) );
1539 num_bytes = ( num_fanins <= 3 ) ? 1 : ( 1 << ( Abc_MinInt( (int)num_fanins, 6 ) - 3 ) );
1540 for ( j = 0; j < num_words; ++j )
1541 {
1542 tt[j] = 0;
1543 for ( k = 0; k < num_bytes; ++k )
1544 {
1545 tt[j] |= ( (word)(decompArray[byte_p++]) ) << ( k << 3 );
1546 }
1547 }
1548
1549 /* extend truth table if size < 5 */
1550 assert( num_fanins != 1 );
1551 if ( num_fanins == 2 )
1552 {
1553 tt[0] |= tt[0] << 4;
1554 }
1555 while ( num_bytes < 4 )
1556 {
1557 tt[0] |= tt[0] << ( num_bytes << 3 );
1558 num_bytes <<= 1;
1559 }
1560
1561 iObjLits[i] = Gia_ManFromIfLogicCreateLut( pNew, tt, vLeavesTemp, vCover, vMapping, vMapping2 );
1562 }
1563
1564 /* check correct read */
1565 assert( byte_p == decompArray[0] );
1566
1567 return iObjLits[i-1];
1568}
int acd_decompose(word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned char *decomposition)
unsigned decDelay
Definition if.h:317
word * puTempW
Definition if.h:221
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFromIfLogicNode()

int Gia_ManFromIfLogicNode ( void * pIfMan,
Gia_Man_t * pNew,
int iObj,
Vec_Int_t * vLeaves,
Vec_Int_t * vLeavesTemp,
word * pRes,
char * pStr,
Vec_Int_t * vCover,
Vec_Int_t * vMapping,
Vec_Int_t * vMapping2,
Vec_Int_t * vPacking,
int fCheck75,
int fCheck44e )

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

Synopsis [Write the node into a file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1189 of file giaIf.c.

1191{
1192 int nLeaves = Vec_IntSize(vLeaves);
1193 int i, Length, nLutLeaf, nLutLeaf2, nLutRoot, iObjLit1, iObjLit2, iObjLit3;
1194 // workaround for the special case
1195 if ( fCheck75 )
1196 pStr = "54";
1197 // perform special case matching for 44
1198 if ( fCheck44e )
1199 {
1200 if ( Vec_IntSize(vLeaves) <= 4 )
1201 {
1202 // create mapping
1203 iObjLit1 = Gia_ManFromIfLogicCreateLut( pNew, pRes, vLeaves, vCover, vMapping, vMapping2 );
1204 // write packing
1205 if ( !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(iObjLit1))) && iObjLit1 > 1 )
1206 {
1207 Vec_IntPush( vPacking, 1 );
1208 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1209 Vec_IntAddToEntry( vPacking, 0, 1 );
1210 }
1211 return iObjLit1;
1212 }
1213 return Gia_ManFromIfLogicCreateLutSpecial( pNew, pRes, vLeaves, vLeavesTemp, vCover, vMapping, vMapping2, vPacking );
1214 }
1215 if ( ((If_Man_t *)pIfMan)->pPars->fLut6Filter && Vec_IntSize(vLeaves) == 6 )
1216 {
1217 extern word If_Dec6Perform( word t, int fDerive );
1218 extern void If_Dec6Verify( word t, word z );
1219 Vec_Int_t * vLeaves2 = Vec_IntAlloc( 4 );
1220 word t = pRes[0];
1221 word z = If_Dec6Perform( t, 1 );
1222 //If_DecPrintConfig( z );
1223 If_Dec6Verify( t, z );
1224
1225 t = Abc_Tt6Stretch( z & 0xffff, 4 );
1226 Vec_IntClear( vLeaves2 );
1227 for ( i = 0; i < 4; i++ )
1228 Vec_IntPush( vLeaves2, Vec_IntEntry( vLeaves, (int)((z >> (16+i*4)) & 7) ) );
1229 iObjLit1 = Gia_ManFromIfLogicCreateLut( pNew, &t, vLeaves2, vCover, vMapping, vMapping2 );
1230
1231 t = Abc_Tt6Stretch( (z >> 32) & 0xffff, 4 );
1232 Vec_IntClear( vLeaves2 );
1233 for ( i = 0; i < 4; i++ )
1234 if ( ((z >> (48+i*4)) & 7) == 7 )
1235 Vec_IntPush( vLeaves2, iObjLit1 );
1236 else
1237 Vec_IntPush( vLeaves2, Vec_IntEntry( vLeaves, (int)((z >> (48+i*4)) & 7) ) );
1238 iObjLit1 = Gia_ManFromIfLogicCreateLut( pNew, &t, vLeaves2, vCover, vMapping, vMapping2 );
1239
1240 Vec_IntFree( vLeaves2 );
1241 return iObjLit1;
1242 }
1243 // check if there is no LUT structures
1244 if ( pStr == NULL )
1245 return Gia_ManFromIfLogicCreateLut( pNew, pRes, vLeaves, vCover, vMapping, vMapping2 );
1246 // quit if parameters are wrong
1247 Length = strlen(pStr);
1248 if ( Length != 2 && Length != 3 )
1249 {
1250 printf( "Wrong LUT struct (%s)\n", pStr );
1251 return -1;
1252 }
1253 for ( i = 0; i < Length; i++ )
1254 if ( pStr[i] - '0' < 3 || pStr[i] - '0' > 6 )
1255 {
1256 printf( "The LUT size (%d) should belong to {3,4,5,6}.\n", pStr[i] - '0' );
1257 return -1;
1258 }
1259
1260 nLutLeaf = pStr[0] - '0';
1261 nLutLeaf2 = ( Length == 3 ) ? pStr[1] - '0' : 0;
1262 nLutRoot = pStr[Length-1] - '0';
1263 if ( nLeaves > nLutLeaf - 1 + (nLutLeaf2 ? nLutLeaf2 - 1 : 0) + nLutRoot )
1264 {
1265 printf( "The node size (%d) is too large for the LUT structure %s.\n", nLeaves, pStr );
1266 return -1;
1267 }
1268
1269 // consider easy case
1270 if ( nLeaves <= Abc_MaxInt( nLutLeaf2, Abc_MaxInt(nLutLeaf, nLutRoot) ) )
1271 {
1272 // create mapping
1273 iObjLit1 = Gia_ManFromIfLogicCreateLut( pNew, pRes, vLeaves, vCover, vMapping, vMapping2 );
1274 // write packing
1275 if ( !Gia_ObjIsCi(Gia_ManObj(pNew, Abc_Lit2Var(iObjLit1))) && iObjLit1 > 1 )
1276 {
1277 Vec_IntPush( vPacking, 1 );
1278 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1279 Vec_IntAddToEntry( vPacking, 0, 1 );
1280 }
1281 return iObjLit1;
1282 }
1283 else
1284 {
1285 extern int If_CluMinimumBase( word * t, int * pSupp, int nVarsAll, int * pnVars );
1286
1287 static word TruthStore[16][1<<10] = {{0}}, * pTruths[16];
1288 word Func0, Func1, Func2;
1289 char pLut0[32], pLut1[32], pLut2[32] = {0};
1290
1291 if ( TruthStore[0][0] == 0 )
1292 {
1293 static word Truth6[6] = {
1294 0xAAAAAAAAAAAAAAAA,
1295 0xCCCCCCCCCCCCCCCC,
1296 0xF0F0F0F0F0F0F0F0,
1297 0xFF00FF00FF00FF00,
1298 0xFFFF0000FFFF0000,
1299 0xFFFFFFFF00000000
1300 };
1301 int nVarsMax = 16;
1302 int nWordsMax = (1 << 10);
1303 int i, k;
1304 assert( nVarsMax <= 16 );
1305 for ( i = 0; i < nVarsMax; i++ )
1306 pTruths[i] = TruthStore[i];
1307 for ( i = 0; i < 6; i++ )
1308 for ( k = 0; k < nWordsMax; k++ )
1309 pTruths[i][k] = Truth6[i];
1310 for ( i = 6; i < nVarsMax; i++ )
1311 for ( k = 0; k < nWordsMax; k++ )
1312 pTruths[i][k] = ((k >> (i-6)) & 1) ? ~(word)0 : 0;
1313 }
1314 // derive truth table
1315 if ( Kit_TruthIsConst0((unsigned *)pRes, nLeaves) || Kit_TruthIsConst1((unsigned *)pRes, nLeaves) )
1316 {
1317// fprintf( pFile, ".names %s\n %d\n", Abc_ObjName(Abc_ObjFanout0(pObj)), Kit_TruthIsConst1((unsigned *)pRes, nLeaves) );
1318 iObjLit1 = Abc_LitNotCond( 0, Kit_TruthIsConst1((unsigned *)pRes, nLeaves) );
1319 // write mapping
1320 if ( Vec_IntEntry(vMapping, 0) == 0 )
1321 {
1322 Vec_IntSetEntry( vMapping, 0, Vec_IntSize(vMapping2) );
1323 Vec_IntPush( vMapping2, 0 );
1324 Vec_IntPush( vMapping2, 0 );
1325 }
1326 return iObjLit1;
1327 }
1328 // check for elementary truth table
1329 for ( i = 0; i < nLeaves; i++ )
1330 {
1331 if ( Kit_TruthIsEqual((unsigned *)pRes, (unsigned *)pTruths[i], nLeaves) )
1332 return Vec_IntEntry(vLeaves, i);
1333 if ( Kit_TruthIsOpposite((unsigned *)pRes, (unsigned *)pTruths[i], nLeaves) )
1334 return Abc_LitNot(Vec_IntEntry(vLeaves, i));
1335 }
1336
1337 // perform decomposition
1338 if ( fCheck75 )
1339 {
1340// if ( nLeaves < 8 && If_CutPerformCheck16( p, (unsigned *)pTruth, nVars, nLeaves, "44" ) )
1341 if ( nLeaves < 8 && If_CluCheckExt( NULL, pRes, nLeaves, 4, 4, pLut0, pLut1, &Func0, &Func1 ) )
1342 {
1343 nLutLeaf = 4;
1344 nLutRoot = 4;
1345 }
1346// if ( If_CutPerformCheck45( p, (unsigned *)pTruth, nVars, nLeaves, pStr ) )
1347 else if ( If_CluCheckExt( NULL, pRes, nLeaves, 5, 4, pLut0, pLut1, &Func0, &Func1 ) )
1348 {
1349 nLutLeaf = 5;
1350 nLutRoot = 4;
1351 }
1352// if ( If_CutPerformCheck54( p, (unsigned *)pTruth, nVars, nLeaves, pStr ) )
1353 else if ( If_CluCheckExt( NULL, pRes, nLeaves, 4, 5, pLut0, pLut1, &Func0, &Func1 ) )
1354 {
1355 nLutLeaf = 4;
1356 nLutRoot = 5;
1357 }
1358 else
1359 {
1360 Extra_PrintHex( stdout, (unsigned *)pRes, nLeaves ); printf( " " );
1361 Kit_DsdPrintFromTruth( (unsigned*)pRes, nLeaves ); printf( "\n" );
1362 printf( "Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1363 return -1;
1364 }
1365 }
1366 else
1367 {
1368 if ( Length == 2 )
1369 {
1370 if ( ((If_Man_t *)pIfMan)->pPars->fEnableStructN )
1371 {
1372 if ( !If_CluCheckXXExt( NULL, pRes, nLeaves, nLutLeaf, nLutRoot, pLut0, pLut1, &Func0, &Func1 ) )
1373 {
1374 Extra_PrintHex( stdout, (unsigned *)pRes, nLeaves ); printf( " " );
1375 Kit_DsdPrintFromTruth( (unsigned*)pRes, nLeaves ); printf( "\n" );
1376 printf( "Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1377 return -1;
1378 }
1379 }
1380 else
1381 {
1382 if ( !If_CluCheckExt( NULL, pRes, nLeaves, nLutLeaf, nLutRoot, pLut0, pLut1, &Func0, &Func1 ) )
1383 {
1384 Extra_PrintHex( stdout, (unsigned *)pRes, nLeaves ); printf( " " );
1385 Kit_DsdPrintFromTruth( (unsigned*)pRes, nLeaves ); printf( "\n" );
1386 printf( "Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1387 return -1;
1388 }
1389 }
1390 }
1391 else
1392 {
1393 if ( !If_CluCheckExt3( pIfMan, pRes, nLeaves, nLutLeaf, nLutLeaf2, nLutRoot, pLut0, pLut1, pLut2, &Func0, &Func1, &Func2 ) )
1394 {
1395 Extra_PrintHex( stdout, (unsigned *)pRes, nLeaves ); printf( " " );
1396 Kit_DsdPrintFromTruth( (unsigned*)pRes, nLeaves ); printf( "\n" );
1397 printf( "Node %d is not decomposable. Deriving LUT structures has failed.\n", iObj );
1398 return -1;
1399 }
1400 }
1401 }
1402
1403/*
1404 // write leaf node
1405 Id = Abc2_NtkAllocObj( pNew, pLut1[0], Abc2_ObjType(pObj) );
1406 iObjLit1 = Abc_Var2Lit( Id, 0 );
1407 pObjNew = Abc2_NtkObj( pNew, Id );
1408 for ( i = 0; i < pLut1[0]; i++ )
1409 Abc2_ObjSetFaninLit( pObjNew, i, Abc2_ObjFaninCopy(pObj, pLut1[2+i]) );
1410 Abc2_ObjSetTruth( pObjNew, Func1 );
1411*/
1412 // write leaf node
1413 Vec_IntClear( vLeavesTemp );
1414 for ( i = 0; i < pLut1[0]; i++ )
1415 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, pLut1[2+i]) );
1416 iObjLit1 = Gia_ManFromIfLogicCreateLut( pNew, &Func1, vLeavesTemp, vCover, vMapping, vMapping2 );
1417
1418 if ( Length == 3 && pLut2[0] > 0 )
1419 {
1420 /*
1421 Id = Abc2_NtkAllocObj( pNew, pLut2[0], Abc2_ObjType(pObj) );
1422 iObjLit2 = Abc_Var2Lit( Id, 0 );
1423 pObjNew = Abc2_NtkObj( pNew, Id );
1424 for ( i = 0; i < pLut2[0]; i++ )
1425 if ( pLut2[2+i] == nLeaves )
1426 Abc2_ObjSetFaninLit( pObjNew, i, iObjLit1 );
1427 else
1428 Abc2_ObjSetFaninLit( pObjNew, i, Abc2_ObjFaninCopy(pObj, pLut2[2+i]) );
1429 Abc2_ObjSetTruth( pObjNew, Func2 );
1430 */
1431
1432 // write leaf node
1433 Vec_IntClear( vLeavesTemp );
1434 for ( i = 0; i < pLut2[0]; i++ )
1435 if ( pLut2[2+i] == nLeaves )
1436 Vec_IntPush( vLeavesTemp, iObjLit1 );
1437 else
1438 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, pLut2[2+i]) );
1439 iObjLit2 = Gia_ManFromIfLogicCreateLut( pNew, &Func2, vLeavesTemp, vCover, vMapping, vMapping2 );
1440
1441 // write packing
1442 Vec_IntPush( vPacking, 3 );
1443 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1444 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit2) );
1445 }
1446 else
1447 {
1448 // write packing
1449 Vec_IntPush( vPacking, 2 );
1450 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit1) );
1451 iObjLit2 = -1;
1452 }
1453/*
1454 // write root node
1455 Id = Abc2_NtkAllocObj( pNew, pLut0[0], Abc2_ObjType(pObj) );
1456 iObjLit3 = Abc_Var2Lit( Id, 0 );
1457 pObjNew = Abc2_NtkObj( pNew, Id );
1458 for ( i = 0; i < pLut0[0]; i++ )
1459 if ( pLut0[2+i] == nLeaves )
1460 Abc2_ObjSetFaninLit( pObjNew, i, iObjLit1 );
1461 else if ( pLut0[2+i] == nLeaves+1 )
1462 Abc2_ObjSetFaninLit( pObjNew, i, iObjLit2 );
1463 else
1464 Abc2_ObjSetFaninLit( pObjNew, i, Abc2_ObjFaninCopy(pObj, pLut0[2+i]) );
1465 Abc2_ObjSetTruth( pObjNew, Func0 );
1466 Abc2_ObjSetCopy( pObj, iObjLit3 );
1467*/
1468 // write root node
1469 Vec_IntClear( vLeavesTemp );
1470 for ( i = 0; i < pLut0[0]; i++ )
1471 if ( pLut0[2+i] == nLeaves )
1472 Vec_IntPush( vLeavesTemp, iObjLit1 );
1473 else if ( pLut0[2+i] == nLeaves+1 )
1474 Vec_IntPush( vLeavesTemp, iObjLit2 );
1475 else
1476 Vec_IntPush( vLeavesTemp, Vec_IntEntry(vLeaves, pLut0[2+i]) );
1477 iObjLit3 = Gia_ManFromIfLogicCreateLut( pNew, &Func0, vLeavesTemp, vCover, vMapping, vMapping2 );
1478
1479 // write packing
1480 Vec_IntPush( vPacking, Abc_Lit2Var(iObjLit3) );
1481 Vec_IntAddToEntry( vPacking, 0, 1 );
1482 }
1483 return iObjLit3;
1484}
int Gia_ManFromIfLogicCreateLutSpecial(Gia_Man_t *pNew, word *pRes, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking)
Definition giaIf.c:1136
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
word If_Dec6Perform(word t, int fDerive)
Definition ifDec07.c:409
void If_Dec6Verify(word t, word z)
Definition ifDec07.c:131
int If_CluMinimumBase(word *t, int *pSupp, int nVarsAll, int *pnVars)
Definition ifDec16.c:1532
int If_CluCheckXXExt(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutRoot, char *pLut0, char *pLut1, word *pFunc0, word *pFunc1)
Definition ifDec66.c:301
int If_CluCheckExt3(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutLeaf2, int nLutRoot, char *pLut0, char *pLut1, char *pLut2, word *pFunc0, word *pFunc1, word *pFunc2)
Definition ifDec16.c:2079
int If_CluCheckExt(void *p, word *pTruth, int nVars, int nLutLeaf, int nLutRoot, char *pLut0, char *pLut1, word *pFunc0, word *pFunc1)
Definition ifDec16.c:2066
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
Definition if.h:77
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition kitDsd.c:491
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManLutFaninCount()

int Gia_ManLutFaninCount ( Gia_Man_t * p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 108 of file giaIf.c.

109{
110 int i, Counter = 0;
111 Gia_ManForEachLut( p, i )
112 Counter += Gia_ObjLutSize(p, i);
113 return Counter;
114}
Here is the caller graph for this function:

◆ Gia_ManLutLevel()

int Gia_ManLutLevel ( Gia_Man_t * p,
int ** ppLevels )

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file giaIf.c.

166{
167 Gia_Obj_t * pObj;
168 int i, k, iFan, Level;
169 int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
170 Gia_ManForEachLut( p, i )
171 {
172 Level = 0;
173 Gia_LutForEachFanin( p, i, iFan, k )
174 if ( Level < pLevels[iFan] )
175 Level = pLevels[iFan];
176 pLevels[i] = Level + 1;
177 }
178 Level = 0;
179 Gia_ManForEachCo( p, pObj, k )
180 {
181 int LevelFan = pLevels[Gia_ObjFaninId0p(p, pObj)];
182 Level = Abc_MaxInt( Level, LevelFan );
183 pLevels[Gia_ObjId(p, pObj)] = LevelFan;
184 }
185 if ( ppLevels )
186 *ppLevels = pLevels;
187 else
188 ABC_FREE( pLevels );
189 return Level;
190}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Here is the caller graph for this function:

◆ Gia_ManLutNum()

int Gia_ManLutNum ( Gia_Man_t * p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file giaIf.c.

147{
148 int i, Counter = 0;
149 Gia_ManForEachLut( p, i )
150 Counter ++;
151 return Counter;
152}
Here is the caller graph for this function:

◆ Gia_ManLutParams()

void Gia_ManLutParams ( Gia_Man_t * p,
int * pnCurLuts,
int * pnCurEdges,
int * pnCurLevels )

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file giaIf.c.

204{
205 int fDisable2Lut = 1;
206 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
207 {
208 int i;
209 *pnCurLuts = 0;
210 *pnCurEdges = 0;
211 Gia_ManForEachLut( p, i )
212 {
213 (*pnCurLuts)++;
214 (*pnCurEdges) += Gia_ObjLutSize(p, i);
215 }
216 *pnCurLevels = Gia_ManLutLevelWithBoxes( p );
217 }
218 else
219 {
220 Gia_Obj_t * pObj;
221 int i, k, iFan;
222 int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
223 *pnCurLuts = 0;
224 *pnCurEdges = 0;
225 *pnCurLevels = 0;
226 Gia_ManForEachLut( p, i )
227 {
228 if ( Gia_ObjLutIsMux(p, i) && !(fDisable2Lut && Gia_ObjLutSize(p, i) == 2) )
229 {
230 int pFanins[3];
231 if ( Gia_ObjLutSize(p, i) == 3 )
232 {
233 Gia_ManPrintGetMuxFanins( p, Gia_ManObj(p, i), pFanins );
234 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
235 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
236 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
237 }
238 else if ( Gia_ObjLutSize(p, i) == 2 )
239 {
240 pObj = Gia_ManObj( p, i );
241 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
242 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
243 }
244 *pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
245 (*pnCurEdges)++;
246 //nMuxF++;
247 continue;
248 }
249 (*pnCurLuts)++;
250 (*pnCurEdges) += Gia_ObjLutSize(p, i);
251 Gia_LutForEachFanin( p, i, iFan, k )
252 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
253 pLevels[i]++;
254 *pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
255 }
256 ABC_FREE( pLevels );
257 }
258}
int Gia_ManLutLevelWithBoxes(Gia_Man_t *p)
Definition giaTim.c:581
int Tim_ManBoxNum(Tim_Man_t *p)
Definition timMan.c:722
Here is the call graph for this function:

◆ Gia_ManLutSizeMax()

int Gia_ManLutSizeMax ( Gia_Man_t * p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file giaIf.c.

128{
129 int i, nSizeMax = -1;
130 Gia_ManForEachLut( p, i )
131 nSizeMax = Abc_MaxInt( nSizeMax, Gia_ObjLutSize(p, i) );
132 return nSizeMax;
133}
Here is the caller graph for this function:

◆ Gia_ManMappingVerify()

void Gia_ManMappingVerify ( Gia_Man_t * p)

Definition at line 2257 of file giaIf.c.

2258{
2259 Gia_Obj_t * pObj, * pFanin;
2260 int i, Result = 1;
2261 assert( Gia_ManHasMapping(p) );
2263 Gia_ManForEachBuf( p, pObj, i )
2264 {
2265 pFanin = Gia_ObjFanin0(pObj);
2266 if ( !Gia_ObjIsAndNotBuf(pFanin) )
2267 continue;
2268 if ( !Gia_ObjIsLut(p, Gia_ObjId(p, pFanin)) )
2269 {
2270 Abc_Print( -1, "Gia_ManMappingVerify: Buffer driver %d does not have mapping.\n", Gia_ObjId(p, pFanin) );
2271 Result = 0;
2272 continue;
2273 }
2274 Result &= Gia_ManMappingVerify_rec( p, pFanin );
2275 }
2276 Gia_ManForEachCo( p, pObj, i )
2277 {
2278 pFanin = Gia_ObjFanin0(pObj);
2279 if ( !Gia_ObjIsAndNotBuf(pFanin) )
2280 continue;
2281 if ( !Gia_ObjIsLut(p, Gia_ObjId(p, pFanin)) )
2282 {
2283 Abc_Print( -1, "Gia_ManMappingVerify: CO driver %d does not have mapping.\n", Gia_ObjId(p, pFanin) );
2284 Result = 0;
2285 continue;
2286 }
2287 Result &= Gia_ManMappingVerify_rec( p, pFanin );
2288 }
2289// if ( Result && Gia_NtkIsRoot(p) )
2290// Abc_Print( 1, "Mapping verified correctly.\n" );
2291}
int Gia_ManMappingVerify_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaIf.c:2238
#define Gia_ManForEachBuf(p, pObj, i)
Definition gia.h:1210
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManMappingVerify_rec()

int Gia_ManMappingVerify_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj )

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

Synopsis [Verifies mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 2238 of file giaIf.c.

2239{
2240 int Id, iFan, k, Result = 1;
2241 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
2242 return 1;
2243 Gia_ObjSetTravIdCurrent(p, pObj);
2244 if ( !Gia_ObjIsAndNotBuf(pObj) )
2245 return 1;
2246 if ( !Gia_ObjIsLut(p, Gia_ObjId(p, pObj)) )
2247 {
2248 Abc_Print( -1, "Gia_ManMappingVerify: Internal node %d does not have mapping.\n", Gia_ObjId(p, pObj) );
2249 return 0;
2250 }
2251 Id = Gia_ObjId(p, pObj);
2252 Gia_LutForEachFanin( p, Id, iFan, k )
2253 if ( Result )
2254 Result &= Gia_ManMappingVerify_rec( p, Gia_ManObj(p, iFan) );
2255 return Result;
2256}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManNodeIfToGia()

int Gia_ManNodeIfToGia ( Gia_Man_t * pNew,
If_Man_t * pIfMan,
If_Obj_t * pIfObj,
Vec_Int_t * vLeaves,
int fHash )

Definition at line 1619 of file giaIf.c.

1620{
1621 If_Cut_t * pCut;
1622 If_Obj_t * pLeaf;
1623 int i, iRes;
1624 // get the best cut
1625 pCut = If_ObjCutBest(pIfObj);
1626 assert( pCut->nLeaves > 1 );
1627 // set the leaf variables
1628 If_CutForEachLeaf( pIfMan, pCut, pLeaf, i )
1629 If_CutSetDataInt( If_ObjCutBest(pLeaf), Vec_IntEntry(vLeaves, i) );
1630 // recursively compute the function while collecting visited cuts
1631 Vec_PtrClear( pIfMan->vTemp );
1632 iRes = Gia_ManNodeIfToGia_rec( pNew, pIfMan, pIfObj, pIfMan->vTemp, fHash );
1633 if ( iRes == ~0 )
1634 {
1635 Abc_Print( -1, "Gia_ManNodeIfToGia(): Computing local AIG has failed.\n" );
1636 return ~0;
1637 }
1638 // clean the cuts
1639 If_CutForEachLeaf( pIfMan, pCut, pLeaf, i )
1640 If_CutSetDataInt( If_ObjCutBest(pLeaf), 0 );
1641 Vec_PtrForEachEntry( If_Cut_t *, pIfMan->vTemp, pCut, i )
1642 If_CutSetDataInt( pCut, 0 );
1643 return iRes;
1644}
int Gia_ManNodeIfToGia_rec(Gia_Man_t *pNew, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Ptr_t *vVisited, int fHash)
Definition giaIf.c:1581
Vec_Ptr_t * vTemp
Definition if.h:208
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManNodeIfToGia_rec()

int Gia_ManNodeIfToGia_rec ( Gia_Man_t * pNew,
If_Man_t * pIfMan,
If_Obj_t * pIfObj,
Vec_Ptr_t * vVisited,
int fHash )

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

Synopsis [Recursively derives the local AIG for the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 1581 of file giaIf.c.

1582{
1583 If_Cut_t * pCut;
1584 If_Obj_t * pTemp;
1585 int iFunc, iFunc0, iFunc1;
1586 // get the best cut
1587 pCut = If_ObjCutBest(pIfObj);
1588 // if the cut is visited, return the result
1589 if ( If_CutDataInt(pCut) )
1590 return If_CutDataInt(pCut);
1591 // mark the node as visited
1592 Vec_PtrPush( vVisited, pCut );
1593 // insert the worst case
1594 If_CutSetDataInt( pCut, ~0 );
1595 // skip in case of primary input
1596 if ( If_ObjIsCi(pIfObj) )
1597 return If_CutDataInt(pCut);
1598 // compute the functions of the children
1599 for ( pTemp = pIfObj; pTemp; pTemp = pTemp->pEquiv )
1600 {
1601 iFunc0 = Gia_ManNodeIfToGia_rec( pNew, pIfMan, pTemp->pFanin0, vVisited, fHash );
1602 if ( iFunc0 == ~0 )
1603 continue;
1604 iFunc1 = Gia_ManNodeIfToGia_rec( pNew, pIfMan, pTemp->pFanin1, vVisited, fHash );
1605 if ( iFunc1 == ~0 )
1606 continue;
1607 // both branches are solved
1608 if ( fHash )
1609 iFunc = Gia_ManHashAnd( pNew, Abc_LitNotCond(iFunc0, pTemp->fCompl0), Abc_LitNotCond(iFunc1, pTemp->fCompl1) );
1610 else
1611 iFunc = Gia_ManAppendAnd( pNew, Abc_LitNotCond(iFunc0, pTemp->fCompl0), Abc_LitNotCond(iFunc1, pTemp->fCompl1) );
1612 if ( pTemp->fPhase != pIfObj->fPhase )
1613 iFunc = Abc_LitNot(iFunc);
1614 If_CutSetDataInt( pCut, iFunc );
1615 break;
1616 }
1617 return If_CutDataInt(pCut);
1618}
unsigned fPhase
Definition if.h:336
If_Obj_t * pEquiv
Definition if.h:351
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformDsdBalance()

Gia_Man_t * Gia_ManPerformDsdBalance ( Gia_Man_t * p,
int nLutSize,
int nCutNum,
int nRelaxRatio,
int fVerbose )

Definition at line 2678 of file giaIf.c.

2679{
2680 Gia_Man_t * pNew;
2681 If_Man_t * pIfMan;
2682 If_Par_t Pars, * pPars = &Pars;
2683 If_ManSetDefaultPars( pPars );
2684 pPars->nCutsMax = nCutNum;
2685 pPars->nRelaxRatio = nRelaxRatio;
2686 pPars->fVerbose = fVerbose;
2687 pPars->nLutSize = nLutSize;
2688 pPars->fDsdBalance = 1;
2689 pPars->fUseDsd = 1;
2690 pPars->fCutMin = 1;
2691 pPars->fTruth = 1;
2692 pPars->fExpRed = 0;
2693 if ( Abc_FrameReadManDsd2() == NULL )
2695 // perform mapping
2696 pIfMan = Gia_ManToIf( p, pPars );
2698 if ( pPars->fDsdBalance )
2699 If_DsdManAllocIsops( pIfMan->pIfDsdMan, pPars->nLutSize );
2700 If_ManPerformMapping( pIfMan );
2701 pNew = Gia_ManFromIfAig( pIfMan );
2702 If_ManStop( pIfMan );
2703 Gia_ManTransferTiming( pNew, p );
2704 // transfer name
2705 assert( pNew->pName == NULL );
2706 pNew->pName = Abc_UtilStrsav( p->pName );
2707 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2708 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2709 return pNew;
2710}
ABC_DLL void * Abc_FrameReadManDsd2()
Definition mainFrame.c:68
ABC_DLL void Abc_FrameSetManDsd2(void *pMan)
Definition mainFrame.c:103
If_Man_t * Gia_ManToIf(Gia_Man_t *p, If_Par_t *pPars)
Definition giaIf.c:893
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
Gia_Man_t * Gia_ManFromIfAig(If_Man_t *pIfMan)
Definition giaIf.c:1032
struct If_Par_t_ If_Par_t
Definition if.h:78
void If_DsdManAllocIsops(If_DsdMan_t *p, int nLutSize)
Definition ifDsd.c:306
struct If_DsdMan_t_ If_DsdMan_t
Definition if.h:84
void If_ManSetDefaultPars(If_Par_t *pPars)
FUNCTION DECLARATIONS ///.
Definition ifCore.c:47
If_DsdMan_t * If_DsdManAlloc(int nVars, int nLutSize)
Definition ifDsd.c:264
void If_ManStop(If_Man_t *p)
Definition ifMan.c:212
int If_ManPerformMapping(If_Man_t *p)
Definition ifCore.c:82
int nRelaxRatio
Definition if.h:112
int fExpRed
Definition if.h:120
int nCutsMax
Definition if.h:105
int fVerbose
Definition if.h:152
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformMapping()

Gia_Man_t * Gia_ManPerformMapping ( Gia_Man_t * p,
void * pp )

Definition at line 2598 of file giaIf.c.

2599{
2600 Gia_Man_t * pNew;
2601 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) && Gia_ManIsNormalized(p) )
2602 {
2603 pNew = Gia_ManDupUnnormalize( p );
2604 if ( pNew == NULL )
2605 return NULL;
2606 Gia_ManTransferTiming( pNew, p );
2607 p = pNew;
2608 // mapping
2609 pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp );
2610 if ( pNew != p )
2611 {
2612 Gia_ManTransferTiming( pNew, p );
2613 Gia_ManStop( p );
2614 }
2615 // normalize
2616 pNew = Gia_ManDupNormalize( p = pNew, ((If_Par_t *)pp)->fHashMapping );
2617 Gia_ManTransferMapping( pNew, p );
2618 Gia_ManTransferPacking( pNew, p );
2619 Gia_ManTransferTiming( pNew, p );
2620 Gia_ManStop( p );
2621 assert( Gia_ManIsNormalized(pNew) );
2622 }
2623 else
2624 {
2625 pNew = Gia_ManPerformMappingInt( p, (If_Par_t *)pp );
2626 Gia_ManTransferTiming( pNew, p );
2627 if ( ((If_Par_t *)pp)->fHashMapping )
2628 {
2629 pNew = Gia_ManDupHashMapping( p = pNew );
2630 Gia_ManTransferPacking( pNew, p );
2631 Gia_ManTransferTiming( pNew, p );
2632 Gia_ManStop( p );
2633 }
2634 }
2635 pNew->MappedDelay = (int)((If_Par_t *)pp)->FinalDelay;
2636 pNew->MappedArea = (int)((If_Par_t *)pp)->FinalArea;
2637 return pNew;
2638}
Gia_Man_t * Gia_ManPerformMappingInt(Gia_Man_t *p, If_Par_t *pPars)
Definition giaIf.c:2485
Gia_Man_t * Gia_ManDupHashMapping(Gia_Man_t *p)
Definition giaIf.c:2772
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2305
void Gia_ManTransferPacking(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2336
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition giaTim.c:114
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
Definition giaTim.c:139
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition giaTim.c:382
int MappedDelay
Definition gia.h:205
int MappedArea
Definition gia.h:204
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformMappingInt()

Gia_Man_t * Gia_ManPerformMappingInt ( Gia_Man_t * p,
If_Par_t * pPars )

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

Synopsis [Interface of LUT mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 2485 of file giaIf.c.

2486{
2487 extern void Gia_ManIffTest( Gia_Man_t * pGia, If_LibLut_t * pLib, int fVerbose );
2488 Gia_Man_t * pNew;
2489 If_Man_t * pIfMan; int i, Entry;//, Id, EntryF;
2490 assert( pPars->pTimesArr == NULL );
2491 assert( pPars->pTimesReq == NULL );
2492 if ( p->vCiArrs )
2493 {
2494 assert( Vec_IntSize(p->vCiArrs) == Gia_ManCiNum(p) );
2495 pPars->pTimesArr = ABC_CALLOC( float, Gia_ManCiNum(p) );
2496 Vec_IntForEachEntry( p->vCiArrs, Entry, i )
2497 pPars->pTimesArr[i] = (float)Entry;
2498 }
2499/* // uncommenting this leads to a mysterious memory corruption
2500 else if ( p->vInArrs )
2501 {
2502 assert( Vec_FltSize(p->vInArrs) == Gia_ManCiNum(p) );
2503 pPars->pTimesArr = ABC_CALLOC( float, Gia_ManCiNum(p));
2504 Gia_ManForEachCiId( p, Id, i )
2505 pPars->pTimesArr[i] = Vec_FltEntry(p->vInArrs, i);
2506 }
2507*/
2508 if ( p->vCoReqs )
2509 {
2510 assert( Vec_IntSize(p->vCoReqs) == Gia_ManCoNum(p) );
2511 pPars->pTimesReq = ABC_CALLOC( float, Gia_ManCoNum(p) );
2512 Vec_IntForEachEntry( p->vCoReqs, Entry, i )
2513 pPars->pTimesReq[i] = (float)Entry;
2514 }
2515/* // uncommenting this leads to a mysterious memory corruption
2516 else if ( p->vOutReqs )
2517 {
2518 assert( Vec_FltSize(p->vOutReqs) == Gia_ManCoNum(p) );
2519 pPars->pTimesReq = ABC_CALLOC( float, Gia_ManCoNum(p) );
2520 Vec_FltForEachEntry( p->vOutReqs, EntryF, i )
2521 pPars->pTimesReq[i] = EntryF;
2522 }
2523*/
2524 ABC_FREE( p->pCellStr );
2525 Vec_IntFreeP( &p->vConfigs );
2526 // disable cut minimization when GIA strucure is needed
2527 if ( !pPars->fDelayOpt && !pPars->fDelayOptLut && !pPars->fDsdBalance && !pPars->fUserRecLib && !pPars->fUserSesLib && !pPars->fDeriveLuts && !pPars->fUseDsd && !pPars->fUseTtPerm && !pPars->pFuncCell2 )
2528 pPars->fCutMin = 0;
2529 // translate into the mapper
2530 pIfMan = Gia_ManToIf( p, pPars );
2531 if ( pIfMan == NULL )
2532 return NULL;
2533 // create DSD manager
2534 if ( pPars->fUseDsd )
2535 {
2537 assert( pPars->nLutSize <= If_DsdManVarNum(p) );
2538 assert( (pPars->pLutStruct == NULL && If_DsdManLutSize(p) == 0) || (pPars->pLutStruct && pPars->pLutStruct[0] - '0' == If_DsdManLutSize(p)) );
2540 if ( pPars->fDsdBalance )
2541 If_DsdManAllocIsops( pIfMan->pIfDsdMan, pPars->nLutSize );
2542 }
2543 // compute switching for the IF objects
2544 if ( pPars->fPower )
2545 {
2546 if ( p->pManTime == NULL )
2547 If_ManComputeSwitching( pIfMan );
2548 else
2549 Abc_Print( 0, "Switching activity computation for designs with boxes is disabled.\n" );
2550 }
2551 if ( pPars->pReoMan )
2552 pIfMan->pUserMan = pPars->pReoMan;
2553 if ( p->pManTime )
2554 pIfMan->pManTim = Tim_ManDup( (Tim_Man_t *)p->pManTime, pPars->fDelayOpt || pPars->fDelayOptLut || pPars->fDsdBalance || pPars->fUserRecLib || pPars->fUserSesLib );
2555// Tim_ManPrint( pIfMan->pManTim );
2556 if ( p->vCoAttrs )
2557 {
2558 assert( If_ManCoNum(pIfMan) == Vec_IntSize(p->vCoAttrs) );
2559 Vec_IntForEachEntry( p->vCoAttrs, Entry, i )
2560 If_ObjFanin0( If_ManCo(pIfMan, i) )->fSpec = (Entry != 0);
2561 }
2562 if ( !If_ManPerformMapping( pIfMan ) )
2563 {
2564 If_ManStop( pIfMan );
2565 return NULL;
2566 }
2567 if ( pPars->pFuncWrite )
2568 pPars->pFuncWrite( pIfMan );
2569 // transform the result of mapping into the new network
2570 if ( pIfMan->pPars->fDelayOpt || pIfMan->pPars->fDsdBalance || pIfMan->pPars->fUserRecLib || pIfMan->pPars->fUserSesLib )
2571 pNew = Gia_ManFromIfAig( pIfMan );
2572 else
2573 pNew = Gia_ManFromIfLogic( pIfMan );
2574 if ( p->vCiArrs || p->vCoReqs )
2575 {
2576 If_Obj_t * pIfObj = NULL;
2577 Vec_IntFreeP( &p->vCoArrs );
2578 p->vCoArrs = Vec_IntAlloc( Gia_ManCoNum(p) );
2579 If_ManForEachCo( pIfMan, pIfObj, i )
2580 Vec_IntPush( p->vCoArrs, (int)If_ObjArrTime(If_ObjFanin0(pIfObj)) );
2581 }
2582 If_ManStop( pIfMan );
2583 // transfer name
2584 assert( pNew->pName == NULL );
2585 pNew->pName = Abc_UtilStrsav( p->pName );
2586 ABC_FREE( pNew->pSpec );
2587 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2588 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2589 // print delay trace
2590 if ( pPars->fVerboseTrace )
2591 {
2592 pNew->pLutLib = pPars->pLutLib;
2593 Gia_ManDelayTraceLutPrint( pNew, 1 );
2594 pNew->pLutLib = NULL;
2595 }
2596 return pNew;
2597}
void If_ManComputeSwitching(If_Man_t *pIfMan)
FUNCTION DEFINITIONS ///.
Definition abcIf.c:59
ABC_DLL void * Abc_FrameReadManDsd()
Definition mainFrame.c:67
Gia_Man_t * Gia_ManFromIfLogic(If_Man_t *pIfMan)
Definition giaIf.c:2000
void Gia_ManIffTest(Gia_Man_t *pGia, If_LibLut_t *pLib, int fVerbose)
Definition giaIff.c:387
float Gia_ManDelayTraceLutPrint(Gia_Man_t *p, int fVerbose)
Definition giaSpeedup.c:444
int If_DsdManLutSize(If_DsdMan_t *p)
Definition ifDsd.c:181
#define If_ManForEachCo(p, pObj, i)
Definition if.h:477
struct If_LibLut_t_ If_LibLut_t
Definition if.h:82
void * pLutLib
Definition gia.h:195
Tim_Man_t * pManTim
Definition if.h:289
void * pUserMan
Definition if.h:282
float * pTimesArr
Definition if.h:176
int fPower
Definition if.h:124
int fVerboseTrace
Definition if.h:153
void * pReoMan
Definition if.h:183
float * pTimesReq
Definition if.h:177
If_LibLut_t * pLutLib
Definition if.h:175
int(* pFuncWrite)(If_Man_t *)
Definition if.h:182
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition timMan.c:86
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformSopBalance()

Gia_Man_t * Gia_ManPerformSopBalance ( Gia_Man_t * p,
int nCutNum,
int nRelaxRatio,
int fVerbose )

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

Synopsis [Interface of other mapping-based procedures.]

Description []

SideEffects []

SeeAlso []

Definition at line 2651 of file giaIf.c.

2652{
2653 Gia_Man_t * pNew;
2654 If_Man_t * pIfMan;
2655 If_Par_t Pars, * pPars = &Pars;
2656 If_ManSetDefaultPars( pPars );
2657 pPars->nCutsMax = nCutNum;
2658 pPars->nRelaxRatio = nRelaxRatio;
2659 pPars->fVerbose = fVerbose;
2660 pPars->nLutSize = 6;
2661 pPars->fDelayOpt = 1;
2662 pPars->fCutMin = 1;
2663 pPars->fTruth = 1;
2664 pPars->fExpRed = 0;
2665 // perform mapping
2666 pIfMan = Gia_ManToIf( p, pPars );
2667 If_ManPerformMapping( pIfMan );
2668 pNew = Gia_ManFromIfAig( pIfMan );
2669 If_ManStop( pIfMan );
2670 Gia_ManTransferTiming( pNew, p );
2671 // transfer name
2672 assert( pNew->pName == NULL );
2673 pNew->pName = Abc_UtilStrsav( p->pName );
2674 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2675 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2676 return pNew;
2677}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintGetMuxFanins()

void Gia_ManPrintGetMuxFanins ( Gia_Man_t * p,
Gia_Obj_t * pObj,
int * pFanins )
extern

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 411 of file giaIf.c.

412{
413 Gia_Obj_t * pData0, * pData1;
414 Gia_Obj_t * pCtrl = Gia_ObjRecognizeMux( pObj, &pData1, &pData0 );
415 pFanins[0] = Gia_ObjId(p, Gia_Regular(pCtrl));
416 pFanins[1] = Gia_ObjId(p, Gia_Regular(pData1));
417 pFanins[2] = Gia_ObjId(p, Gia_Regular(pData0));
418}
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition giaUtil.c:1056
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintLutStats()

void Gia_ManPrintLutStats ( Gia_Man_t * p)

Definition at line 727 of file giaIf.c.

728{
729 int i, nSizeMax, pCounts[33] = {0};
730 nSizeMax = Gia_ManLutSizeMax( p );
731 if ( nSizeMax > 32 )
732 {
733 Abc_Print( 1, "The max LUT size (%d) is too large.\n", nSizeMax );
734 return;
735 }
736 Gia_ManForEachLut( p, i )
737 pCounts[ Gia_ObjLutSize(p, i) ]++;
738 Gia_ManPrintNodeProfile( pCounts, nSizeMax );
739}
void Gia_ManPrintNodeProfile(int *pCounts, int nSizeMax)
Definition giaIf.c:714
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition giaIf.c:127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintMappingStats()

void Gia_ManPrintMappingStats ( Gia_Man_t * p,
char * pDumpFile )

Definition at line 532 of file giaIf.c.

533{
534 int fDisable2Lut = 1;
535 Gia_Obj_t * pObj;
536 int * pLevels;
537 int i, k, iFan, nLutSize = 0, nLuts = 0, nFanins = 0, LevelMax = 0, Ave = 0, nMuxF = 0;
538 if ( !Gia_ManHasMapping(p) )
539 return;
540 pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
541 Gia_ManForEachLut( p, i )
542 {
543 if ( Gia_ObjLutIsMux(p, i) && !(fDisable2Lut && Gia_ObjLutSize(p, i) == 2) )
544 {
545 int pFanins[3];
546 if ( Gia_ObjLutSize(p, i) == 3 )
547 {
548 Gia_ManPrintGetMuxFanins( p, Gia_ManObj(p, i), pFanins );
549 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
550 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
551 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
552 }
553 else if ( Gia_ObjLutSize(p, i) == 2 )
554 {
555 pObj = Gia_ManObj( p, i );
556 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
557 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
558 }
559 LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
560 nFanins++;
561 nMuxF++;
562 continue;
563 }
564 nLuts++;
565 nFanins += Gia_ObjLutSize(p, i);
566 nLutSize = Abc_MaxInt( nLutSize, Gia_ObjLutSize(p, i) );
567 Gia_LutForEachFanin( p, i, iFan, k )
568 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
569 pLevels[i]++;
570 LevelMax = Abc_MaxInt( LevelMax, pLevels[i] );
571 }
572 Gia_ManForEachCo( p, pObj, i )
573 Ave += pLevels[Gia_ObjFaninId0p(p, pObj)];
574 ABC_FREE( pLevels );
575
576#ifdef WIN32
577 {
578 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
579 Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
580 SetConsoleTextAttribute( hConsole, 14 ); // yellow
581 Abc_Print( 1, "lut =%7d ", nLuts );
582 if ( nMuxF )
583 Abc_Print( 1, "muxF =%7d ", nMuxF );
584 SetConsoleTextAttribute( hConsole, 10 ); // green
585 Abc_Print( 1, "edge =%8d ", nFanins );
586 SetConsoleTextAttribute( hConsole, 12 ); // red
587 Abc_Print( 1, "lev =%5d ", LevelMax );
588 Abc_Print( 1, "(%.2f) ", (float)Ave / Gia_ManCoNum(p) );
589// Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
590 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
591 Abc_Print( 1, "levB =%5d ", Gia_ManLutLevelWithBoxes(p) );
592 SetConsoleTextAttribute( hConsole, 7 ); // normal
593 Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
594 Abc_Print( 1, "\n" );
595 }
596#else
597 Abc_Print( 1, "Mapping (K=%d) : ", nLutSize );
598 Abc_Print( 1, "%slut =%7d%s ", "\033[1;33m", nLuts, "\033[0m" ); // yellow
599 Abc_Print( 1, "%sedge =%8d%s ", "\033[1;32m", nFanins, "\033[0m" ); // green
600 Abc_Print( 1, "%slev =%5d%s ", "\033[1;31m", LevelMax, "\033[0m" ); // red
601 Abc_Print( 1, "%s(%.2f)%s ", "\033[1;31m", (float)Ave / Gia_ManCoNum(p), "\033[0m" );
602// Abc_Print( 1, "over =%5.1f %% ", 100.0 * Gia_ManComputeOverlap(p) / Gia_ManAndNum(p) );
603 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) )
604 Abc_Print( 1, "%slevB =%5d%s ", "\033[1;31m", Gia_ManLutLevelWithBoxes(p), "\033[0m" );
605 Abc_Print( 1, "mem =%5.2f MB", 4.0*(Gia_ManObjNum(p) + 2*nLuts + nFanins)/(1<<20) );
606 Abc_Print( 1, "\n" );
607#endif
608
609 if ( nMuxF )
611
612 //return;
613 if ( pDumpFile )
614 {
615 static char FileNameOld[1000] = {0};
616 static abctime clk = 0;
617 FILE * pTable = fopen( pDumpFile, "a+" );
618 if ( strcmp( FileNameOld, p->pName ) )
619 {
620 sprintf( FileNameOld, "%s_out", p->pName );
621 fprintf( pTable, "\n" );
622 fprintf( pTable, "%s ", p->pName );
623 fprintf( pTable, " " );
624 //fprintf( pTable, "%d ", Gia_ManAndNum(p) );
625 fprintf( pTable, "%d ", Gia_ManRegNum(p) );
626 fprintf( pTable, "%d ", nLuts );
627 fprintf( pTable, "%d ", Gia_ManLutLevelWithBoxes(p) );
628 //fprintf( pTable, "%d ", Gia_ManRegBoxNum(p) );
629 //fprintf( pTable, "%d ", Gia_ManNonRegBoxNum(p) );
630 //fprintf( pTable, "%.2f", 1.0*(Abc_Clock() - clk)/CLOCKS_PER_SEC );
631 clk = Abc_Clock();
632 }
633 else
634 {
635 //printf( "This part of the code is currently not used.\n" );
636 //assert( 0 );
637 fprintf( pTable, " " );
638 fprintf( pTable, " " );
639 fprintf( pTable, "%d ", Gia_ManRegNum(p) );
640 fprintf( pTable, "%d ", nLuts );
641 fprintf( pTable, "%d ", Gia_ManLutLevelWithBoxes(p) );
642 //fprintf( pTable, "%d ", Gia_ManRegBoxNum(p) );
643 //fprintf( pTable, "%d ", Gia_ManNonRegBoxNum(p) );
644// fprintf( pTable, "%.2f", 1.0*(Abc_Clock() - clk)/CLOCKS_PER_SEC );
645 clk = Abc_Clock();
646 }
647 fclose( pTable );
648 }
649
650}
ABC_INT64_T abctime
Definition abc_global.h:332
int Gia_ManCountDupLut(Gia_Man_t *p)
Definition giaIf.c:419
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintNodeProfile()

void Gia_ManPrintNodeProfile ( int * pCounts,
int nSizeMax )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 714 of file giaIf.c.

715{
716 int i, SizeAll = 0, NodeAll = 0;
717 for ( i = 0; i <= nSizeMax; i++ )
718 {
719 SizeAll += i * pCounts[i];
720 NodeAll += pCounts[i];
721 }
722 Abc_Print( 1, "LUT = %d : ", NodeAll );
723 for ( i = 2; i <= nSizeMax; i++ )
724 Abc_Print( 1, "%d=%d %.1f %% ", i, pCounts[i], 100.0*pCounts[i]/NodeAll );
725 Abc_Print( 1, "Ave = %.2f\n", 1.0*SizeAll/(NodeAll ? NodeAll : 1) );
726}
Here is the caller graph for this function:

◆ Gia_ManPrintOutputLutStats()

void Gia_ManPrintOutputLutStats ( Gia_Man_t * p)

Definition at line 497 of file giaIf.c.

498{
499 int Limit = 100000;
500 int nLutSize = Gia_ManLutSizeMax(p);
501 Vec_Int_t * vLuts = Vec_IntAlloc( 1000 );
502 Vec_Int_t * vNodes = Vec_IntStart( Limit );
503 Vec_Int_t * vLevels = Vec_IntStart( Limit );
504 Vec_Int_t * vLevel = Vec_IntStart( Gia_ManObjNum(p) );
505 int i, DriverId, Value, nTotalLuts = 0;
506 Gia_ManForEachCoDriverId( p, DriverId, i ) {
507 Vec_IntClear( vLuts );
509 Gia_ManCollectLuts_rec( p, DriverId, vLuts );
510 if ( Vec_IntSize(vLuts) < Limit )
511 Vec_IntAddToEntry( vNodes, Vec_IntSize(vLuts), 1 );
512 int Level = Gia_ManCountLutLevels( p, vLuts, vLevel );
513 if ( Level < Limit )
514 Vec_IntAddToEntry( vLevels, Level, 1 );
515 nTotalLuts += Vec_IntSize(vLuts);
516 }
517 printf( "Level count statistics for %d AIG outputs:\n", Gia_ManCoNum(p) );
518 Vec_IntForEachEntry( vLevels, Value, i )
519 if ( Value )
520 printf( " %2d level : Function count = %8d (%6.2f %%)\n", i, Value, 100.0*Value/Gia_ManCoNum(p) );
521 printf( "LUT count statistics for %d AIG outputs:\n", Gia_ManCoNum(p) );
522 Vec_IntForEachEntry( vNodes, Value, i )
523 if ( Value )
524 printf( " %2d LUT%d : Function count = %8d (%6.2f %%)\n", i, nLutSize, Value, 100.0*Value/Gia_ManCoNum(p) );
525 printf( "Sum total of LUT counts for all outputs = %d. Shared LUT count = %d.\n", nTotalLuts, Gia_ManLutNum(p) );
526 Vec_IntFree( vLuts );
527 Vec_IntFree( vNodes );
528 Vec_IntFree( vLevels );
529 Vec_IntFree( vLevel );
530}
int Gia_ManCountLutLevels(Gia_Man_t *p, Vec_Int_t *vLuts, Vec_Int_t *vLevel)
Definition giaIf.c:483
#define Gia_ManForEachCoDriverId(p, DriverId, i)
Definition gia.h:1246
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintPackingStats()

void Gia_ManPrintPackingStats ( Gia_Man_t * p)

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

Synopsis [Prints mapping statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 663 of file giaIf.c.

664{
665 int fVerbose = 0;
666 int nObjToShow = 200;
667 int nNumStr[5] = {0};
668 int i, k, Entry, nEntries, nEntries2, MaxSize = -1, Count = 0;
669 if ( p->vPacking == NULL )
670 return;
671 nEntries = Vec_IntEntry( p->vPacking, 0 );
672 nEntries2 = 0;
673 Vec_IntForEachEntryStart( p->vPacking, Entry, i, 1 )
674 {
675 assert( Entry > 0 && Entry < 4 );
676 nNumStr[Entry]++;
677 i++;
678 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "{ " );
679 for ( k = 0; k < Entry; k++, i++ )
680 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "%d ", Vec_IntEntry(p->vPacking, i) );
681 if ( fVerbose && nEntries2 < nObjToShow ) Abc_Print( 1, "}\n" );
682 i--;
683 nEntries2++;
684 }
685 assert( nEntries == nEntries2 );
686 if ( nNumStr[3] > 0 )
687 MaxSize = 3;
688 else if ( nNumStr[2] > 0 )
689 MaxSize = 2;
690 else if ( nNumStr[1] > 0 )
691 MaxSize = 1;
692 Abc_Print( 1, "Packing (N=%d) : ", MaxSize );
693 for ( i = 1; i <= MaxSize; i++ )
694 {
695 Abc_Print( 1, "%d x LUT = %d ", i, nNumStr[i] );
696 Count += i * nNumStr[i];
697 }
698 Abc_Print( 1, "Total = %d ", nEntries2 );
699 Abc_Print( 1, "Total LUT = %d", Count );
700 Abc_Print( 1, "\n" );
701}
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
Here is the caller graph for this function:

◆ Gia_ManSetIfParsDefault()

void Gia_ManSetIfParsDefault ( void * pp)

FUNCTION DEFINITIONS ///.

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

Synopsis [Load the network into FPGA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 59 of file giaIf.c.

60{
61 If_Par_t * pPars = (If_Par_t *)pp;
62// extern void * Abc_FrameReadLibLut();
63 If_Par_t * p = (If_Par_t *)pPars;
64 // set defaults
65 memset( p, 0, sizeof(If_Par_t) );
66 // user-controlable paramters
67 p->nLutSize = -1;
68// p->nLutSize = 6;
69 p->nCutsMax = 8;
70 p->nFlowIters = 1;
71 p->nAreaIters = 2;
72 p->DelayTarget = -1;
73 p->Epsilon = (float)0.005;
74 p->fPreprocess = 1;
75 p->fArea = 0;
76 p->fFancy = 0;
77 p->fExpRed = 1;
78 p->fLatchPaths = 0;
79 p->fEdge = 1;
80 p->fPower = 0;
81 p->fCutMin = 0;
82 p->fVerbose = 0;
83 p->pLutStruct = NULL;
84 // internal parameters
85 p->fTruth = 0;
86 p->nLatchesCi = 0;
87 p->nLatchesCo = 0;
88 p->fLiftLeaves = 0;
89 p->fUseCoAttrs = 1; // use CO attributes
90 p->pLutLib = NULL;
91 p->pTimesArr = NULL;
92 p->pTimesReq = NULL;
93 p->pFuncCost = NULL;
94}
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSetLutRefs()

void Gia_ManSetLutRefs ( Gia_Man_t * p)

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file giaIf.c.

296{
297 Gia_Obj_t * pObj;
298 int i, k, iFan;
299 ABC_FREE( p->pLutRefs );
300 p->pLutRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
301 Gia_ManForEachCo( p, pObj, i )
302 Gia_ObjLutRefIncId( p, Gia_ObjFaninId0p(p, pObj) );
303 Gia_ManForEachLut( p, i )
304 Gia_LutForEachFanin( p, i, iFan, k )
305 Gia_ObjLutRefIncId( p, iFan );
306}
Here is the caller graph for this function:

◆ Gia_ManSetRefsMapped()

void Gia_ManSetRefsMapped ( Gia_Man_t * p)

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

Synopsis [Assigns levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file giaIf.c.

272{
273 Gia_Obj_t * pObj;
274 int i, k, iFan;
275 ABC_FREE( p->pRefs );
276 p->pRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
277 Gia_ManForEachCo( p, pObj, i )
278 Gia_ObjRefIncId( p, Gia_ObjFaninId0p(p, pObj) );
279 Gia_ManForEachLut( p, i )
280 Gia_LutForEachFanin( p, i, iFan, k )
281 Gia_ObjRefIncId( p, iFan );
282}
Here is the caller graph for this function:

◆ Gia_ManTestStruct()

void Gia_ManTestStruct ( Gia_Man_t * p)

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

Synopsis [Tests decomposition structures.]

Description []

SideEffects []

SeeAlso []

Definition at line 2723 of file giaIf.c.

2724{
2725 int nCutMax = 7;
2726 int LutCount[8] = {0}, LutNDecomp[8] = {0};
2727 int i, k, iFan, nFanins, Status;
2728 Vec_Int_t * vLeaves;
2729 word * pTruth;
2730
2731 vLeaves = Vec_IntAlloc( 100 );
2732 Gia_ObjComputeTruthTableStart( p, nCutMax );
2733 Gia_ManForEachLut( p, i )
2734 {
2735 nFanins = Gia_ObjLutSize(p, i);
2736 assert( nFanins <= 7 );
2737 LutCount[Abc_MaxInt(nFanins, 5)]++;
2738 if ( nFanins <= 5 )
2739 continue;
2740 Vec_IntClear( vLeaves );
2741 Gia_LutForEachFanin( p, i, iFan, k )
2742 Vec_IntPush( vLeaves, iFan );
2743 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, i), vLeaves );
2744 // check if it is decomposable
2745 Status = If_CutPerformCheck07( NULL, (unsigned *)pTruth, 7, nFanins, NULL );
2746 if ( Status == 1 )
2747 continue;
2748 LutNDecomp[nFanins]++;
2749 if ( LutNDecomp[nFanins] > 10 )
2750 continue;
2751 Kit_DsdPrintFromTruth( (unsigned *)pTruth, nFanins ); printf( "\n" );
2752 }
2754
2755 printf( "LUT5 = %d ", LutCount[5] );
2756 printf( "LUT6 = %d NonDec = %d (%.2f %%) ", LutCount[6], LutNDecomp[6], 100.0 * LutNDecomp[6]/Abc_MaxInt(LutCount[6], 1) );
2757 printf( "LUT7 = %d NonDec = %d (%.2f %%) ", LutCount[7], LutNDecomp[7], 100.0 * LutNDecomp[7]/Abc_MaxInt(LutCount[7], 1) );
2758 printf( "\n" );
2759}
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
Definition giaTruth.c:628
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition giaTruth.c:552
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition giaTruth.c:568
int If_CutPerformCheck07(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
Definition ifDec07.c:1060
Here is the call graph for this function:

◆ Gia_ManToIf()

If_Man_t * Gia_ManToIf ( Gia_Man_t * p,
If_Par_t * pPars )

Definition at line 893 of file giaIf.c.

894{
895 If_Man_t * pIfMan;
896 If_Obj_t * pIfObj = NULL;
897 Gia_Obj_t * pObj;
898 int i;
899 // create levels with choices
901 // mark representative nodes
902 if ( Gia_ManHasChoices(p) )
904 // start the mapping manager and set its parameters
905 pIfMan = If_ManStart( pPars );
906 pIfMan->pName = Abc_UtilStrsav( Gia_ManName(p) );
907 // print warning about excessive memory usage
908 if ( 1.0 * Gia_ManObjNum(p) * pIfMan->nObjBytes / (1<<30) > 1.0 )
909 printf( "Warning: The mapper will allocate %.1f GB for to represent the subject graph with %d AIG nodes.\n",
910 1.0 * Gia_ManObjNum(p) * pIfMan->nObjBytes / (1<<30), Gia_ManObjNum(p) );
911 // load the AIG into the mapper
913 Gia_ManConst0(p)->Value = If_ObjId( If_ManConst1(pIfMan) );
914 Gia_ManForEachObj1( p, pObj, i )
915 {
916 if ( Gia_ObjIsAnd(pObj) )
917 pIfObj = If_ManCreateAnd( pIfMan, If_ManFanin0Copy(pIfMan, pObj), If_ManFanin1Copy(pIfMan, pObj) );
918 else if ( Gia_ObjIsCi(pObj) )
919 {
920 pIfObj = If_ManCreateCi( pIfMan );
921 If_ObjSetLevel( pIfObj, Gia_ObjLevel(p, pObj) );
922// Abc_Print( 1, "pi%d=%d\n ", If_ObjId(pIfObj), If_ObjLevel(pIfObj) );
923 if ( pIfMan->nLevelMax < (int)pIfObj->Level )
924 pIfMan->nLevelMax = (int)pIfObj->Level;
925 }
926 else if ( Gia_ObjIsCo(pObj) )
927 {
928 pIfObj = If_ManCreateCo( pIfMan, If_NotCond( If_ManFanin0Copy(pIfMan, pObj), Gia_ObjIsConst0(Gia_ObjFanin0(pObj))) );
929// Abc_Print( 1, "po%d=%d\n ", If_ObjId(pIfObj), If_ObjLevel(pIfObj) );
930 }
931 else assert( 0 );
932 assert( i == If_ObjId(pIfObj) );
933 Gia_ObjSetValue( pObj, If_ObjId(pIfObj) );
934 // set up the choice node
935 if ( Gia_ObjSibl(p, i) && pObj->fMark0 )
936 {
937 Gia_Obj_t * pSibl, * pPrev;
938 for ( pPrev = pObj, pSibl = Gia_ObjSiblObj(p, i); pSibl; pPrev = pSibl, pSibl = Gia_ObjSiblObj(p, Gia_ObjId(p, pSibl)) )
939 If_ObjSetChoice( If_ManObj(pIfMan, Gia_ObjValue(pPrev)), If_ManObj(pIfMan, Gia_ObjValue(pSibl)) );
940 If_ManCreateChoice( pIfMan, If_ManObj(pIfMan, Gia_ObjValue(pObj)) );
941 pPars->fExpRed = 0;
942 }
943// assert( If_ObjLevel(pIfObj) == Gia_ObjLevel(pNode) );
944 }
945 if ( Gia_ManHasChoices(p) )
947 //If_ManCheckChoices( pIfMan );
948 return pIfMan;
949}
int Gia_ManChoiceLevel(Gia_Man_t *p)
Definition giaIf.c:813
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
void Gia_ManMarkFanoutDrivers(Gia_Man_t *p)
Definition giaUtil.c:1779
void If_ManCreateChoice(If_Man_t *p, If_Obj_t *pRepr)
Definition ifMan.c:460
If_Obj_t * If_ManCreateCo(If_Man_t *p, If_Obj_t *pDriver)
Definition ifMan.c:356
If_Obj_t * If_ManCreateAnd(If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1)
Definition ifMan.c:384
If_Man_t * If_ManStart(If_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition ifMan.c:50
If_Obj_t * If_ManCreateCi(If_Man_t *p)
Definition ifMan.c:334
int nLevelMax
Definition if.h:211
int nObjBytes
Definition if.h:245
unsigned Level
Definition if.h:343
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTransferMapping()

void Gia_ManTransferMapping ( Gia_Man_t * p,
Gia_Man_t * pGia )

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

Synopsis [Transfers mapping from hie GIA to normalized GIA.]

Description [Hie GIA (pGia) points to normalized GIA (p).]

SideEffects []

SeeAlso []

Definition at line 2305 of file giaIf.c.

2306{
2307 Gia_Obj_t * pObj;
2308 int i, k, iFan, iPlace;
2309 if ( !Gia_ManHasMapping(pGia) )
2310 return;
2311 Gia_ManMappingVerify( pGia );
2312 Vec_IntFreeP( &p->vMapping );
2313 p->vMapping = Vec_IntAlloc( 2 * Gia_ManObjNum(p) );
2314 Vec_IntFill( p->vMapping, Gia_ManObjNum(p), 0 );
2315 Gia_ManForEachLut( pGia, i )
2316 {
2317 if ( Gia_ObjValue(Gia_ManObj(pGia, i)) == ~0 ) // handle dangling LUT
2318 continue;
2319 assert( !Abc_LitIsCompl(Gia_ObjValue(Gia_ManObj(pGia, i))) );
2320 pObj = Gia_ManObj( p, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, i))) );
2321 Vec_IntWriteEntry( p->vMapping, Gia_ObjId(p, pObj), Vec_IntSize(p->vMapping) );
2322 iPlace = Vec_IntSize( p->vMapping );
2323 Vec_IntPush( p->vMapping, Gia_ObjLutSize(pGia, i) );
2324 Gia_LutForEachFanin( pGia, i, iFan, k )
2325 {
2326 if ( Gia_ObjValue(Gia_ManObj(pGia, iFan)) == ~0 ) // handle dangling LUT fanin
2327 Vec_IntAddToEntry( p->vMapping, iPlace, -1 );
2328 else
2329 Vec_IntPush( p->vMapping, Abc_Lit2Var(Gia_ObjValue(Gia_ManObj(pGia, iFan))) );
2330 }
2331 iFan = Abc_Lit2Var( Gia_ObjValue(Gia_ManObj(pGia, Abc_AbsInt(Gia_ObjLutMuxId(pGia, i)))) );
2332 Vec_IntPush( p->vMapping, Gia_ObjLutIsMux(pGia, i) ? -iFan : iFan );
2333 }
2335}
void Gia_ManMappingVerify(Gia_Man_t *p)
Definition giaIf.c:2257
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTransferPacking()

void Gia_ManTransferPacking ( Gia_Man_t * p,
Gia_Man_t * pGia )

Definition at line 2336 of file giaIf.c.

2337{
2338 Vec_Int_t * vPackingNew;
2339 Gia_Obj_t * pObj, * pObjNew;
2340 int i, k, Entry, nEntries, nEntries2;
2341 if ( pGia->vPacking == NULL )
2342 return;
2343 nEntries = Vec_IntEntry( pGia->vPacking, 0 );
2344 nEntries2 = 0;
2345 // create new packing info
2346 vPackingNew = Vec_IntAlloc( Vec_IntSize(pGia->vPacking) );
2347 Vec_IntPush( vPackingNew, nEntries );
2348 Vec_IntForEachEntryStart( pGia->vPacking, Entry, i, 1 )
2349 {
2350 assert( Entry > 0 && Entry < 4 );
2351 Vec_IntPush( vPackingNew, Entry );
2352 i++;
2353 for ( k = 0; k < Entry; k++, i++ )
2354 {
2355 pObj = Gia_ManObj(pGia, Vec_IntEntry(pGia->vPacking, i));
2356 pObjNew = Gia_ManObj(p, Abc_Lit2Var(Gia_ObjValue(pObj)));
2357 assert( Gia_ObjIsLut(pGia, Gia_ObjId(pGia, pObj)) );
2358 assert( Gia_ObjIsLut(p, Gia_ObjId(p, pObjNew)) );
2359 Vec_IntPush( vPackingNew, Gia_ObjId(p, pObjNew) );
2360// printf( "%d -> %d ", Vec_IntEntry(pGia->vPacking, i), Gia_ObjId(p, pObjNew) );
2361 }
2362 i--;
2363 nEntries2++;
2364 }
2365 assert( nEntries == nEntries2 );
2366 // attach packing info
2367 assert( p->vPacking == NULL );
2368 p->vPacking = vPackingNew;
2369}
Here is the caller graph for this function:

◆ Gia_ManTransferTiming()

void Gia_ManTransferTiming ( Gia_Man_t * p,
Gia_Man_t * pGia )

Definition at line 2370 of file giaIf.c.

2371{
2372 if ( p == pGia )
2373 return;
2374 if ( pGia->vCiArrs || pGia->vCoReqs || pGia->vCoArrs || pGia->vCoAttrs )
2375 {
2376 p->vCiArrs = pGia->vCiArrs; pGia->vCiArrs = NULL;
2377 p->vCoReqs = pGia->vCoReqs; pGia->vCoReqs = NULL;
2378 p->vCoArrs = pGia->vCoArrs; pGia->vCoArrs = NULL;
2379 p->vCoAttrs = pGia->vCoAttrs; pGia->vCoAttrs = NULL;
2380 p->And2Delay = pGia->And2Delay;
2381 }
2382 if ( pGia->vInArrs || pGia->vOutReqs )
2383 {
2384 p->vInArrs = pGia->vInArrs; pGia->vInArrs = NULL;
2385 p->vOutReqs = pGia->vOutReqs; pGia->vOutReqs = NULL;
2386 p->DefInArrs = pGia->DefInArrs;
2387 p->DefOutReqs = pGia->DefOutReqs;
2388 p->And2Delay = pGia->And2Delay;
2389 }
2390 if ( pGia->vNamesIn || pGia->vNamesOut || pGia->vNamesNode )
2391 {
2392 p->vNamesIn = pGia->vNamesIn; pGia->vNamesIn = NULL;
2393 p->vNamesOut = pGia->vNamesOut; pGia->vNamesOut = NULL;
2394 p->vNamesNode = pGia->vNamesNode; pGia->vNamesNode = NULL;
2395 }
2396 if ( pGia->vConfigs || pGia->pCellStr )
2397 {
2398 p->vConfigs = pGia->vConfigs; pGia->vConfigs = NULL;
2399 p->pCellStr = pGia->pCellStr; pGia->pCellStr = NULL;
2400 }
2401 if ( pGia->pManTime == NULL )
2402 return;
2403 p->pManTime = pGia->pManTime; pGia->pManTime = NULL;
2404 p->pAigExtra = pGia->pAigExtra; pGia->pAigExtra = NULL;
2405 p->vRegClasses = pGia->vRegClasses; pGia->vRegClasses = NULL;
2406 p->vRegInits = pGia->vRegInits; pGia->vRegInits = NULL;
2407 p->nAnd2Delay = pGia->nAnd2Delay; pGia->nAnd2Delay = 0;
2408}
Vec_Int_t * vCoAttrs
Definition gia.h:173
Gia_Man_t * pAigExtra
Definition gia.h:167
Vec_Ptr_t * vNamesIn
Definition gia.h:181
float DefOutReqs
Definition gia.h:177
int nAnd2Delay
Definition gia.h:202
Vec_Flt_t * vOutReqs
Definition gia.h:169
Vec_Flt_t * vInArrs
Definition gia.h:168
Vec_Int_t * vRegInits
Definition gia.h:161
Vec_Ptr_t * vNamesOut
Definition gia.h:182
Vec_Int_t * vRegClasses
Definition gia.h:160
void * pManTime
Definition gia.h:194
float DefInArrs
Definition gia.h:176
Vec_Ptr_t * vNamesNode
Definition gia.h:183
Here is the caller graph for this function:

◆ If_ManCheckChoices()

void If_ManCheckChoices ( If_Man_t * pIfMan)

Definition at line 862 of file giaIf.c.

863{
864 If_Obj_t * pIfObj;
865 int i, fFound = 0;
866 If_ManForEachObj( pIfMan, pIfObj, i )
867 pIfObj->fDriver = 0;
868 If_ManForEachCo( pIfMan, pIfObj, i )
869 If_ManCheckChoices_rec( pIfMan, If_ObjFanin0(pIfObj) );
870 If_ManForEachNode( pIfMan, pIfObj, i )
871 if ( !pIfObj->fDriver )
872 printf( "Object %d is dangling.\n", i ), fFound = 1;
873 if ( !fFound )
874 printf( "There are no dangling objects.\n" );
875 If_ManForEachObj( pIfMan, pIfObj, i )
876 pIfObj->fDriver = 0;
877}
void If_ManCheckChoices_rec(If_Man_t *pIfMan, If_Obj_t *pIfObj)
Definition giaIf.c:853
#define If_ManForEachNode(p, pObj, i)
Definition if.h:497
unsigned fDriver
Definition if.h:341
Here is the call graph for this function:

◆ If_ManCheckChoices_rec()

void If_ManCheckChoices_rec ( If_Man_t * pIfMan,
If_Obj_t * pIfObj )

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

Synopsis [Checks integrity of choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 853 of file giaIf.c.

854{
855 if ( !pIfObj || pIfObj->Type != IF_AND || pIfObj->fDriver )
856 return;
857 pIfObj->fDriver = 1;
858 If_ManCheckChoices_rec( pIfMan, If_ObjFanin0(pIfObj) );
859 If_ManCheckChoices_rec( pIfMan, If_ObjFanin1(pIfObj) );
860 If_ManCheckChoices_rec( pIfMan, pIfObj->pEquiv );
861}
@ IF_AND
Definition if.h:69
unsigned Type
Definition if.h:333
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Kit_TruthToGia()

ABC_NAMESPACE_IMPL_START int Kit_TruthToGia ( Gia_Man_t * pMan,
unsigned * pTruth,
int nVars,
Vec_Int_t * vMemory,
Vec_Int_t * vLeaves,
int fHash )
extern

DECLARATIONS ///.

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

FileName [giaMap.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Manipulation of mapping associated with the AIG.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 80 of file kitHop.c.

81{
82 int iLit;
83 Kit_Graph_t * pGraph;
84 // transform truth table into the decomposition tree
85 if ( vMemory == NULL )
86 {
87 vMemory = Vec_IntAlloc( 0 );
88 pGraph = Kit_TruthToGraph( pTruth, nVars, vMemory );
89 Vec_IntFree( vMemory );
90 }
91 else
92 pGraph = Kit_TruthToGraph( pTruth, nVars, vMemory );
93 if ( pGraph == NULL )
94 {
95 printf( "Kit_TruthToGia(): Converting truth table to AIG has failed for function:\n" );
96 Kit_DsdPrintFromTruth( pTruth, nVars ); printf( "\n" );
97 }
98 // derive the AIG for the decomposition tree
99 iLit = Kit_GraphToGia( pMan, pGraph, vLeaves, fHash );
100 Kit_GraphFree( pGraph );
101 return iLit;
102}
int Kit_GraphToGia(Gia_Man_t *pMan, Kit_Graph_t *pGraph, Vec_Int_t *vLeaves, int fHash)
Definition kitHop.c:70
struct Kit_Graph_t_ Kit_Graph_t
Definition kit.h:88
void Kit_GraphFree(Kit_Graph_t *pGraph)
Definition kitGraph.c:132
Kit_Graph_t * Kit_TruthToGraph(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Definition kitGraph.c:356
Here is the call graph for this function:
Here is the caller graph for this function: