ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaPf.c File Reference
#include <float.h>
#include "gia.h"
#include "misc/st/st.h"
#include "map/mio/mio.h"
#include "misc/util/utilTruth.h"
#include "misc/extra/extra.h"
#include "base/main/main.h"
#include "misc/vec/vecMem.h"
#include "misc/vec/vecWec.h"
#include "opt/dau/dau.h"
Include dependency graph for giaPf.c:

Go to the source code of this file.

Classes

struct  Pf_Cut_t_
 
struct  Pf_Mat_t_
 
struct  Pf_Obj_t_
 
struct  Pf_Man_t_
 

Macros

#define PF_LEAF_MAX   6
 DECLARATIONS ///.
 
#define PF_CUT_MAX   32
 
#define PF_NO_LEAF   31
 
#define PF_NO_FUNC   0x3FFFFFF
 
#define PF_INFINITY   FLT_MAX
 
#define Pf_SetForEachCut(pList, pCut, i)
 
#define Pf_ObjForEachCut(pCuts, i, nCuts)
 
#define Pf_CutForEachLit(pCut, Conf, iLit, i)
 
#define Pf_CutForEachVar(pCut, Conf, iVar, c, i)
 

Typedefs

typedef struct Pf_Cut_t_ Pf_Cut_t
 
typedef struct Pf_Mat_t_ Pf_Mat_t
 
typedef struct Pf_Obj_t_ Pf_Obj_t
 
typedef struct Pf_Man_t_ Pf_Man_t
 

Functions

void Pf_StoCreateGateAdd (Pf_Man_t *pMan, word uTruth, int *pFans, int nFans, int CellId)
 FUNCTION DEFINITIONS ///.
 
void Pf_StoCreateGate (Pf_Man_t *pMan, Mio_Cell_t *pCell, int **pComp, int **pPerm, int *pnPerms)
 
void Pf_StoDeriveMatches (Pf_Man_t *p, int fVerbose)
 
void Pf_StoPrintOne (Pf_Man_t *p, int Count, int t, int i, int GateId, Pf_Mat_t Mat)
 
void Pf_StoPrint (Pf_Man_t *p, int fVerbose)
 
Pf_Man_tPf_StoCreate (Gia_Man_t *pGia, Jf_Par_t *pPars)
 
void Pf_StoDelete (Pf_Man_t *p)
 
void Pf_ObjMergeOrder (Pf_Man_t *p, int iObj)
 
void Pf_ManComputeCuts (Pf_Man_t *p)
 
void Pf_ManPrintStats (Pf_Man_t *p, char *pTitle)
 
void Pf_ManPrintInit (Pf_Man_t *p)
 
void Pf_ManPrintQuit (Pf_Man_t *p)
 
void Pf_ManComputeMapping (Pf_Man_t *p)
 
void Pf_ManSetDefaultPars (Jf_Par_t *pPars)
 
Gia_Man_tPf_ManPerformMapping (Gia_Man_t *pGia, Jf_Par_t *pPars)
 

Macro Definition Documentation

◆ PF_CUT_MAX

#define PF_CUT_MAX   32

Definition at line 39 of file giaPf.c.

◆ Pf_CutForEachLit

#define Pf_CutForEachLit ( pCut,
Conf,
iLit,
i )
Value:
for ( i = 0; i < Pf_CutSize(pCut) && (iLit = Abc_Lit2LitV(Pf_CutLeaves(pCut), Pf_CutConfLit(Conf, i))); i++ )

Definition at line 129 of file giaPf.c.

◆ Pf_CutForEachVar

#define Pf_CutForEachVar ( pCut,
Conf,
iVar,
c,
i )
Value:
for ( i = 0; i < Pf_CutSize(pCut) && (iVar = Pf_CutLeaves(pCut)[Pf_CutConfVar(Conf, i)]) && ((c = Pf_CutConfC(Conf, i)), 1); i++ )

Definition at line 130 of file giaPf.c.

◆ PF_INFINITY

#define PF_INFINITY   FLT_MAX

Definition at line 42 of file giaPf.c.

◆ PF_LEAF_MAX

#define PF_LEAF_MAX   6

DECLARATIONS ///.

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

FileName [giaNf.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Standard-cell mapper.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 38 of file giaPf.c.

◆ PF_NO_FUNC

#define PF_NO_FUNC   0x3FFFFFF

Definition at line 41 of file giaPf.c.

◆ PF_NO_LEAF

#define PF_NO_LEAF   31

Definition at line 40 of file giaPf.c.

◆ Pf_ObjForEachCut

#define Pf_ObjForEachCut ( pCuts,
i,
nCuts )
Value:
for ( i = 0, i < nCuts; i++ )

Definition at line 128 of file giaPf.c.

◆ Pf_SetForEachCut

#define Pf_SetForEachCut ( pList,
pCut,
i )
Value:
for ( i = 0, pCut = pList + 1; i < pList[0]; i++, pCut += Pf_CutSize(pCut) + 1 )

Definition at line 127 of file giaPf.c.

Typedef Documentation

◆ Pf_Cut_t

typedef struct Pf_Cut_t_ Pf_Cut_t

Definition at line 44 of file giaPf.c.

◆ Pf_Man_t

typedef struct Pf_Man_t_ Pf_Man_t

Definition at line 71 of file giaPf.c.

◆ Pf_Mat_t

typedef struct Pf_Mat_t_ Pf_Mat_t

Definition at line 55 of file giaPf.c.

◆ Pf_Obj_t

typedef struct Pf_Obj_t_ Pf_Obj_t

Definition at line 62 of file giaPf.c.

Function Documentation

◆ Pf_ManComputeCuts()

void Pf_ManComputeCuts ( Pf_Man_t * p)

Definition at line 878 of file giaPf.c.

879{
880 Gia_Obj_t * pObj; int i, iFanin;
881 Gia_ManForEachAnd( p->pGia, pObj, i )
882 if ( Gia_ObjIsBuf(pObj) )
883 {
884 iFanin = Gia_ObjFaninId0(pObj, i);
885 Pf_ObjSetCutFlow( p, i, Pf_ObjCutFlow(p, iFanin) );
886 Pf_ObjSetCutDelay( p, i, Pf_ObjCutDelay(p, iFanin) );
887 }
888 else
889 Pf_ObjMergeOrder( p, i );
890}
Cube * p
Definition exorList.c:222
void Pf_ObjMergeOrder(Pf_Man_t *p, int iObj)
Definition giaPf.c:777
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pf_ManComputeMapping()

void Pf_ManComputeMapping ( Pf_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso [] Function*************************************************************

Synopsis [Technology mappping.]

Description []

SideEffects []

SeeAlso []

Definition at line 1262 of file giaPf.c.

1263{
1264}

◆ Pf_ManPerformMapping()

Gia_Man_t * Pf_ManPerformMapping ( Gia_Man_t * pGia,
Jf_Par_t * pPars )

Definition at line 1303 of file giaPf.c.

1304{
1305 Gia_Man_t * pNew = NULL, * pCls;
1306 Pf_Man_t * p;
1307 if ( Gia_ManHasChoices(pGia) )
1308 pPars->fCoarsen = 0;
1309 pCls = pPars->fCoarsen ? Gia_ManDupMuxes(pGia, pPars->nCoarseLimit) : pGia;
1310 p = Pf_StoCreate( pCls, pPars );
1311// if ( pPars->fVeryVerbose )
1312 Pf_StoPrint( p, 1 );
1313 if ( pPars->fVerbose && pPars->fCoarsen )
1314 {
1315 printf( "Initial " ); Gia_ManPrintMuxStats( pGia ); printf( "\n" );
1316 printf( "Derived " ); Gia_ManPrintMuxStats( pCls ); printf( "\n" );
1317 }
1318 Pf_ManPrintInit( p );
1320 Pf_ManPrintQuit( p );
1321/*
1322 Gia_ManForEachCiId( p->pGia, Id, i )
1323 Pf_ObjPrepareCi( p, Id );
1324 for ( p->Iter = 0; p->Iter < p->pPars->nRounds; p->Iter++ )
1325 {
1326 Pf_ManComputeMapping( p );
1327 //Pf_ManSetMapRefs( p );
1328 Pf_ManPrintStats( p, p->Iter ? "Area " : "Delay" );
1329 }
1330 p->fUseEla = 1;
1331 for ( ; p->Iter < p->pPars->nRounds + pPars->nRoundsEla; p->Iter++ )
1332 {
1333 Pf_ManComputeMapping( p );
1334 //Pf_ManUpdateStats( p );
1335 Pf_ManPrintStats( p, "Ela " );
1336 }
1337*/
1338 pNew = NULL; //Pf_ManDeriveMapping( p );
1339// Gia_ManMappingVerify( pNew );
1340 Pf_StoDelete( p );
1341 if ( pCls != pGia )
1342 Gia_ManStop( pCls );
1343 if ( pNew == NULL )
1344 return Gia_ManDup( pGia );
1345 return pNew;
1346}
void Pf_ManPrintInit(Pf_Man_t *p)
Definition giaPf.c:919
void Pf_StoPrint(Pf_Man_t *p, int fVerbose)
Definition giaPf.c:249
void Pf_StoDelete(Pf_Man_t *p)
Definition giaPf.c:336
Pf_Man_t * Pf_StoCreate(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaPf.c:293
struct Pf_Man_t_ Pf_Man_t
Definition giaPf.c:71
void Pf_ManComputeCuts(Pf_Man_t *p)
Definition giaPf.c:878
void Pf_ManPrintQuit(Pf_Man_t *p)
Definition giaPf.c:938
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
Definition giaMuxes.c:98
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
void Gia_ManPrintMuxStats(Gia_Man_t *p)
Definition giaMuxes.c:63
int fCoarsen
Definition gia.h:357
int nCoarseLimit
Definition gia.h:342
int fVerbose
Definition gia.h:370
Here is the call graph for this function:

◆ Pf_ManPrintInit()

void Pf_ManPrintInit ( Pf_Man_t * p)

Definition at line 919 of file giaPf.c.

920{
921 int nChoices;
922 if ( !p->pPars->fVerbose )
923 return;
924 printf( "LutSize = %d ", p->pPars->nLutSize );
925 printf( "CutNum = %d ", p->pPars->nCutNum );
926 printf( "Iter = %d ", p->pPars->nRounds + p->pPars->nRoundsEla );
927 printf( "Coarse = %d ", p->pPars->fCoarsen );
928 printf( "Cells = %d ", p->nCells );
929 printf( "Funcs = %d ", Vec_MemEntryNum(p->vTtMem) );
930 printf( "Matches = %d ", Vec_WecSizeSize(p->vTt2Match)/2 );
931 nChoices = Gia_ManChoiceNum( p->pGia );
932 if ( nChoices )
933 printf( "Choices = %d ", nChoices );
934 printf( "\n" );
935 printf( "Computing cuts...\r" );
936 fflush( stdout );
937}
Here is the caller graph for this function:

◆ Pf_ManPrintQuit()

void Pf_ManPrintQuit ( Pf_Man_t * p)

Definition at line 938 of file giaPf.c.

939{
940 float MemGia = Gia_ManMemory(p->pGia) / (1<<20);
941 float MemMan =(1.0 * sizeof(Pf_Obj_t) + 3.0 * sizeof(int)) * Gia_ManObjNum(p->pGia) / (1<<20);
942 float MemCuts = 1.0 * sizeof(int) * (1 << 16) * Vec_PtrSize(&p->vPages) / (1<<20);
943 float MemTt = p->vTtMem ? Vec_MemMemory(p->vTtMem) / (1<<20) : 0;
944 if ( p->CutCount[0] == 0 )
945 p->CutCount[0] = 1;
946 if ( !p->pPars->fVerbose )
947 return;
948 printf( "CutPair = %.0f ", p->CutCount[0] );
949 printf( "Merge = %.0f (%.1f) ", p->CutCount[1], 1.0*p->CutCount[1]/Gia_ManAndNum(p->pGia) );
950 printf( "Eval = %.0f (%.1f) ", p->CutCount[2], 1.0*p->CutCount[2]/Gia_ManAndNum(p->pGia) );
951 printf( "Cut = %.0f (%.1f) ", p->CutCount[3], 1.0*p->CutCount[3]/Gia_ManAndNum(p->pGia) );
952 printf( "Use = %.0f (%.1f) ", p->CutCount[4], 1.0*p->CutCount[4]/Gia_ManAndNum(p->pGia) );
953 printf( "Mat = %.0f (%.1f) ", p->CutCount[5], 1.0*p->CutCount[5]/Gia_ManAndNum(p->pGia) );
954// printf( "Equ = %d (%.2f %%) ", p->nCutUseAll, 100.0*p->nCutUseAll /p->CutCount[0] );
955 printf( "\n" );
956 printf( "Gia = %.2f MB ", MemGia );
957 printf( "Man = %.2f MB ", MemMan );
958 printf( "Cut = %.2f MB ", MemCuts );
959 printf( "TT = %.2f MB ", MemTt );
960 printf( "Total = %.2f MB ", MemGia + MemMan + MemCuts + MemTt );
961// printf( "\n" );
962 Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart );
963 fflush( stdout );
964}
struct Pf_Obj_t_ Pf_Obj_t
Definition giaPf.c:62
double Gia_ManMemory(Gia_Man_t *p)
Definition giaMan.c:194
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pf_ManPrintStats()

void Pf_ManPrintStats ( Pf_Man_t * p,
char * pTitle )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 906 of file giaPf.c.

907{
908 if ( !p->pPars->fVerbose )
909 return;
910 printf( "%s : ", pTitle );
911 printf( "Delay =%8.2f ", (float)p->pPars->MapDelay );
912 printf( "Area =%12.2f ", p->pPars->MapArea );
913 printf( "Gate =%6d ", (int)p->pPars->Area );
914 printf( "Inv =%6d ", (int)p->nInvs );
915 printf( "Edge =%7d ", (int)p->pPars->Edge );
916 Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart );
917 fflush( stdout );
918}

◆ Pf_ManSetDefaultPars()

void Pf_ManSetDefaultPars ( Jf_Par_t * pPars)

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

Synopsis [Technology mappping.]

Description []

SideEffects []

SeeAlso []

Definition at line 1277 of file giaPf.c.

1278{
1279 memset( pPars, 0, sizeof(Jf_Par_t) );
1280 pPars->nLutSize = 6;
1281 pPars->nCutNum = 16;
1282 pPars->nProcNum = 0;
1283 pPars->nRounds = 3;
1284 pPars->nRoundsEla = 0;
1285 pPars->nRelaxRatio = 0;
1286 pPars->nCoarseLimit = 3;
1287 pPars->nAreaTuner = 1;
1288 pPars->nVerbLimit = 5;
1289 pPars->DelayTarget = -1;
1290 pPars->fAreaOnly = 0;
1291 pPars->fOptEdge = 1;
1292 pPars->fCoarsen = 0;
1293 pPars->fCutMin = 1;
1294 pPars->fGenCnf = 0;
1295 pPars->fPureAig = 0;
1296 pPars->fVerbose = 0;
1297 pPars->fVeryVerbose = 0;
1298 pPars->nLutSizeMax = PF_LEAF_MAX;
1299 pPars->nCutNumMax = PF_CUT_MAX;
1300 pPars->MapDelayTarget = -1;
1301 pPars->Epsilon = (float)0.01;
1302}
#define PF_CUT_MAX
Definition giaPf.c:39
#define PF_LEAF_MAX
DECLARATIONS ///.
Definition giaPf.c:38
struct Jf_Par_t_ Jf_Par_t
Definition gia.h:333
float MapDelayTarget
Definition gia.h:387
int nRounds
Definition gia.h:339
int fGenCnf
Definition gia.h:360
int nProcNum
Definition gia.h:338
int nRelaxRatio
Definition gia.h:341
int nCutNum
Definition gia.h:337
int nRoundsEla
Definition gia.h:340
int fOptEdge
Definition gia.h:354
int fAreaOnly
Definition gia.h:350
int nCutNumMax
Definition gia.h:373
int nLutSizeMax
Definition gia.h:372
int nLutSize
Definition gia.h:336
int nAreaTuner
Definition gia.h:343
int fVeryVerbose
Definition gia.h:371
int fCutMin
Definition gia.h:358
int fPureAig
Definition gia.h:365
float Epsilon
Definition gia.h:388
int nVerbLimit
Definition gia.h:345
int DelayTarget
Definition gia.h:349
char * memset()
Here is the call graph for this function:

◆ Pf_ObjMergeOrder()

void Pf_ObjMergeOrder ( Pf_Man_t * p,
int iObj )

Definition at line 777 of file giaPf.c.

778{
779 Pf_Cut_t pCuts0[PF_CUT_MAX], pCuts1[PF_CUT_MAX], pCuts[PF_CUT_MAX], * pCutsR[PF_CUT_MAX];
780 Gia_Obj_t * pObj = Gia_ManObj(p->pGia, iObj);
781 int nGiaRefs = 2*Gia_ObjRefNumId(p->pGia, iObj);
782 int nLutSize = p->pPars->nLutSize;
783 int nCutNum = p->pPars->nCutNum;
784 int nCuts0 = Pf_ManPrepareCuts(pCuts0, p, Gia_ObjFaninId0(pObj, iObj), 1);
785 int nCuts1 = Pf_ManPrepareCuts(pCuts1, p, Gia_ObjFaninId1(pObj, iObj), 1);
786 int fComp0 = Gia_ObjFaninC0(pObj);
787 int fComp1 = Gia_ObjFaninC1(pObj);
788 int iSibl = Gia_ObjSibl(p->pGia, iObj);
789 Pf_Cut_t * pCut0, * pCut1, * pCut0Lim = pCuts0 + nCuts0, * pCut1Lim = pCuts1 + nCuts1;
790 int i, nCutsUse, nCutsR = 0;
791 assert( !Gia_ObjIsBuf(pObj) );
792 for ( i = 0; i < nCutNum; i++ )
793 pCutsR[i] = pCuts + i;
794 if ( iSibl )
795 {
796 Pf_Cut_t pCuts2[PF_CUT_MAX];
797 Gia_Obj_t * pObjE = Gia_ObjSiblObj(p->pGia, iObj);
798 int fCompE = Gia_ObjPhase(pObj) ^ Gia_ObjPhase(pObjE);
799 int nCuts2 = Pf_ManPrepareCuts(pCuts2, p, iSibl, 0);
800 Pf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
801 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
802 {
803 *pCutsR[nCutsR] = *pCut2;
804 pCutsR[nCutsR]->iFunc = Abc_LitNotCond( pCutsR[nCutsR]->iFunc, fCompE );
805 Pf_CutParams( p, pCutsR[nCutsR], nGiaRefs );
806 nCutsR = Pf_SetAddCut( pCutsR, nCutsR, nCutNum );
807 }
808 }
809 if ( Gia_ObjIsMuxId(p->pGia, iObj) )
810 {
811 Pf_Cut_t pCuts2[PF_CUT_MAX];
812 int nCuts2 = Pf_ManPrepareCuts(pCuts2, p, Gia_ObjFaninId2(p->pGia, iObj), 1);
813 int fComp2 = Gia_ObjFaninC2(p->pGia, pObj);
814 Pf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
815 p->CutCount[0] += nCuts0 * nCuts1 * nCuts2;
816 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
817 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
818 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
819 {
820 if ( Pf_CutCountBits(pCut0->Sign | pCut1->Sign | pCut2->Sign) > nLutSize )
821 continue;
822 p->CutCount[1]++;
823 if ( !Pf_CutMergeOrderMux(pCut0, pCut1, pCut2, pCutsR[nCutsR], nLutSize) )
824 continue;
825 if ( Pf_SetLastCutIsContained(pCutsR, nCutsR) )
826 continue;
827 p->CutCount[2]++;
828 if ( Pf_CutComputeTruthMux6(p, pCut0, pCut1, pCut2, fComp0, fComp1, fComp2, pCutsR[nCutsR]) )
829 pCutsR[nCutsR]->Sign = Pf_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
830 Pf_CutParams( p, pCutsR[nCutsR], nGiaRefs );
831 nCutsR = Pf_SetAddCut( pCutsR, nCutsR, nCutNum );
832 }
833 }
834 else
835 {
836 int fIsXor = Gia_ObjIsXor(pObj);
837 p->CutCount[0] += nCuts0 * nCuts1;
838 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
839 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
840 {
841 if ( (int)(pCut0->nLeaves + pCut1->nLeaves) > nLutSize && Pf_CutCountBits(pCut0->Sign | pCut1->Sign) > nLutSize )
842 continue;
843 p->CutCount[1]++;
844 if ( !Pf_CutMergeOrder(pCut0, pCut1, pCutsR[nCutsR], nLutSize) )
845 continue;
846 if ( Pf_SetLastCutIsContained(pCutsR, nCutsR) )
847 continue;
848 p->CutCount[2]++;
849 if ( Pf_CutComputeTruth6(p, pCut0, pCut1, fComp0, fComp1, pCutsR[nCutsR], fIsXor) )
850 pCutsR[nCutsR]->Sign = Pf_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
851 Pf_CutParams( p, pCutsR[nCutsR], nGiaRefs );
852 nCutsR = Pf_SetAddCut( pCutsR, nCutsR, nCutNum );
853 }
854 }
855 // debug printout
856 if ( 0 )
857// if ( iObj % 10000 == 0 )
858// if ( iObj == 1090 )
859 {
860 printf( "*** Obj = %d Useful = %d\n", iObj, Pf_ManCountUseful(pCutsR, nCutsR) );
861 for ( i = 0; i < nCutsR; i++ )
862 Pf_Cutprintf( p, pCutsR[i] );
863 printf( "\n" );
864 }
865 // verify
866 assert( nCutsR > 0 && nCutsR < nCutNum );
867// assert( Pf_SetCheckArray(pCutsR, nCutsR) );
868 // store the cutset
869 Pf_ObjSetCutFlow( p, iObj, pCutsR[0]->Flow );
870 Pf_ObjSetCutDelay( p, iObj, pCutsR[0]->Delay );
871 *Vec_IntEntryP(&p->vCutSets, iObj) = Pf_ManSaveCuts(p, pCutsR, nCutsR, 0);
872 p->CutCount[3] += nCutsR;
873 nCutsUse = Pf_ManCountUseful(pCutsR, nCutsR);
874 p->CutCount[4] += nCutsUse;
875 p->nCutUseAll += nCutsUse == nCutsR;
876 p->CutCount[5] += Pf_ManCountMatches(p, pCutsR, nCutsR);
877}
struct Pf_Cut_t_ Pf_Cut_t
Definition giaPf.c:44
word Sign
Definition giaPf.c:47
unsigned iFunc
Definition giaPf.c:50
unsigned nLeaves
Definition giaPf.c:52
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Pf_StoCreate()

Pf_Man_t * Pf_StoCreate ( Gia_Man_t * pGia,
Jf_Par_t * pPars )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file giaPf.c.

294{
295 extern void Mf_ManSetFlowRefs( Gia_Man_t * p, Vec_Int_t * vRefs );
296 Pf_Man_t * p;
297 Vec_Int_t * vFlowRefs;
298 assert( pPars->nCutNum > 1 && pPars->nCutNum <= PF_CUT_MAX );
299 assert( pPars->nLutSize > 1 && pPars->nLutSize <= PF_LEAF_MAX );
300 ABC_FREE( pGia->pRefs );
301 Vec_IntFreeP( &pGia->vCellMapping );
302 if ( Gia_ManHasChoices(pGia) )
303 Gia_ManSetPhase(pGia);
304 // create references
305 ABC_FREE( pGia->pRefs );
306 vFlowRefs = Vec_IntAlloc(0);
307 Mf_ManSetFlowRefs( pGia, vFlowRefs );
308 pGia->pRefs= Vec_IntReleaseArray(vFlowRefs);
309 Vec_IntFree(vFlowRefs);
310 // create
311 p = ABC_CALLOC( Pf_Man_t, 1 );
312 p->clkStart = Abc_Clock();
313 p->pGia = pGia;
314 p->pPars = pPars;
315 p->pPfObjs = ABC_CALLOC( Pf_Obj_t, Gia_ManObjNum(pGia) );
316 p->iCur = 2;
317 // other
318 Vec_PtrGrow( &p->vPages, 256 ); // cut memory
319 Vec_IntFill( &p->vCutSets, Gia_ManObjNum(pGia), 0 ); // cut offsets
320 Vec_FltFill( &p->vCutFlows, Gia_ManObjNum(pGia), 0 ); // cut area
321 Vec_IntFill( &p->vCutDelays,Gia_ManObjNum(pGia), 0 ); // cut delay
322 // matching
323 p->vTtMem = Vec_MemAllocForTT( 6, 0 );
324 p->vTt2Match = Vec_WecAlloc( 1000 );
325 Vec_WecPushLevel( p->vTt2Match );
326 Vec_WecPushLevel( p->vTt2Match );
327 assert( Vec_WecSize(p->vTt2Match) == Vec_MemEntryNum(p->vTtMem) );
328 Pf_StoDeriveMatches( p, 0 );//pPars->fVerbose );
329 p->InvDelay = p->pCells[3].Delays[0];
330 p->InvArea = p->pCells[3].Area;
331 //Pf_ObjMatchD(p, 0, 0)->Gate = 0;
332 //Pf_ObjMatchD(p, 0, 1)->Gate = 1;
333 // prepare cuts
334 return p;
335}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Mf_ManSetFlowRefs(Gia_Man_t *p, Vec_Int_t *vRefs)
Definition giaMf.c:1137
void Pf_StoDeriveMatches(Pf_Man_t *p, int fVerbose)
Definition giaPf.c:204
void Gia_ManSetPhase(Gia_Man_t *p)
Definition giaUtil.c:420
Vec_Int_t * vCellMapping
Definition gia.h:139
int * pRefs
Definition gia.h:118
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pf_StoCreateGate()

void Pf_StoCreateGate ( Pf_Man_t * pMan,
Mio_Cell_t * pCell,
int ** pComp,
int ** pPerm,
int * pnPerms )

Definition at line 174 of file giaPf.c.

175{
176 int Perm[PF_LEAF_MAX], * Perm1, * Perm2;
177 int nPerms = pnPerms[pCell->nFanins];
178 int nMints = (1 << pCell->nFanins);
179 word tCur, tTemp1, tTemp2;
180 int i, p, c;
181 for ( i = 0; i < (int)pCell->nFanins; i++ )
182 Perm[i] = Abc_Var2Lit( i, 0 );
183 tCur = tTemp1 = pCell->uTruth;
184 for ( p = 0; p < nPerms; p++ )
185 {
186 tTemp2 = tCur;
187 for ( c = 0; c < nMints; c++ )
188 {
189 Pf_StoCreateGateAdd( pMan, tCur, Perm, pCell->nFanins, pCell->Id );
190 // update
191 tCur = Abc_Tt6Flip( tCur, pComp[pCell->nFanins][c] );
192 Perm1 = Perm + pComp[pCell->nFanins][c];
193 *Perm1 = Abc_LitNot( *Perm1 );
194 }
195 assert( tTemp2 == tCur );
196 // update
197 tCur = Abc_Tt6SwapAdjacent( tCur, pPerm[pCell->nFanins][p] );
198 Perm1 = Perm + pPerm[pCell->nFanins][p];
199 Perm2 = Perm1 + 1;
200 ABC_SWAP( int, *Perm1, *Perm2 );
201 }
202 assert( tTemp1 == tCur );
203}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
void Pf_StoCreateGateAdd(Pf_Man_t *pMan, word uTruth, int *pFans, int nFans, int CellId)
FUNCTION DEFINITIONS ///.
Definition giaPf.c:147
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
unsigned nFanins
Definition mio.h:51
unsigned Id
Definition mio.h:50
word uTruth
Definition mio.h:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pf_StoCreateGateAdd()

void Pf_StoCreateGateAdd ( Pf_Man_t * pMan,
word uTruth,
int * pFans,
int nFans,
int CellId )

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file giaPf.c.

148{
149 Vec_Int_t * vArray;
150 Pf_Mat_t Mat = Pf_Int2Mat(0);
151 int i, GateId, Entry, fCompl = (int)(uTruth & 1);
152 word uFunc = fCompl ? ~uTruth : uTruth;
153 int iFunc = Vec_MemHashInsert( pMan->vTtMem, &uFunc );
154 if ( iFunc == Vec_WecSize(pMan->vTt2Match) )
155 Vec_WecPushLevel( pMan->vTt2Match );
156 vArray = Vec_WecEntry( pMan->vTt2Match, iFunc );
157 Mat.fCompl = fCompl;
158 assert( nFans < 7 );
159 for ( i = 0; i < nFans; i++ )
160 {
161 Mat.Perm |= (unsigned)(Abc_Lit2Var(pFans[i]) << (3*i));
162 Mat.Phase |= (unsigned)(Abc_LitIsCompl(pFans[i]) << i);
163 }
164 // check if the same one exists
165 Vec_IntForEachEntryDouble( vArray, GateId, Entry, i )
166 if ( GateId == CellId && Pf_Int2Mat(Entry).Phase == Mat.Phase )
167 break;
168 if ( i == Vec_IntSize(vArray) )
169 {
170 Vec_IntPush( vArray, CellId );
171 Vec_IntPush( vArray, Pf_Mat2Int(Mat) );
172 }
173}
struct Pf_Mat_t_ Pf_Mat_t
Definition giaPf.c:55
Vec_Wec_t * vTt2Match
Definition giaPf.c:79
Vec_Mem_t * vTtMem
Definition giaPf.c:78
unsigned fCompl
Definition giaPf.c:58
unsigned Phase
Definition giaPf.c:59
unsigned Perm
Definition giaPf.c:60
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
Here is the caller graph for this function:

◆ Pf_StoDelete()

void Pf_StoDelete ( Pf_Man_t * p)

Definition at line 336 of file giaPf.c.

337{
338 Vec_PtrFreeData( &p->vPages );
339 ABC_FREE( p->vPages.pArray );
340 ABC_FREE( p->vCutSets.pArray );
341 ABC_FREE( p->vCutFlows.pArray );
342 ABC_FREE( p->vCutDelays.pArray );
343 ABC_FREE( p->pPfObjs );
344 // matching
345 Vec_WecFree( p->vTt2Match );
346 Vec_MemHashFree( p->vTtMem );
347 Vec_MemFree( p->vTtMem );
348 ABC_FREE( p->pCells );
349 ABC_FREE( p );
350}
Here is the caller graph for this function:

◆ Pf_StoDeriveMatches()

void Pf_StoDeriveMatches ( Pf_Man_t * p,
int fVerbose )

Definition at line 204 of file giaPf.c.

205{
206// abctime clk = Abc_Clock();
207 int * pComp[7];
208 int * pPerm[7];
209 int nPerms[7], i;
210 for ( i = 2; i <= 6; i++ )
211 pComp[i] = Extra_GreyCodeSchedule( i );
212 for ( i = 2; i <= 6; i++ )
213 pPerm[i] = Extra_PermSchedule( i );
214 for ( i = 2; i <= 6; i++ )
215 nPerms[i] = Extra_Factorial( i );
216 p->pCells = Mio_CollectRootsNewDefault( 6, &p->nCells, fVerbose );
217 for ( i = 4; i < p->nCells; i++ )
218 Pf_StoCreateGate( p, p->pCells + i, pComp, pPerm, nPerms );
219 for ( i = 2; i <= 6; i++ )
220 ABC_FREE( pComp[i] );
221 for ( i = 2; i <= 6; i++ )
222 ABC_FREE( pPerm[i] );
223// Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
224}
int * Extra_PermSchedule(int n)
int Extra_Factorial(int n)
int * Extra_GreyCodeSchedule(int n)
void Pf_StoCreateGate(Pf_Man_t *pMan, Mio_Cell_t *pCell, int **pComp, int **pPerm, int *pnPerms)
Definition giaPf.c:174
Mio_Cell_t * Mio_CollectRootsNewDefault(int nInputs, int *pnGates, int fVerbose)
Definition mioUtils.c:715
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pf_StoPrint()

void Pf_StoPrint ( Pf_Man_t * p,
int fVerbose )

Definition at line 249 of file giaPf.c.

250{
251 int t, i, GateId, Entry, Count = 0;
252 for ( t = 2; t < Vec_WecSize(p->vTt2Match); t++ )
253 {
254 Vec_Int_t * vArr = Vec_WecEntry( p->vTt2Match, t );
255 Vec_IntForEachEntryDouble( vArr, GateId, Entry, i )
256 {
257 Count++;
258 if ( !fVerbose )
259 continue;
260 if ( t < 10 )
261 Pf_StoPrintOne( p, Count, t, i/2, GateId, Pf_Int2Mat(Entry) );
262 }
263 }
264 printf( "Gates = %d. Truths = %d. Matches = %d.\n",
265 p->nCells, Vec_MemEntryNum(p->vTtMem), Count );
266}
void Pf_StoPrintOne(Pf_Man_t *p, int Count, int t, int i, int GateId, Pf_Mat_t Mat)
Definition giaPf.c:225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pf_StoPrintOne()

void Pf_StoPrintOne ( Pf_Man_t * p,
int Count,
int t,
int i,
int GateId,
Pf_Mat_t Mat )

Definition at line 225 of file giaPf.c.

226{
227 Mio_Cell_t * pC = p->pCells + GateId;
228 word * pTruth = Vec_MemReadEntry(p->vTtMem, t);
229 int k, nSuppSize = Abc_TtSupportSize(pTruth, 6);
230 printf( "%6d : ", Count );
231 printf( "%6d : ", t );
232 printf( "%6d : ", i );
233 printf( "Gate %16s ", pC->pName );
234 printf( "Area =%8.2f ", pC->Area );
235 printf( "In = %d ", pC->nFanins );
236 if ( Mat.fCompl )
237 printf( " compl " );
238 else
239 printf( " " );
240 for ( k = 0; k < (int)pC->nFanins; k++ )
241 {
242 int fComplF = (Mat.Phase >> k) & 1;
243 int iFanin = (Mat.Perm >> (3*k)) & 7;
244 printf( "%c", 'a' + iFanin - fComplF * ('a' - 'A') );
245 }
246 printf( " " );
247 Dau_DsdPrintFromTruth( pTruth, nSuppSize );
248}
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
Definition dauDsd.c:1968
struct Mio_Cell_t_ Mio_Cell_t
Definition mio.h:46
float Area
Definition mio.h:52
char * pName
Definition mio.h:49
Here is the call graph for this function:
Here is the caller graph for this function: