DECLARATIONS ///.
Date [Ver. 1.0. Started - June 20, 2005.]
] FUNCTION DEFINITIONS /// Function*************************************************************
46{
48 FILE * pFile;
52 int nInputs, nOutputs, nLatches, nAnds, nFileSize, Num, i;
53 char * pContents, * pName, * pCur;
54 unsigned * pBufferNode;
55 int RetValue;
56
57
59 pFile = fopen( pFileName, "rb" );
61 RetValue = fread( pContents, nFileSize, 1, pFile );
62 fclose( pFile );
63
64
65 for ( pCur = pContents; *pCur == '#'; )
66 while ( *pCur++ != '\n' );
67
68
69 pName = pCur; while ( *pCur++ );
70
71 nInputs = atoi( pCur ); while ( *pCur++ );
72
73 nOutputs = atoi( pCur ); while ( *pCur++ );
74
75 nLatches = atoi( pCur ); while ( *pCur++ );
76
77 nAnds = atoi( pCur ); while ( *pCur++ );
78
79
83
84
85 vNodes = Vec_PtrAlloc( 1 + nInputs + nLatches + nAnds );
87
88
89 for ( i = 0; i < nInputs; i++ )
90 {
91 pObj = Abc_NtkCreatePi(pNtkNew);
93 Vec_PtrPush( vNodes, pObj );
94 }
95
96 for ( i = 0; i < nOutputs; i++ )
97 {
98 pObj = Abc_NtkCreatePo(pNtkNew);
100 }
101
102 for ( i = 0; i < nLatches; i++ )
103 {
104 pObj = Abc_NtkCreateLatch(pNtkNew);
106
107 pNode0 = Abc_NtkCreateBi(pNtkNew);
109
110 pNode1 = Abc_NtkCreateBo(pNtkNew);
112 Vec_PtrPush( vNodes, pNode1 );
113
116 }
117
118
119 pBufferNode = (unsigned *)(pContents + (nFileSize - (2 * nAnds + nOutputs + nLatches) * sizeof(int)) );
120
121 if ( pBufferNode != (unsigned *)pCur )
122 {
124 Vec_PtrFree( vNodes );
126 printf( "Warning: Internal reader error.\n" );
127 return NULL;
128 }
129
130
132 for ( i = 0; i < nAnds; i++ )
133 {
134 Extra_ProgressBarUpdate( pProgress, i, NULL );
135 pNode0 = Abc_ObjNotCond( (
Abc_Obj_t *)Vec_PtrEntry(vNodes, pBufferNode[2*i+0] >> 1), pBufferNode[2*i+0] & 1 );
136 pNode1 = Abc_ObjNotCond( (
Abc_Obj_t *)Vec_PtrEntry(vNodes, pBufferNode[2*i+1] >> 1), pBufferNode[2*i+1] & 1 );
138 }
140
141
143 {
144 Num = pBufferNode[2*nAnds+i];
145 if ( Abc_ObjFanoutNum(pObj) > 0 && Abc_ObjIsLatch(Abc_ObjFanout0(pObj)) )
146 {
147 Abc_ObjSetData( Abc_ObjFanout0(pObj), (void *)(ABC_PTRINT_T)(Num & 3) );
148 Num >>= 2;
149 }
150 pNode0 = Abc_ObjNotCond( (
Abc_Obj_t *)Vec_PtrEntry(vNodes, Num >> 1), Num & 1 );
152 }
154 Vec_PtrFree( vNodes );
155
156
157
158
159
161 {
162 printf( "Io_ReadBaf: The network check has failed.\n" );
164 return NULL;
165 }
166 return pNtkNew;
167
168}
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL int Abc_NtkCheckRead(Abc_Ntk_t *pNtk)
struct Abc_Aig_t_ Abc_Aig_t
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
#define ABC_ALLOC(type, num)
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.