ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaMuxes.c File Reference
#include "gia.h"
#include "misc/util/utilNam.h"
#include "misc/util/utilTruth.h"
#include "misc/vec/vecWec.h"
#include "misc/vec/vecHsh.h"
Include dependency graph for giaMuxes.c:

Go to the source code of this file.

Classes

struct  Mux_Man_t_
 

Macros

#define GIA_FOREACH_ITEM(ITEM)
 
#define GENERATE_ENUM(ENUM)
 
#define GENERATE_STRING(STRING)
 

Typedefs

typedef struct Mux_Man_t_ Mux_Man_t
 

Enumerations

enum  Gia_ObjType_t { GIA_FOREACH_ITEM =(GENERATE_ENUM) }
 

Functions

ABC_NAMESPACE_IMPL_START void Gia_ManCountMuxXor (Gia_Man_t *p, int *pnMuxes, int *pnXors)
 DECLARATIONS ///.
 
void Gia_ManPrintMuxStats (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupMuxes (Gia_Man_t *p, int Limit)
 
Gia_Man_tGia_ManCreateXors (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupNoMuxes (Gia_Man_t *p, int fSkipBufs)
 
Gia_Man_tGia_ManDupMuxesTest (Gia_Man_t *p)
 
Gia_Man_tGia_ManMuxRestructure (Gia_Man_t *p)
 
Gia_Man_tGia_ManDupMuxRestructure (Gia_Man_t *p)
 
int Gia_MuxRef_rec (Gia_Man_t *p, int iObj)
 
int Gia_MuxRef (Gia_Man_t *p, int iObj)
 
int Gia_MuxDeref_rec (Gia_Man_t *p, int iObj)
 
int Gia_MuxDeref (Gia_Man_t *p, int iObj)
 
int Gia_MuxMffcSize (Gia_Man_t *p, int iObj)
 
void Gia_MuxStructPrint_rec (Gia_Man_t *p, int iObj, int fFirst)
 
void Gia_MuxStructPrint (Gia_Man_t *p, int iObj)
 
void Gia_MuxStructDump_rec (Gia_Man_t *p, int iObj, int fFirst, Vec_Str_t *vStr, int nDigitsId)
 
int Gia_MuxStructDump (Gia_Man_t *p, int iObj, Vec_Str_t *vStr, int nDigitsNum, int nDigitsId)
 
int Gia_ManMuxCompare (char **pp1, char **pp2)
 
int Gia_ManMuxCountOne (char *p)
 
Mux_Man_tMux_ManAlloc (Gia_Man_t *pGia)
 
void Mux_ManFree (Mux_Man_t *p)
 
int Gia_ManMuxProfile (Mux_Man_t *p, int fWidth)
 
void Gia_ManMuxProfiling (Gia_Man_t *p)
 
void Gia_ManProfileStructuresTest (Gia_Man_t *p)
 
int Gia_ManEncodeObj (Gia_Man_t *p, int i)
 
int Gia_ManEncodeFanin (Gia_Man_t *p, int iLit)
 
Gia_ObjType_t Gia_ManEncodeFanout (Gia_Man_t *p, Gia_Obj_t *pObj, int i)
 
void Gia_ManProfileCollect (Gia_Man_t *p, int i, Vec_Int_t *vCode, Vec_Int_t *vCodeOffsets, Vec_Int_t *vArray)
 
void Gia_ManProfilePrintOne (Gia_Man_t *p, int i, Vec_Int_t *vArray)
 
Vec_Int_tGia_ManProfileHash (Gia_Man_t *p, Vec_Int_t *vCode, Vec_Int_t *vCodeOffsets)
 
void Gia_ManProfileStructuresInt (Gia_Man_t *p, int nLimit, int fVerbose)
 
void Gia_ManProfileStructures (Gia_Man_t *p, int nLimit, int fVerbose)
 
void Gia_ManMarkTfi_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
Vec_Int_tGia_ManFindSharedInputs (Gia_Man_t *p)
 
Vec_Wec_tGia_ManFindCofs (Gia_Man_t *p, Vec_Int_t *vRes, Gia_Man_t **ppNew)
 
Vec_Int_tGia_ManFindEquivClasses (Vec_Wec_t *vCofs)
 
int Gia_ManFindMuxTree_rec (Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, int Shift)
 
void Gia_ManFindDerive (Gia_Man_t *pNew, int nOuts, Vec_Int_t *vIns, Vec_Wec_t *vCofs, Vec_Int_t *vMap)
 
Gia_Man_tGia_ManCofStructure (Gia_Man_t *p)
 

Macro Definition Documentation

◆ GENERATE_ENUM

#define GENERATE_ENUM ( ENUM)
Value:
ENUM,

Definition at line 780 of file giaMuxes.c.

◆ GENERATE_STRING

#define GENERATE_STRING ( STRING)
Value:
#STRING,

Definition at line 783 of file giaMuxes.c.

◆ GIA_FOREACH_ITEM

#define GIA_FOREACH_ITEM ( ITEM)
Value:
ITEM(C0) \
ITEM(PO) \
ITEM(PI) \
ITEM(FF) \
ITEM(XOR) \
ITEM(MUX) \
ITEM(AND) \
ITEM(iC0) \
ITEM(iC1) \
ITEM(iPI) \
ITEM(iFF) \
ITEM(iXOR) \
ITEM(iMUX) \
ITEM(iAND) \
ITEM(iANDn) \
ITEM(iANDp) \
ITEM(oPO) \
ITEM(oFF) \
ITEM(oXOR) \
ITEM(oMUXc) \
ITEM(oMUXd) \
ITEM(oAND) \
ITEM(oANDn) \
ITEM(oANDp) \
ITEM(GIA_END)
@ AND
Definition ltl_parser.c:32

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

Synopsis [Compute one-level TFI/TFO structural signatures.]

Description []

SideEffects []

SeeAlso []

Definition at line 753 of file giaMuxes.c.

753#define GIA_FOREACH_ITEM(ITEM) \
754 ITEM(C0) \
755 ITEM(PO) \
756 ITEM(PI) \
757 ITEM(FF) \
758 ITEM(XOR) \
759 ITEM(MUX) \
760 ITEM(AND) \
761 ITEM(iC0) \
762 ITEM(iC1) \
763 ITEM(iPI) \
764 ITEM(iFF) \
765 ITEM(iXOR) \
766 ITEM(iMUX) \
767 ITEM(iAND) \
768 ITEM(iANDn) \
769 ITEM(iANDp) \
770 ITEM(oPO) \
771 ITEM(oFF) \
772 ITEM(oXOR) \
773 ITEM(oMUXc) \
774 ITEM(oMUXd) \
775 ITEM(oAND) \
776 ITEM(oANDn) \
777 ITEM(oANDp) \
778 ITEM(GIA_END)

Typedef Documentation

◆ Mux_Man_t

typedef struct Mux_Man_t_ Mux_Man_t

Definition at line 563 of file giaMuxes.c.

Enumeration Type Documentation

◆ Gia_ObjType_t

Enumerator
GIA_FOREACH_ITEM 

Definition at line 781 of file giaMuxes.c.

#define GIA_FOREACH_ITEM(ITEM)
Definition giaMuxes.c:753
Gia_ObjType_t
Definition giaMuxes.c:781
#define GENERATE_ENUM(ENUM)
Definition giaMuxes.c:780

Function Documentation

◆ Gia_ManCofStructure()

Gia_Man_t * Gia_ManCofStructure ( Gia_Man_t * p)

Definition at line 1210 of file giaMuxes.c.

1211{
1212 Gia_Man_t * pNew = NULL;
1214 Vec_Wec_t * vCfs = vIns ? Gia_ManFindCofs( p, vIns, &pNew ) : NULL;
1215 Vec_Int_t * vMap = vCfs ? Gia_ManFindEquivClasses( vCfs ) : NULL;
1216 if ( vMap && Abc_Base2Log(Vec_IntFindMax(vMap)+1) < Vec_IntSize(vIns) )
1217 {
1218 Gia_Man_t * pTemp;
1219 Gia_ManFindDerive( pNew, Gia_ManCoNum(p), vIns, vCfs, vMap );
1220 pNew = Gia_ManCleanup( pTemp = pNew );
1221 Gia_ManStop( pTemp );
1222 }
1223 else
1224 Gia_ManStopP( &pNew );
1225 Vec_WecFreeP( &vCfs );
1226 Vec_IntFreeP( &vMap );
1227 Vec_IntFreeP( &vIns );
1228 return pNew;
1229}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
void Gia_ManFindDerive(Gia_Man_t *pNew, int nOuts, Vec_Int_t *vIns, Vec_Wec_t *vCofs, Vec_Int_t *vMap)
Definition giaMuxes.c:1155
Vec_Int_t * Gia_ManFindEquivClasses(Vec_Wec_t *vCofs)
Definition giaMuxes.c:1125
Vec_Wec_t * Gia_ManFindCofs(Gia_Man_t *p, Vec_Int_t *vRes, Gia_Man_t **ppNew)
Definition giaMuxes.c:1094
Vec_Int_t * Gia_ManFindSharedInputs(Gia_Man_t *p)
Definition giaMuxes.c:1072
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
void Gia_ManStopP(Gia_Man_t **p)
Definition giaMan.c:224
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:

◆ Gia_ManCountMuxXor()

ABC_NAMESPACE_IMPL_START void Gia_ManCountMuxXor ( Gia_Man_t * p,
int * pnMuxes,
int * pnXors )

DECLARATIONS ///.

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

FileName [giaMuxes.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Multiplexer profiling algorithm.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Counts XORs and MUXes.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file giaMuxes.c.

50{
51 Gia_Obj_t * pObj, * pFan0, * pFan1; int i;
52 *pnMuxes = *pnXors = 0;
53 Gia_ManForEachAnd( p, pObj, i )
54 {
55 if ( !Gia_ObjIsMuxType(pObj) )
56 continue;
57 if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
58 (*pnXors)++;
59 else
60 (*pnMuxes)++;
61 }
62}
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition giaUtil.c:982
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition giaUtil.c:1018
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCreateXors()

Gia_Man_t * Gia_ManCreateXors ( Gia_Man_t * p)

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

Synopsis [Creates AIG with XORs.]

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file giaMuxes.c.

162{
163 Gia_Man_t * pNew; Gia_Obj_t * pObj, * pFan0, * pFan1;
164 Vec_Int_t * vRefs = Vec_IntStart( Gia_ManObjNum(p) );
165 int i, iLit0, iLit1, nXors = 0, nObjs = 0;
166 Gia_ManForEachObj( p, pObj, i )
167 pObj->fMark0 = 0;
168 Gia_ManForEachAnd( p, pObj, i )
169 {
170 if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
171 {
172 Vec_IntAddToEntry( vRefs, Gia_ObjId(p, Gia_Regular(pFan0)), 1 );
173 Vec_IntAddToEntry( vRefs, Gia_ObjId(p, Gia_Regular(pFan1)), 1 );
174 pObj->fMark0 = 1;
175 nXors++;
176 }
177 else
178 {
179 Vec_IntAddToEntry( vRefs, Gia_ObjFaninId0(pObj, i), 1 );
180 Vec_IntAddToEntry( vRefs, Gia_ObjFaninId1(pObj, i), 1 );
181 }
182 }
183 Gia_ManForEachCo( p, pObj, i )
184 Vec_IntAddToEntry( vRefs, Gia_ObjFaninId0p(p, pObj), 1 );
185 Gia_ManForEachAnd( p, pObj, i )
186 nObjs += Vec_IntEntry(vRefs, i) > 0;
187 pNew = Gia_ManStart( 1 + Gia_ManCiNum(p) + Gia_ManCoNum(p) + nObjs );
188 pNew->pName = Abc_UtilStrsav( p->pName );
189 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
190 Gia_ManConst0(p)->Value = 0;
191 Gia_ManForEachObj1( p, pObj, i )
192 {
193 if ( Gia_ObjIsCi(pObj) )
194 pObj->Value = Gia_ManAppendCi( pNew );
195 else if ( Gia_ObjIsCo(pObj) )
196 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
197 else if ( Gia_ObjIsBuf(pObj) )
198 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
199 else if ( pObj->fMark0 )
200 {
201 Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1);
202 iLit0 = Abc_LitNotCond( Gia_Regular(pFan0)->Value, Gia_IsComplement(pFan0) );
203 iLit1 = Abc_LitNotCond( Gia_Regular(pFan1)->Value, Gia_IsComplement(pFan1) );
204 pObj->Value = Gia_ManAppendXorReal( pNew, iLit0, iLit1 );
205 }
206 else if ( Vec_IntEntry(vRefs, i) > 0 )
207 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
208 }
209 assert( pNew->nObjs == pNew->nObjsAlloc );
210 pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjs );
211 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
212 Vec_IntFree( vRefs );
213 //printf( "Created %d XORs.\n", nXors );
214 return pNew;
215}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
unsigned * pMuxes
Definition gia.h:106
char * pSpec
Definition gia.h:100
int nObjsAlloc
Definition gia.h:104
char * pName
Definition gia.h:99
int nObjs
Definition gia.h:103
unsigned Value
Definition gia.h:89
unsigned fMark0
Definition gia.h:81
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Gia_ManDupMuxes()

Gia_Man_t * Gia_ManDupMuxes ( Gia_Man_t * p,
int Limit )

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

Synopsis [Derives GIA with MUXes.]

Description [Create MUX if the sum of fanin references does not exceed limit.]

SideEffects []

SeeAlso []

Definition at line 98 of file giaMuxes.c.

99{
100 Gia_Man_t * pNew, * pTemp;
101 Gia_Obj_t * pObj, * pFan0, * pFan1, * pFanC, * pSiblNew, * pObjNew;
102 int i;
103 assert( p->pMuxes == NULL );
104 assert( Limit >= 0 ); // allows to create AIG with XORs without MUXes
105 ABC_FREE( p->pRefs );
107 // start the new manager
108 pNew = Gia_ManStart( Gia_ManObjNum(p) );
109 pNew->pName = Abc_UtilStrsav( p->pName );
110 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
111 pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
112 if ( Gia_ManHasChoices(p) )
113 pNew->pSibls = ABC_CALLOC( int, pNew->nObjsAlloc );
114 Gia_ManConst0(p)->Value = 0;
115 Gia_ManHashStart( pNew );
116 Gia_ManForEachObj1( p, pObj, i )
117 {
118 if ( Gia_ObjIsCi(pObj) )
119 pObj->Value = Gia_ManAppendCi( pNew );
120 else if ( Gia_ObjIsCo(pObj) )
121 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
122 else if ( Gia_ObjIsBuf(pObj) )
123 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
124 else if ( !Gia_ObjIsMuxType(pObj) || Gia_ObjSibl(p, Gia_ObjFaninId0(pObj, i)) || Gia_ObjSibl(p, Gia_ObjFaninId1(pObj, i)) )
125 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
126 else if ( Gia_ObjRecognizeExor(pObj, &pFan0, &pFan1) )
127 pObj->Value = Gia_ManHashXorReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)) );
128 else if ( Gia_ObjRefNum(p, Gia_ObjFanin0(pObj)) + Gia_ObjRefNum(p, Gia_ObjFanin1(pObj)) > Limit )
129 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
130 else
131 {
132 pFanC = Gia_ObjRecognizeMux( pObj, &pFan1, &pFan0 );
133 pObj->Value = Gia_ManHashMuxReal( pNew, Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFanC)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan1)), Gia_ObjLitCopy(p, Gia_ObjToLit(p, pFan0)) );
134 }
135 if ( !Gia_ObjSibl(p, i) )
136 continue;
137 pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->Value) );
138 pSiblNew = Gia_ManObj( pNew, Abc_Lit2Var(Gia_ObjSiblObj(p, i)->Value) );
139 if ( Gia_ObjIsAnd(pObjNew) && Gia_ObjIsAnd(pSiblNew) && Gia_ObjId(pNew, pObjNew) > Gia_ObjId(pNew, pSiblNew) )
140 pNew->pSibls[Gia_ObjId(pNew, pObjNew)] = Gia_ObjId(pNew, pSiblNew);
141 }
142 Gia_ManHashStop( pNew );
143 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
144 // perform cleanup
145 pNew = Gia_ManCleanup( pTemp = pNew );
146 Gia_ManStop( pTemp );
147 return pNew;
148}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition giaUtil.c:1056
int Gia_ManHashMuxReal(Gia_Man_t *p, int iLitC, int iLit1, int iLit0)
Definition giaHash.c:521
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
int Gia_ManHashXorReal(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:469
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
int * pSibls
Definition gia.h:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDupMuxesTest()

Gia_Man_t * Gia_ManDupMuxesTest ( Gia_Man_t * p)

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

Synopsis [Test these procedures.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file giaMuxes.c.

275{
276 Gia_Man_t * pNew, * pNew2;
277 pNew = Gia_ManDupMuxes( p, 2 );
278 pNew2 = Gia_ManDupNoMuxes( pNew, 0 );
279 Gia_ManPrintStats( p, NULL );
280 Gia_ManPrintStats( pNew, NULL );
281 Gia_ManPrintStats( pNew2, NULL );
282 Gia_ManStop( pNew );
283// Gia_ManStop( pNew2 );
284 return pNew2;
285}
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
Definition giaMuxes.c:98
Gia_Man_t * Gia_ManDupNoMuxes(Gia_Man_t *p, int fSkipBufs)
Definition giaMuxes.c:228
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition giaMan.c:495
Here is the call graph for this function:

◆ Gia_ManDupMuxRestructure()

Gia_Man_t * Gia_ManDupMuxRestructure ( Gia_Man_t * p)

Definition at line 354 of file giaMuxes.c.

355{
356 Gia_Man_t * pTemp, * pNew = Gia_ManDupMuxes( p, 2 );
357 pNew = Gia_ManMuxRestructure( pTemp = pNew ); Gia_ManStop( pTemp );
358 pNew = Gia_ManDupNoMuxes( pTemp = pNew, 0 ); Gia_ManStop( pTemp );
359 return pNew;
360}
Gia_Man_t * Gia_ManMuxRestructure(Gia_Man_t *p)
Definition giaMuxes.c:299
Here is the call graph for this function:

◆ Gia_ManDupNoMuxes()

Gia_Man_t * Gia_ManDupNoMuxes ( Gia_Man_t * p,
int fSkipBufs )

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

Synopsis [Derives GIA without MUXes.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file giaMuxes.c.

229{
230 Gia_Man_t * pNew, * pTemp;
231 Gia_Obj_t * pObj;
232 int i;
233 assert( p->pMuxes != NULL || Gia_ManXorNum(p) );
234 // start the new manager
235 pNew = Gia_ManStart( 5000 );
236 pNew->pName = Abc_UtilStrsav( p->pName );
237 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
238 Gia_ManConst0(p)->Value = 0;
239 Gia_ManHashStart( pNew );
240 Gia_ManForEachObj1( p, pObj, i )
241 {
242 if ( Gia_ObjIsCi(pObj) )
243 pObj->Value = Gia_ManAppendCi( pNew );
244 else if ( Gia_ObjIsCo(pObj) )
245 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
246 else if ( Gia_ObjIsBuf(pObj) )
247 pObj->Value = fSkipBufs ? Gia_ObjFanin0Copy(pObj) : Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
248 else if ( Gia_ObjIsMuxId(p, i) )
249 pObj->Value = Gia_ManHashMux( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
250 else if ( Gia_ObjIsXor(pObj) )
251 pObj->Value = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
252 else
253 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
254 }
255 Gia_ManHashStop( pNew );
256 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
257 // perform cleanup
258 pNew = Gia_ManCleanup( pTemp = pNew );
259 Gia_ManStop( pTemp );
260 return pNew;
261}
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManEncodeFanin()

int Gia_ManEncodeFanin ( Gia_Man_t * p,
int iLit )

Definition at line 816 of file giaMuxes.c.

817{
818 Gia_Obj_t * pObj = Gia_ManObj( p, Abc_Lit2Var(iLit) );
819 if ( Gia_ObjIsConst0(pObj) )
820 return iC0;
821 if ( Gia_ObjIsPi(p, pObj) )
822 return iPI;
823 if ( Gia_ObjIsCi(pObj) )
824 return iFF;
825 if ( Gia_ObjIsXor(pObj) )
826 return iXOR;
827 if ( Gia_ObjIsMux(p, pObj) )
828 return iMUX;
829 assert( Gia_ObjIsAnd(pObj) );
830 return iAND;
831// if ( Abc_LitIsCompl(iLit) )
832// return iANDn;
833// else
834// return iANDp;
835}
Here is the caller graph for this function:

◆ Gia_ManEncodeFanout()

Gia_ObjType_t Gia_ManEncodeFanout ( Gia_Man_t * p,
Gia_Obj_t * pObj,
int i )

Definition at line 837 of file giaMuxes.c.

838{
839// int iLit;
840 if ( Gia_ObjIsPo(p, pObj) )
841 return oPO;
842 if ( Gia_ObjIsCo(pObj) )
843 return oFF;
844 if ( Gia_ObjIsXor(pObj) )
845 return oXOR;
846 if ( Gia_ObjIsMux(p, pObj) )
847 return i == 2 ? oMUXc : oMUXd;
848 assert( Gia_ObjIsAnd(pObj) );
849 return oAND;
850// iLit = i ? Gia_ObjFaninLit1p(p, pObj) : Gia_ObjFaninLit0p(p, pObj);
851// if ( Abc_LitIsCompl(iLit) )
852// return oANDn;
853// else
854// return oANDp;
855}
Here is the caller graph for this function:

◆ Gia_ManEncodeObj()

int Gia_ManEncodeObj ( Gia_Man_t * p,
int i )

Definition at line 796 of file giaMuxes.c.

797{
798 Gia_Obj_t * pObj = Gia_ManObj( p, i );
799 assert( !Gia_ObjIsRi(p, pObj) );
800 if ( Gia_ObjIsConst0(pObj) )
801 return C0;
802 if ( Gia_ObjIsPo(p, pObj) )
803 return PO;
804 if ( Gia_ObjIsPi(p, pObj) )
805 return PI;
806 if ( Gia_ObjIsCi(pObj) )
807 return FF;
808 if ( Gia_ObjIsXor(pObj) )
809 return XOR;
810 if ( Gia_ObjIsMux(p, pObj) )
811 return MUX;
812 assert( Gia_ObjIsAnd(pObj) );
813 return AND;
814}
@ XOR
Definition rrrTypes.h:14
@ PI
Definition rrrTypes.h:11
@ PO
Definition rrrTypes.h:12
Here is the caller graph for this function:

◆ Gia_ManFindCofs()

Vec_Wec_t * Gia_ManFindCofs ( Gia_Man_t * p,
Vec_Int_t * vRes,
Gia_Man_t ** ppNew )

Definition at line 1094 of file giaMuxes.c.

1095{
1096 Gia_Obj_t * pObj;
1097 Vec_Wec_t * vCofs = Vec_WecStart( 1 << Vec_IntSize(vRes) );
1098 int Value, i, m, nMints = 1 << Vec_IntSize(vRes);
1099 Gia_Man_t * pNew = Gia_ManStart( Gia_ManObjNum(p) );
1100 pNew->pName = Abc_UtilStrsav( p->pName );
1101 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1102 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1103 Gia_ManHashAlloc( pNew );
1105 Gia_ManConst0(p)->Value = 0;
1106 assert( Vec_IntSize(vRes) < Gia_ManCiNum(p) );
1107 Gia_ManForEachCi( p, pObj, i )
1108 pObj->Value = Gia_ManAppendCi(pNew);
1109 for ( m = 0; m < nMints; m++ )
1110 {
1111 Vec_Int_t * vLayer = Vec_WecEntry( vCofs, m );
1112 Vec_IntForEachEntry( vRes, Value, i )
1113 Gia_ManCi(p, Value)->Value = (unsigned)((m >> i) & 1);
1114 Gia_ManForEachAnd( p, pObj, i )
1115 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1116 Gia_ManForEachCo( p, pObj, i )
1117 Vec_IntPush( vLayer, Gia_ObjFanin0Copy(pObj) );
1118 assert( Vec_IntSize(vLayer) == Gia_ManCoNum(p) );
1119 //printf( "%3d : ", m ); Vec_IntPrint( vLayer );
1120 }
1121 if ( ppNew != NULL )
1122 *ppNew = pNew;
1123 return vCofs;
1124}
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
#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_ManFindDerive()

void Gia_ManFindDerive ( Gia_Man_t * pNew,
int nOuts,
Vec_Int_t * vIns,
Vec_Wec_t * vCofs,
Vec_Int_t * vMap )

Definition at line 1155 of file giaMuxes.c.

1156{
1157 extern int Kit_TruthToGia( Gia_Man_t * pMan, unsigned * pTruth, int nVars, Vec_Int_t * vMemory, Vec_Int_t * vLeaves, int fHash );
1158 Vec_Int_t * vMemory = Vec_IntAlloc( 1 << 16 );
1159 Vec_Int_t * vLeaves = Vec_IntAlloc( 100 );
1160 Vec_Int_t * vUsed = Vec_IntStart( Vec_WecSize(vCofs) );
1161 Vec_Int_t * vBits = Vec_IntAlloc( 10 );
1162 Vec_Int_t * vData = Vec_IntAlloc( Vec_WecSize(vCofs) );
1163 int nWords = Abc_TtWordNum(Vec_IntSize(vIns));
1164 word * pTruth = ABC_ALLOC( word, nWords );
1165 int nValues = Vec_IntFindMax(vMap)+1;
1166 int i, k, Value, nBits = Abc_Base2Log(nValues);
1167 assert( nBits < Vec_IntSize(vIns) );
1168 assert( Vec_IntSize(vMap) == Vec_WecSize(vCofs) );
1169 assert( Vec_IntSize(vMap) == (1 << Vec_IntSize(vIns)) );
1170 Vec_IntForEachEntry( vIns, Value, i )
1171 Vec_IntPush( vLeaves, Gia_ObjToLit(pNew, Gia_ManCi(pNew, Value)) );
1172 for ( i = 0; i < nBits; i++ )
1173 {
1174 Abc_TtClear( pTruth, nWords );
1175 Vec_IntForEachEntry( vMap, Value, k )
1176 if ( (Value >> i) & 1 )
1177 Abc_TtSetBit( pTruth, k );
1178 if ( nBits < 6 )
1179 pTruth[0] = Abc_Tt6Stretch( pTruth[0], Vec_IntSize(vIns) );
1180 Vec_IntPush( vBits, Kit_TruthToGia(pNew, (unsigned*)pTruth, Vec_IntSize(vIns), vMemory, vLeaves, 1) );
1181 //printf( "Bit %d : ", i ); Dau_DsdPrintFromTruth( pTruth, Vec_IntSize(vIns) );
1182 }
1183 for ( i = 0; i < nValues; i++ )
1184 {
1185 int Cof = Vec_IntFind(vMap, i);
1186 assert( Cof >= 0 && Cof < Vec_WecSize(vCofs) );
1187 Vec_IntWriteEntry( vUsed, Cof, 1 );
1188 }
1189 for ( i = 0; i < nOuts; i++ )
1190 {
1191 Vec_Int_t * vLevel;
1192 Vec_IntClear( vData );
1193 Vec_WecForEachLevel( vCofs, vLevel, k )
1194 if ( Vec_IntEntry(vUsed, k) )
1195 Vec_IntPush( vData, Vec_IntEntry(vLevel, i) );
1196 while ( Vec_IntSize(vData) < (1 << nBits) )
1197 Vec_IntPush( vData, 0 );
1198 assert( Vec_IntSize(vData) == (1 << nBits) );
1199 assert( Vec_IntSize(vBits) == nBits );
1200 Value = Gia_ManFindMuxTree_rec( pNew, Vec_IntArray(vBits), Vec_IntSize(vBits), vData, 0 );
1201 Gia_ManAppendCo( pNew, Value );
1202 }
1203 ABC_FREE( pTruth );
1204 Vec_IntFree( vUsed );
1205 Vec_IntFree( vBits );
1206 Vec_IntFree( vData );
1207 Vec_IntFree( vLeaves );
1208 Vec_IntFree( vMemory );
1209}
int nWords
Definition abcNpn.c:127
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
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 Gia_ManFindMuxTree_rec(Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, int Shift)
Definition giaMuxes.c:1146
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFindEquivClasses()

Vec_Int_t * Gia_ManFindEquivClasses ( Vec_Wec_t * vCofs)

Definition at line 1125 of file giaMuxes.c.

1126{
1127 Vec_Int_t * vVec; int i, k, Lev;
1128 Vec_Int_t * vMap = Vec_IntAlloc( Vec_WecSize(vCofs) );
1129 Vec_Int_t * vUnique = Vec_IntAlloc( Vec_WecSize(vCofs) );
1130 Vec_WecForEachLevel( vCofs, vVec, i )
1131 {
1132 Vec_IntForEachEntry( vUnique, Lev, k )
1133 if ( Vec_IntEqual(vVec, Vec_WecEntry(vCofs, Lev)) )
1134 break;
1135 Vec_IntPush( vMap, k );
1136 if ( k == Vec_IntSize(vUnique) )
1137 Vec_IntPush( vUnique, i );
1138 }
1139 //printf( "Found %d equiv clasess.\n", Vec_IntSize(vUnique) );
1140 //Vec_IntPrint( vUnique );
1141 Vec_IntFree( vUnique );
1142 assert( Vec_IntSize(vMap) == Vec_WecSize(vCofs) );
1143 //Vec_IntPrint( vMap );
1144 return vMap;
1145}
Here is the caller graph for this function:

◆ Gia_ManFindMuxTree_rec()

int Gia_ManFindMuxTree_rec ( Gia_Man_t * pNew,
int * pCtrl,
int nCtrl,
Vec_Int_t * vData,
int Shift )

Definition at line 1146 of file giaMuxes.c.

1147{
1148 int iLit0, iLit1;
1149 if ( nCtrl-- == 0 )
1150 return Vec_IntEntry( vData, Shift );
1151 iLit0 = Gia_ManFindMuxTree_rec( pNew, pCtrl, nCtrl, vData, Shift );
1152 iLit1 = Gia_ManFindMuxTree_rec( pNew, pCtrl, nCtrl, vData, Shift + (1<<nCtrl) );
1153 return Gia_ManHashMux( pNew, pCtrl[nCtrl], iLit1, iLit0 );
1154}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFindSharedInputs()

Vec_Int_t * Gia_ManFindSharedInputs ( Gia_Man_t * p)

Definition at line 1072 of file giaMuxes.c.

1073{
1074 Gia_Obj_t * pObj, * pObj2; int i, k, Value;
1075 Vec_Int_t * vRes = Vec_IntStart( Gia_ManCiNum(p) );
1076 Gia_ManForEachCo( p, pObj, i )
1077 {
1079 Gia_ManMarkTfi_rec( p, Gia_ObjFanin0(pObj) );
1080 Gia_ManForEachCi( p, pObj2, k )
1081 if ( Gia_ObjIsTravIdCurrent(p, pObj2) )
1082 Vec_IntAddToEntry( vRes, k, 1 );
1083 }
1084 k = 0;
1085 Vec_IntForEachEntry( vRes, Value, i )
1086 if ( Value == Gia_ManCoNum(p) )
1087 Vec_IntWriteEntry( vRes, k++, i );
1088 Vec_IntShrink( vRes, k );
1089 //printf( "Found %d candidate inputs.\n", Vec_IntSize(vRes) );
1090 if ( Vec_IntSize(vRes) == 0 || Vec_IntSize(vRes) > 10 )
1091 Vec_IntFreeP(&vRes);
1092 return vRes;
1093}
void Gia_ManMarkTfi_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaMuxes.c:1062
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManMarkTfi_rec()

void Gia_ManMarkTfi_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj )

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

Synopsis [Circuit restructuring.]

Description []

SideEffects []

SeeAlso []

Definition at line 1062 of file giaMuxes.c.

1063{
1064 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
1065 return;
1066 Gia_ObjSetTravIdCurrent(p, pObj);
1067 if ( !Gia_ObjIsAnd(pObj) )
1068 return;
1069 Gia_ManMarkTfi_rec( p, Gia_ObjFanin0(pObj) );
1070 Gia_ManMarkTfi_rec( p, Gia_ObjFanin1(pObj) );
1071}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManMuxCompare()

int Gia_ManMuxCompare ( char ** pp1,
char ** pp2 )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 546 of file giaMuxes.c.

547{
548 int Diff = strcmp( *pp1, *pp2 );
549 if ( Diff < 0 )
550 return 1;
551 if ( Diff > 0)
552 return -1;
553 return 0;
554}
int strcmp()
Here is the call graph for this function:

◆ Gia_ManMuxCountOne()

int Gia_ManMuxCountOne ( char * p)

Definition at line 555 of file giaMuxes.c.

556{
557 int Count = 0;
558 for ( ; *p; p++ )
559 Count += (*p == '[');
560 return Count;
561}

◆ Gia_ManMuxProfile()

int Gia_ManMuxProfile ( Mux_Man_t * p,
int fWidth )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 610 of file giaMuxes.c.

611{
612 int i, Entry, Counter, Total;
613 Vec_Int_t * vVec, * vCounts;
614 vCounts = Vec_IntStart( 1000 );
615 if ( fWidth )
616 {
617 Vec_WecForEachLevelStart( p->vTops, vVec, i, 1 )
618 Vec_IntAddToEntry( vCounts, Abc_MinInt(Vec_IntSize(vVec), 999), 1 );
619 }
620 else
621 {
622 for ( i = 1; i < Vec_WecSize(p->vTops); i++ )
623 Vec_IntAddToEntry( vCounts, Abc_MinInt(atoi(Abc_NamStr(p->pNames, i)), 999), 1 );
624 }
625 Total = Vec_IntCountPositive(vCounts);
626 if ( Total == 0 )
627 return 0;
628 printf( "The distribution of MUX tree %s:\n", fWidth ? "widths" : "sizes" );
629 Counter = 0;
630 Vec_IntForEachEntry( vCounts, Entry, i )
631 {
632 if ( !Entry ) continue;
633 if ( ++Counter == 12 )
634 printf( "\n" ), Counter = 0;
635 printf( " %d=%d", i, Entry );
636 }
637 printf( "\nSummary: " );
638 printf( "Max = %d ", Vec_IntFindMax(vCounts) );
639 printf( "Ave = %.2f", 1.0*Vec_IntSum(vCounts)/Total );
640 printf( "\n" );
641 Vec_IntFree( vCounts );
642 return 1;
643}
else
Definition sparse_int.h:55
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition utilNam.c:555
#define Vec_WecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition vecWec.h:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManMuxProfiling()

void Gia_ManMuxProfiling ( Gia_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 656 of file giaMuxes.c.

657{
658 Mux_Man_t * pMan;
659 Gia_Man_t * pNew;
660 Gia_Obj_t * pObj;
661 Vec_Str_t * vStr;
662 Vec_Int_t * vFans, * vVec;
663 int i, Counter, fFound, iStructId, nDigitsId;
664 abctime clk = Abc_Clock();
665
666 pNew = Gia_ManDupMuxes( p, 2 );
667 nDigitsId = Abc_Base10Log( Gia_ManObjNum(pNew) );
668
669 pMan = Mux_ManAlloc( pNew );
670
671 Gia_ManLevelNum( pNew );
672 Gia_ManCreateRefs( pNew );
673 Gia_ManForEachCo( pNew, pObj, i )
674 Gia_ObjRefFanin0Inc( pNew, pObj );
675
676 vStr = Vec_StrAlloc( 1000 );
677 vFans = Gia_ManFirstFanouts( pNew );
678 Gia_ManForEachMux( pNew, pObj, i )
679 {
680 // skip MUXes in the middle of the tree (which have only one MUX fanout)
681 if ( Gia_ObjRefNumId(pNew, i) == 1 && Gia_ObjIsMuxId(pNew, Vec_IntEntry(vFans, i)) )
682 continue;
683 // this node is the root of the MUX structure - create hash key
684 Counter = Gia_MuxStructDump( pNew, i, vStr, 3, nDigitsId );
685 if ( Counter == 1 )
686 continue;
687 iStructId = Abc_NamStrFindOrAdd( pMan->pNames, Vec_StrArray(vStr), &fFound );
688 if ( !fFound )
689 Vec_WecPushLevel( pMan->vTops );
690 assert( Abc_NamObjNumMax(pMan->pNames) == Vec_WecSize(pMan->vTops) );
691 Vec_IntPush( Vec_WecEntry(pMan->vTops, iStructId), i );
692 }
693 Vec_StrFree( vStr );
694 Vec_IntFree( vFans );
695
696 printf( "MUX structure profile for AIG \"%s\":\n", p->pName );
697 printf( "Total MUXes = %d. Total trees = %d. Unique trees = %d. Memory = %.2f MB ",
698 Gia_ManMuxNum(pNew), Vec_WecSizeSize(pMan->vTops), Vec_WecSize(pMan->vTops)-1,
699 1.0*Abc_NamMemUsed(pMan->pNames)/(1<<20) );
700 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
701
702 if ( Gia_ManMuxProfile(pMan, 0) )
703 {
704 Gia_ManMuxProfile( pMan, 1 );
705
706 // short the first ones
707 printf( "The first %d structures: \n", 10 );
708 Vec_WecForEachLevelStartStop( pMan->vTops, vVec, i, 1, Abc_MinInt(Vec_WecSize(pMan->vTops), 10) )
709 {
710 char * pTemp = Abc_NamStr(pMan->pNames, i);
711 printf( "%5d : ", i );
712 printf( "Occur = %4d ", Vec_IntSize(vVec) );
713 printf( "Size = %4d ", atoi(pTemp) );
714 printf( "%s\n", pTemp );
715 }
716
717 // print trees for the first one
718 Counter = 0;
719 Vec_WecForEachLevelStart( pMan->vTops, vVec, i, 1 )
720 {
721 char * pTemp = Abc_NamStr(pMan->pNames, i);
722 if ( Vec_IntSize(vVec) > 5 && atoi(pTemp) > 5 )
723 {
724 int k, Entry;
725 printf( "For example, structure %d has %d MUXes and bit-width %d:\n", i, atoi(pTemp), Vec_IntSize(vVec) );
726 Vec_IntForEachEntry( vVec, Entry, k )
727 Gia_MuxStructPrint( pNew, Entry );
728 if ( ++Counter == 5 )
729 break;
730 }
731 }
732 }
733
734 Mux_ManFree( pMan );
735 Gia_ManStop( pNew );
736}
ABC_INT64_T abctime
Definition abc_global.h:332
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Mux_ManFree(Mux_Man_t *p)
Definition giaMuxes.c:592
void Gia_MuxStructPrint(Gia_Man_t *p, int iObj)
Definition giaMuxes.c:470
int Gia_ManMuxProfile(Mux_Man_t *p, int fWidth)
Definition giaMuxes.c:610
Mux_Man_t * Mux_ManAlloc(Gia_Man_t *pGia)
Definition giaMuxes.c:582
struct Mux_Man_t_ Mux_Man_t
Definition giaMuxes.c:563
int Gia_MuxStructDump(Gia_Man_t *p, int iObj, Vec_Str_t *vStr, int nDigitsNum, int nDigitsId)
Definition giaMuxes.c:521
#define Gia_ManForEachMux(p, pObj, i)
Definition gia.h:1226
Vec_Int_t * Gia_ManFirstFanouts(Gia_Man_t *p)
Definition giaUtil.c:1861
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
Vec_Wec_t * vTops
Definition giaMuxes.c:568
Abc_Nam_t * pNames
Definition giaMuxes.c:567
int Abc_NamMemUsed(Abc_Nam_t *p)
Definition utilNam.c:247
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
int Abc_NamObjNumMax(Abc_Nam_t *p)
Definition utilNam.c:231
#define Vec_WecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
Definition vecWec.h:63
Here is the call graph for this function:

◆ Gia_ManMuxRestructure()

Gia_Man_t * Gia_ManMuxRestructure ( Gia_Man_t * p)

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

Synopsis [Test these procedures.]

Description []

SideEffects []

SeeAlso []

Definition at line 299 of file giaMuxes.c.

300{
301 Gia_Man_t * pNew, * pTemp;
302 Gia_Obj_t * pObj;
303 int i, nNodes = 0;
304 Vec_Bit_t * vUsed = Vec_BitStart( Gia_ManObjNum(p) );
305 assert( !Gia_ManHasChoices(p) );
306 assert( !Gia_ManHasMapping(p) );
307 assert( p->pMuxes != NULL );
308 ABC_FREE( p->pRefs );
310 // start the new manager
311 pNew = Gia_ManStart( Gia_ManObjNum(p) );
312 pNew->pName = Abc_UtilStrsav( p->pName );
313 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
314 pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
315 Gia_ManConst0(p)->Value = 0;
316 Gia_ManHashStart( pNew );
317 Gia_ManForEachObj1( p, pObj, i )
318 {
319 if ( Gia_ObjIsCi(pObj) )
320 pObj->Value = Gia_ManAppendCi( pNew );
321 else if ( Gia_ObjIsCo(pObj) )
322 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
323 else if ( Gia_ObjIsBuf(pObj) )
324 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
325 else if ( Gia_ObjIsMuxId(p, i) &&
326 Gia_ObjIsMuxId(p, Gia_ObjFaninId0(pObj, i)) && !Vec_BitEntry(vUsed, Gia_ObjFaninId0(pObj, i)) &&
327 Gia_ObjIsMuxId(p, Gia_ObjFaninId1(pObj, i)) && !Vec_BitEntry(vUsed, Gia_ObjFaninId1(pObj, i)) &&
328 Gia_ObjFaninId2(p, Gia_ObjFaninId0(pObj, i)) == Gia_ObjFaninId2(p, Gia_ObjFaninId1(pObj, i)) )
329 {
330 Gia_Obj_t * pFan1 = Gia_ObjFanin1(pObj);
331 int Value0 = Gia_ManHashMux( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin2Copy(p, pFan1), Gia_ObjFanin0Copy(pObj) );
332 int Value1 = Gia_ManHashMux( pNew, Value0, Gia_ObjFanin1Copy(pFan1), Gia_ObjFanin0Copy(pFan1) );
333 pObj->Value = Gia_ManHashMux( pNew, Gia_ObjFanin2Copy(p, pObj), Value1, Value0 );
334 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId0(pObj, i), 1 );
335 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId1(pObj, i), 1 );
336 Vec_BitWriteEntry( vUsed, i, 1 );
337 nNodes++;
338 }
339 else if ( Gia_ObjIsMuxId(p, i) )
340 pObj->Value = Gia_ManHashMux( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
341 else if ( Gia_ObjIsXor(pObj) )
342 pObj->Value = Gia_ManHashXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
343 else
344 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
345 }
346 Vec_BitFree( vUsed );
347 Gia_ManHashStop( pNew );
348 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
349 // perform cleanup
350 pNew = Gia_ManCleanup( pTemp = pNew );
351 Gia_ManStop( pTemp );
352 return pNew;
353}
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintMuxStats()

void Gia_ManPrintMuxStats ( Gia_Man_t * p)

Definition at line 63 of file giaMuxes.c.

64{
65 int nAnds, nMuxes, nXors, nTotal;
66 if ( p->pMuxes )
67 {
68 nAnds = Gia_ManAndNotBufNum(p)-Gia_ManXorNum(p)-Gia_ManMuxNum(p);
69 nXors = Gia_ManXorNum(p);
70 nMuxes = Gia_ManMuxNum(p);
71 nTotal = nAnds + 3*nXors + 3*nMuxes;
72 }
73 else
74 {
75 Gia_ManCountMuxXor( p, &nMuxes, &nXors );
76 nAnds = Gia_ManAndNotBufNum(p) - 3*nMuxes - 3*nXors;
77 nTotal = Gia_ManAndNotBufNum(p);
78 }
79 Abc_Print( 1, "stats: " );
80 Abc_Print( 1, "xor =%8d %6.2f %% ", nXors, 300.0*nXors/nTotal );
81 Abc_Print( 1, "mux =%8d %6.2f %% ", nMuxes, 300.0*nMuxes/nTotal );
82 Abc_Print( 1, "and =%8d %6.2f %% ", nAnds, 100.0*nAnds/nTotal );
83 Abc_Print( 1, "obj =%8d ", Gia_ManAndNotBufNum(p) );
84 fflush( stdout );
85}
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
ABC_NAMESPACE_IMPL_START void Gia_ManCountMuxXor(Gia_Man_t *p, int *pnMuxes, int *pnXors)
DECLARATIONS ///.
Definition giaMuxes.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManProfileCollect()

void Gia_ManProfileCollect ( Gia_Man_t * p,
int i,
Vec_Int_t * vCode,
Vec_Int_t * vCodeOffsets,
Vec_Int_t * vArray )

Definition at line 857 of file giaMuxes.c.

858{
859 int k;
860 Vec_IntClear( vArray );
861 for ( k = Vec_IntEntry(vCodeOffsets, i); k < Vec_IntEntry(vCodeOffsets, i+1); k++ )
862 Vec_IntPush( vArray, Vec_IntEntry(vCode, k) );
863}
Here is the caller graph for this function:

◆ Gia_ManProfileHash()

Vec_Int_t * Gia_ManProfileHash ( Gia_Man_t * p,
Vec_Int_t * vCode,
Vec_Int_t * vCodeOffsets )

Definition at line 900 of file giaMuxes.c.

901{
902 Hsh_VecMan_t * pHash;
903 Vec_Int_t * vRes, * vArray;
904 Gia_Obj_t * pObj;
905 int i;
906 vRes = Vec_IntAlloc( Gia_ManObjNum(p) );
907 pHash = Hsh_VecManStart( Gia_ManObjNum(p) );
908 // add empty entry
909 vArray = Vec_IntAlloc( 100 );
910 Hsh_VecManAdd( pHash, vArray );
911 // iterate through the entries
912 Gia_ManForEachObj( p, pObj, i )
913 {
914 Gia_ManProfileCollect( p, i, vCode, vCodeOffsets, vArray );
915 Vec_IntPush( vRes, Hsh_VecManAdd( pHash, vArray ) );
916 }
917 Hsh_VecManStop( pHash );
918 Vec_IntFree( vArray );
919 assert( Vec_IntSize(vRes) == Gia_ManObjNum(p) );
920 return vRes;
921}
void Gia_ManProfileCollect(Gia_Man_t *p, int i, Vec_Int_t *vCode, Vec_Int_t *vCodeOffsets, Vec_Int_t *vArray)
Definition giaMuxes.c:857
struct Hsh_VecMan_t_ Hsh_VecMan_t
Definition vecHsh.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManProfilePrintOne()

void Gia_ManProfilePrintOne ( Gia_Man_t * p,
int i,
Vec_Int_t * vArray )

Definition at line 865 of file giaMuxes.c.

866{
867 Gia_Obj_t * pObj = Gia_ManObj( p, i );
868 int k, nFanins, nFanouts;
869 if ( Gia_ObjIsRi(p, pObj) )
870 return;
871 nFanins = Gia_ObjIsRo(p, pObj) ? 1 : Gia_ObjFaninNum(p, pObj);
872 nFanouts = Gia_ObjFanoutNum(p, pObj);
873
874 printf( "%6d : ", i );
875 for ( k = 0; k < nFanins; k++ )
876 printf( " %5s", GIA_TYPE_STRINGS[Vec_IntEntry(vArray, k + 1)] );
877 for ( ; k < 3; k++ )
878 printf( " %5s", "" );
879 printf( " ->" );
880 printf( " %5s", GIA_TYPE_STRINGS[Vec_IntEntry(vArray, 0)] );
881 printf( " ->" );
882 if ( nFanouts > 0 )
883 {
884 int Count = 1, Prev = Vec_IntEntry(vArray, 1 + nFanins);
885 for ( k = 1; k < nFanouts; k++ )
886 {
887 if ( Prev != Vec_IntEntry(vArray, k + 1 + nFanins) )
888 {
889 printf( " %d x %s", Count, GIA_TYPE_STRINGS[Prev] );
890 Prev = Vec_IntEntry(vArray, k + 1 + nFanins);
891 Count = 0;
892 }
893 Count++;
894 }
895 printf( " %d x %s", Count, GIA_TYPE_STRINGS[Prev] );
896 }
897 printf( "\n" );
898}
Here is the caller graph for this function:

◆ Gia_ManProfileStructures()

void Gia_ManProfileStructures ( Gia_Man_t * p,
int nLimit,
int fVerbose )

Definition at line 1039 of file giaMuxes.c.

1040{
1041 if ( p->pMuxes )
1042 Gia_ManProfileStructuresInt( p, nLimit, fVerbose );
1043 else
1044 {
1045 Gia_Man_t * pNew = Gia_ManDupMuxes( p, 2 );
1046 Gia_ManProfileStructuresInt( pNew, nLimit, fVerbose );
1047 Gia_ManStop( pNew );
1048 }
1049}
void Gia_ManProfileStructuresInt(Gia_Man_t *p, int nLimit, int fVerbose)
Definition giaMuxes.c:924
Here is the call graph for this function:

◆ Gia_ManProfileStructuresInt()

void Gia_ManProfileStructuresInt ( Gia_Man_t * p,
int nLimit,
int fVerbose )

Definition at line 924 of file giaMuxes.c.

925{
926 Vec_Int_t * vRes, * vCount, * vFirst;
927 Vec_Int_t * vCode, * vCodeOffsets, * vArray;
928 Gia_Obj_t * pObj, * pFanout;
929 int i, k, nFanins, nFanouts, * pPerm, nClasses;
930 assert( p->pMuxes );
932 // create fanout codes
933 vArray = Vec_IntAlloc( 100 );
934 vCode = Vec_IntAlloc( 5 * Gia_ManObjNum(p) );
935 vCodeOffsets = Vec_IntAlloc( Gia_ManObjNum(p) );
936 Gia_ManForEachObj( p, pObj, i )
937 {
938 Vec_IntPush( vCodeOffsets, Vec_IntSize(vCode) );
939 if ( Gia_ObjIsRi(p, pObj) )
940 continue;
941 nFanins = Gia_ObjFaninNum(p, pObj);
942 nFanouts = Gia_ObjFanoutNum(p, pObj);
943 Vec_IntPush( vCode, Gia_ManEncodeObj(p, i) );
944 if ( nFanins == 3 )
945 {
946 int iLit = Gia_ObjFaninLit2p(p, pObj);
947 Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Abc_LitRegular(iLit)) );
948 if ( Abc_LitIsCompl(iLit) )
949 {
950 Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) );
951 Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) );
952 }
953 else
954 {
955 Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) );
956 Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) );
957 }
958 }
959 else if ( nFanins == 2 )
960 {
961 int Code0 = Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj));
962 int Code1 = Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj));
963 Vec_IntPush( vCode, Code0 < Code1 ? Code0 : Code1 );
964 Vec_IntPush( vCode, Code0 < Code1 ? Code1 : Code0 );
965 }
966 else if ( nFanins == 1 )
967 Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) );
968 else if ( Gia_ObjIsRo(p, pObj) )
969 Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, Gia_ObjRoToRi(p, pObj))) );
970
971 // add fanouts
972 Vec_IntClear( vArray );
973 Gia_ObjForEachFanoutStatic( p, pObj, pFanout, k )
974 {
975 int Index = Gia_ObjWhatFanin( p, pFanout, pObj );
976 Gia_ObjType_t Type = Gia_ManEncodeFanout( p, pFanout, Index );
977 Vec_IntPush( vArray, Type );
978 }
979 Vec_IntSort( vArray, 0 );
980 Vec_IntAppend( vCode, vArray );
981 }
982 assert( Vec_IntSize(vCodeOffsets) == Gia_ManObjNum(p) );
983 Vec_IntPush( vCodeOffsets, Vec_IntSize(vCode) );
984 // print the results
985 if ( fVerbose )
986 {
987 printf( "Showing TFI/node/TFO structures for all nodes:\n" );
988 Gia_ManForEachObj( p, pObj, i )
989 {
990 Gia_ManProfileCollect( p, i, vCode, vCodeOffsets, vArray );
991 Gia_ManProfilePrintOne( p, i, vArray );
992 }
993 }
994
995 // collect statistics
996 vRes = Gia_ManProfileHash( p, vCode, vCodeOffsets );
997 //Vec_IntPrint( vRes );
998
999 // count how many times each class appears
1000 nClasses = Vec_IntFindMax(vRes) + 1;
1001 vCount = Vec_IntStart( nClasses );
1002 vFirst = Vec_IntStart( nClasses );
1003 Gia_ManForEachObj( p, pObj, i )
1004 {
1005 int Entry = Vec_IntEntry( vRes, i );
1006 if ( Gia_ObjIsRi(p, pObj) )
1007 continue;
1008 if ( Vec_IntEntry(vCount, Entry) == 0 )
1009 Vec_IntWriteEntry( vFirst, Entry, i );
1010 Vec_IntAddToEntry( vCount, Entry, -1 );
1011 }
1012 // sort the counts
1013 pPerm = Abc_MergeSortCost( Vec_IntArray(vCount), Vec_IntSize(vCount) );
1014 printf( "Showing TFI/node/TFO structures that appear more than %d times.\n", nLimit );
1015 for ( i = 0; i < nClasses-1; i++ )
1016 {
1017 if ( nLimit > -Vec_IntEntry(vCount, pPerm[i]) )
1018 break;
1019 printf( "%6d : ", i );
1020 printf( "%6d : ", pPerm[i] );
1021 printf( "Weight =%6d ", -Vec_IntEntry(vCount, pPerm[i]) );
1022 printf( "First obj =" );
1023 // print the object
1024 Gia_ManProfileCollect( p, Vec_IntEntry(vFirst, pPerm[i]), vCode, vCodeOffsets, vArray );
1025 Gia_ManProfilePrintOne( p, Vec_IntEntry(vFirst, pPerm[i]), vArray );
1026 }
1027
1028 // cleanup
1029 ABC_FREE( pPerm );
1030 Vec_IntFree( vRes );
1031 Vec_IntFree( vCount );
1032 Vec_IntFree( vFirst );
1033
1034 Vec_IntFree( vArray );
1035 Vec_IntFree( vCode );
1036 Vec_IntFree( vCodeOffsets );
1038}
int * Abc_MergeSortCost(int *pCosts, int nSize)
Definition utilSort.c:442
Gia_ObjType_t Gia_ManEncodeFanout(Gia_Man_t *p, Gia_Obj_t *pObj, int i)
Definition giaMuxes.c:837
int Gia_ManEncodeFanin(Gia_Man_t *p, int iLit)
Definition giaMuxes.c:816
Vec_Int_t * Gia_ManProfileHash(Gia_Man_t *p, Vec_Int_t *vCode, Vec_Int_t *vCodeOffsets)
Definition giaMuxes.c:900
void Gia_ManProfilePrintOne(Gia_Man_t *p, int i, Vec_Int_t *vArray)
Definition giaMuxes.c:865
int Gia_ManEncodeObj(Gia_Man_t *p, int i)
Definition giaMuxes.c:796
#define Gia_ObjForEachFanoutStatic(p, pObj, pFanout, i)
Definition gia.h:1125
void Gia_ManStaticFanoutStart(Gia_Man_t *p)
Definition giaFanout.c:238
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
Definition giaFanout.c:393
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManProfileStructuresTest()

void Gia_ManProfileStructuresTest ( Gia_Man_t * p)

Definition at line 786 of file giaMuxes.c.

787{
788 int i;
789 for ( i = 0; i < GIA_END; i++ )
790 printf( "%d = %s\n", i, GIA_TYPE_STRINGS[i] );
791}

◆ Gia_MuxDeref()

int Gia_MuxDeref ( Gia_Man_t * p,
int iObj )

Definition at line 405 of file giaMuxes.c.

406{
407 Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
408 assert( Gia_ObjIsMuxId(p, iObj) );
409 return Gia_MuxDeref_rec( p, Gia_ObjFaninId0p(p, pObj) ) +
410 Gia_MuxDeref_rec( p, Gia_ObjFaninId1p(p, pObj) ) +
411 Gia_MuxDeref_rec( p, Gia_ObjFaninId2p(p, pObj) ) + 1;
412}
int Gia_MuxDeref_rec(Gia_Man_t *p, int iObj)
Definition giaMuxes.c:393
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MuxDeref_rec()

int Gia_MuxDeref_rec ( Gia_Man_t * p,
int iObj )

Definition at line 393 of file giaMuxes.c.

394{
395 Gia_Obj_t * pObj;
396 if ( !Gia_ObjIsMuxId(p, iObj) )
397 return 0;
398 pObj = Gia_ManObj( p, iObj );
399 if ( Gia_ObjRefDec(p, pObj) )
400 return 0;
401 return Gia_MuxDeref_rec( p, Gia_ObjFaninId0p(p, pObj) ) +
402 Gia_MuxDeref_rec( p, Gia_ObjFaninId1p(p, pObj) ) +
403 Gia_MuxDeref_rec( p, Gia_ObjFaninId2p(p, pObj) ) + 1;
404}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MuxMffcSize()

int Gia_MuxMffcSize ( Gia_Man_t * p,
int iObj )

Definition at line 413 of file giaMuxes.c.

414{
415 int Count1, Count2;
416 if ( !Gia_ObjIsMuxId(p, iObj) )
417 return 0;
418 Count1 = Gia_MuxDeref( p, iObj );
419 Count2 = Gia_MuxRef( p, iObj );
420 assert( Count1 == Count2 );
421 return Count1;
422}
int Gia_MuxRef(Gia_Man_t *p, int iObj)
Definition giaMuxes.c:385
int Gia_MuxDeref(Gia_Man_t *p, int iObj)
Definition giaMuxes.c:405
Here is the call graph for this function:

◆ Gia_MuxRef()

int Gia_MuxRef ( Gia_Man_t * p,
int iObj )

Definition at line 385 of file giaMuxes.c.

386{
387 Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
388 assert( Gia_ObjIsMuxId(p, iObj) );
389 return Gia_MuxRef_rec( p, Gia_ObjFaninId0p(p, pObj) ) +
390 Gia_MuxRef_rec( p, Gia_ObjFaninId1p(p, pObj) ) +
391 Gia_MuxRef_rec( p, Gia_ObjFaninId2p(p, pObj) ) + 1;
392}
int Gia_MuxRef_rec(Gia_Man_t *p, int iObj)
Definition giaMuxes.c:373
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MuxRef_rec()

int Gia_MuxRef_rec ( Gia_Man_t * p,
int iObj )

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

Synopsis [Returns the size of MUX structure.]

Description []

SideEffects []

SeeAlso []

Definition at line 373 of file giaMuxes.c.

374{
375 Gia_Obj_t * pObj;
376 if ( !Gia_ObjIsMuxId(p, iObj) )
377 return 0;
378 pObj = Gia_ManObj( p, iObj );
379 if ( Gia_ObjRefInc(p, pObj) )
380 return 0;
381 return Gia_MuxRef_rec( p, Gia_ObjFaninId0p(p, pObj) ) +
382 Gia_MuxRef_rec( p, Gia_ObjFaninId1p(p, pObj) ) +
383 Gia_MuxRef_rec( p, Gia_ObjFaninId2p(p, pObj) ) + 1;
384}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MuxStructDump()

int Gia_MuxStructDump ( Gia_Man_t * p,
int iObj,
Vec_Str_t * vStr,
int nDigitsNum,
int nDigitsId )

Definition at line 521 of file giaMuxes.c.

522{
523 int Count1, Count2;
524 assert( Gia_ObjIsMuxId(p, iObj) );
525 Count1 = Gia_MuxDeref( p, iObj );
526 Vec_StrClear( vStr );
527 Vec_StrPrintNumStar( vStr, Count1, nDigitsNum );
528 Gia_MuxStructDump_rec( p, iObj, 1, vStr, nDigitsId );
529 Vec_StrPush( vStr, '\0' );
530 Count2 = Gia_MuxRef( p, iObj );
531 assert( Count1 == Count2 );
532 return Count1;
533}
void Gia_MuxStructDump_rec(Gia_Man_t *p, int iObj, int fFirst, Vec_Str_t *vStr, int nDigitsId)
Definition giaMuxes.c:492
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MuxStructDump_rec()

void Gia_MuxStructDump_rec ( Gia_Man_t * p,
int iObj,
int fFirst,
Vec_Str_t * vStr,
int nDigitsId )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 492 of file giaMuxes.c.

493{
494 Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
495 int iCtrl;
496 if ( !fFirst && (!Gia_ObjIsMuxId(p, iObj) || Gia_ObjRefNumId(p, iObj) > 0) )
497 return;
498 iCtrl = Gia_ObjFaninId2p(p, pObj);
499 Vec_StrPush( vStr, '[' );
500 Vec_StrPush( vStr, '(' );
501 if ( Gia_ObjIsMuxId(p, iCtrl) && Gia_ObjRefNumId(p, iCtrl) == 0 )
502 Gia_MuxStructDump_rec( p, iCtrl, 0, vStr, nDigitsId );
503 else
504 Vec_StrPrintNumStar( vStr, iCtrl, nDigitsId );
505 Vec_StrPush( vStr, ')' );
506 if ( Gia_ObjFaninC2(p, pObj) )
507 {
508 Gia_MuxStructDump_rec( p, Gia_ObjFaninId0p(p, pObj), 0, vStr, nDigitsId );
509 Vec_StrPush( vStr, '|' );
510 Gia_MuxStructDump_rec( p, Gia_ObjFaninId1p(p, pObj), 0, vStr, nDigitsId );
511 Vec_StrPush( vStr, ']' );
512 }
513 else
514 {
515 Gia_MuxStructDump_rec( p, Gia_ObjFaninId1p(p, pObj), 0, vStr, nDigitsId );
516 Vec_StrPush( vStr, '|' );
517 Gia_MuxStructDump_rec( p, Gia_ObjFaninId0p(p, pObj), 0, vStr, nDigitsId );
518 Vec_StrPush( vStr, ']' );
519 }
520}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MuxStructPrint()

void Gia_MuxStructPrint ( Gia_Man_t * p,
int iObj )

Definition at line 470 of file giaMuxes.c.

471{
472 int Count1, Count2;
473 assert( Gia_ObjIsMuxId(p, iObj) );
474 Count1 = Gia_MuxDeref( p, iObj );
475 Gia_MuxStructPrint_rec( p, iObj, 1 );
476 Count2 = Gia_MuxRef( p, iObj );
477 assert( Count1 == Count2 );
478 printf( "\n" );
479}
void Gia_MuxStructPrint_rec(Gia_Man_t *p, int iObj, int fFirst)
Definition giaMuxes.c:435
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_MuxStructPrint_rec()

void Gia_MuxStructPrint_rec ( Gia_Man_t * p,
int iObj,
int fFirst )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 435 of file giaMuxes.c.

436{
437 Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
438 int iCtrl;
439 if ( !fFirst && (!Gia_ObjIsMuxId(p, iObj) || Gia_ObjRefNumId(p, iObj) > 0) )
440 {
441// printf( "%d", iObj );
442 printf( "<%02d>", Gia_ObjLevelId(p, iObj) );
443 return;
444 }
445 iCtrl = Gia_ObjFaninId2p(p, pObj);
446 printf( " [(" );
447 if ( Gia_ObjIsMuxId(p, iCtrl) && Gia_ObjRefNumId(p, iCtrl) == 0 )
448 Gia_MuxStructPrint_rec( p, iCtrl, 0 );
449 else
450 {
451 printf( "%d", iCtrl );
452 printf( "<%d>", Gia_ObjLevelId(p, iCtrl) );
453 }
454 printf( ")" );
455 if ( Gia_ObjFaninC2(p, pObj) )
456 {
457 Gia_MuxStructPrint_rec( p, Gia_ObjFaninId0p(p, pObj), 0 );
458 printf( "|" );
459 Gia_MuxStructPrint_rec( p, Gia_ObjFaninId1p(p, pObj), 0 );
460 printf( "]" );
461 }
462 else
463 {
464 Gia_MuxStructPrint_rec( p, Gia_ObjFaninId1p(p, pObj), 0 );
465 printf( "|" );
466 Gia_MuxStructPrint_rec( p, Gia_ObjFaninId0p(p, pObj), 0 );
467 printf( "]" );
468 }
469}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mux_ManAlloc()

Mux_Man_t * Mux_ManAlloc ( Gia_Man_t * pGia)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 582 of file giaMuxes.c.

583{
584 Mux_Man_t * p;
585 p = ABC_CALLOC( Mux_Man_t, 1 );
586 p->pGia = pGia;
587 p->pNames = Abc_NamStart( 10000, 50 );
588 p->vTops = Vec_WecAlloc( 1000 );
589 Vec_WecPushLevel( p->vTops );
590 return p;
591}
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
Definition utilNam.c:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mux_ManFree()

void Mux_ManFree ( Mux_Man_t * p)

Definition at line 592 of file giaMuxes.c.

593{
594 Abc_NamStop( p->pNames );
595 Vec_WecFree( p->vTops );
596 ABC_FREE( p );
597}
void Abc_NamStop(Abc_Nam_t *p)
Definition utilNam.c:112
Here is the call graph for this function:
Here is the caller graph for this function: