FUNCTION DEFINITIONS ///.
61{
63 unsigned ** puTruthGates;
64 unsigned uTruths[6][2];
67 int nGates, nFanins, i;
68
69 assert( Abc_NtkIsSopLogic(pNtk) );
70
71
73 if ( pGenlib == NULL )
74 {
75 printf( "The current library is not available.\n" );
76 return 0;
77 }
78
79
80 Abc_AttachSetupTruthTables( uTruths );
81
82
84
85
86 puTruthGates =
ABC_ALLOC(
unsigned *, nGates );
87 puTruthGates[0] =
ABC_ALLOC(
unsigned, 2 * nGates );
88 for ( i = 1; i < nGates; i++ )
89 puTruthGates[i] = puTruthGates[i-1] + 2;
90 for ( i = 0; i < nGates; i++ )
92
93
96 {
97 nFanins = Abc_ObjFaninNum(pNode);
98 if ( nFanins == 0 )
99 {
102 else
104 }
105 else if ( nFanins == 1 )
106 {
109 else
111 }
112 else if ( nFanins > 6 )
113 {
114 printf(
"Cannot attach gate with more than 6 inputs to node %s.\n",
Abc_ObjName(pNode) );
118 return 0;
119 }
120 else if ( !Abc_NodeAttach( pNode, ppGates, puTruthGates, nGates, uTruths ) )
121 {
122 printf(
"Could not attach the library gate to node %s.\n",
Abc_ObjName(pNode) );
126 return 0;
127 }
128 }
133
134
136 {
137 if ( pNode->
pCopy == NULL )
138 {
139 printf( "Some elementary gates (constant, buffer, or inverter) are missing in the library.\n" );
140 return 0;
141 }
142 }
143
144
150
151 printf( "Library gates are successfully attached to the nodes.\n" );
152
153
155 {
156 printf( "Abc_NtkAttach: The network check has failed.\n" );
157 return 0;
158 }
159 return 1;
160}
struct Abc_Obj_t_ Abc_Obj_t
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_SopIsBuf(char *pSop)
ABC_DLL int Abc_SopIsConst1(char *pSop)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_ALLOC(type, num)
ABC_DLL void * Abc_FrameReadLibGen()
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Mio_Gate_t ** Mio_CollectRoots(Mio_Library_t *pLib, int nInputs, float tDelay, int fSkipInv, int *pnGates, int fVerbose)
void Mio_DeriveTruthTable(Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[])
struct Mio_LibraryStruct_t_ Mio_Library_t
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
struct Mio_GateStruct_t_ Mio_Gate_t
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)