ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaMan.c File Reference
#include <ctype.h>
#include "gia.h"
#include "misc/tim/tim.h"
#include "proof/abs/abs.h"
#include "opt/dar/dar.h"
#include "misc/extra/extra.h"
Include dependency graph for giaMan.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Gia_ManDfsSlacksPrint (Gia_Man_t *p)
 DECLARATIONS ///.
 
Gia_Man_tGia_ManStart (int nObjsMax)
 FUNCTION DEFINITIONS ///.
 
void Gia_ManStop (Gia_Man_t *p)
 
double Gia_ManMemory (Gia_Man_t *p)
 
void Gia_ManStopP (Gia_Man_t **p)
 
void Gia_ManPrintClasses_old (Gia_Man_t *p)
 
void Gia_ManPrintPlacement (Gia_Man_t *p)
 
void Gia_ManPrintTents_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs)
 
void Gia_ManPrintTents (Gia_Man_t *p)
 
void Gia_ManPrintInitClasses (Vec_Int_t *vInits)
 
void Gia_ManPrintChoiceStats (Gia_Man_t *p)
 
int Gia_ManPrintEdges (Gia_Man_t *p)
 
void Gia_ManLogAigStats (Gia_Man_t *p, char *pDumpFile)
 
void Gia_ManPrintStats (Gia_Man_t *p, Gps_Par_t *pPars)
 
void Gia_ManPrintStatsShort (Gia_Man_t *p)
 
void Gia_ManPrintMiterStatus (Gia_Man_t *p)
 
void Gia_ManPrintStatsMiter (Gia_Man_t *p, int fVerbose)
 
void Gia_ManSetRegNum (Gia_Man_t *p, int nRegs)
 
void Gia_ManReportImprovement (Gia_Man_t *p, Gia_Man_t *pNew)
 
void Gia_ManPrintNpnClasses (Gia_Man_t *p)
 
void Gia_ManDfsCollect_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs)
 
Vec_Int_tGia_ManDfsCollect (Gia_Man_t *p)
 
Vec_Int_tGia_ManDfsArrivals (Gia_Man_t *p, Vec_Int_t *vObjs)
 
Vec_Int_tGia_ManDfsRequireds (Gia_Man_t *p, Vec_Int_t *vObjs, int ReqTime)
 
Vec_Int_tGia_ManDfsSlacks (Gia_Man_t *p)
 
void Gia_ManWriteNamesInter (FILE *pFile, char c, int n, int Start, int Skip, int nRegs, int fReverse)
 
void Gia_ManDumpModuleName (FILE *pFile, char *pName)
 
void Gia_ManDumpInterface2 (Gia_Man_t *p, FILE *pFile)
 
Vec_Bit_tGia_ManGenUsed (Gia_Man_t *p, int fBuf)
 
int Gia_ManNameIsLegalInVerilog (char *pName)
 
char * Gia_ObjGetDumpName (Vec_Ptr_t *vNames, char c, int i, int d)
 
void Gia_ManWriteNames (FILE *pFile, char c, int n, Vec_Ptr_t *vNames, int Start, int Skip, Vec_Bit_t *vObjs, int fReverse)
 
void Gia_ManDumpVerilog (Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign, int fReverse)
 
void Gia_ManDumpVerilogNoInter (Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
 
void Gia_ManDumpVerilogNoInterAssign (Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
 
void Gia_ManPrintOneName (FILE *pFile, char *pName, int Size)
 
int Gia_ManCountSymbs (char *pName)
 
int Gia_ManReadRangeNum (char *pName, int Size)
 
Vec_Int_tGia_ManCountSymbsAll (Vec_Ptr_t *vNames)
 
void Gia_ManDumpIoList (Gia_Man_t *p, FILE *pFile, int fOuts, int fReverse)
 
void Gia_ManDumpIoRanges (Gia_Man_t *p, FILE *pFile, int fOuts)
 
void Gia_ManDumpInterface (Gia_Man_t *p, char *pFileName)
 
void Gia_ManDumpInterfaceAssign (Gia_Man_t *p, char *pFileName)
 
void Gia_ManDumpNandLit (FILE *pFile, int nIns, int Lit, int nDigits)
 
void Gia_ManDumpVerilogNand (Gia_Man_t *p, char *pFileName)
 
void Gia_FreeMany (Gia_Man_t **pGias, int nGias)
 
void Gia_GenSandwich (char **pFNames, int nFNames, char *pFileName)
 
void Gia_GenPutOnTopOne (Gia_Man_t *pNew, Gia_Man_t *p, Vec_Int_t *vLits)
 
Gia_Man_tGia_GenPutOnTop (char **pFNames, int nFNames)
 

Function Documentation

◆ Gia_FreeMany()

void Gia_FreeMany ( Gia_Man_t ** pGias,
int nGias )

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

Synopsis [Generate hierarchical design.]

Description []

SideEffects []

SeeAlso []

Definition at line 2227 of file giaMan.c.

2228{
2229 int i;
2230 for ( i = 0; i < nGias; i++ )
2231 Gia_ManStopP( &pGias[i] );
2232}
void Gia_ManStopP(Gia_Man_t **p)
Definition giaMan.c:224
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_GenPutOnTop()

Gia_Man_t * Gia_GenPutOnTop ( char ** pFNames,
int nFNames )

Definition at line 2322 of file giaMan.c.

2323{
2324 Gia_Man_t * pNew, * pTemp;
2325 Gia_Man_t * pGias[16] = {0};
2326 Vec_Int_t * vLits;
2327 int i, iLit, nObjs = 0;
2328 assert( nFNames <= 16 );
2329 for ( i = 0; i < nFNames; i++ )
2330 {
2331 FILE * pFile = fopen( pFNames[i], "rb" );
2332 if ( pFile == NULL ) {
2333 printf( "Cannot open input file \"%s\".\n", pFNames[i] );
2334 Gia_FreeMany( pGias, nFNames );
2335 return NULL;
2336 }
2337 fclose( pFile );
2338 pGias[i] = Gia_AigerRead( pFNames[i], 0, 0, 0 );
2339 if ( pGias[i] == NULL ) {
2340 printf( "Failed to read an AIG from file \"%s\".\n", pFNames[i] );
2341 Gia_FreeMany( pGias, nFNames );
2342 return NULL;
2343 }
2344 nObjs += Gia_ManObjNum(pGias[i]);
2345 }
2346 // start new AIG
2347 pNew = Gia_ManStart( nObjs );
2348 pNew->pName = Abc_UtilStrsav( "putontop" );
2349 Gia_ManHashAlloc( pNew );
2350 // collect inputs
2351 vLits = Vec_IntAlloc( Gia_ManCiNum(pGias[0]) );
2352 for ( i = 0; i < Gia_ManCiNum(pGias[0]); i++ )
2353 Vec_IntPush( vLits, Gia_ManAppendCi(pNew) );
2354 // add parts
2355 for ( i = 0; i < nFNames; i++ )
2356 {
2357 Gia_Man_t * p = pGias[i];
2358 while ( Vec_IntSize(vLits) < Gia_ManCiNum(p) )
2359 Vec_IntPush( vLits, Gia_ManAppendCi(pNew) );
2360 while ( Vec_IntSize(vLits) > Gia_ManCiNum(p) )
2361 Gia_ManAppendCo( pNew, Vec_IntPop(vLits) );
2362 Gia_GenPutOnTopOne( pNew, p, vLits );
2363 }
2364 // create outputs
2365 Vec_IntForEachEntry( vLits, iLit, i )
2366 Gia_ManAppendCo( pNew, iLit );
2367 Vec_IntFree( vLits );
2368 // cleanup
2369 pNew = Gia_ManDupNormalize( pTemp = pNew, 0 );
2370 Gia_ManStop( pTemp );
2371 pNew = Gia_ManCleanup( pTemp = pNew );
2372 Gia_ManStop( pTemp );
2373 return pNew;
2374}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
void Gia_GenPutOnTopOne(Gia_Man_t *pNew, Gia_Man_t *p, Vec_Int_t *vLits)
Definition giaMan.c:2308
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
void Gia_FreeMany(Gia_Man_t **pGias, int nGias)
Definition giaMan.c:2227
Gia_Man_t * Gia_AigerRead(char *pFileName, int fGiaSimple, int fSkipStrash, int fCheck)
Definition giaAiger.c:1017
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
Definition giaTim.c:139
char * pName
Definition gia.h:99
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:

◆ Gia_GenPutOnTopOne()

void Gia_GenPutOnTopOne ( Gia_Man_t * pNew,
Gia_Man_t * p,
Vec_Int_t * vLits )

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

Synopsis [Generate hierarchical design.]

Description []

SideEffects []

SeeAlso []

Definition at line 2308 of file giaMan.c.

2309{
2310 Gia_Obj_t * pObj; int i;
2311 Gia_ManConst0(p)->Value = 0;
2312 assert( Vec_IntSize(vLits) == Gia_ManCiNum(p) );
2313 Gia_ManForEachCi( p, pObj, i )
2314 pObj->Value = Vec_IntEntry(vLits, i);
2315 Gia_ManForEachAnd( p, pObj, i )
2316 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
2317 Vec_IntClear( vLits );
2318 Gia_ManForEachCo( p, pObj, i )
2319 Vec_IntPush( vLits, Gia_ObjFanin0Copy(pObj) );
2320 assert( Vec_IntSize(vLits) == Gia_ManCoNum(p) );
2321}
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_GenSandwich()

void Gia_GenSandwich ( char ** pFNames,
int nFNames,
char * pFileName )

Definition at line 2233 of file giaMan.c.

2234{
2235 FILE * pFile = NULL;
2236 Gia_Man_t * pGias[16] = {0};
2237 int i, k;
2238 assert( nFNames <= 16 );
2239 for ( i = 0; i < nFNames; i++ )
2240 {
2241 FILE * pFile = fopen( pFNames[i], "rb" );
2242 if ( pFile == NULL ) {
2243 printf( "Cannot open input file \"%s\".\n", pFNames[i] );
2244 Gia_FreeMany( pGias, nFNames );
2245 return;
2246 }
2247 fclose( pFile );
2248 pGias[i] = Gia_AigerRead( pFNames[i], 0, 0, 0 );
2249 if ( pGias[i] == NULL ) {
2250 printf( "Failed to read an AIG from file \"%s\".\n", pFNames[i] );
2251 Gia_FreeMany( pGias, nFNames );
2252 return;
2253 }
2254 }
2255 for ( i = 0; i < nFNames-1; i++ )
2256 if ( Gia_ManPoNum(pGias[i]) < Gia_ManPiNum(pGias[i+1]) ) {
2257 printf( "AIG in file \"%s\" has fewer outputs than inputs of AIG in file \"%s\".\n", pFNames[i], pFNames[i+1] );
2258 Gia_FreeMany( pGias, nFNames );
2259 return;
2260 }
2261 pFile = fopen( pFileName, "wb" );
2262 if ( pFile == NULL )
2263 {
2264 printf( "Cannot open output file \"%s\".\n", pFileName );
2265 Gia_FreeMany( pGias, nFNames );
2266 return;
2267 }
2268 fprintf( pFile, "\n" );
2269 for ( i = 0; i < nFNames; i++ )
2270 fprintf( pFile, "`include \"%s\"\n", Extra_FileNameGenericAppend(pGias[i]->pSpec, ".v") );
2271 fprintf( pFile, "\n" );
2272 fprintf( pFile, "module sandwich ( in, out );\n" );
2273 fprintf( pFile, " input [%3d:0] in;\n", Gia_ManPiNum(pGias[0])-1 );
2274 fprintf( pFile, " output [%3d:0] out;\n", Gia_ManPoNum(pGias[nFNames-1])-1 );
2275 fprintf( pFile, " wire [%3d:0] tmp0 = in;\n", Gia_ManPiNum(pGias[0])-1 );
2276 for ( i = 0; i < nFNames; i++ ) {
2277 fprintf( pFile, " wire [%3d:0] tmp%d; ", Gia_ManPoNum(pGias[i])-1, i+1 );
2278 Gia_ManDumpModuleName( pFile, pGias[i]->pName );
2279 fprintf( pFile, "_wrapper" );
2280 for ( k = strlen(pGias[i]->pName); k < 24; k++ )
2281 fprintf( pFile, " " );
2282 fprintf( pFile, " i%d ( tmp%d, tmp%d );\n", i+1, i, i+1 );
2283 }
2284 fprintf( pFile, " assign out = tmp%d;\n", nFNames );
2285 fprintf( pFile, "endmodule\n" );
2286 fclose( pFile );
2287 for ( i = 0; i < nFNames; i++ ) {
2288 Vec_PtrFreeFree( pGias[i]->vNamesIn ); pGias[i]->vNamesIn = NULL;
2289 Vec_PtrFreeFree( pGias[i]->vNamesOut ); pGias[i]->vNamesOut = NULL;
2290 Gia_ManDumpVerilog( pGias[i], Extra_FileNameGenericAppend(pGias[i]->pSpec, ".v"), NULL, 0, 0, 1, 0, 0 );
2291 printf( "Dumped Verilog file \"%s\"\n", Extra_FileNameGenericAppend(pGias[i]->pSpec, ".v") );
2292 }
2293 Gia_FreeMany( pGias, nFNames );
2294 printf( "Dumped hierarchical design into file \"%s\"\n", pFileName );
2295}
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
void Gia_ManDumpModuleName(FILE *pFile, char *pName)
Definition giaMan.c:1290
void Gia_ManDumpVerilog(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign, int fReverse)
Definition giaMan.c:1415
Vec_Ptr_t * vNamesIn
Definition gia.h:181
Vec_Ptr_t * vNamesOut
Definition gia.h:182
int strlen()
Here is the call graph for this function:

◆ Gia_ManCountSymbs()

int Gia_ManCountSymbs ( char * pName)

Definition at line 1811 of file giaMan.c.

1812{
1813 int i;
1814 for ( i = 0; pName[i]; i++ )
1815 if ( pName[i] == '[' )
1816 break;
1817 return i;
1818}
Here is the caller graph for this function:

◆ Gia_ManCountSymbsAll()

Vec_Int_t * Gia_ManCountSymbsAll ( Vec_Ptr_t * vNames)

Definition at line 1826 of file giaMan.c.

1827{
1828 char * pNameLast = (char *)Vec_PtrEntry(vNames, 0), * pName;
1829 int i, nSymbsLast = Gia_ManCountSymbs(pNameLast);
1830 Vec_Int_t * vArray = Vec_IntAlloc( Vec_PtrSize(vNames) * 2 );
1831 Vec_IntPush( vArray, 0 );
1832 Vec_IntPush( vArray, nSymbsLast );
1833 Vec_PtrForEachEntryStart( char *, vNames, pName, i, 1 )
1834 {
1835 int nSymbs = Gia_ManCountSymbs(pName);
1836 if ( nSymbs == nSymbsLast && !strncmp(pName, pNameLast, nSymbsLast) )
1837 continue;
1838 Vec_IntPush( vArray, i );
1839 Vec_IntPush( vArray, nSymbs );
1840 pNameLast = pName;
1841 nSymbsLast = nSymbs;
1842 }
1843 return vArray;
1844}
int Gia_ManCountSymbs(char *pName)
Definition giaMan.c:1811
int strncmp()
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition vecPtr.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDfsArrivals()

Vec_Int_t * Gia_ManDfsArrivals ( Gia_Man_t * p,
Vec_Int_t * vObjs )

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

Synopsis [Compute arrival/required times.]

Description []

SideEffects []

SeeAlso []

Definition at line 1028 of file giaMan.c.

1029{
1030 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
1031 Vec_Int_t * vTimes = Vec_IntStartFull( Gia_ManObjNum(p) );
1032 Gia_Obj_t * pObj; int j, Entry, k, iFan;
1033 Vec_IntWriteEntry( vTimes, 0, 0 );
1034 if ( pManTime )
1035 {
1036 Tim_ManIncrementTravId( pManTime );
1037 Gia_ManForEachCi( p, pObj, j )
1038 if ( j < Tim_ManPiNum(pManTime) )
1039 {
1040 float arrTime = Tim_ManGetCiArrival( pManTime, j );
1041 Vec_IntWriteEntry( vTimes, Gia_ObjId(p, pObj), (int)arrTime );
1042 }
1043 }
1044 else
1045 {
1046 Gia_ManForEachCi( p, pObj, j )
1047 Vec_IntWriteEntry( vTimes, Gia_ObjId(p, pObj), 0 );
1048 }
1049 Vec_IntForEachEntry( vObjs, Entry, j )
1050 {
1051 if ( Entry < 0 ) // box
1052 {
1053 int Time0, iFirst, nTerms, iBox = -Entry-1;
1054 assert( iBox >= 0 );
1055 // set arrivals for box inputs
1056 iFirst = Tim_ManBoxInputFirst( pManTime, iBox );
1057 nTerms = Tim_ManBoxInputNum( pManTime, iBox );
1058 for ( k = 0; k < nTerms; k++ )
1059 {
1060 pObj = Gia_ManCo( p, iFirst + k );
1061 Time0 = Vec_IntEntry( vTimes, Gia_ObjFaninId0p(p, pObj) );
1062 assert( Time0 >= 0 );
1063 Tim_ManSetCoArrival( pManTime, Gia_ObjCioId(pObj), Time0 );
1064 }
1065 // derive arrivals for box outputs
1066 iFirst = Tim_ManBoxOutputFirst( pManTime, iBox );
1067 nTerms = Tim_ManBoxOutputNum( pManTime, iBox );
1068 for ( k = 0; k < nTerms; k++ )
1069 {
1070 pObj = Gia_ManCi( p, iFirst + k );
1071 Time0 = Tim_ManGetCiArrival( pManTime, Gia_ObjCioId(pObj) );
1072 assert( Time0 >= 0 );
1073 Vec_IntWriteEntry( vTimes, Gia_ObjId(p, pObj), Time0 );
1074 }
1075 }
1076 else if ( Entry > 0 ) // node
1077 {
1078 int Time0, Time1, TimeMax = 0;
1079 if ( Gia_ManHasMapping(p) )
1080 {
1081 assert( Gia_ObjIsLut(p, Entry) );
1082 Gia_LutForEachFanin( p, Entry, iFan, k )
1083 {
1084 Time0 = Vec_IntEntry( vTimes, iFan );
1085 assert( Time0 >= 0 );
1086 TimeMax = Abc_MaxInt( TimeMax, Time0 );
1087 }
1088 }
1089 else
1090 {
1091 pObj = Gia_ManObj( p, Entry );
1092 Time0 = Vec_IntEntry( vTimes, Gia_ObjFaninId0(pObj, Entry) );
1093 Time1 = Vec_IntEntry( vTimes, Gia_ObjFaninId1(pObj, Entry) );
1094 assert( Time0 >= 0 && Time1 >= 0 );
1095 TimeMax = Abc_MaxInt( Time0, Time1 );
1096 }
1097 Vec_IntWriteEntry( vTimes, Entry, TimeMax + 10 );
1098 }
1099 else assert( 0 );
1100 }
1101 return vTimes;
1102}
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition gia.h:1161
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:203
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:116
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition timTrav.c:44
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
int Tim_ManPiNum(Tim_Man_t *p)
Definition timMan.c:708
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition timTime.c:174
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition timBox.c:155
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDfsCollect()

Vec_Int_t * Gia_ManDfsCollect ( Gia_Man_t * p)

Definition at line 1005 of file giaMan.c.

1006{
1007 Vec_Int_t * vObjs = Vec_IntAlloc( Gia_ManObjNum(p) );
1008 Gia_Obj_t * pObj; int i;
1010 Gia_ManForEachCo( p, pObj, i )
1011 Gia_ManDfsCollect_rec( p, pObj, vObjs );
1012 Gia_ManForEachCi( p, pObj, i )
1013 Gia_ManDfsCollect_rec( p, pObj, vObjs );
1014 return vObjs;
1015}
void Gia_ManDfsCollect_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs)
Definition giaMan.c:945
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_ManDfsCollect_rec()

void Gia_ManDfsCollect_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vObjs )

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

Synopsis [Collects internal nodes and boxes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 945 of file giaMan.c.

946{
947 if ( Gia_ObjIsTravIdCurrent( p, pObj ) )
948 return;
949 Gia_ObjSetTravIdCurrent( p, pObj );
950 if ( Gia_ObjIsCi(pObj) )
951 {
952 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
953 if ( pManTime )
954 {
955 int i, iFirst, nTerms, iBox;
956 iBox = Tim_ManBoxForCi( pManTime, Gia_ObjCioId(pObj) );
957 if ( iBox >= 0 ) // pObj is a box input
958 {
959 // mark box outputs
960 iFirst = Tim_ManBoxOutputFirst( pManTime, iBox );
961 nTerms = Tim_ManBoxOutputNum( pManTime, iBox );
962 for ( i = 0; i < nTerms; i++ )
963 {
964 pObj = Gia_ManCi( p, iFirst + i );
965 Gia_ObjSetTravIdCurrent( p, pObj );
966 }
967 // traverse box inputs
968 iFirst = Tim_ManBoxInputFirst( pManTime, iBox );
969 nTerms = Tim_ManBoxInputNum( pManTime, iBox );
970 for ( i = 0; i < nTerms; i++ )
971 {
972 pObj = Gia_ManCo( p, iFirst + i );
973 Gia_ManDfsCollect_rec( p, pObj, vObjs );
974 }
975 // save the box
976 Vec_IntPush( vObjs, -iBox-1 );
977 }
978 }
979 return;
980 }
981 else if ( Gia_ObjIsCo(pObj) )
982 {
983 Gia_ManDfsCollect_rec( p, Gia_ObjFanin0(pObj), vObjs );
984 }
985 else if ( Gia_ObjIsAnd(pObj) )
986 {
987 int iFan, k, iObj = Gia_ObjId(p, pObj);
988 if ( Gia_ManHasMapping(p) )
989 {
990 assert( Gia_ObjIsLut(p, iObj) );
991 Gia_LutForEachFanin( p, iObj, iFan, k )
992 Gia_ManDfsCollect_rec( p, Gia_ManObj(p, iFan), vObjs );
993 }
994 else
995 {
996 Gia_ManDfsCollect_rec( p, Gia_ObjFanin0(pObj), vObjs );
997 Gia_ManDfsCollect_rec( p, Gia_ObjFanin1(pObj), vObjs );
998 }
999 // save the object
1000 Vec_IntPush( vObjs, iObj );
1001 }
1002 else if ( !Gia_ObjIsConst0(pObj) )
1003 assert( 0 );
1004}
int Tim_ManBoxForCi(Tim_Man_t *p, int iCo)
Definition timBox.c:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDfsRequireds()

Vec_Int_t * Gia_ManDfsRequireds ( Gia_Man_t * p,
Vec_Int_t * vObjs,
int ReqTime )

Definition at line 1109 of file giaMan.c.

1110{
1111 Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
1112 Vec_Int_t * vTimes = Vec_IntStartFull( Gia_ManObjNum(p) );
1113 Gia_Obj_t * pObj;
1114 int j, Entry, k, iFan, Req;
1115 Vec_IntWriteEntry( vTimes, 0, 0 );
1116 if ( pManTime )
1117 {
1118 int nCoLimit = Gia_ManCoNum(p) - Tim_ManPoNum(pManTime);
1119 Tim_ManIncrementTravId( pManTime );
1120 //Tim_ManInitPoRequiredAll( pManTime, (float)ReqTime );
1121 Gia_ManForEachCo( p, pObj, j )
1122 if ( j >= nCoLimit )
1123 {
1124 Tim_ManSetCoRequired( pManTime, j, ReqTime );
1125 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0p(p, pObj), ReqTime );
1126 }
1127 }
1128 else
1129 {
1130 Gia_ManForEachCo( p, pObj, j )
1131 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0p(p, pObj), ReqTime );
1132 }
1133 Vec_IntForEachEntryReverse( vObjs, Entry, j )
1134 {
1135 if ( Entry < 0 ) // box
1136 {
1137 int iFirst, nTerms, iBox = -Entry-1;
1138 assert( iBox >= 0 );
1139 // set requireds for box outputs
1140 iFirst = Tim_ManBoxOutputFirst( pManTime, iBox );
1141 nTerms = Tim_ManBoxOutputNum( pManTime, iBox );
1142 for ( k = 0; k < nTerms; k++ )
1143 {
1144 pObj = Gia_ManCi( p, iFirst + k );
1145 Req = Vec_IntEntry( vTimes, Gia_ObjId(p, pObj) );
1146 Req = Req == -1 ? ReqTime : Req; // dangling box output
1147 assert( Req >= 0 );
1148 Tim_ManSetCiRequired( pManTime, Gia_ObjCioId(pObj), Req );
1149 }
1150 // derive requireds for box inputs
1151 iFirst = Tim_ManBoxInputFirst( pManTime, iBox );
1152 nTerms = Tim_ManBoxInputNum( pManTime, iBox );
1153 for ( k = 0; k < nTerms; k++ )
1154 {
1155 pObj = Gia_ManCo( p, iFirst + k );
1156 Req = Tim_ManGetCoRequired( pManTime, Gia_ObjCioId(pObj) );
1157 assert( Req >= 0 );
1158 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0p(p, pObj), Req );
1159 }
1160 }
1161 else if ( Entry > 0 ) // node
1162 {
1163 Req = Vec_IntEntry(vTimes, Entry) - 10;
1164 assert( Req >= 0 );
1165 if ( Gia_ManHasMapping(p) )
1166 {
1167 assert( Gia_ObjIsLut(p, Entry) );
1168 Gia_LutForEachFanin( p, Entry, iFan, k )
1169 Gia_ManDfsUpdateRequired( vTimes, iFan, Req );
1170 }
1171 else
1172 {
1173 pObj = Gia_ManObj( p, Entry );
1174 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId0(pObj, Entry), Req );
1175 Gia_ManDfsUpdateRequired( vTimes, Gia_ObjFaninId1(pObj, Entry), Req );
1176 }
1177 }
1178 else assert( 0 );
1179 }
1180 return vTimes;
1181}
int Tim_ManPoNum(Tim_Man_t *p)
Definition timMan.c:714
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
Definition timTime.c:135
void Tim_ManSetCoRequired(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:154
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition timTime.c:222
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)
Definition vecInt.h:62
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDfsSlacks()

Vec_Int_t * Gia_ManDfsSlacks ( Gia_Man_t * p)

Definition at line 1182 of file giaMan.c.

1183{
1184 Vec_Int_t * vSlack = Vec_IntStartFull( Gia_ManObjNum(p) );
1185 Vec_Int_t * vObjs = Gia_ManDfsCollect( p );
1186 if ( Vec_IntSize(vObjs) > 0 )
1187 {
1188 Vec_Int_t * vArrs = Gia_ManDfsArrivals( p, vObjs );
1189 int Required = Vec_IntFindMax( vArrs );
1190 Vec_Int_t * vReqs = Gia_ManDfsRequireds( p, vObjs, Required );
1191 int i, Arr, Req, Arrivals = ABC_INFINITY;
1192 Vec_IntForEachEntry( vReqs, Req, i )
1193 if ( Req != -1 )
1194 Arrivals = Abc_MinInt( Arrivals, Req );
1195 //if ( Arrivals != 0 )
1196 // printf( "\nGlobal timing check has failed.\n\n" );
1197 //assert( Arrivals == 0 );
1198 Vec_IntForEachEntryTwo( vArrs, vReqs, Arr, Req, i )
1199 {
1200 if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) )
1201 continue;
1202 if ( Gia_ManHasMapping(p) && !Gia_ObjIsLut(p, i) )
1203 continue;
1204 assert( Arr <= Req );
1205 Vec_IntWriteEntry( vSlack, i, Req - Arr );
1206 }
1207 Vec_IntFree( vArrs );
1208 Vec_IntFree( vReqs );
1209 }
1210 Vec_IntFree( vObjs );
1211 return vSlack;
1212}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
Vec_Int_t * Gia_ManDfsArrivals(Gia_Man_t *p, Vec_Int_t *vObjs)
Definition giaMan.c:1028
Vec_Int_t * Gia_ManDfsRequireds(Gia_Man_t *p, Vec_Int_t *vObjs, int ReqTime)
Definition giaMan.c:1109
Vec_Int_t * Gia_ManDfsCollect(Gia_Man_t *p)
Definition giaMan.c:1005
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
Definition vecInt.h:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDfsSlacksPrint()

void Gia_ManDfsSlacksPrint ( Gia_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [giaMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Package manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 1213 of file giaMan.c.

1214{
1215 Vec_Int_t * vCounts, * vSlacks = Gia_ManDfsSlacks( p );
1216 int i, Entry, nRange, nTotal;
1217 if ( Vec_IntSize(vSlacks) == 0 )
1218 {
1219 printf( "Network contains no internal objects.\n" );
1220 Vec_IntFree( vSlacks );
1221 return;
1222 }
1223 // compute slacks
1224 Vec_IntForEachEntry( vSlacks, Entry, i )
1225 if ( Entry != -1 )
1226 Vec_IntWriteEntry( vSlacks, i, Entry/10 );
1227 nRange = Vec_IntFindMax( vSlacks );
1228 // count items
1229 vCounts = Vec_IntStart( nRange + 1 );
1230 Vec_IntForEachEntry( vSlacks, Entry, i )
1231 if ( Entry != -1 )
1232 Vec_IntAddToEntry( vCounts, Entry, 1 );
1233 // print slack ranges
1234 nTotal = Vec_IntSum( vCounts );
1235 assert( nTotal > 0 );
1236 Vec_IntForEachEntry( vCounts, Entry, i )
1237 {
1238 printf( "Slack range %3d = ", i );
1239 printf( "[%4d, %4d) ", 10*i, 10*(i+1) );
1240 printf( "Nodes = %5d ", Entry );
1241 printf( "(%6.2f %%) ", 100.0*Entry/nTotal );
1242 printf( "\n" );
1243 }
1244 Vec_IntFree( vSlacks );
1245 Vec_IntFree( vCounts );
1246}
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
Vec_Int_t * Gia_ManDfsSlacks(Gia_Man_t *p)
Definition giaMan.c:1182
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpInterface()

void Gia_ManDumpInterface ( Gia_Man_t * p,
char * pFileName )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1905 of file giaMan.c.

1906{
1907 Gia_Obj_t * pObj;
1908 Vec_Bit_t * vInvs, * vUsed;
1909 int nDigits = Abc_Base10Log( Gia_ManObjNum(p) );
1910 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(p) );
1911 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(p) );
1912 int i;
1913
1914 FILE * pFile = fopen( pFileName, "wb" );
1915 if ( pFile == NULL )
1916 {
1917 printf( "Cannot open output file \"%s\".\n", pFileName );
1918 return;
1919 }
1920
1921 vInvs = Gia_ManGenUsed( p, 0 );
1922 vUsed = Gia_ManGenUsed( p, 1 );
1923
1924 fprintf( pFile, "module " );
1925 Gia_ManDumpModuleName( pFile, p->pName );
1926 fprintf( pFile, "_wrapper" );
1927 fprintf( pFile, " ( " );
1928 Gia_ManDumpIoList( p, pFile, 0, 0 );
1929 fprintf( pFile, ", " );
1930 Gia_ManDumpIoList( p, pFile, 1, 0 );
1931 fprintf( pFile, " );\n\n" );
1932 Gia_ManDumpIoRanges( p, pFile, 0 );
1933 Gia_ManDumpIoRanges( p, pFile, 1 );
1934 fprintf( pFile, "\n" );
1935
1936 fprintf( pFile, " wire " );
1937 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 8, 4, NULL, 0 );
1938 fprintf( pFile, ";\n\n" );
1939
1940 fprintf( pFile, " wire " );
1941 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 9, 4, NULL, 0 );
1942 fprintf( pFile, ";\n\n" );
1943
1944 fprintf( pFile, " assign { " );
1945 Gia_ManWriteNames( pFile, 'x', Gia_ManCiNum(p), p->vNamesIn, 8, 4, NULL, 1 );
1946 fprintf( pFile, " } = { " );
1947 Gia_ManDumpIoList( p, pFile, 0, 1 );
1948 fprintf( pFile, " };\n\n" );
1949
1950 fprintf( pFile, " assign { " );
1951 Gia_ManDumpIoList( p, pFile, 1, 1 );
1952 fprintf( pFile, " } = { " );
1953 Gia_ManWriteNames( pFile, 'z', Gia_ManCoNum(p), p->vNamesOut, 9, 4, NULL, 1 );
1954 fprintf( pFile, " };\n\n" );
1955
1956 if ( Vec_BitCount(vUsed) )
1957 {
1958 fprintf( pFile, " wire " );
1959 Gia_ManWriteNames( pFile, 'n', Gia_ManObjNum(p), NULL, 7, 4, vUsed, 0 );
1960 fprintf( pFile, ";\n\n" );
1961 }
1962
1963 if ( Vec_BitCount(vInvs) )
1964 {
1965 fprintf( pFile, " wire " );
1966 Gia_ManWriteNames( pFile, 'i', Gia_ManObjNum(p), NULL, 7, 4, vInvs, 0 );
1967 fprintf( pFile, ";\n\n" );
1968 }
1969
1970 // input inverters
1971 Gia_ManForEachCi( p, pObj, i )
1972 {
1973 if ( Vec_BitEntry(vUsed, Gia_ObjId(p, pObj)) )
1974 {
1975 fprintf( pFile, " buf ( %s,", Gia_ObjGetDumpName(NULL, 'n', Gia_ObjId(p, pObj), nDigits) );
1976 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1977 }
1978 if ( Vec_BitEntry(vInvs, Gia_ObjId(p, pObj)) )
1979 {
1980 fprintf( pFile, " not ( %s,", Gia_ObjGetDumpName(NULL, 'i', Gia_ObjId(p, pObj), nDigits) );
1981 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1982 }
1983 }
1984
1985 // internal nodes and their inverters
1986 fprintf( pFile, "\n" );
1987 Gia_ManForEachAnd( p, pObj, i )
1988 {
1989 fprintf( pFile, " and ( %s,", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
1990 fprintf( pFile, " %s,", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
1991 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC1(pObj)? 'i':'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
1992 if ( Vec_BitEntry(vInvs, i) )
1993 {
1994 fprintf( pFile, " not ( %s,", Gia_ObjGetDumpName(NULL, 'i', i, nDigits) );
1995 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
1996 }
1997 }
1998
1999 // output drivers
2000 fprintf( pFile, "\n" );
2001 Gia_ManForEachCo( p, pObj, i )
2002 {
2003 fprintf( pFile, " buf ( %s, ", Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
2004 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
2005 fprintf( pFile, "1\'b%d );\n", Gia_ObjFaninC0(pObj) );
2006 else
2007 fprintf( pFile, "%s );\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0p(p, pObj), nDigits) );
2008 }
2009
2010 fprintf( pFile, "\nendmodule\n\n" );
2011 fclose( pFile );
2012
2013 Vec_BitFree( vInvs );
2014 Vec_BitFree( vUsed );
2015}
Vec_Bit_t * Gia_ManGenUsed(Gia_Man_t *p, int fBuf)
Definition giaMan.c:1343
void Gia_ManWriteNames(FILE *pFile, char c, int n, Vec_Ptr_t *vNames, int Start, int Skip, Vec_Bit_t *vObjs, int fReverse)
Definition giaMan.c:1393
void Gia_ManDumpIoRanges(Gia_Man_t *p, FILE *pFile, int fOuts)
Definition giaMan.c:1867
void Gia_ManDumpIoList(Gia_Man_t *p, FILE *pFile, int fOuts, int fReverse)
Definition giaMan.c:1845
char * Gia_ObjGetDumpName(Vec_Ptr_t *vNames, char c, int i, int d)
Definition giaMan.c:1378
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_ManDumpInterface2()

void Gia_ManDumpInterface2 ( Gia_Man_t * p,
FILE * pFile )

Definition at line 1299 of file giaMan.c.

1300{
1301 int fPrintClk = 0;
1302 fprintf( pFile, "module " );
1303 Gia_ManDumpModuleName( pFile, p->pName );
1304 fprintf( pFile, "_wrapper" );
1305 fprintf( pFile, " (%s i, o );\n\n", fPrintClk && Gia_ManRegNum(p) ? " clk," : "" );
1306 if ( fPrintClk && Gia_ManRegNum(p) )
1307 fprintf( pFile, " input clk;\n" );
1308 fprintf( pFile, " input [%d:0] i;\n", Gia_ManPiNum(p)-1 );
1309 fprintf( pFile, " output [%d:0] o;\n\n", Gia_ManPoNum(p)-1 );
1310
1311 if ( Gia_ManRegNum(p) ) {
1312 fprintf( pFile, " wire [%d:%d] ii;\n", Gia_ManCiNum(p)-1, Gia_ManPiNum(p) );
1313 fprintf( pFile, " wire [%d:%d] oo;\n\n", Gia_ManCoNum(p)-1, Gia_ManPoNum(p) );
1314 fprintf( pFile, " always @ (posedge %s)\n ii <= oo;\n\n", fPrintClk ? "clk" : "i[0]" );
1315 }
1316
1317 fprintf( pFile, " " );
1318 Gia_ManDumpModuleName( pFile, p->pName );
1319 fprintf( pFile, " " );
1320 Gia_ManDumpModuleName( pFile, p->pName );
1321 fprintf( pFile, "_inst" );
1322
1323 fprintf( pFile, " (\n " );
1324 Gia_ManWriteNamesInter( pFile, 'i', Gia_ManCiNum(p), 4, 4, Gia_ManRegNum(p), 0 );
1325 fprintf( pFile, ",\n " );
1326 Gia_ManWriteNamesInter( pFile, 'o', Gia_ManCoNum(p), 4, 4, Gia_ManRegNum(p), 0 );
1327 fprintf( pFile, "\n );\n\n" );
1328
1329 fprintf( pFile, "endmodule\n\n" );
1330}
void Gia_ManWriteNamesInter(FILE *pFile, char c, int n, int Start, int Skip, int nRegs, int fReverse)
Definition giaMan.c:1260
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpInterfaceAssign()

void Gia_ManDumpInterfaceAssign ( Gia_Man_t * p,
char * pFileName )

Definition at line 2016 of file giaMan.c.

2017{
2018 Gia_Obj_t * pObj;
2019 Vec_Bit_t * vInvs, * vUsed;
2020 int nDigits = Abc_Base10Log( Gia_ManObjNum(p) );
2021 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(p) );
2022 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(p) );
2023 int i;
2024
2025 FILE * pFile = fopen( pFileName, "wb" );
2026 if ( pFile == NULL )
2027 {
2028 printf( "Cannot open output file \"%s\".\n", pFileName );
2029 return;
2030 }
2031
2032 vInvs = Gia_ManGenUsed( p, 0 );
2033 vUsed = Gia_ManGenUsed( p, 1 );
2034
2035 fprintf( pFile, "module " );
2036 Gia_ManDumpModuleName( pFile, p->pName );
2037 fprintf( pFile, "_wrapper" );
2038 fprintf( pFile, " ( " );
2039 Gia_ManDumpIoList( p, pFile, 0, 0 );
2040 fprintf( pFile, ", " );
2041 Gia_ManDumpIoList( p, pFile, 1, 0 );
2042 fprintf( pFile, " );\n\n" );
2043 Gia_ManDumpIoRanges( p, pFile, 0 );
2044 Gia_ManDumpIoRanges( p, pFile, 1 );
2045 fprintf( pFile, "\n" );
2046
2047 fprintf( pFile, " wire " );
2048 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 8, 4, NULL, 0 );
2049 fprintf( pFile, ";\n\n" );
2050
2051 fprintf( pFile, " wire " );
2052 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 9, 4, NULL, 0 );
2053 fprintf( pFile, ";\n\n" );
2054
2055 fprintf( pFile, " assign { " );
2056 Gia_ManWriteNames( pFile, 'x', Gia_ManCiNum(p), p->vNamesIn, 8, 4, NULL, 1 );
2057 fprintf( pFile, " } = { " );
2058 Gia_ManDumpIoList( p, pFile, 0, 1 );
2059 fprintf( pFile, " };\n\n" );
2060
2061 fprintf( pFile, " assign { " );
2062 Gia_ManDumpIoList( p, pFile, 1, 1 );
2063 fprintf( pFile, " } = { " );
2064 Gia_ManWriteNames( pFile, 'z', Gia_ManCoNum(p), p->vNamesOut, 9, 4, NULL, 1 );
2065 fprintf( pFile, " };\n\n" );
2066
2067 if ( Vec_BitCount(vUsed) )
2068 {
2069 fprintf( pFile, " wire " );
2070 Gia_ManWriteNames( pFile, 'n', Gia_ManObjNum(p), NULL, 7, 4, vUsed, 0 );
2071 fprintf( pFile, ";\n\n" );
2072 }
2073
2074 if ( Vec_BitCount(vInvs) )
2075 {
2076 fprintf( pFile, " wire " );
2077 Gia_ManWriteNames( pFile, 'i', Gia_ManObjNum(p), NULL, 7, 4, vInvs, 0 );
2078 fprintf( pFile, ";\n\n" );
2079 }
2080
2081 // input inverters
2082 Gia_ManForEachCi( p, pObj, i )
2083 {
2084 if ( Vec_BitEntry(vUsed, Gia_ObjId(p, pObj)) )
2085 {
2086 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'n', Gia_ObjId(p, pObj), nDigits) );
2087 fprintf( pFile, " %s;\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
2088 }
2089 if ( Vec_BitEntry(vInvs, Gia_ObjId(p, pObj)) )
2090 {
2091 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'i', Gia_ObjId(p, pObj), nDigits) );
2092 fprintf( pFile, " ~%s;\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
2093 }
2094 }
2095
2096 // internal nodes and their inverters
2097 fprintf( pFile, "\n" );
2098 Gia_ManForEachAnd( p, pObj, i )
2099 {
2100 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
2101 fprintf( pFile, " %s &", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
2102 fprintf( pFile, " %s;\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC1(pObj)? 'i':'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
2103 if ( Vec_BitEntry(vInvs, i) )
2104 {
2105 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'i', i, nDigits) );
2106 fprintf( pFile, " ~%s;\n", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
2107 }
2108 }
2109
2110 // output drivers
2111 fprintf( pFile, "\n" );
2112 Gia_ManForEachCo( p, pObj, i )
2113 {
2114 fprintf( pFile, " assign %s = ", Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
2115 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
2116 fprintf( pFile, "1\'b%d;\n", Gia_ObjFaninC0(pObj) );
2117 else
2118 fprintf( pFile, "%s;\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0p(p, pObj), nDigits) );
2119 }
2120
2121 fprintf( pFile, "\nendmodule\n\n" );
2122 fclose( pFile );
2123
2124 Vec_BitFree( vInvs );
2125 Vec_BitFree( vUsed );
2126}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpIoList()

void Gia_ManDumpIoList ( Gia_Man_t * p,
FILE * pFile,
int fOuts,
int fReverse )

Definition at line 1845 of file giaMan.c.

1846{
1847 Vec_Ptr_t * vNames = fOuts ? p->vNamesOut : p->vNamesIn;
1848 if ( vNames == NULL )
1849 fprintf( pFile, "_%c_", fOuts ? 'o' : 'i' );
1850 else
1851 {
1852 Vec_Int_t * vArray = Gia_ManCountSymbsAll( vNames );
1853 int iName, Size, i;
1854 Vec_IntForEachEntryDouble( vArray, iName, Size, i )
1855 {
1856 if ( fReverse )
1857 {
1858 iName = Vec_IntEntry(vArray, Vec_IntSize(vArray)-2-i);
1859 Size = Vec_IntEntry(vArray, Vec_IntSize(vArray)-1-i);
1860 }
1861 if ( i ) fprintf( pFile, ", " );
1862 Gia_ManPrintOneName( pFile, (char *)Vec_PtrEntry(vNames, iName), Size );
1863 }
1864 Vec_IntFree( vArray );
1865 }
1866}
void Gia_ManPrintOneName(FILE *pFile, char *pName, int Size)
Definition giaMan.c:1805
Vec_Int_t * Gia_ManCountSymbsAll(Vec_Ptr_t *vNames)
Definition giaMan.c:1826
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpIoRanges()

void Gia_ManDumpIoRanges ( Gia_Man_t * p,
FILE * pFile,
int fOuts )

Definition at line 1867 of file giaMan.c.

1868{
1869 Vec_Ptr_t * vNames = fOuts ? p->vNamesOut : p->vNamesIn;
1870 if ( p->vNamesOut == NULL )
1871 fprintf( pFile, "%s [%d:0] _%c_;\n", fOuts ? "output" : "input", fOuts ? Gia_ManPoNum(p)-1 : Gia_ManPiNum(p)-1, fOuts ? 'o' : 'i' );
1872 else
1873 {
1874 Vec_Int_t * vArray = Gia_ManCountSymbsAll( vNames );
1875 int iName, Size, i;
1876 Vec_IntForEachEntryDouble( vArray, iName, Size, i )
1877 {
1878 int iNameNext = Vec_IntSize(vArray) > i+2 ? Vec_IntEntry(vArray, i+2) : Vec_PtrSize(vNames);
1879 char * pName = (char *)Vec_PtrEntry(vNames, iName);
1880 char * pNameLast = (char *)Vec_PtrEntry(vNames, iNameNext-1);
1881 assert( !strncmp(pName, pNameLast, Size) );
1882 int NumBeg = Gia_ManReadRangeNum( pName, Size );
1883 int NumEnd = Gia_ManReadRangeNum( pNameLast, Size );
1884 fprintf( pFile, " %s ", fOuts ? "output" : "input" );
1885 if ( NumBeg != -1 && iName < iNameNext-1 )
1886 fprintf( pFile, "[%d:%d] ", NumEnd, NumBeg );
1887 Gia_ManPrintOneName( pFile, pName, Size );
1888 fprintf( pFile, ";\n" );
1889 }
1890 Vec_IntFree( vArray );
1891 }
1892}
int Gia_ManReadRangeNum(char *pName, int Size)
Definition giaMan.c:1819
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpModuleName()

void Gia_ManDumpModuleName ( FILE * pFile,
char * pName )

Definition at line 1290 of file giaMan.c.

1291{
1292 int i;
1293 for ( i = 0; i < (int)strlen(pName); i++ )
1294 if ( isalpha(pName[i]) || isdigit(pName[i]) )
1295 fprintf( pFile, "%c", pName[i] );
1296 else
1297 fprintf( pFile, "_" );
1298}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpNandLit()

void Gia_ManDumpNandLit ( FILE * pFile,
int nIns,
int Lit,
int nDigits )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2140 of file giaMan.c.

2141{
2142 if ( Lit == 0 )
2143 fprintf( pFile, "1\'b0" );
2144 else if ( Lit == 1 )
2145 fprintf( pFile, "1\'b1" );
2146 else if ( Abc_Lit2Var(Lit) <= nIns )
2147 fprintf( pFile, "%cn%0*d", (char)(Abc_LitIsCompl(Lit)? '~':' '), nDigits, Abc_Lit2Var(Lit) );
2148 else
2149 fprintf( pFile, "%cn%0*d", (char)(Abc_LitIsCompl(Lit)? ' ':'~'), nDigits, Abc_Lit2Var(Lit) );
2150}
Here is the caller graph for this function:

◆ Gia_ManDumpVerilog()

void Gia_ManDumpVerilog ( Gia_Man_t * p,
char * pFileName,
Vec_Int_t * vObjs,
int fVerBufs,
int fInter,
int fInterComb,
int fAssign,
int fReverse )

Definition at line 1415 of file giaMan.c.

1416{
1417 if ( fInterComb )
1418 {
1419 if ( fAssign ) {
1420 extern void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName );
1421 Gia_ManDumpInterfaceAssign( p, pFileName );
1422 }
1423 else {
1424 extern void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName );
1425 Gia_ManDumpInterface( p, pFileName );
1426 }
1427 }
1428 else
1429 {
1430 if ( fAssign ) {
1431 extern void Gia_ManDumpVerilogNoInterAssign( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter );
1432 Gia_ManDumpVerilogNoInterAssign( p, pFileName, vObjs, fVerBufs, fInter );
1433 }
1434 else {
1435 extern void Gia_ManDumpVerilogNoInter( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter );
1436 Gia_ManDumpVerilogNoInter( p, pFileName, vObjs, fVerBufs, fInter );
1437 }
1438 }
1439}
void Gia_ManDumpVerilogNoInter(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
Definition giaMan.c:1440
void Gia_ManDumpVerilogNoInterAssign(Gia_Man_t *p, char *pFileName, Vec_Int_t *vObjs, int fVerBufs, int fInter)
Definition giaMan.c:1620
void Gia_ManDumpInterfaceAssign(Gia_Man_t *p, char *pFileName)
Definition giaMan.c:2016
void Gia_ManDumpInterface(Gia_Man_t *p, char *pFileName)
Definition giaMan.c:1905
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpVerilogNand()

void Gia_ManDumpVerilogNand ( Gia_Man_t * p,
char * pFileName )

Definition at line 2151 of file giaMan.c.

2152{
2153 Gia_Obj_t * pObj; int i, nPis = Gia_ManPiNum(p);
2154 int nDigits = Abc_Base10Log( Gia_ManObjNum(p) );
2155 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(p) );
2156 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(p) );
2157 FILE * pFile = fopen( pFileName, "wb" );
2158 if ( pFile == NULL )
2159 {
2160 printf( "Cannot open output file \"%s\".\n", pFileName );
2161 return;
2162 }
2163 assert( Gia_ManRegNum(p) == 0 );
2164 fprintf( pFile, "module " );
2165 Gia_ManDumpModuleName( pFile, p->pName );
2166 fprintf( pFile, "_wrapper" );
2167 fprintf( pFile, " ( " );
2168 if ( p->vNamesIn ) {
2169 Gia_ManDumpIoList( p, pFile, 0, 0 );
2170 fprintf( pFile, ", " );
2171 Gia_ManDumpIoList( p, pFile, 1, 0 );
2172 fprintf( pFile, " );\n\n" );
2173 Gia_ManDumpIoRanges( p, pFile, 0 );
2174 Gia_ManDumpIoRanges( p, pFile, 1 );
2175 }
2176 else {
2177 fprintf( pFile, "\n " );
2178 Gia_ManForEachPi( p, pObj, i )
2179 fprintf( pFile, "%s, ", Gia_ObjGetDumpName(NULL, 'x', i, nDigitsI) );
2180 fprintf( pFile, "\n " );
2181 Gia_ManForEachPo( p, pObj, i )
2182 fprintf( pFile, "%s%s ", Gia_ObjGetDumpName(NULL, 'z', i, nDigitsO), i < Gia_ManPoNum(p)-1 ? ",":"" );
2183 fprintf( pFile, "\n);\n\n" );
2184 fprintf( pFile, " input" );
2185 Gia_ManForEachPi( p, pObj, i )
2186 fprintf( pFile, " %s%s", Gia_ObjGetDumpName(NULL, 'x', i, nDigitsI), i < Gia_ManPiNum(p)-1 ? ",":"" );
2187 fprintf( pFile, ";\n" );
2188 fprintf( pFile, " output" );
2189 Gia_ManForEachPo( p, pObj, i )
2190 fprintf( pFile, " %s%s", Gia_ObjGetDumpName(NULL, 'z', i, nDigitsO), i < Gia_ManPoNum(p)-1 ? ",":"" );
2191 fprintf( pFile, ";\n" );
2192 }
2193 fprintf( pFile, "\n" );
2194 Gia_ManForEachPi( p, pObj, i )
2195 fprintf( pFile, " wire n%0*d = %s;\n", nDigits, i+1, p->vNamesIn ? (char *)Vec_PtrEntry(p->vNamesIn, i) : Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
2196 fprintf( pFile, "\n" );
2197 Gia_ManForEachAnd( p, pObj, i )
2198 {
2199 fprintf( pFile, " wire n%0*d = ~(", nDigits, i );
2200 Gia_ManDumpNandLit( pFile, nPis, Gia_ObjFaninLit0(pObj, i), nDigits );
2201 fprintf( pFile, " & " );
2202 Gia_ManDumpNandLit( pFile, nPis, Gia_ObjFaninLit1(pObj, i), nDigits );
2203 fprintf( pFile, ");\n" );
2204 }
2205 fprintf( pFile, "\n" );
2206 Gia_ManForEachPo( p, pObj, i )
2207 {
2208 fprintf( pFile, " assign %s = ", p->vNamesOut ? (char *)Vec_PtrEntry(p->vNamesOut, i) : Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
2209 Gia_ManDumpNandLit( pFile, nPis, Gia_ObjFaninLit0p(p, pObj), nDigits );
2210 fprintf( pFile, ";\n" );
2211 }
2212 fprintf( pFile, "\nendmodule\n\n" );
2213 fclose( pFile );
2214}
void Gia_ManDumpNandLit(FILE *pFile, int nIns, int Lit, int nDigits)
Definition giaMan.c:2140
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
Here is the call graph for this function:

◆ Gia_ManDumpVerilogNoInter()

void Gia_ManDumpVerilogNoInter ( Gia_Man_t * p,
char * pFileName,
Vec_Int_t * vObjs,
int fVerBufs,
int fInter )

Definition at line 1440 of file giaMan.c.

1441{
1442 Gia_Obj_t * pObj;
1443 Vec_Bit_t * vInvs, * vUsed;
1444 int nDigits = Abc_Base10Log( Gia_ManObjNum(p) );
1445 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(p) );
1446 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(p) );
1447 int i, k, iObj, nRegs = Gia_ManRegNum(p);
1448 FILE * pFile = fopen( pFileName, "wb" );
1449 if ( pFile == NULL )
1450 {
1451 printf( "Cannot open output file \"%s\".\n", pFileName );
1452 return;
1453 }
1454
1455 if ( fInter || nRegs )
1456 Gia_ManDumpInterface2( p, pFile );
1457 //Gia_ManSetRegNum( p, 0 );
1458 p->nRegs = 0;
1459
1460 vInvs = Gia_ManGenUsed( p, 0 );
1461 vUsed = Gia_ManGenUsed( p, 1 );
1462
1463 //fprintf( pFile, "// This Verilog file is written by ABC on %s\n\n", Extra_TimeStamp() );
1464
1465 fprintf( pFile, "module " );
1466 Gia_ManDumpModuleName( pFile, p->pName );
1467
1468 if ( fVerBufs )
1469 {
1470 fprintf( pFile, " (\n " );
1471 Gia_ManWriteNames( pFile, 'a', Gia_ManPiNum(p), NULL, 4, 4, NULL, 0 );
1472 fprintf( pFile, ",\n " );
1473
1474 Gia_ManWriteNames( pFile, 'y', Gia_ManPoNum(p), NULL, 4, 4, NULL, 0 );
1475 fprintf( pFile, "\n );\n\n" );
1476
1477 fprintf( pFile, " input " );
1478 Gia_ManWriteNames( pFile, 'a', Gia_ManPiNum(p), NULL, 8, 4, NULL, 0 );
1479 fprintf( pFile, ";\n\n" );
1480
1481 fprintf( pFile, " output " );
1482 Gia_ManWriteNames( pFile, 'y', Gia_ManPoNum(p), NULL, 9, 4, NULL, 0 );
1483 fprintf( pFile, ";\n\n" );
1484
1485 fprintf( pFile, " wire " );
1486 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 8, 4, NULL, 0 );
1487 fprintf( pFile, ";\n\n" );
1488
1489 fprintf( pFile, " wire " );
1490 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 9, 4, NULL, 0 );
1491 fprintf( pFile, ";\n\n" );
1492
1493 Gia_ManForEachPi( p, pObj, i )
1494 {
1495 fprintf( pFile, " buf ( %s,", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1496 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(NULL, 'a', i, nDigitsI) );
1497 }
1498 fprintf( pFile, "\n" );
1499
1500 Gia_ManForEachPo( p, pObj, i )
1501 {
1502 fprintf( pFile, " buf ( %s,", Gia_ObjGetDumpName(NULL, 'y', i, nDigitsO) );
1503 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
1504 }
1505 fprintf( pFile, "\n" );
1506 }
1507 else
1508 {
1509 fprintf( pFile, " (\n " );
1510 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 4, 4, NULL, 0 );
1511 fprintf( pFile, ",\n " );
1512
1513 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 4, 4, NULL, 0 );
1514 fprintf( pFile, "\n );\n\n" );
1515
1516 fprintf( pFile, " input " );
1517 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 8, 4, NULL, 0 );
1518 fprintf( pFile, ";\n\n" );
1519
1520 fprintf( pFile, " output " );
1521 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 9, 4, NULL, 0 );
1522 fprintf( pFile, ";\n\n" );
1523 }
1524
1525 if ( Vec_BitCount(vUsed) )
1526 {
1527 fprintf( pFile, " wire " );
1528 Gia_ManWriteNames( pFile, 'n', Gia_ManObjNum(p), NULL, 7, 4, vUsed, 0 );
1529 fprintf( pFile, ";\n\n" );
1530 }
1531
1532 if ( Vec_BitCount(vInvs) )
1533 {
1534 fprintf( pFile, " wire " );
1535 Gia_ManWriteNames( pFile, 'i', Gia_ManObjNum(p), NULL, 7, 4, vInvs, 0 );
1536 fprintf( pFile, ";\n\n" );
1537 }
1538
1539 if ( vObjs )
1540 {
1541 fprintf( pFile, " wire " );
1542 Vec_IntForEachEntry( vObjs, iObj, i )
1543 fprintf( pFile, " t_%d%s", i, i==Vec_IntSize(vObjs)-1 ? "" : "," );
1544 fprintf( pFile, ";\n\n" );
1545 Vec_IntForEachEntry( vObjs, iObj, i )
1546 {
1547 fprintf( pFile, " buf ( %s,", Gia_ObjGetDumpName(NULL, 'n', iObj, nDigits) );
1548 fprintf( pFile, " t_%d );\n", i );
1549 }
1550 fprintf( pFile, "\n" );
1551 }
1552
1553 // input inverters
1554 Gia_ManForEachPi( p, pObj, i )
1555 {
1556 if ( Vec_BitEntry(vUsed, Gia_ObjId(p, pObj)) )
1557 {
1558 fprintf( pFile, " buf ( %s,", Gia_ObjGetDumpName(NULL, 'n', Gia_ObjId(p, pObj), nDigits) );
1559 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1560 }
1561 if ( Vec_BitEntry(vInvs, Gia_ObjId(p, pObj)) )
1562 {
1563 fprintf( pFile, " not ( %s,", Gia_ObjGetDumpName(NULL, 'i', Gia_ObjId(p, pObj), nDigits) );
1564 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1565 }
1566 }
1567
1568 // internal nodes and their inverters
1569 fprintf( pFile, "\n" );
1570 Gia_ManForEachAnd( p, pObj, i )
1571 {
1572 int fSkip = 0;
1573 if ( vObjs )
1574 {
1575 Vec_IntForEachEntry( vObjs, iObj, k )
1576 if ( iObj == i )
1577 break;
1578 if ( k < Vec_IntSize(vObjs) )
1579 fSkip = 1;
1580 }
1581 if ( !fSkip )
1582 {
1583 fprintf( pFile, " and ( %s,", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
1584 fprintf( pFile, " %s,", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
1585 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC1(pObj)? 'i':'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
1586 }
1587 if ( Vec_BitEntry(vInvs, i) )
1588 {
1589 fprintf( pFile, " not ( %s,", Gia_ObjGetDumpName(NULL, 'i', i, nDigits) );
1590 fprintf( pFile, " %s );\n", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
1591 }
1592 }
1593
1594 // output drivers
1595 fprintf( pFile, "\n" );
1596 Gia_ManForEachPo( p, pObj, i )
1597 {
1598/*
1599 fprintf( pFile, " assign %s = ", Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigits2) );
1600 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
1601 fprintf( pFile, "1\'b%d;\n", Gia_ObjFaninC0(pObj) );
1602 else
1603 fprintf( pFile, "%s;\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0p(p, pObj), nDigits) );
1604*/
1605 fprintf( pFile, " buf ( %s, ", Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
1606 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
1607 fprintf( pFile, "1\'b%d );\n", Gia_ObjFaninC0(pObj) );
1608 else
1609 fprintf( pFile, "%s );\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0p(p, pObj), nDigits) );
1610 }
1611
1612 fprintf( pFile, "\nendmodule\n\n" );
1613 fclose( pFile );
1614
1615 Vec_BitFree( vInvs );
1616 Vec_BitFree( vUsed );
1617
1618 Gia_ManSetRegNum( p, nRegs );
1619}
void Gia_ManDumpInterface2(Gia_Man_t *p, FILE *pFile)
Definition giaMan.c:1299
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDumpVerilogNoInterAssign()

void Gia_ManDumpVerilogNoInterAssign ( Gia_Man_t * p,
char * pFileName,
Vec_Int_t * vObjs,
int fVerBufs,
int fInter )

Definition at line 1620 of file giaMan.c.

1621{
1622 Gia_Obj_t * pObj;
1623 Vec_Bit_t * vInvs, * vUsed;
1624 int nDigits = Abc_Base10Log( Gia_ManObjNum(p) );
1625 int nDigitsI = Abc_Base10Log( Gia_ManPiNum(p) );
1626 int nDigitsO = Abc_Base10Log( Gia_ManPoNum(p) );
1627 int i, k, iObj, nRegs = Gia_ManRegNum(p);
1628 FILE * pFile = fopen( pFileName, "wb" );
1629 if ( pFile == NULL )
1630 {
1631 printf( "Cannot open output file \"%s\".\n", pFileName );
1632 return;
1633 }
1634
1635 if ( fInter || nRegs )
1636 Gia_ManDumpInterface2( p, pFile );
1637 //Gia_ManSetRegNum( p, 0 );
1638 p->nRegs = 0;
1639
1640 vInvs = Gia_ManGenUsed( p, 0 );
1641 vUsed = Gia_ManGenUsed( p, 1 );
1642
1643 //fprintf( pFile, "// This Verilog file is written by ABC on %s\n\n", Extra_TimeStamp() );
1644
1645 fprintf( pFile, "module " );
1646 Gia_ManDumpModuleName( pFile, p->pName );
1647
1648 if ( fVerBufs )
1649 {
1650 fprintf( pFile, " (\n " );
1651 Gia_ManWriteNames( pFile, 'a', Gia_ManPiNum(p), NULL, 4, 4, NULL, 0 );
1652 fprintf( pFile, ",\n " );
1653
1654 Gia_ManWriteNames( pFile, 'y', Gia_ManPoNum(p), NULL, 4, 4, NULL, 0 );
1655 fprintf( pFile, "\n );\n\n" );
1656
1657 fprintf( pFile, " input " );
1658 Gia_ManWriteNames( pFile, 'a', Gia_ManPiNum(p), NULL, 8, 4, NULL, 0 );
1659 fprintf( pFile, ";\n\n" );
1660
1661 fprintf( pFile, " output " );
1662 Gia_ManWriteNames( pFile, 'y', Gia_ManPoNum(p), NULL, 9, 4, NULL, 0 );
1663 fprintf( pFile, ";\n\n" );
1664
1665 fprintf( pFile, " wire " );
1666 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 8, 4, NULL, 0 );
1667 fprintf( pFile, ";\n\n" );
1668
1669 fprintf( pFile, " wire " );
1670 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 9, 4, NULL, 0 );
1671 fprintf( pFile, ";\n\n" );
1672
1673 Gia_ManForEachPi( p, pObj, i )
1674 {
1675 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1676 fprintf( pFile, " %s;\n", Gia_ObjGetDumpName(NULL, 'a', i, nDigitsI) );
1677 }
1678 fprintf( pFile, "\n" );
1679
1680 Gia_ManForEachPo( p, pObj, i )
1681 {
1682 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'y', i, nDigitsO) );
1683 fprintf( pFile, " %s;\n", Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
1684 }
1685 fprintf( pFile, "\n" );
1686 }
1687 else
1688 {
1689 fprintf( pFile, " (\n " );
1690 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 4, 4, NULL, 0 );
1691 fprintf( pFile, ",\n " );
1692
1693 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 4, 4, NULL, 0 );
1694 fprintf( pFile, "\n );\n\n" );
1695
1696 fprintf( pFile, " input " );
1697 Gia_ManWriteNames( pFile, 'x', Gia_ManPiNum(p), p->vNamesIn, 8, 4, NULL, 0 );
1698 fprintf( pFile, ";\n\n" );
1699
1700 fprintf( pFile, " output " );
1701 Gia_ManWriteNames( pFile, 'z', Gia_ManPoNum(p), p->vNamesOut, 9, 4, NULL, 0 );
1702 fprintf( pFile, ";\n\n" );
1703 }
1704
1705 if ( Vec_BitCount(vUsed) )
1706 {
1707 fprintf( pFile, " wire " );
1708 Gia_ManWriteNames( pFile, 'n', Gia_ManObjNum(p), NULL, 7, 4, vUsed, 0 );
1709 fprintf( pFile, ";\n\n" );
1710 }
1711
1712 if ( Vec_BitCount(vInvs) )
1713 {
1714 fprintf( pFile, " wire " );
1715 Gia_ManWriteNames( pFile, 'i', Gia_ManObjNum(p), NULL, 7, 4, vInvs, 0 );
1716 fprintf( pFile, ";\n\n" );
1717 }
1718
1719 if ( vObjs )
1720 {
1721 fprintf( pFile, " wire " );
1722 Vec_IntForEachEntry( vObjs, iObj, i )
1723 fprintf( pFile, " t_%d%s", i, i==Vec_IntSize(vObjs)-1 ? "" : "," );
1724 fprintf( pFile, ";\n\n" );
1725 Vec_IntForEachEntry( vObjs, iObj, i )
1726 {
1727 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'n', iObj, nDigits) );
1728 fprintf( pFile, " t_%d;\n", i );
1729 }
1730 fprintf( pFile, "\n" );
1731 }
1732
1733 // input inverters
1734 Gia_ManForEachPi( p, pObj, i )
1735 {
1736 if ( Vec_BitEntry(vUsed, Gia_ObjId(p, pObj)) )
1737 {
1738 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'n', Gia_ObjId(p, pObj), nDigits) );
1739 fprintf( pFile, " %s;\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1740 }
1741 if ( Vec_BitEntry(vInvs, Gia_ObjId(p, pObj)) )
1742 {
1743 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'i', Gia_ObjId(p, pObj), nDigits) );
1744 fprintf( pFile, " ~%s;\n", Gia_ObjGetDumpName(p->vNamesIn, 'x', i, nDigitsI) );
1745 }
1746 }
1747
1748 // internal nodes and their inverters
1749 fprintf( pFile, "\n" );
1750 Gia_ManForEachAnd( p, pObj, i )
1751 {
1752 int fSkip = 0;
1753 if ( vObjs )
1754 {
1755 Vec_IntForEachEntry( vObjs, iObj, k )
1756 if ( iObj == i )
1757 break;
1758 if ( k < Vec_IntSize(vObjs) )
1759 fSkip = 1;
1760 }
1761 if ( !fSkip )
1762 {
1763 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
1764 fprintf( pFile, " %s &", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0(pObj, i), nDigits) );
1765 fprintf( pFile, " %s;\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC1(pObj)? 'i':'n'), Gia_ObjFaninId1(pObj, i), nDigits) );
1766 }
1767 if ( Vec_BitEntry(vInvs, i) )
1768 {
1769 fprintf( pFile, " assign %s =", Gia_ObjGetDumpName(NULL, 'i', i, nDigits) );
1770 fprintf( pFile, " ~%s;\n", Gia_ObjGetDumpName(NULL, 'n', i, nDigits) );
1771 }
1772 }
1773
1774 // output drivers
1775 fprintf( pFile, "\n" );
1776 Gia_ManForEachPo( p, pObj, i )
1777 {
1778 fprintf( pFile, " assign %s = ", Gia_ObjGetDumpName(p->vNamesOut, 'z', i, nDigitsO) );
1779 if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
1780 fprintf( pFile, "1\'b%d;\n", Gia_ObjFaninC0(pObj) );
1781 else
1782 fprintf( pFile, "%s;\n", Gia_ObjGetDumpName(NULL, (char)(Gia_ObjFaninC0(pObj)? 'i':'n'), Gia_ObjFaninId0p(p, pObj), nDigits) );
1783 }
1784
1785 fprintf( pFile, "\nendmodule\n\n" );
1786 fclose( pFile );
1787
1788 Vec_BitFree( vInvs );
1789 Vec_BitFree( vUsed );
1790
1791 Gia_ManSetRegNum( p, nRegs );
1792}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManGenUsed()

Vec_Bit_t * Gia_ManGenUsed ( Gia_Man_t * p,
int fBuf )

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

Synopsis [Compute arrival/required times.]

Description []

SideEffects []

SeeAlso []

Definition at line 1343 of file giaMan.c.

1344{
1345 Gia_Obj_t * pObj; int i;
1346 Vec_Bit_t * vUsed = Vec_BitStart( Gia_ManObjNum(p) );
1347 Gia_ManForEachAnd( p, pObj, i )
1348 {
1349 if ( fBuf )
1350 Vec_BitWriteEntry( vUsed, i, 1 );
1351 if ( Gia_ObjFaninC0(pObj) ^ fBuf )
1352 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId0(pObj, i), 1 );
1353 if ( Gia_ObjFaninC1(pObj) ^ fBuf )
1354 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId1(pObj, i), 1 );
1355 }
1356 Gia_ManForEachCo( p, pObj, i )
1357 if ( Gia_ObjFaninC0(pObj) ^ fBuf )
1358 Vec_BitWriteEntry( vUsed, Gia_ObjFaninId0p(p, pObj), 1 );
1359 Vec_BitWriteEntry( vUsed, 0, 0 ); // clean zero
1360 return vUsed;
1361}
Here is the caller graph for this function:

◆ Gia_ManLogAigStats()

void Gia_ManLogAigStats ( Gia_Man_t * p,
char * pDumpFile )

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file giaMan.c.

471{
472 FILE * pTable = fopen( pDumpFile, "wb" );
473 fprintf( pTable, "{\n" );
474 fprintf( pTable, " \"name\" : \"%s\",\n", p->pName );
475 fprintf( pTable, " \"input\" : %d,\n", Gia_ManCiNum(p) );
476 fprintf( pTable, " \"output\" : %d,\n", Gia_ManCoNum(p) );
477 fprintf( pTable, " \"flop\" : %d,\n", Gia_ManRegNum(p) );
478 fprintf( pTable, " \"and\" : %d,\n", Gia_ManAndNum(p) );
479 fprintf( pTable, " \"level\" : %d\n", Gia_ManLevelNum(p) );
480 fprintf( pTable, "}\n" );
481 fclose( pTable );
482}
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManMemory()

double Gia_ManMemory ( Gia_Man_t * p)

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

Synopsis [Returns memory used in megabytes.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file giaMan.c.

195{
196 double Memory = sizeof(Gia_Man_t);
197 Memory += sizeof(Gia_Obj_t) * Gia_ManObjNum(p);
198 Memory += sizeof(int) * Gia_ManCiNum(p);
199 Memory += sizeof(int) * Gia_ManCoNum(p);
200 Memory += sizeof(int) * Vec_IntSize(&p->vHTable);
201 Memory += sizeof(int) * Gia_ManObjNum(p) * (p->pRefs != NULL);
202 Memory += Vec_IntMemory( p->vLevels );
203 Memory += Vec_IntMemory( p->vCellMapping );
204 Memory += Vec_IntMemory( &p->vCopies );
205 Memory += Vec_FltMemory( p->vInArrs );
206 Memory += Vec_FltMemory( p->vOutReqs );
207 Memory += Vec_PtrMemory( p->vNamesIn );
208 Memory += Vec_PtrMemory( p->vNamesOut );
209 Memory += Vec_PtrMemory( p->vNamesNode );
210 return Memory;
211}
Here is the caller graph for this function:

◆ Gia_ManNameIsLegalInVerilog()

int Gia_ManNameIsLegalInVerilog ( char * pName)

Definition at line 1362 of file giaMan.c.

1363{
1364 // identifier ::= simple_identifier | escaped_identifier
1365 // simple_identifier ::= [a-zA-Z_][a-zA-Z0-9_$]
1366 // escaped_identifier ::= \ {Any_ASCII_character_except_white_space} white_space
1367 // white_space ::= space | tab | newline
1368 assert( pName != NULL && *pName != '\0' );
1369 if ( *pName == '\\' )
1370 return 1;
1371 if ( (*pName < 'a' || *pName > 'z') && (*pName < 'A' || *pName > 'Z') && *pName != '_' )
1372 return 0;
1373 while ( *(++pName) )
1374 if ( (*pName < 'a' || *pName > 'z') && (*pName < 'A' || *pName > 'Z') && (*pName < '0' || *pName > '9') && *pName != '_' && *pName != '$' )
1375 return 0;
1376 return 1;
1377}
Here is the caller graph for this function:

◆ Gia_ManPrintChoiceStats()

void Gia_ManPrintChoiceStats ( Gia_Man_t * p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 406 of file giaMan.c.

407{
408 Gia_Obj_t * pObj;
409 int i, nEquivs = 0, nChoices = 0;
411 Gia_ManForEachAnd( p, pObj, i )
412 {
413 if ( !Gia_ObjSibl(p, i) )
414 continue;
415 nEquivs++;
416 if ( pObj->fMark0 )
417 nChoices++;
418 assert( !Gia_ObjSiblObj(p, i)->fMark0 );
419 assert( Gia_ObjIsAnd(Gia_ObjSiblObj(p, i)) );
420 }
421 Abc_Print( 1, "Choice stats: Equivs =%7d. Choices =%7d.\n", nEquivs, nChoices );
423}
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
void Gia_ManMarkFanoutDrivers(Gia_Man_t *p)
Definition giaUtil.c:1779
unsigned fMark0
Definition gia.h:81
Here is the call graph for this function:

◆ Gia_ManPrintClasses_old()

void Gia_ManPrintClasses_old ( Gia_Man_t * p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 243 of file giaMan.c.

244{
245 Gia_Obj_t * pObj;
246 int i;
247 if ( p->vFlopClasses == NULL )
248 return;
249 Gia_ManForEachRo( p, pObj, i )
250 Abc_Print( 1, "%d", Vec_IntEntry(p->vFlopClasses, i) );
251 Abc_Print( 1, "\n" );
252
253 {
254 Gia_Man_t * pTemp;
255 pTemp = Gia_ManDupFlopClass( p, 1 );
256 Gia_AigerWrite( pTemp, "dom1.aig", 0, 0, 0 );
257 Gia_ManStop( pTemp );
258 pTemp = Gia_ManDupFlopClass( p, 2 );
259 Gia_AigerWrite( pTemp, "dom2.aig", 0, 0, 0 );
260 Gia_ManStop( pTemp );
261 }
262}
#define Gia_ManForEachRo(p, pObj, i)
Definition gia.h:1252
Gia_Man_t * Gia_ManDupFlopClass(Gia_Man_t *p, int iClass)
Definition giaDup.c:1399
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
Definition giaAiger.c:1595
Here is the call graph for this function:

◆ Gia_ManPrintEdges()

int Gia_ManPrintEdges ( Gia_Man_t * p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 437 of file giaMan.c.

438{
439 printf( "Edges (Q=2) : " );
440 printf( "edge =%8d ", (Vec_IntCountPositive(p->vEdge1) + Vec_IntCountPositive(p->vEdge2))/2 );
441 printf( "lev =%5.1f", 0.1*Gia_ManEvalEdgeDelay(p) );
442 printf( "\n" );
443 return 0;
444}
int Gia_ManEvalEdgeDelay(Gia_Man_t *p)
Definition giaEdge.c:201
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintInitClasses()

void Gia_ManPrintInitClasses ( Vec_Int_t * vInits)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 361 of file giaMan.c.

362{
363 int i, Value;
364 int Counts[6] = {0};
365 Vec_IntForEachEntry( vInits, Value, i )
366 Counts[Value]++;
367 for ( i = 0; i < 6; i++ )
368 if ( Counts[i] )
369 printf( "%d = %d ", i, Counts[i] );
370 printf( " " );
371 printf( "B = %d ", Counts[0] + Counts[1] );
372 printf( "X = %d ", Counts[2] + Counts[3] );
373 printf( "Q = %d\n", Counts[4] + Counts[5] );
374 Vec_IntForEachEntry( vInits, Value, i )
375 {
376 Counts[Value]++;
377 if ( Value == 0 )
378 printf( "0" );
379 else if ( Value == 1 )
380 printf( "1" );
381 else if ( Value == 2 )
382 printf( "2" );
383 else if ( Value == 3 )
384 printf( "3" );
385 else if ( Value == 4 )
386 printf( "4" );
387 else if ( Value == 5 )
388 printf( "5" );
389 else assert( 0 );
390 }
391 printf( "\n" );
392
393}
Here is the caller graph for this function:

◆ Gia_ManPrintMiterStatus()

void Gia_ManPrintMiterStatus ( Gia_Man_t * p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 679 of file giaMan.c.

680{
681 Gia_Obj_t * pObj, * pChild;
682 int i, nSat = 0, nUnsat = 0, nUndec = 0, iOut = -1;
683 Gia_ManForEachPo( p, pObj, i )
684 {
685 pChild = Gia_ObjChild0(pObj);
686 // check if the output is constant 0
687 if ( pChild == Gia_ManConst0(p) )
688 nUnsat++;
689 // check if the output is constant 1
690 else if ( pChild == Gia_ManConst1(p) )
691 {
692 nSat++;
693 if ( iOut == -1 )
694 iOut = i;
695 }
696 // check if the output is a primary input
697 else if ( Gia_ObjIsPi(p, Gia_Regular(pChild)) )
698 {
699 nSat++;
700 if ( iOut == -1 )
701 iOut = i;
702 }
703/*
704 // check if the output is 1 for the 0000 pattern
705 else if ( Gia_Regular(pChild)->fPhase != (unsigned)Gia_IsComplement(pChild) )
706 {
707 nSat++;
708 if ( iOut == -1 )
709 iOut = i;
710 }
711*/
712 else
713 nUndec++;
714 }
715 Abc_Print( 1, "Outputs = %7d. Unsat = %7d. Sat = %7d. Undec = %7d.\n",
716 Gia_ManPoNum(p), nUnsat, nSat, nUndec );
717}

◆ Gia_ManPrintNpnClasses()

void Gia_ManPrintNpnClasses ( Gia_Man_t * p)

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

Synopsis [Prints NPN class statistics.]

Description []

SideEffects []

SeeAlso []

Definition at line 804 of file giaMan.c.

805{
806 extern char ** Kit_DsdNpn4ClassNames();
807 char ** pNames = Kit_DsdNpn4ClassNames();
808 Vec_Int_t * vLeaves, * vTruth, * vVisited;
809 int * pLutClass, ClassCounts[222] = {0};
810 int i, k, iFan, Class, OtherClasses, OtherClasses2, nTotal, Counter, Counter2;
811 unsigned * pTruth; int nLutSize = 0;
812 assert( Gia_ManHasMapping(p) );
813 //assert( Gia_ManLutSizeMax( p ) <= 4 );
814 vLeaves = Vec_IntAlloc( 100 );
815 vVisited = Vec_IntAlloc( 100 );
816 vTruth = Vec_IntAlloc( (1<<16) );
817 pLutClass = ABC_CALLOC( int, Gia_ManObjNum(p) );
819 Gia_ManForEachLut( p, i )
820 {
821 nLutSize = Abc_MaxInt( nLutSize, Gia_ObjLutSize(p,i) );
822 if ( Gia_ObjLutSize(p,i) > 4 )
823 continue;
824 Vec_IntClear( vLeaves );
825 Gia_LutForEachFanin( p, i, iFan, k )
826 Vec_IntPush( vLeaves, iFan );
827 for ( ; k < 4; k++ )
828 Vec_IntPush( vLeaves, 0 );
829 pTruth = Gia_ManConvertAigToTruth( p, Gia_ManObj(p, i), vLeaves, vTruth, vVisited );
830 Class = Dar_LibReturnClass( *pTruth );
831 ClassCounts[ Class ]++;
832 pLutClass[i] = Class;
833 }
834 Vec_IntFree( vLeaves );
835 Vec_IntFree( vTruth );
836 Vec_IntFree( vVisited );
837 Vec_IntFreeP( &p->vTruths );
838 nTotal = 0;
839 for ( i = 0; i < 222; i++ )
840 nTotal += ClassCounts[i];
841 Abc_Print( 1, "NPN CLASS STATISTICS (for %d LUT4 present in the current mapping):\n", nTotal );
842 OtherClasses = 0;
843 for ( i = k = 0; i < 222; i++ )
844 {
845 if ( ClassCounts[i] == 0 )
846 continue;
847// if ( 100.0 * ClassCounts[i] / (nTotal+1) < 0.1 ) // do not show anything below 0.1 percent
848// continue;
849 OtherClasses += ClassCounts[i];
850 Abc_Print( 1, "%3d: Class %3d : Count = %6d (%7.2f %%) %s\n",
851 ++k, i, ClassCounts[i], 100.0 * ClassCounts[i] / (nTotal+1), pNames[i] );
852 }
853 OtherClasses = nTotal - OtherClasses;
854 Abc_Print( 1, "Other : Count = %6d (%7.2f %%)\n",
855 OtherClasses, 100.0 * OtherClasses / (nTotal+1) );
856 // count the number of LUTs that have MUX function and two fanins with MUX functions
857 OtherClasses = OtherClasses2 = 0;
858 ABC_FREE( p->pRefs );
860 Gia_ManForEachLut( p, i )
861 {
862 if ( pLutClass[i] != 109 )
863 continue;
864 Counter = Counter2 = 0;
865 Gia_LutForEachFanin( p, i, iFan, k )
866 {
867 Counter += (pLutClass[iFan] == 109);
868 Counter2 += (pLutClass[iFan] == 109) && (Gia_ObjRefNumId(p, iFan) == 1);
869 }
870 OtherClasses += (Counter > 1);
871 OtherClasses2 += (Counter2 > 1);
872// Abc_Print( 1, "%d -- ", pLutClass[i] );
873// Gia_LutForEachFanin( p, i, iFan, k )
874// Abc_Print( 1, "%d ", pLutClass[iFan] );
875// Abc_Print( 1, "\n" );
876 }
877 ABC_FREE( p->pRefs );
878 Abc_Print( 1, "Approximate number of 4:1 MUX structures: All = %6d (%7.2f %%) MFFC = %6d (%7.2f %%)\n",
879 OtherClasses, 100.0 * OtherClasses / (nTotal+1),
880 OtherClasses2, 100.0 * OtherClasses2 / (nTotal+1) );
881 // print information about LUT pairs
882 if ( nLutSize <= 4 )
883 {
884 int nTopPairs = 100, nTopShow = 30;
885 int i, j, k, iFan, * pVec = NULL;
886 Vec_Int_t * vPairs = Vec_IntAlloc( 3 * nTopPairs );
887 Gia_ManForEachLut( p, j ) {
888 Gia_LutForEachFanin( p, j, iFan, k ) {
889 int Num1 = pLutClass[iFan];
890 int Num2 = pLutClass[j];
891 assert( Vec_IntSize(vPairs) % 3 == 0 );
892 for ( i = 0; i < Vec_IntSize(vPairs); i += 3 )
893 if ( Vec_IntEntry(vPairs, i+0) == Num1 && Vec_IntEntry(vPairs, i+1) == Num2 )
894 break;
895 if ( i == Vec_IntSize(vPairs) ) {
896 if ( Vec_IntSize(vPairs) < 3*nTopPairs ) {
897 Vec_IntPush( vPairs, Num1 );
898 Vec_IntPush( vPairs, Num2 );
899 Vec_IntPush( vPairs, 1 );
900 }
901 continue;
902 }
903 // found this pair
904 assert( Vec_IntEntry(vPairs, i+0) == Num1 );
905 assert( Vec_IntEntry(vPairs, i+1) == Num2 );
906 Vec_IntAddToEntry( vPairs, i+2, 1 );
907 // sort
908 pVec = Vec_IntArray( vPairs );
909 while ( i > 0 && pVec[i+2] > pVec[i-1] ) {
910 ABC_SWAP( int, pVec[i+0], pVec[i-3] )
911 ABC_SWAP( int, pVec[i+1], pVec[i-2] )
912 ABC_SWAP( int, pVec[i+2], pVec[i-1] )
913 i -= 3;
914 }
915 while ( i < Vec_IntSize(vPairs) - 3 && pVec[i+2] < pVec[i+5] ) {
916 ABC_SWAP( int, pVec[i+0], pVec[i+3] )
917 ABC_SWAP( int, pVec[i+1], pVec[i+4] )
918 ABC_SWAP( int, pVec[i+2], pVec[i+5] )
919 i += 3;
920 assert( 0 );
921 }
922 }
923 }
924 pVec = Vec_IntArray( vPairs );
925 nTopShow = Abc_MinInt( nTopShow, Vec_IntSize(vPairs)/3 );
926 for ( i = 0; i < 3*nTopShow; i += 3 )
927 printf( "%3d : (%3d %3d) x %3d\n", i/3, pVec[i+0], pVec[i+1], pVec[i+2] );
928 Vec_IntFree( vPairs );
929 }
930 ABC_FREE( pLutClass );
931}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
int Dar_LibReturnClass(unsigned uTruth)
Definition darLib.c:194
unsigned * Gia_ManConvertAigToTruth(Gia_Man_t *p, Gia_Obj_t *pRoot, Vec_Int_t *vLeaves, Vec_Int_t *vTruth, Vec_Int_t *vVisited)
Definition giaBidec.c:90
void Gia_ManSetRefsMapped(Gia_Man_t *p)
Definition giaIf.c:271
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
void Gia_ManCleanTruth(Gia_Man_t *p)
Definition giaUtil.c:528
char ** Kit_DsdNpn4ClassNames()
Definition kitDsd.c:3049
for(p=first;p->value< newval;p=p->next)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintOneName()

void Gia_ManPrintOneName ( FILE * pFile,
char * pName,
int Size )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1805 of file giaMan.c.

1806{
1807 int i;
1808 for ( i = 0; i < Size; i++ )
1809 fprintf( pFile, "%c", pName[i] );
1810}
Here is the caller graph for this function:

◆ Gia_ManPrintPlacement()

void Gia_ManPrintPlacement ( Gia_Man_t * p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 275 of file giaMan.c.

276{
277 int i, nFixed = 0, nUndef = 0;
278 if ( p->pPlacement == NULL )
279 return;
280 for ( i = 0; i < Gia_ManObjNum(p); i++ )
281 {
282 nFixed += p->pPlacement[i].fFixed;
283 nUndef += p->pPlacement[i].fUndef;
284 }
285 Abc_Print( 1, "Placement: Objects = %8d. Fixed = %8d. Undef = %8d.\n", Gia_ManObjNum(p), nFixed, nUndef );
286}
Here is the caller graph for this function:

◆ Gia_ManPrintStats()

void Gia_ManPrintStats ( Gia_Man_t * p,
Gps_Par_t * pPars )

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 495 of file giaMan.c.

496{
497 extern float Gia_ManLevelAve( Gia_Man_t * p );
498 int fHaveLevels = p->vLevels != NULL;
499 if ( pPars && pPars->fMiter )
500 {
502 return;
503 }
504 if ( pPars && pPars->fNoColor )
505 {
506 if ( p->pName )
507 Abc_Print( 1, "%-8s : ", p->pName );
508 }
509 else
510 {
511#ifdef WIN32
512 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 15 ); // bright
513 if ( p->pName )
514 Abc_Print( 1, "%-8s : ", p->pName );
515 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
516#else
517 if ( p->pName )
518 Abc_Print( 1, "%s%-8s%s : ", "\033[1;37m", p->pName, "\033[0m" ); // bright
519#endif
520 }
521 Abc_Print( 1, "i/o =%7d/%7d",
522 Gia_ManPiNum(p) - Gia_ManBoxCiNum(p) - Gia_ManRegBoxNum(p),
523 Gia_ManPoNum(p) - Gia_ManBoxCoNum(p) - Gia_ManRegBoxNum(p) );
524 if ( Gia_ManConstrNum(p) )
525 Abc_Print( 1, "(c=%d)", Gia_ManConstrNum(p) );
526 if ( Gia_ManRegNum(p) )
527 Abc_Print( 1, " ff =%7d", Gia_ManRegNum(p) );
528 if ( Gia_ManRegBoxNum(p) )
529 Abc_Print( 1, " boxff =%d(%d)", Gia_ManRegBoxNum(p), Gia_ManClockDomainNum(p) );
530 if ( pPars && pPars->fNoColor )
531 {
532 Abc_Print( 1, " %s =%8d", p->pMuxes? "nod" : "and", Gia_ManAndNum(p) );
533 Abc_Print( 1, " lev =%5d", Gia_ManLevelNum(p) );
534 Abc_Print( 1, " (%.2f)", Gia_ManLevelAve(p) );
535 }
536 else
537 {
538#ifdef WIN32
539 {
540 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
541 SetConsoleTextAttribute( hConsole, 11 ); // blue
542 Abc_Print( 1, " %s =%8d", p->pMuxes? "nod" : "and", Gia_ManAndNum(p) );
543 SetConsoleTextAttribute( hConsole, 13 ); // magenta
544 Abc_Print( 1, " lev =%5d", Gia_ManLevelNum(p) );
545 Abc_Print( 1, " (%7.2f)", Gia_ManLevelAve(p) );
546 SetConsoleTextAttribute( hConsole, 7 ); // normal
547 }
548#else
549 Abc_Print( 1, " %s%s =%8d%s", "\033[1;36m", p->pMuxes? "nod" : "and", Gia_ManAndNum(p), "\033[0m" ); // blue
550 Abc_Print( 1, " %slev =%5d%s", "\033[1;35m", Gia_ManLevelNum(p), "\033[0m" ); // magenta
551 Abc_Print( 1, " %s(%.2f)%s", "\033[1;35m", Gia_ManLevelAve(p), "\033[0m" );
552#endif
553 }
554 if ( !fHaveLevels )
555 Vec_IntFreeP( &p->vLevels );
556 if ( pPars && pPars->fCut )
557 Abc_Print( 1, " cut = %d(%d)", Gia_ManCrossCut(p, 0), Gia_ManCrossCut(p, 1) );
558 Abc_Print( 1, " mem =%5.2f MB", Gia_ManMemory(p)/(1<<20) );
559 if ( Gia_ManHasChoices(p) )
560 Abc_Print( 1, " ch =%5d", Gia_ManChoiceNum(p) );
561 if ( p->pManTime )
562 Abc_Print( 1, " box = %d", Gia_ManNonRegBoxNum(p) );
563 if ( p->pManTime )
564 Abc_Print( 1, " bb = %d", Gia_ManBlackBoxNum(p) );
565 if ( Gia_ManBufNum(p) )
566 Abc_Print( 1, " buf = %d", Gia_ManBufNum(p) );
567 if ( Gia_ManXorNum(p) && p->pMuxes == NULL )
568 Abc_Print( 1, " xor = %d", Gia_ManXorNum(p) );
569 if ( pPars && pPars->fMuxXor )
570 printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p );
571 if ( pPars && pPars->fSwitch )
572 {
573 static int nPiPo = 0;
574 static float PrevSwiTotal = 0;
575 float SwiTotal = Gia_ManComputeSwitching( p, 48, 16, 0 );
576 Abc_Print( 1, " power =%8.1f", SwiTotal );
577 if ( PrevSwiTotal > 0 && nPiPo == Gia_ManCiNum(p) + Gia_ManCoNum(p) )
578 Abc_Print( 1, " %6.2f %%", 100.0*(PrevSwiTotal-SwiTotal)/PrevSwiTotal );
579 else if ( PrevSwiTotal == 0 || nPiPo != Gia_ManCiNum(p) + Gia_ManCoNum(p) )
580 PrevSwiTotal = SwiTotal, nPiPo = Gia_ManCiNum(p) + Gia_ManCoNum(p);
581 }
582// Abc_Print( 1, "obj =%5d ", Gia_ManObjNum(p) );
583 Abc_Print( 1, "\n" );
584
585// Gia_ManSatExperiment( p );
586 if ( p->pReprs && p->pNexts )
587 Gia_ManEquivPrintClasses( p, 0, 0.0 );
588 if ( Gia_ManHasMapping(p) && (pPars == NULL || !pPars->fSkipMap) )
589 Gia_ManPrintMappingStats( p, pPars ? pPars->pDumpFile : NULL );
590 else if ( pPars && pPars->pDumpFile )
591 Gia_ManLogAigStats( p, pPars->pDumpFile );
592 if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) )
594 if ( p->vPacking )
596 if ( p->vEdge1 )
598 if ( pPars && pPars->fLutProf && Gia_ManHasMapping(p) )
600 if ( p->pPlacement )
602// if ( p->pManTime )
603// Tim_ManPrintStats( (Tim_Man_t *)p->pManTime, p->nAnd2Delay );
607// if ( p->vRegClasses )
608// {
609// printf( "The design has %d flops with the following class info: ", Vec_IntSize(p->vRegClasses) );
610// Vec_IntPrint( p->vRegClasses );
611// }
612 if ( p->vInitClasses )
613 Gia_ManPrintInitClasses( p->vInitClasses );
614 // check integrity of boxes
616/*
617 if ( Gia_ManRegBoxNum(p) )
618 {
619 int i, Limit = Vec_IntFindMax(p->vRegClasses);
620 for ( i = 1; i <= Limit; i++ )
621 printf( "%d ", Vec_IntCountEntry(p->vRegClasses, i) );
622 printf( "\n" );
623 }
624*/
625 if ( pPars && pPars->fTents )
626 {
627/*
628 int k, Entry, Prev = 1;
629 Vec_Int_t * vLimit = Vec_IntAlloc( 1000 );
630 Gia_Man_t * pNew = Gia_ManUnrollDup( p, vLimit );
631 Abc_Print( 1, "Tents: " );
632 Vec_IntForEachEntryStart( vLimit, Entry, k, 1 )
633 Abc_Print( 1, "%d=%d ", k, Entry-Prev ), Prev = Entry;
634 Abc_Print( 1, " Unused=%d.", Gia_ManObjNum(p) - Gia_ManObjNum(pNew) );
635 Abc_Print( 1, "\n" );
636 Vec_IntFree( vLimit );
637 Gia_ManStop( pNew );
638*/
640 }
641 if ( pPars && pPars->fSlacks )
643 if ( Gia_ManHasMapping(p) && pPars->fMapOutStats )
645}
void Gia_ManPrintGateClasses(Gia_Man_t *p)
Definition absDup.c:331
void Gia_ManPrintObjClasses(Gia_Man_t *p)
Definition absDup.c:367
void Gia_ManPrintFlopClasses(Gia_Man_t *p)
Definition absDup.c:301
int Gia_ManPrintEdges(Gia_Man_t *p)
Definition giaMan.c:437
double Gia_ManMemory(Gia_Man_t *p)
Definition giaMan.c:194
void Gia_ManPrintTents(Gia_Man_t *p)
Definition giaMan.c:312
void Gia_ManPrintInitClasses(Vec_Int_t *vInits)
Definition giaMan.c:361
void Gia_ManPrintPlacement(Gia_Man_t *p)
Definition giaMan.c:275
void Gia_ManLogAigStats(Gia_Man_t *p, char *pDumpFile)
Definition giaMan.c:470
void Gia_ManPrintStatsMiter(Gia_Man_t *p, int fVerbose)
Definition giaMan.c:730
void Gia_ManPrintNpnClasses(Gia_Man_t *p)
Definition giaMan.c:804
ABC_NAMESPACE_IMPL_START void Gia_ManDfsSlacksPrint(Gia_Man_t *p)
DECLARATIONS ///.
Definition giaMan.c:1213
float Gia_ManLevelAve(Gia_Man_t *p)
Definition giaUtil.c:588
int Gia_ManNonRegBoxNum(Gia_Man_t *p)
Definition giaTim.c:58
void Gia_ManPrintMappingStats(Gia_Man_t *p, char *pDumpFile)
Definition giaIf.c:532
int Gia_ManRegBoxNum(Gia_Man_t *p)
Definition giaTim.c:54
int Gia_ManBoxCiNum(Gia_Man_t *p)
Definition giaTim.c:66
float Gia_ManComputeSwitching(Gia_Man_t *p, int nFrames, int nPref, int fProbOne)
Definition giaSwitch.c:808
void Gia_ManPrintPackingStats(Gia_Man_t *p)
Definition giaIf.c:663
void Gia_ManPrintLutStats(Gia_Man_t *p)
Definition giaIf.c:727
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition giaEquiv.c:501
void Gia_ManPrintOutputLutStats(Gia_Man_t *p)
Definition giaIf.c:497
void Gia_ManPrintMuxStats(Gia_Man_t *p)
Definition giaMuxes.c:63
int Gia_ManCrossCut(Gia_Man_t *p, int fReverse)
Definition giaUtil.c:916
int Gia_ManClockDomainNum(Gia_Man_t *p)
Definition giaTim.c:74
void Gia_ManCheckIntegrityWithBoxes(Gia_Man_t *p)
Definition giaSweep.c:441
int Gia_ManBlackBoxNum(Gia_Man_t *p)
Definition giaTim.c:62
int Gia_ManBoxCoNum(Gia_Man_t *p)
Definition giaTim.c:70
int fMiter
Definition gia.h:269
char * pDumpFile
Definition gia.h:274
int fTents
Definition gia.h:263
int fNpn
Definition gia.h:266
int fLutProf
Definition gia.h:267
int fCut
Definition gia.h:265
int fSlacks
Definition gia.h:271
int fMuxXor
Definition gia.h:268
int fSwitch
Definition gia.h:264
int fSkipMap
Definition gia.h:270
int fNoColor
Definition gia.h:272
int fMapOutStats
Definition gia.h:273
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintStatsMiter()

void Gia_ManPrintStatsMiter ( Gia_Man_t * p,
int fVerbose )

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

Synopsis [Statistics of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 730 of file giaMan.c.

731{
732 Gia_Obj_t * pObj;
733 Vec_Flt_t * vProb;
734 int i, iObjId;
737 vProb = Gia_ManPrintOutputProb( p );
738 printf( "Statistics for each outputs of the miter:\n" );
739 Gia_ManForEachPo( p, pObj, i )
740 {
741 iObjId = Gia_ObjId(p, pObj);
742 printf( "%4d : ", i );
743 printf( "Level = %5d ", Gia_ObjLevelId(p, iObjId) );
744 printf( "Supp = %5d ", Gia_ManSuppSize(p, &iObjId, 1) );
745 printf( "Cone = %5d ", Gia_ManConeSize(p, &iObjId, 1) );
746 printf( "Mffc = %5d ", Gia_NodeMffcSize(p, Gia_ObjFanin0(pObj)) );
747 printf( "Prob = %8.4f ", Vec_FltEntry(vProb, iObjId) );
748 printf( "\n" );
749 }
750 Vec_FltFree( vProb );
751}
int Gia_ManSuppSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition giaDfs.c:324
int Gia_NodeMffcSize(Gia_Man_t *p, Gia_Obj_t *pNode)
Definition giaUtil.c:1230
Vec_Flt_t * Gia_ManPrintOutputProb(Gia_Man_t *p)
Definition giaSwitch.c:848
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
int Gia_ManConeSize(Gia_Man_t *p, int *pNodes, int nNodes)
Definition giaDfs.c:375
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition vecFlt.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintStatsShort()

void Gia_ManPrintStatsShort ( Gia_Man_t * p)

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file giaMan.c.

659{
660 Abc_Print( 1, "i/o =%7d/%7d ", Gia_ManPiNum(p), Gia_ManPoNum(p) );
661 Abc_Print( 1, "ff =%7d ", Gia_ManRegNum(p) );
662 Abc_Print( 1, "and =%8d ", Gia_ManAndNum(p) );
663 Abc_Print( 1, "lev =%5d ", Gia_ManLevelNum(p) );
664// Abc_Print( 1, "mem =%5.2f MB", 12.0*Gia_ManObjNum(p)/(1<<20) );
665 Abc_Print( 1, "\n" );
666}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintTents()

void Gia_ManPrintTents ( Gia_Man_t * p)

Definition at line 312 of file giaMan.c.

313{
314 Vec_Int_t * vObjs;
315 Gia_Obj_t * pObj;
316 int t, i, iObjId, nSizePrev, nSizeCurr;
317 assert( Gia_ManPoNum(p) > 0 );
318 vObjs = Vec_IntAlloc( 100 );
319 // save constant class
321 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
322 Vec_IntPush( vObjs, 0 );
323 // create starting root
324 nSizePrev = Vec_IntSize(vObjs);
325 Gia_ManForEachPo( p, pObj, i )
326 Gia_ManPrintTents_rec( p, pObj, vObjs );
327 // build tents
328 Abc_Print( 1, "Tents: " );
329 for ( t = 1; nSizePrev < Vec_IntSize(vObjs); t++ )
330 {
331 int nPis = 0;
332 nSizeCurr = Vec_IntSize(vObjs);
333 Vec_IntForEachEntryStartStop( vObjs, iObjId, i, nSizePrev, nSizeCurr )
334 {
335 nPis += Gia_ObjIsPi(p, Gia_ManObj(p, iObjId));
336 if ( Gia_ObjIsRo(p, Gia_ManObj(p, iObjId)) )
337 Gia_ManPrintTents_rec( p, Gia_ObjRoToRi(p, Gia_ManObj(p, iObjId)), vObjs );
338 }
339 Abc_Print( 1, "%d=%d(%d) ", t, nSizeCurr - nSizePrev, nPis );
340 nSizePrev = nSizeCurr;
341 }
342 Abc_Print( 1, " Unused=%d\n", Gia_ManObjNum(p) - Vec_IntSize(vObjs) );
343 Vec_IntFree( vObjs );
344 // the remaining objects are PIs without fanout
345// Gia_ManForEachObj( p, pObj, i )
346// if ( !Gia_ObjIsTravIdCurrent(p, pObj) )
347// Gia_ObjPrint( p, pObj );
348}
void Gia_ManPrintTents_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vObjs)
Definition giaMan.c:300
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
Definition vecInt.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPrintTents_rec()

void Gia_ManPrintTents_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vObjs )

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

Synopsis [Duplicates AIG for unrolling.]

Description []

SideEffects []

SeeAlso []

Definition at line 300 of file giaMan.c.

301{
302 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
303 return;
304 Gia_ObjSetTravIdCurrent(p, pObj);
305 Vec_IntPush( vObjs, Gia_ObjId(p, pObj) );
306 if ( Gia_ObjIsCi(pObj) )
307 return;
308 Gia_ManPrintTents_rec( p, Gia_ObjFanin0(pObj), vObjs );
309 if ( Gia_ObjIsAnd(pObj) )
310 Gia_ManPrintTents_rec( p, Gia_ObjFanin1(pObj), vObjs );
311}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManReadRangeNum()

int Gia_ManReadRangeNum ( char * pName,
int Size )

Definition at line 1819 of file giaMan.c.

1820{
1821 if ( pName[Size] == 0 )
1822 return -1;
1823 assert( pName[Size] == '[' );
1824 return atoi(pName+Size+1);
1825}
Here is the caller graph for this function:

◆ Gia_ManReportImprovement()

void Gia_ManReportImprovement ( Gia_Man_t * p,
Gia_Man_t * pNew )

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

Synopsis [Reports the reduction of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 782 of file giaMan.c.

783{
784 Abc_Print( 1, "REG: Beg = %5d. End = %5d. (R =%5.1f %%) ",
785 Gia_ManRegNum(p), Gia_ManRegNum(pNew),
786 Gia_ManRegNum(p)? 100.0*(Gia_ManRegNum(p)-Gia_ManRegNum(pNew))/Gia_ManRegNum(p) : 0.0 );
787 Abc_Print( 1, "AND: Beg = %6d. End = %6d. (R =%5.1f %%)",
788 Gia_ManAndNum(p), Gia_ManAndNum(pNew),
789 Gia_ManAndNum(p)? 100.0*(Gia_ManAndNum(p)-Gia_ManAndNum(pNew))/Gia_ManAndNum(p) : 0.0 );
790 Abc_Print( 1, "\n" );
791}
Here is the caller graph for this function:

◆ Gia_ManSetRegNum()

void Gia_ManSetRegNum ( Gia_Man_t * p,
int nRegs )

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

Synopsis [Prints stats for the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 764 of file giaMan.c.

765{
766 assert( p->nRegs == 0 );
767 p->nRegs = nRegs;
768}

◆ Gia_ManStart()

Gia_Man_t * Gia_ManStart ( int nObjsMax)

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file giaMan.c.

58{
59 Gia_Man_t * p;
60 assert( nObjsMax > 0 );
61 p = ABC_CALLOC( Gia_Man_t, 1 );
62 p->nObjsAlloc = nObjsMax;
63 p->pObjs = ABC_CALLOC( Gia_Obj_t, nObjsMax );
64 p->pObjs->iDiff0 = p->pObjs->iDiff1 = GIA_NONE;
65 p->nObjs = 1;
66 p->vCis = Vec_IntAlloc( nObjsMax / 20 );
67 p->vCos = Vec_IntAlloc( nObjsMax / 20 );
68 return p;
69}
#define GIA_NONE
INCLUDES ///.
Definition gia.h:45

◆ Gia_ManStop()

void Gia_ManStop ( Gia_Man_t * p)

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

Synopsis [Deletes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 82 of file giaMan.c.

83{
84 if ( p->vSeqModelVec )
85 Vec_PtrFreeFree( p->vSeqModelVec );
87 Tim_ManStopP( (Tim_Man_t **)&p->pManTime );
88 assert( p->pManTime == NULL );
89 Vec_PtrFreeFree( p->vNamesIn );
90 Vec_PtrFreeFree( p->vNamesOut );
91 Vec_PtrFreeFree( p->vNamesNode );
92 Vec_IntFreeP( &p->vSwitching );
93 Vec_IntFreeP( &p->vSuper );
94 Vec_IntFreeP( &p->vStore );
95 Vec_IntFreeP( &p->vClassNew );
96 Vec_IntFreeP( &p->vClassOld );
97 Vec_IntFreeP( &p->vPats );
98 Vec_BitFreeP( &p->vPolars );
99 Vec_WrdFreeP( &p->vSims );
100 Vec_WrdFreeP( &p->vSimsT );
101 Vec_WrdFreeP( &p->vSimsPi );
102 Vec_WrdFreeP( &p->vSimsPo );
103 Vec_IntFreeP( &p->vTimeStamps );
104 Vec_FltFreeP( &p->vTiming );
105 Vec_VecFreeP( &p->vClockDoms );
106 Vec_IntFreeP( &p->vCofVars );
107 Vec_IntFreeP( &p->vIdsOrig );
108 Vec_IntFreeP( &p->vIdsEquiv );
109 Vec_IntFreeP( &p->vLutConfigs );
110 Vec_IntFreeP( &p->vEdgeDelay );
111 Vec_IntFreeP( &p->vEdgeDelayR );
112 Vec_IntFreeP( &p->vEdge1 );
113 Vec_IntFreeP( &p->vEdge2 );
114 Vec_IntFreeP( &p->vUserPiIds );
115 Vec_IntFreeP( &p->vUserPoIds );
116 Vec_IntFreeP( &p->vUserFfIds );
117 Vec_IntFreeP( &p->vFlopClasses );
118 Vec_IntFreeP( &p->vGateClasses );
119 Vec_IntFreeP( &p->vObjClasses );
120 Vec_IntFreeP( &p->vInitClasses );
121 Vec_IntFreeP( &p->vRegClasses );
122 Vec_IntFreeP( &p->vRegInits );
123 Vec_IntFreeP( &p->vDoms );
124 Vec_IntFreeP( &p->vBarBufs );
125 Vec_IntFreeP( &p->vXors );
126 Vec_IntFreeP( &p->vLevels );
127 Vec_IntFreeP( &p->vTruths );
128 Vec_IntErase( &p->vCopies );
129 Vec_IntErase( &p->vCopies2 );
130 Vec_IntFreeP( &p->vVar2Obj );
131 Vec_IntErase( &p->vCopiesTwo );
132 Vec_IntErase( &p->vSuppVars );
133 Vec_IntErase( &p->vVarMap );
134 Vec_WrdFreeP( &p->vSuppWords );
135 Vec_IntFreeP( &p->vTtNums );
136 Vec_IntFreeP( &p->vTtNodes );
137 Vec_WrdFreeP( &p->vTtMemory );
138 Vec_PtrFreeP( &p->vTtInputs );
139 Vec_IntFreeP( &p->vMapping );
140 Vec_WecFreeP( &p->vMapping2 );
141 Vec_WecFreeP( &p->vFanouts2 );
142 Vec_IntFreeP( &p->vCellMapping );
143 Vec_IntFreeP( &p->vPacking );
144 Vec_IntFreeP( &p->vConfigs );
145 ABC_FREE( p->pCellStr );
146 Vec_FltFreeP( &p->vInArrs );
147 Vec_FltFreeP( &p->vOutReqs );
148 Vec_IntFreeP( &p->vCiArrs );
149 Vec_IntFreeP( &p->vCoReqs );
150 Vec_IntFreeP( &p->vCoArrs );
151 Vec_IntFreeP( &p->vCoAttrs );
152 Vec_IntFreeP( &p->vWeights );
153 Gia_ManStopP( &p->pAigExtra );
154 Vec_IntFree( p->vCis );
155 Vec_IntFree( p->vCos );
156 Vec_IntErase( &p->vHash );
157 Vec_IntErase( &p->vHTable );
158 Vec_IntErase( &p->vRefs );
159 Vec_StrFreeP( &p->vStopsF );
160 Vec_StrFreeP( &p->vStopsB );
161 ABC_FREE( p->pData2 );
162 ABC_FREE( p->pTravIds );
163 ABC_FREE( p->pPlacement );
164 ABC_FREE( p->pSwitching );
165 ABC_FREE( p->pCexSeq );
166 ABC_FREE( p->pCexComb );
167 ABC_FREE( p->pIso );
168// ABC_FREE( p->pMapping );
169 ABC_FREE( p->pFanData );
170 ABC_FREE( p->pReprsOld );
171 ABC_FREE( p->pReprs );
172 ABC_FREE( p->pNexts );
173 ABC_FREE( p->pSibls );
174 ABC_FREE( p->pRefs );
175 ABC_FREE( p->pLutRefs );
176 ABC_FREE( p->pMuxes );
177 ABC_FREE( p->pObjs );
178 ABC_FREE( p->pSpec );
179 ABC_FREE( p->pName );
180 ABC_FREE( p );
181}
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
Definition giaFanout.c:393
void Tim_ManStopP(Tim_Man_t **p)
Definition timMan.c:387
Here is the call graph for this function:

◆ Gia_ManStopP()

void Gia_ManStopP ( Gia_Man_t ** p)

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file giaMan.c.

225{
226 if ( *p == NULL )
227 return;
228 Gia_ManStop( *p );
229 *p = NULL;
230}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManWriteNames()

void Gia_ManWriteNames ( FILE * pFile,
char c,
int n,
Vec_Ptr_t * vNames,
int Start,
int Skip,
Vec_Bit_t * vObjs,
int fReverse )

Definition at line 1393 of file giaMan.c.

1394{
1395 int Digits = Abc_Base10Log( n );
1396 int Length = Start, i, fFirst = 1;
1397 char * pName;
1398 for ( i = 0; i < n; i++ )
1399 {
1400 int k = fReverse ? n-1-i : i;
1401 if ( vObjs && !Vec_BitEntry(vObjs, k) )
1402 continue;
1403 pName = Gia_ObjGetDumpName( vNames, c, k, Digits );
1404 Length += strlen(pName) + 2;
1405 if ( Length > 60 )
1406 {
1407 fprintf( pFile, ",\n " );
1408 Length = Skip;
1409 fFirst = 1;
1410 }
1411 fprintf( pFile, "%s%s", fFirst ? "":", ", pName );
1412 fFirst = 0;
1413 }
1414}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManWriteNamesInter()

void Gia_ManWriteNamesInter ( FILE * pFile,
char c,
int n,
int Start,
int Skip,
int nRegs,
int fReverse )

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

Synopsis [Dump interface module]

Description []

SideEffects []

SeeAlso []

Definition at line 1260 of file giaMan.c.

1261{
1262 int Length = Start, i, fFirst = 1;
1263 char pName[100];
1264 for ( i = 0; i < n-nRegs; i++ )
1265 {
1266 sprintf( pName, "%c[%d]", c, i );
1267 Length += strlen(pName) + 2;
1268 if ( Length > 60 )
1269 {
1270 fprintf( pFile, ",\n " );
1271 Length = Skip;
1272 fFirst = 1;
1273 }
1274 fprintf( pFile, "%s%s", fFirst ? "":", ", pName );
1275 fFirst = 0;
1276 }
1277 for ( i = n-nRegs; i < n; i++ )
1278 {
1279 sprintf( pName, "%c%c[%d]", c, c, i );
1280 Length += strlen(pName) + 2;
1281 if ( Length > 60 )
1282 {
1283 fprintf( pFile, ",\n " );
1284 Length = Skip;
1285 fFirst = 1;
1286 }
1287 fprintf( pFile, "%s%s", fFirst ? "":", ", pName );
1288 fFirst = 0;
1289 }}
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjGetDumpName()

char * Gia_ObjGetDumpName ( Vec_Ptr_t * vNames,
char c,
int i,
int d )

Definition at line 1378 of file giaMan.c.

1379{
1380 static char pBuffer[10000];
1381 if ( vNames )
1382 {
1383 char * pName = (char *)Vec_PtrEntry(vNames, i);
1384 if ( Gia_ManNameIsLegalInVerilog(pName) )
1385 sprintf( pBuffer, "%s", pName );
1386 else
1387 sprintf( pBuffer, "\\%s ", pName );
1388 }
1389 else
1390 sprintf( pBuffer, "%c%0*d%c", c, d, i, c );
1391 return pBuffer;
1392}
int Gia_ManNameIsLegalInVerilog(char *pName)
Definition giaMan.c:1362
Here is the call graph for this function:
Here is the caller graph for this function: