66 printf(
"Io_ReadBench: The network check has failed.\n" );
92 char * pType, ** ppNames, * pString;
93 int iLine, nNames, nDigits, fLutsPresent = 0;
105 if ( vTokens->nSize == 1 )
114 if (
strncmp( (
char *)vTokens->pArray[0],
"INPUT", 5 ) == 0 )
116 else if (
strncmp( (
char *)vTokens->pArray[0],
"OUTPUT", 5 ) == 0 )
121 pType = (
char *)vTokens->pArray[1];
124 pNode =
Io_ReadCreateLatch( pNtk, (
char *)vTokens->pArray[2], (
char *)vTokens->pArray[0] );
126 if ( pType[3] ==
'0' )
128 else if ( pType[3] ==
'1' )
133 else if (
strcmp(pType,
"LUT") == 0 )
136 ppNames = (
char **)vTokens->pArray + 3;
137 nNames = vTokens->nSize - 3;
147 pString = (
char *)vTokens->pArray[2];
150 printf(
"%s: The LUT signature (%s) does not look like a hexadecimal beginning with \"0x\".\n",
Extra_FileReaderGetFileName(p), pString );
157 nDigits = (1 << nNames) / 4;
160 if (
strlen(pString) < (unsigned)nDigits )
193 else if ( pString[0] ==
'2' )
195 else if ( pString[0] ==
'1' )
209 ppNames = (
char **)vTokens->pArray + 2;
210 nNames = vTokens->nSize - 2;
213 if (
strcmp(pType,
"AND") == 0 )
215 else if (
strcmp(pType,
"OR") == 0 )
217 else if (
strcmp(pType,
"NAND") == 0 )
219 else if (
strcmp(pType,
"NOR") == 0 )
221 else if (
strcmp(pType,
"XOR") == 0 )
223 else if (
strcmp(pType,
"NXOR") == 0 ||
strcmp(pType,
"XNOR") == 0 )
225 else if (
strncmp(pType,
"BUF", 3) == 0 )
227 else if (
strcmp(pType,
"NOT") == 0 )
229 else if (
strncmp(pType,
"MUX", 3) == 0 )
232 else if (
strncmp(pType,
"gnd", 3) == 0 )
234 else if (
strncmp(pType,
"vdd", 3) == 0 )
259 printf(
"Io_ReadBenchNetwork(): Adding constant 0 fanin to non-driven net \"1\".\n" );
273 printf(
"Io_ReadBenchNetwork(): Adding constant 1 fanin to non-driven net \"2\".\n" );
285 printf(
"Io_ReadBenchNetwork(): Converting to BDD has failed.\n" );
291 printf(
"Io_ReadBenchNetwork(): Converting to SOP has failed.\n" );
318 pFile = fopen( pFileName,
"r" );
321 printf(
"Io_ReadBenchInit(): Failed to open file \"%s\".\n", pFileName );
324 while ( fgets( pBuffer, 999, pFile ) )
326 pToken =
strtok( pBuffer,
" \n\t\r" );
331 printf(
"Io_ReadBenchInit(): Cannot find register with output %s.\n", pToken );
337 printf(
"Io_ReadBenchInit(): The signal is not a register output %s.\n", pToken );
341 pToken =
strtok( NULL,
" \n\t\r" );
342 if ( pToken[0] ==
'0' )
344 else if ( pToken[0] ==
'1' )
346 else if ( pToken[0] ==
'2' )
350 printf(
"Io_ReadBenchInit(): The signal %s has unknown initial value (%s).\n",
static ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Io_ReadBenchNetwork(Extra_FileReader_t *p)
DECLARATIONS ///.
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static char * Vec_StrArray(Vec_Str_t *p)
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
ABC_DLL char * Abc_SopCreateAnd(Mem_Flex_t *pMan, int nVars, int *pfCompl)
ABC_DLL char * Abc_SopCreateInv(Mem_Flex_t *pMan)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Abc_Obj_t * Io_ReadCreateConst(Abc_Ntk_t *pNtk, char *pName, int fConst1)
Abc_Ntk_t * Io_ReadBench(char *pFileName, int fCheck)
FUNCTION DEFINITIONS ///.
static Vec_Str_t * Vec_StrAlloc(int nCap)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
ABC_DLL void Abc_NtkFinalizeRead(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
static void Abc_LatchSetInitDc(Abc_Obj_t *pLatch)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
ABC_DLL char * Abc_SopCreateNand(Mem_Flex_t *pMan, int nVars)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
static void Abc_ObjSetData(Abc_Obj_t *pObj, void *pData)
ABC_DLL char * Abc_SopCreateBuf(Mem_Flex_t *pMan)
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Abc_Obj_t * Io_ReadCreatePi(Abc_Ntk_t *pNtk, char *pName)
ABC_DLL Abc_Ntk_t * Abc_NtkStartRead(char *pName)
ABC_DLL int Abc_NtkToSop(Abc_Ntk_t *pNtk, int fDirect)
static void Vec_StrFree(Vec_Str_t *p)
ABC_DLL char * Abc_SopCreateNxor(Mem_Flex_t *pMan, int nVars)
ABC_DLL int Abc_NtkCheckRead(Abc_Ntk_t *pNtk)
static void Vec_StrFill(Vec_Str_t *p, int nSize, char Fill)
#define ABC_NAMESPACE_IMPL_END
ABC_DLL Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
ABC_DLL char * Abc_SopCreateXor(Mem_Flex_t *pMan, int nVars)
ABC_DLL int Abc_NtkToBdd(Abc_Ntk_t *pNtk)
Abc_Obj_t * Io_ReadCreateLatch(Abc_Ntk_t *pNtk, char *pNetLI, char *pNetLO)
#define ABC_NAMESPACE_IMPL_START
static void Abc_LatchSetInit1(Abc_Obj_t *pLatch)
ABC_DLL char * Abc_SopCreateNor(Mem_Flex_t *pMan, int nVars)
ABC_DLL char * Abc_SopCreateFromTruth(Mem_Flex_t *pMan, int nVars, unsigned *pTruth)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Abc_Obj_t * Io_ReadCreateNode(Abc_Ntk_t *pNtk, char *pNameOut, char *pNamesIn[], int nInputs)
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Abc_Obj_t * Io_ReadCreatePo(Abc_Ntk_t *pNtk, char *pName)
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
ABC_DLL char * Abc_SopCreateOr(Mem_Flex_t *pMan, int nVars, int *pfCompl)
void Io_ReadBenchInit(Abc_Ntk_t *pNtk, char *pFileName)
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)