summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-09-19 17:35:04 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-09-19 17:35:04 -0700
commit480ca14c75e9f8c54ca9b55c39162324aaa1e288 (patch)
tree446dc0fd3a98d5d60c01f01f5b95e380b002ce34 /src/base
parent3af0f719afa368cafbe7c8178d0995819b47be90 (diff)
downloadabc-480ca14c75e9f8c54ca9b55c39162324aaa1e288.tar.gz
abc-480ca14c75e9f8c54ca9b55c39162324aaa1e288.tar.bz2
abc-480ca14c75e9f8c54ca9b55c39162324aaa1e288.zip
Extending Liberty parser to handle multi-output cells.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abc/abc.h2
-rw-r--r--src/base/abc/abcUtil.c12
-rw-r--r--src/base/abci/abcMap.c29
-rw-r--r--src/base/abci/abcPrint.c2
-rw-r--r--src/base/io/ioWriteBlif.c25
5 files changed, 45 insertions, 25 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h
index 83aa3f7b..683bb76b 100644
--- a/src/base/abc/abc.h
+++ b/src/base/abc/abc.h
@@ -661,6 +661,8 @@ extern ABC_DLL int Abc_LibFindTopLevelModels( Abc_Lib_t * pLib );
extern ABC_DLL Abc_Ntk_t * Abc_LibDeriveRoot( Abc_Lib_t * pLib );
/*=== abcLog.c ==========================================================*/
extern ABC_DLL void Abc_NtkWriteLogFile( char * pFileName, Abc_Cex_t * pSeqCex, int Status, int nFrames, char * pCommand );
+/*=== abcMap.c ==========================================================*/
+extern ABC_DLL Abc_Obj_t * Abc_NtkFetchTwinNode( Abc_Obj_t * pNode );
/*=== abcMiter.c ==========================================================*/
extern ABC_DLL int Abc_NtkMinimumBase( Abc_Ntk_t * pNtk );
extern ABC_DLL int Abc_NodeMinimumBase( Abc_Obj_t * pNode );
diff --git a/src/base/abc/abcUtil.c b/src/base/abc/abcUtil.c
index 2ad32dba..e2ffb016 100644
--- a/src/base/abc/abcUtil.c
+++ b/src/base/abc/abcUtil.c
@@ -357,22 +357,22 @@ int Abc_NtkGetClauseNum( Abc_Ntk_t * pNtk )
***********************************************************************/
double Abc_NtkGetMappedArea( Abc_Ntk_t * pNtk )
{
- Abc_Obj_t * pNode;
+ Abc_Obj_t * pObj;
double TotalArea;
int i;
assert( Abc_NtkHasMapping(pNtk) );
TotalArea = 0.0;
- Abc_NtkForEachNode( pNtk, pNode, i )
+ Abc_NtkForEachNode( pNtk, pObj, i )
{
-// assert( pNode->pData );
- if ( pNode->pData == NULL )
+// assert( pObj->pData );
+ if ( pObj->pData == NULL )
{
printf( "Node without mapping is encountered.\n" );
continue;
}
- TotalArea += Mio_GateReadArea( (Mio_Gate_t *)pNode->pData );
+ TotalArea += Mio_GateReadArea( (Mio_Gate_t *)pObj->pData );
// assuming that twin gates follow each other
- if ( Mio_GateReadTwin(((Mio_Gate_t *)pNode->pData)) != NULL )
+ if ( Abc_NtkFetchTwinNode(pObj) )
i++;
}
return TotalArea;
diff --git a/src/base/abci/abcMap.c b/src/base/abci/abcMap.c
index c9d743eb..fb8c87ed 100644
--- a/src/base/abci/abcMap.c
+++ b/src/base/abci/abcMap.c
@@ -682,6 +682,35 @@ Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Super_t * p
return pNodeNew;
}
+/**Function*************************************************************
+
+ Synopsis [Returns the twin node if it exists.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Abc_Obj_t * Abc_NtkFetchTwinNode( Abc_Obj_t * pNode )
+{
+ Abc_Obj_t * pNode2;
+ Mio_Gate_t * pGate = (Mio_Gate_t *)pNode->pData;
+ assert( Abc_NtkHasMapping(pNode->pNtk) );
+ if ( pGate == NULL || Mio_GateReadTwin(pGate) == NULL )
+ return NULL;
+ // assuming the twin node is following next
+ if ( (int)Abc_ObjId(pNode) == Abc_NtkObjNumMax(pNode->pNtk) - 1 )
+ return NULL;
+ pNode2 = Abc_NtkObj( pNode->pNtk, Abc_ObjId(pNode) + 1 );
+ if ( pNode2 == NULL || !Abc_ObjIsNode(pNode2) || Abc_ObjFaninNum(pNode) != Abc_ObjFaninNum(pNode2) )
+ return NULL;
+ if ( Mio_GateReadTwin(pGate) != (Mio_Gate_t *)pNode2->pData )
+ return NULL;
+ return pNode2;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c
index 5f151b49..71900771 100644
--- a/src/base/abci/abcPrint.c
+++ b/src/base/abci/abcPrint.c
@@ -1025,7 +1025,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
Mio_GateSetValue( (Mio_Gate_t *)pObj->pData, 1 + Mio_GateReadValue((Mio_Gate_t *)pObj->pData) );
CounterTotal++;
// assuming that twin gates follow each other
- if ( Mio_GateReadTwin(((Mio_Gate_t *)pObj->pData)) != NULL )
+ if ( Abc_NtkFetchTwinNode(pObj) )
i++;
}
diff --git a/src/base/io/ioWriteBlif.c b/src/base/io/ioWriteBlif.c
index a8305d07..0a33c9a2 100644
--- a/src/base/io/ioWriteBlif.c
+++ b/src/base/io/ioWriteBlif.c
@@ -514,6 +514,7 @@ void Io_NtkWriteNodeFanins( FILE * pFile, Abc_Obj_t * pNode )
fprintf( pFile, " %s", pName );
}
+
/**Function*************************************************************
Synopsis [Writes the primary input list.]
@@ -527,12 +528,11 @@ void Io_NtkWriteNodeFanins( FILE * pFile, Abc_Obj_t * pNode )
***********************************************************************/
int Io_NtkWriteNodeGate( FILE * pFile, Abc_Obj_t * pNode, int Length )
{
+ static int fReport = 0;
Mio_Gate_t * pGate = (Mio_Gate_t *)pNode->pData;
- Mio_Gate_t * pGate2;
Mio_Pin_t * pGatePin;
Abc_Obj_t * pNode2;
int i;
- // write the node
fprintf( pFile, " %-*s ", Length, Mio_GateReadName(pGate) );
for ( pGatePin = Mio_GateReadPins(pGate), i = 0; pGatePin; pGatePin = Mio_PinReadNext(pGatePin), i++ )
fprintf( pFile, "%s=%s ", Mio_PinReadName(pGatePin), Abc_ObjName( Abc_ObjFanin(pNode,i) ) );
@@ -540,25 +540,14 @@ int Io_NtkWriteNodeGate( FILE * pFile, Abc_Obj_t * pNode, int Length )
fprintf( pFile, "%s=%s", Mio_GateReadOutName(pGate), Abc_ObjName( Abc_ObjFanout0(pNode) ) );
if ( Mio_GateReadTwin(pGate) == NULL )
return 0;
- // assuming the twin node is following next
- if ( (int)Abc_ObjId(pNode) == Abc_NtkObjNumMax(pNode->pNtk) - 1 )
- {
- printf( "Warning: Missing second output of gate \"%s\".\n", Mio_GateReadName(pGate) );
- return 0;
- }
- pNode2 = Abc_NtkObj( pNode->pNtk, Abc_ObjId(pNode) + 1 );
- if ( !Abc_ObjIsNode(pNode2) || Abc_ObjFaninNum(pNode) != Abc_ObjFaninNum(pNode2) )
- {
- printf( "Warning: Missing second output of gate \"%s\".\n", Mio_GateReadName(pGate) );
- return 0;
- }
- pGate2 = (Mio_Gate_t *)pNode2->pData;
- if ( strcmp( Mio_GateReadName(pGate), Mio_GateReadName(pGate2)) )
+ pNode2 = Abc_NtkFetchTwinNode( pNode );
+ if ( pNode2 == NULL )
{
- printf( "Warning: Missing second output of gate \"%s\".\n", Mio_GateReadName(pGate) );
+ if ( !fReport )
+ fReport = 1, printf( "Warning: Missing second output of gate(s) \"%s\".\n", Mio_GateReadName(pGate) );
return 0;
}
- fprintf( pFile, " %s=%s", Mio_GateReadOutName(pGate2), Abc_ObjName( Abc_ObjFanout0(pNode2) ) );
+ fprintf( pFile, " %s=%s", Mio_GateReadOutName((Mio_Gate_t *)pNode2->pData), Abc_ObjName( Abc_ObjFanout0(pNode2) ) );
return 1;
}