summaryrefslogtreecommitdiffstats
path: root/src/base/cba
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-07-21 17:51:28 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-07-21 17:51:28 -0700
commit91b62b3bb8ee38938d4119d4cbd2360a652974bd (patch)
tree0d4207652a871a2e8118ef98cf4b70b3a7f6a19d /src/base/cba
parent477ecc172f3d9088bf6ecd21044b9d1c758d7b64 (diff)
downloadabc-91b62b3bb8ee38938d4119d4cbd2360a652974bd.tar.gz
abc-91b62b3bb8ee38938d4119d4cbd2360a652974bd.tar.bz2
abc-91b62b3bb8ee38938d4119d4cbd2360a652974bd.zip
Renaming Cba into Bac.
Diffstat (limited to 'src/base/cba')
-rw-r--r--src/base/cba/cba.h2
-rw-r--r--src/base/cba/cbaLib.c52
-rw-r--r--src/base/cba/cbaOper.c365
-rw-r--r--src/base/cba/cbaPrsBuild.c375
-rw-r--r--src/base/cba/cbaPrsTrans.c211
-rw-r--r--src/base/cba/cbaPtr.c470
-rw-r--r--src/base/cba/cbaPtrAbc.c486
-rw-r--r--src/base/cba/cbaReadSmt.c42
-rw-r--r--src/base/cba/cbaReadVer.c2
-rw-r--r--src/base/cba/cbaWriteSmt.c52
10 files changed, 2 insertions, 2055 deletions
diff --git a/src/base/cba/cba.h b/src/base/cba/cba.h
index 20b4a7b1..d36c75af 100644
--- a/src/base/cba/cba.h
+++ b/src/base/cba/cba.h
@@ -606,7 +606,7 @@ static inline Cba_Ntk_t * Cba_NtkDupOrder( Cba_Man_t * pMan, Cba_Ntk_t * p, Vec_
Vec_IntFree( vObjs );
return pNew;
}
-static inline Cba_Ntk_t * Cba_NtkDupAttrs( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
+static inline void Cba_NtkDupAttrs( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
{
// transfer object attributes
Vec_IntRemapArray( &p->vObjCopy, &p->vObjFunc, &pNew->vObjFunc, Cba_NtkObjNum(pNew) + 1 );
diff --git a/src/base/cba/cbaLib.c b/src/base/cba/cbaLib.c
deleted file mode 100644
index 04f7adfb..00000000
--- a/src/base/cba/cbaLib.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaLib.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [Library procedures.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaLib.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "cba.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-
diff --git a/src/base/cba/cbaOper.c b/src/base/cba/cbaOper.c
deleted file mode 100644
index b39618b7..00000000
--- a/src/base/cba/cbaOper.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaOper.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [Operator procedures.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaOper.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "cba.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Cba_BoxCreate( Cba_Ntk_t * p, Cba_ObjType_t Type, Vec_Int_t * vFanins, int nInA, int nInB, int nOuts )
-{
- char pName[100]; int i, iObj, iFanin;
- assert( CBA_OBJ_BOX < Type && Type < CBA_BOX_UNKNOWN );
- if ( CBA_BOX_CF <= Type && Type <= CBA_BOX_CZ )
- {
- sprintf( pName, "ABCCTo%d", nOuts );
- assert( 0 == Vec_IntSize(vFanins) );
- iObj = Cba_BoxAlloc( p, Type, 0, nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- else if ( CBA_BOX_BUF <= Type && Type <= CBA_BOX_INV )
- {
- char * pPref[2] = { "ABCBUF", "ABCINV" };
- assert( nInA == nOuts );
- assert( nInA == Vec_IntSize(vFanins) );
- sprintf( pName, "%sa%do%d", pPref[Type - CBA_BOX_BUF], nInA, nOuts );
- iObj = Cba_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- else if ( CBA_BOX_AND <= Type && Type <= CBA_BOX_XNOR )
- {
- char * pPref[6] = { "ABCAND", "ABCNAND", "ABCOR", "ABCNOR", "ABCXOR", "ABCXNOR" };
- assert( nInA == nOuts && nInB == nOuts );
- assert( nInA + nInB == Vec_IntSize(vFanins) );
- sprintf( pName, "%sa%db%do%d", pPref[Type - CBA_BOX_AND], nInA, nInB, nOuts );
- iObj = Cba_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- else if ( Type == CBA_BOX_MUX )
- {
- char * pPref[1] = { "ABCMUX" };
- assert( nInA == nOuts && nInB == nOuts );
- assert( 1 + nInA + nInB == Vec_IntSize(vFanins) );
- sprintf( pName, "%sc%da%db%do%d", pPref[Type - CBA_BOX_MUX], 1, nInA, nInB, nOuts );
- iObj = Cba_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- else if ( Type == CBA_BOX_MAJ )
- {
- char * pPref[1] = { "ABCMAJ" };
- assert( nInA == 1 && nInB == 1 && nOuts == 1 );
- assert( 3 == Vec_IntSize(vFanins) );
- sprintf( pName, "%sa%db%dc%do%d", pPref[Type - CBA_BOX_MAJ], 1, 1, 1, 1 );
- iObj = Cba_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- else if ( CBA_BOX_RAND <= Type && Type <= CBA_BOX_RXNOR )
- {
- char * pPref[6] = { "ABCRAND", "ABCRNAND", "ABCROR", "ABCRNOR", "ABCRXOR", "ABCRXNOR" };
- assert( nInA == nInB && 1 == nOuts );
- assert( nInA + nInB == Vec_IntSize(vFanins) );
- sprintf( pName, "%sa%db%do%d", pPref[Type - CBA_BOX_RAND], nInA, nInB, nOuts );
- iObj = Cba_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- else if ( Type == CBA_BOX_SEL )
- {
- char * pPref[1] = { "ABCSEL" };
- assert( nInA * nOuts == nInB );
- assert( nInA + nInB == Vec_IntSize(vFanins) );
- sprintf( pName, "%sa%db%do%d", pPref[Type - CBA_BOX_SEL], nInA, nInB, nOuts );
- iObj = Cba_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- else if ( Type == CBA_BOX_PSEL )
- {
- char * pPref[1] = { "ABCPSEL" };
- assert( nInA * nOuts == nInB );
- assert( 1 + nInA + nInB == Vec_IntSize(vFanins) );
- sprintf( pName, "%si%da%db%do%d", pPref[Type - CBA_BOX_SEL], 1, nInA, nInB, nOuts );
- iObj = Cba_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
- }
- // add fanins
- Vec_IntForEachEntry( vFanins, iFanin, i )
- Cba_ObjSetFanin( p, Cba_BoxBi(p, iObj, i), iFanin );
- return iObj;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Cba_ObjClpWide( Cba_Ntk_t * p, int iBox )
-{
- Cba_ObjType_t Type = Cba_ObjType( p, iBox );
- int nBis = Cba_BoxBiNum(p, iBox);
- int nBos = Cba_BoxBoNum(p, iBox);
- int i, k, iObj;
- assert( nBos > 1 );
- Vec_IntClear( &p->vArray );
- if ( CBA_BOX_BUF <= Type && Type <= CBA_BOX_INV )
- {
- for ( i = 0; i < nBos; i++ )
- {
- Vec_IntFill( &p->vArray2, 1, Cba_BoxFanin(p, iBox, i) );
- iObj = Cba_BoxCreate( p, Type, &p->vArray2, 1, -1, 1 );
- Vec_IntPush( &p->vArray, Cba_BoxBo(p, iObj, 0) );
- }
- }
- else if ( CBA_BOX_AND <= Type && Type <= CBA_BOX_XNOR )
- {
- assert( nBis == 2 * nBos );
- for ( i = 0; i < nBos; i++ )
- {
- Vec_IntFillTwo( &p->vArray2, 2, Cba_BoxFanin(p, iBox, i), Cba_BoxFanin(p, iBox, nBos+i) );
- iObj = Cba_BoxCreate( p, Type, &p->vArray2, 1, 1, 1 );
- Vec_IntPush( &p->vArray, Cba_BoxBo(p, iObj, 0) );
- }
- }
- else if ( Type == CBA_BOX_MUX )
- {
- assert( nBis - 1 == 2 * nBos );
- for ( i = 0; i < nBos; i++ )
- {
- Vec_IntFill( &p->vArray2, 1, Cba_BoxFanin(p, iBox, 0) );
- Vec_IntPushTwo( &p->vArray2, Cba_BoxFanin(p, iBox, 1+i), Cba_BoxFanin(p, iBox, 1+nBos+i) );
- iObj = Cba_BoxCreate( p, Type, &p->vArray2, 1, 1, 1 );
- Vec_IntPush( &p->vArray, Cba_BoxBo(p, iObj, 0) );
- }
- }
- else if ( Type == CBA_BOX_NMUX )
- {
- int n, nIns = nBis / nBos;
- assert( nBis % nBos == 0 );
- for ( n = 1; n < 32; n++ )
- if ( n + (1 << n) == nIns )
- break;
- assert( n > 1 && n < 32 );
- for ( i = 0; i < nBos; i++ )
- {
- Vec_IntClear( &p->vArray2 );
- for ( k = 0; k < n; k++ )
- Vec_IntPush( &p->vArray2, Cba_BoxFanin(p, iBox, k) );
- for ( k = 0; k < (1 << n); k++ )
- Vec_IntPush( &p->vArray2, Cba_BoxFanin(p, iBox, n + (1 << n) * i + k) );
- iObj = Cba_BoxCreate( p, Type, &p->vArray2, n, (1 << n), 1 );
- Vec_IntPush( &p->vArray, Cba_BoxBo(p, iObj, 0) );
- }
- }
- else if ( Type == CBA_BOX_SEL )
- {
- }
- else if ( Type == CBA_BOX_PSEL )
- {
- }
- else if ( Type == CBA_BOX_DFF || Type == CBA_BOX_LATCH )
- {
- }
- else if ( Type == CBA_BOX_DFFRS || Type == CBA_BOX_LATCHRS )
- {
- }
- else assert( 0 );
- Cba_BoxReplace( p, iBox, Vec_IntArray(&p->vArray), Vec_IntSize(&p->vArray) );
- return iBox;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Cba_ObjClpArith( Cba_Ntk_t * p, int iBox )
-{
- Cba_ObjType_t Type = Cba_ObjType( p, iBox );
- int i, iObj = -1;
- int nBis = 0;//Cba_NtkReadRangesPrim( Cba_BoxNtkName(p, iObj), &p->vArray, 0 );
- assert( nBis == Cba_BoxBiNum(p, iBox) );
- if ( Type == CBA_BOX_ADD )
- {
- int Carry = Cba_BoxFanin(p, iBox, 0);
- int nBits = Vec_IntEntry(&p->vArray, 1);
- assert( Vec_IntSize(&p->vArray) == 3 );
- assert( Vec_IntEntry(&p->vArray, 0) == 1 );
- assert( Vec_IntEntry(&p->vArray, 2) == nBits );
- Vec_IntClear( &p->vArray );
- for ( i = 0; i < nBits; i++ )
- {
- Vec_IntFill( &p->vArray2, 1, Carry );
- Vec_IntPushTwo( &p->vArray2, Cba_BoxFanin(p, iBox, 1+i), Cba_BoxFanin(p, iBox, 1+nBits+i) );
- iObj = Cba_BoxCreate( p, CBA_BOX_ADD, &p->vArray2, 1, 1, 1 );
- Carry = Cba_BoxBo(p, iObj, 1);
- Vec_IntPush( &p->vArray, Cba_BoxBo(p, iObj, 0) );
- }
- Vec_IntPush( &p->vArray, Carry );
- }
- else if ( Type == CBA_BOX_SUB )
- {
- int iConst, nBits = Vec_IntEntry(&p->vArray, 0);
- assert( Vec_IntSize(&p->vArray) == 2 );
- assert( Vec_IntEntry(&p->vArray, 1) == nBits );
- // create inverter
- Vec_IntClear( &p->vArray2 );
- for ( i = 0; i < nBits; i++ )
- Vec_IntPush( &p->vArray2, Cba_BoxFanin(p, iBox, nBits+i) );
- iObj = Cba_BoxCreate( p, CBA_BOX_INV, &p->vArray2, nBits, -1, nBits );
- // create constant
- Vec_IntClear( &p->vArray2 );
- iConst = Cba_BoxCreate( p, CBA_BOX_CT, &p->vArray2, -1, -1, 1 );
- // collect fanins
- Vec_IntFill( &p->vArray2, 1, iConst+1 );
- for ( i = 0; i < nBits; i++ )
- Vec_IntPush( &p->vArray2, Cba_BoxFanin(p, iBox, i) );
- for ( i = 0; i < nBits; i++ )
- Vec_IntPush( &p->vArray2, Cba_BoxBo(p, iObj, i) );
- // create adder
- iObj = Cba_BoxCreate( p, CBA_BOX_ADD, &p->vArray2, nBits, nBits, nBits );
- // collect fanins
- Vec_IntClear( &p->vArray );
- for ( i = 0; i < nBits; i++ )
- Vec_IntPush( &p->vArray, Cba_BoxBo(p, iObj, i) );
- }
- else if ( Type == CBA_BOX_MUL )
- {
- }
- else if ( Type == CBA_BOX_DIV )
- {
- }
- else if ( Type == CBA_BOX_MOD )
- {
- }
- else if ( Type == CBA_BOX_REM )
- {
- }
- else if ( Type == CBA_BOX_POW )
- {
- }
- else if ( Type == CBA_BOX_MIN )
- {
- }
- else if ( Type == CBA_BOX_ABS )
- {
- }
-
- else if ( Type == CBA_BOX_LTHAN )
- {
- }
- else if ( Type == CBA_BOX_LETHAN )
- {
- }
- else if ( Type == CBA_BOX_METHAN )
- {
- }
- else if ( Type == CBA_BOX_MTHAN )
- {
- }
- else if ( Type == CBA_BOX_EQU )
- {
- }
- else if ( Type == CBA_BOX_NEQU )
- {
- }
-
- else if ( Type == CBA_BOX_SHIL )
- {
- }
- else if ( Type == CBA_BOX_SHIR )
- {
- }
- else if ( Type == CBA_BOX_ROTL )
- {
- }
- else if ( Type == CBA_BOX_ROTR )
- {
- }
- Cba_BoxReplace( p, iBox, Vec_IntArray(&p->vArray), Vec_IntSize(&p->vArray) );
- return 1;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Cba_ObjClpMemory( Cba_Ntk_t * p, int iBox )
-{
- int i, En, iNext, nItems = Cba_BoxBiNum(p, iBox);
- assert( Cba_ObjType(p, iBox) == CBA_BOX_RAMBOX );
- assert( Cba_BoxBiNum(p, iBox) == Cba_BoxBoNum(p, iBox) );
- // for each fanin of RAMBOX, make sure address width is the same
- Cba_BoxForEachFaninBox( p, iBox, iNext, i )
- assert( Cba_ObjType(p, iNext) == CBA_BOX_RAMWC );
-
- // create decoders, selectors and flops
- for ( i = 0; i < nItems; i++ )
- {
- int BoxW = Cba_ObjFanin(p, Cba_BoxBi(p, iBox, i));
- int BoxR = Cba_ObjFanout(p, Cba_BoxBo(p, iBox, 0));
- assert( Cba_ObjType(p, BoxW) == CBA_BOX_RAMWC );
- assert( Cba_ObjType(p, BoxR) == CBA_BOX_RAMR );
- // create enable
- Vec_IntFillTwo( &p->vArray2, 2, Cba_BoxFanin(p, BoxW, 1), Cba_BoxFanin(p, BoxR, 0) );
- En = Cba_BoxCreate( p, CBA_BOX_AND, &p->vArray2, 1, 1, 1 );
- En = Cba_BoxBo( p, En, 0 );
- // collect address
- }
- // for each fanout of RAMBOX, makes ure address width is the same
-// Cba_BoxForEachFanoutBox( p, iBox, iNext, i )
-// assert( Cba_ObjType(p, iNext) == CBA_BOX_RAMR );
- // create selectors and connect them
- return 1;
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-
diff --git a/src/base/cba/cbaPrsBuild.c b/src/base/cba/cbaPrsBuild.c
deleted file mode 100644
index a74088fa..00000000
--- a/src/base/cba/cbaPrsBuild.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaPrsBuild.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [Parse tree to netlist transformation.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaPrsBuild.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "cba.h"
-#include "cbaPrs.h"
-#include "map/mio/mio.h"
-#include "base/main/main.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Prs_ManIsMapped( Prs_Ntk_t * pNtk )
-{
- Vec_Int_t * vSigs; int iBox;
- Mio_Library_t * pLib = (Mio_Library_t *)Abc_FrameReadLibGen();
- if ( pLib == NULL )
- return 0;
- Prs_NtkForEachBox( pNtk, vSigs, iBox )
- if ( !Prs_BoxIsNode(pNtk, iBox) )
- {
- int NtkId = Prs_BoxNtk( pNtk, iBox );
- if ( Mio_LibraryReadGateByName(pLib, Prs_NtkStr(pNtk, NtkId), NULL) )
- return 1;
- }
- return 0;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Prs_ManVecFree( Vec_Ptr_t * vPrs )
-{
- Prs_Ntk_t * pNtk; int i;
- Vec_PtrForEachEntry( Prs_Ntk_t *, vPrs, pNtk, i )
- Prs_NtkFree( pNtk );
- Vec_PtrFree( vPrs );
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Prs_NtkCountObjects( Prs_Ntk_t * pNtk )
-{
- Vec_Int_t * vFanins;
- int i, Count = Prs_NtkObjNum(pNtk);
- Prs_NtkForEachBox( pNtk, vFanins, i )
- Count += Prs_BoxIONum(pNtk, i);
- return Count;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-// replaces NameIds of formal names by their index in the box model
-void Prs_ManRemapOne( Vec_Int_t * vSigs, Prs_Ntk_t * pNtkBox, Vec_Int_t * vMap )
-{
- int i, NameId;
- // map formal names into I/O indexes
- Prs_NtkForEachPi( pNtkBox, NameId, i )
- {
- assert( Vec_IntEntry(vMap, NameId) == -1 );
- Vec_IntWriteEntry( vMap, NameId, i + 1 ); // +1 to keep 1st form input non-zero
- }
- Prs_NtkForEachPo( pNtkBox, NameId, i )
- {
- assert( Vec_IntEntry(vMap, NameId) == -1 );
- Vec_IntWriteEntry( vMap, NameId, Prs_NtkPiNum(pNtkBox) + i + 1 ); // +1 to keep 1st form input non-zero
- }
- // remap box
- assert( Vec_IntSize(vSigs) % 2 == 0 );
- Vec_IntForEachEntry( vSigs, NameId, i )
- {
- assert( Vec_IntEntry(vMap, NameId) != -1 );
- Vec_IntWriteEntry( vSigs, i++, Vec_IntEntry(vMap, NameId) );
- }
- // unmap formal inputs
- Prs_NtkForEachPi( pNtkBox, NameId, i )
- Vec_IntWriteEntry( vMap, NameId, -1 );
- Prs_NtkForEachPo( pNtkBox, NameId, i )
- Vec_IntWriteEntry( vMap, NameId, -1 );
-}
-void Prs_ManRemapGate( Vec_Int_t * vSigs )
-{
- int i, FormId;
- Vec_IntForEachEntry( vSigs, FormId, i )
- Vec_IntWriteEntry( vSigs, i, i/2 + 1 ), i++;
-}
-void Prs_ManRemapBoxes( Cba_Man_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_Int_t * vMap )
-{
- Vec_Int_t * vSigs; int iBox;
- Prs_NtkForEachBox( pNtk, vSigs, iBox )
- if ( !Prs_BoxIsNode(pNtk, iBox) )
- {
- int NtkId = Prs_BoxNtk( pNtk, iBox );
- int NtkIdNew = Cba_ManNtkFindId( pNew, Prs_NtkStr(pNtk, NtkId) );
- assert( NtkIdNew > 0 );
- Prs_BoxSetNtk( pNtk, iBox, NtkIdNew );
- if ( NtkIdNew <= Cba_ManNtkNum(pNew) )
- Prs_ManRemapOne( vSigs, Prs_ManNtk(vDes, NtkIdNew-1), vMap );
- //else
- // Prs_ManRemapGate( vSigs );
- }
-}
-void Prs_ManCleanMap( Prs_Ntk_t * pNtk, Vec_Int_t * vMap )
-{
- Vec_Int_t * vSigs;
- int i, k, NameId, Sig;
- Prs_NtkForEachPi( pNtk, NameId, i )
- Vec_IntWriteEntry( vMap, NameId, -1 );
- Prs_NtkForEachBox( pNtk, vSigs, i )
- Vec_IntForEachEntryDouble( vSigs, NameId, Sig, k )
- Vec_IntWriteEntry( vMap, Prs_NtkSigName(pNtk, Sig), -1 );
- Prs_NtkForEachPo( pNtk, NameId, i )
- Vec_IntWriteEntry( vMap, NameId, -1 );
-}
-// create maps of NameId and boxes
-void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_Int_t * vMap, Vec_Int_t * vBoxes )
-{
- Prs_Ntk_t * pNtkBox; Vec_Int_t * vSigs; int iBox;
- int i, Index, NameId, iObj, iConst0, iTerm;
- int iNonDriven = -1, nNonDriven = 0;
- assert( Prs_NtkPioNum(pNtk) == 0 );
- Prs_ManRemapBoxes( pNew->pDesign, vDes, pNtk, vMap );
- Cba_NtkStartNames( pNew );
- // create primary inputs
- Prs_NtkForEachPi( pNtk, NameId, i )
- {
- if ( Vec_IntEntry(vMap, NameId) != -1 )
- printf( "Primary inputs %d and %d have the same name.\n", Vec_IntEntry(vMap, NameId), i );
- iObj = Cba_ObjAlloc( pNew, CBA_OBJ_PI, -1 );
- Cba_ObjSetName( pNew, iObj, Abc_Var2Lit2(NameId, CBA_NAME_BIN) );
- Vec_IntWriteEntry( vMap, NameId, iObj );
- }
- // create box outputs
- Vec_IntClear( vBoxes );
- Prs_NtkForEachBox( pNtk, vSigs, iBox )
- if ( !Prs_BoxIsNode(pNtk, iBox) )
- {
- pNtkBox = Prs_ManNtk( vDes, Prs_BoxNtk(pNtk, iBox)-1 );
- if ( pNtkBox == NULL )
- {
- iObj = Cba_BoxAlloc( pNew, CBA_BOX_GATE, Vec_IntSize(vSigs)/2-1, 1, Prs_BoxNtk(pNtk, iBox) );
- Cba_ObjSetName( pNew, iObj, Abc_Var2Lit2(Prs_BoxName(pNtk, iBox), CBA_NAME_BIN) );
- // consider box output
- NameId = Vec_IntEntryLast( vSigs );
- NameId = Prs_NtkSigName( pNtk, NameId );
- if ( Vec_IntEntry(vMap, NameId) != -1 )
- printf( "Box output name %d is already driven.\n", NameId );
- iTerm = Cba_BoxBo( pNew, iObj, 0 );
- Cba_ObjSetName( pNew, iTerm, Abc_Var2Lit2(NameId, CBA_NAME_BIN) );
- Vec_IntWriteEntry( vMap, NameId, iTerm );
- }
- else
- {
- iObj = Cba_BoxAlloc( pNew, CBA_OBJ_BOX, Prs_NtkPiNum(pNtkBox), Prs_NtkPoNum(pNtkBox), Prs_BoxNtk(pNtk, iBox) );
- Cba_ObjSetName( pNew, iObj, Abc_Var2Lit2(Prs_BoxName(pNtk, iBox), CBA_NAME_BIN) );
- Cba_NtkSetHost( Cba_ManNtk(pNew->pDesign, Prs_BoxNtk(pNtk, iBox)), Cba_NtkId(pNew), iObj );
- Vec_IntForEachEntry( vSigs, Index, i )
- {
- i++;
- if ( --Index < Prs_NtkPiNum(pNtkBox) )
- continue;
- assert( Index - Prs_NtkPiNum(pNtkBox) < Prs_NtkPoNum(pNtkBox) );
- // consider box output
- NameId = Vec_IntEntry( vSigs, i );
- NameId = Prs_NtkSigName( pNtk, NameId );
- if ( Vec_IntEntry(vMap, NameId) != -1 )
- printf( "Box output name %d is already driven.\n", NameId );
- iTerm = Cba_BoxBo( pNew, iObj, Index - Prs_NtkPiNum(pNtkBox) );
- Cba_ObjSetName( pNew, iTerm, Abc_Var2Lit2(NameId, CBA_NAME_BIN) );
- Vec_IntWriteEntry( vMap, NameId, iTerm );
- }
- }
- // remember box
- Vec_IntPush( vBoxes, iObj );
- }
- else
- {
- iObj = Cba_BoxAlloc( pNew, (Cba_ObjType_t)Prs_BoxNtk(pNtk, iBox), Prs_BoxIONum(pNtk, iBox)-1, 1, -1 );
- // consider box output
- NameId = Vec_IntEntryLast( vSigs );
- NameId = Prs_NtkSigName( pNtk, NameId );
- if ( Vec_IntEntry(vMap, NameId) != -1 )
- printf( "Node output name %d is already driven.\n", NameId );
- iTerm = Cba_BoxBo( pNew, iObj, 0 );
- Cba_ObjSetName( pNew, iTerm, Abc_Var2Lit2(NameId, CBA_NAME_BIN) );
- Vec_IntWriteEntry( vMap, NameId, iTerm );
- // remember box
- Vec_IntPush( vBoxes, iObj );
- }
- // add fanins for box inputs
- Prs_NtkForEachBox( pNtk, vSigs, iBox )
- if ( !Prs_BoxIsNode(pNtk, iBox) )
- {
- pNtkBox = Prs_ManNtk( vDes, Prs_BoxNtk(pNtk, iBox)-1 );
- iObj = Vec_IntEntry( vBoxes, iBox );
- if ( pNtkBox == NULL )
- {
- Vec_IntForEachEntryStop( vSigs, Index, i, Vec_IntSize(vSigs)-2 )
- {
- i++;
- NameId = Vec_IntEntry( vSigs, i );
- NameId = Prs_NtkSigName( pNtk, NameId );
- iTerm = Cba_BoxBi( pNew, iObj, i/2 );
- if ( Vec_IntEntry(vMap, NameId) == -1 )
- {
- iConst0 = Cba_BoxAlloc( pNew, CBA_BOX_CF, 0, 1, -1 );
- Vec_IntWriteEntry( vMap, NameId, iConst0+1 );
- if ( iNonDriven == -1 )
- iNonDriven = NameId;
- nNonDriven++;
- }
- Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) );
- }
- }
- else
- {
- Vec_IntForEachEntry( vSigs, Index, i )
- {
- i++;
- if ( --Index >= Prs_NtkPiNum(pNtkBox) )
- continue;
- NameId = Vec_IntEntry( vSigs, i );
- NameId = Prs_NtkSigName( pNtk, NameId );
- iTerm = Cba_BoxBi( pNew, iObj, Index );
- if ( Vec_IntEntry(vMap, NameId) == -1 )
- {
- iConst0 = Cba_BoxAlloc( pNew, CBA_BOX_CF, 0, 1, -1 );
- Vec_IntWriteEntry( vMap, NameId, iConst0+1 );
- if ( iNonDriven == -1 )
- iNonDriven = NameId;
- nNonDriven++;
- }
- Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) );
- }
- }
- }
- else
- {
- iObj = Vec_IntEntry( vBoxes, iBox );
- Vec_IntForEachEntryStop( vSigs, Index, i, Vec_IntSize(vSigs)-2 )
- {
- NameId = Vec_IntEntry( vSigs, ++i );
- NameId = Prs_NtkSigName( pNtk, NameId );
- iTerm = Cba_BoxBi( pNew, iObj, i/2 );
- if ( Vec_IntEntry(vMap, NameId) == -1 )
- {
- iConst0 = Cba_BoxAlloc( pNew, CBA_BOX_CF, 0, 1, -1 );
- Vec_IntWriteEntry( vMap, NameId, iConst0+1 );
- if ( iNonDriven == -1 )
- iNonDriven = NameId;
- nNonDriven++;
- }
- Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) );
- }
- }
- // add fanins for primary outputs
- Prs_NtkForEachPo( pNtk, NameId, i )
- if ( Vec_IntEntry(vMap, NameId) == -1 )
- {
- iConst0 = Cba_BoxAlloc( pNew, CBA_BOX_CF, 0, 1, -1 );
- Vec_IntWriteEntry( vMap, NameId, iConst0+1 );
- if ( iNonDriven == -1 )
- iNonDriven = NameId;
- nNonDriven++;
- }
- Prs_NtkForEachPo( pNtk, NameId, i )
- iObj = Cba_ObjAlloc( pNew, CBA_OBJ_PO, Vec_IntEntry(vMap, NameId) );
- if ( nNonDriven )
- printf( "Module %s has %d non-driven nets (for example, %s).\n", Prs_NtkName(pNtk), nNonDriven, Prs_NtkStr(pNtk, iNonDriven) );
- Prs_ManCleanMap( pNtk, vMap );
- // setup info
- Vec_IntForEachEntry( &pNtk->vOrder, NameId, i )
- Cba_NtkAddInfo( pNew, NameId, -1, -1 );
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Cba_Man_t * Prs_ManBuildCba( char * pFileName, Vec_Ptr_t * vDes )
-{
- Prs_Ntk_t * pNtk = Prs_ManRoot( vDes ); int i;
- Cba_Man_t * pNew = Cba_ManAlloc( pFileName, Vec_PtrSize(vDes) );
- Vec_Int_t * vMap = Vec_IntStartFull( Abc_NamObjNumMax(pNtk->pStrs) + 1 );
- Vec_Int_t * vTmp = Vec_IntAlloc( Prs_NtkBoxNum(pNtk) );
- Abc_NamDeref( pNew->pStrs );
- pNew->pStrs = Abc_NamRef( pNtk->pStrs );
- Vec_PtrForEachEntry( Prs_Ntk_t *, vDes, pNtk, i )
- Cba_NtkAlloc( Cba_ManNtk(pNew, i+1), Prs_NtkId(pNtk), Prs_NtkPiNum(pNtk), Prs_NtkPoNum(pNtk), Prs_NtkCountObjects(pNtk) );
- if ( (pNtk->fMapped || (pNtk->fSlices && Prs_ManIsMapped(pNtk))) && !Cba_NtkBuildLibrary(pNew) )
- Cba_ManFree(pNew), pNew = NULL;
- else
- Vec_PtrForEachEntry( Prs_Ntk_t *, vDes, pNtk, i )
- Prs_ManBuildNtk( Cba_ManNtk(pNew, i+1), vDes, pNtk, vMap, vTmp );
- assert( Vec_IntCountEntry(vMap, -1) == Vec_IntSize(vMap) );
- Vec_IntFree( vMap );
- Vec_IntFree( vTmp );
-// Vec_StrPrint( &Cba_ManNtk(pNew, 1)->vType, 1 );
- return pNew;
-}
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-
diff --git a/src/base/cba/cbaPrsTrans.c b/src/base/cba/cbaPrsTrans.c
deleted file mode 100644
index 02cb4403..00000000
--- a/src/base/cba/cbaPrsTrans.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaPrsTrans.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [Parse tree to netlist transformation.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaPrsTrans.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "cba.h"
-#include "cbaPrs.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-typedef struct Cba_Trip_t_ Cba_Trip_t;
-struct Cba_Trip_t_
-{
- Cba_ObjType_t Type;
- char * pName;
- char * pCode;
- char * pSigs[6];
-};
-/*
-static Cba_Trip_t s_Types[100] =
-{
- { CBA_BOX_CT , "VERIFIC_PWR", "1", {"o"} },
- { CBA_BOX_CF , "VERIFIC_GND", "1", {"o"} },
- { CBA_BOX_CX , "VERIFIC_X", "1", {"o"} },
- { CBA_BOX_CZ , "VERIFIC_Z", "1", {"o"} },
- { CBA_BOX_INV , "VERIFIC_INV", "11", {"i","o"} },
- { CBA_BOX_BUF , "VERIFIC_BUF", "11", {"i","o"} },
- { CBA_BOX_AND , "VERIFIC_AND", "111", {"a0","a1","o"} },
- { CBA_BOX_NAND , "VERIFIC_NAND", "111", {"a0","a1","o"} },
- { CBA_BOX_OR , "VERIFIC_OR", "111", {"a0","a1","o"} },
- { CBA_BOX_NOR , "VERIFIC_NOR", "111", {"a0","a1","o"} },
- { CBA_BOX_XOR , "VERIFIC_XOR", "111", {"a0","a1","o"} },
- { CBA_BOX_XNOR , "VERIFIC_XNOR", "111", {"a0","a1","o"} },
- { CBA_BOX_MUX , "VERIFIC_MUX", "1111", {"c","a1","a0","o"} }, // changed order
- { (Cba_ObjType_t)-1, "VERIFIC_PULLUP", "1", {"o"} },
- { (Cba_ObjType_t)-1, "VERIFIC_PULLDOWN", "1", {"o"} },
- { CBA_BOX_TRI , "VERIFIC_TRI", "111", {"i","c","o"} },
- { CBA_BOX_LATCH , "VERIFIC_DLATCH", "11111", {"d","async_val","async_cond","gate","q"} }, // changed order
- { CBA_BOX_LATCHRS , "VERIFIC_DLATCHRS", "11111", {"d","s","r","gate","q"} }, // changed order
- { CBA_BOX_DFF , "VERIFIC_DFF", "11111", {"d","async_val","async_cond","clk","q"} }, // changed order
- { CBA_BOX_DFFRS , "VERIFIC_DFFRS", "11111", {"d","s","r","clk","q"} }, // changed order
- { (Cba_ObjType_t)-1, "VERIFIC_NMOS", "111", {"c","d","o"} },
- { (Cba_ObjType_t)-1, "VERIFIC_PMOS", "111", {"c","d","o"} },
- { (Cba_ObjType_t)-1, "VERIFIC_CMOS", "1111", {"d","nc","pc","o"} },
- { (Cba_ObjType_t)-1, "VERIFIC_TRAN", "111", {"inout1","inout2","control"} },
- { CBA_BOX_ADD , "VERIFIC_FADD", "11111", {"cin","a","b","o","cout"} },
- { (Cba_ObjType_t)-1, "VERIFIC_RCMOS", "1111", {"d","nc","pc","o"} },
- { (Cba_ObjType_t)-1, "VERIFIC_RNMOS", "111", {"c","d","o"} },
- { (Cba_ObjType_t)-1, "VERIFIC_RPMOS", "111", {"c","d","o"} },
- { (Cba_ObjType_t)-1, "VERIFIC_RTRAN", "111", {"inout1","inout2","control"} },
- { (Cba_ObjType_t)-1, "VERIFIC_HDL_ASSERTION", "1", {"condition"} },
- { CBA_BOX_ADD , "add_", "1aba1", {"cin","a","b","o","cout"} },
- { CBA_BOX_MUL , "mult_", "ab?", {"a","b","o"} }, // ? = a * b
- { CBA_BOX_DIV , "div_", "ab?", {"a","b","o"} }, // ? =
- { CBA_BOX_MOD , "mod_", "ab?", {"a","b","o"} }, // ? =
- { CBA_BOX_REM , "rem_", "ab?", {"a","b","o"} }, // ? =
- { CBA_BOX_SHIL , "shift_left_", "1aba", {"cin","a","amount","o"} },
- { CBA_BOX_SHIR , "shift_right_", "1aba", {"cin","a","amount","o"} },
- { CBA_BOX_ROTL , "rotate_left_", "aba", {"a","amount","o"} },
- { CBA_BOX_ROTR , "rotate_right_", "aba", {"a","amount","o"} },
- { CBA_BOX_RAND , "reduce_and_", "ab1", {"a","o"} },
- { CBA_BOX_ROR , "reduce_or_", "ab1", {"a","o"} },
- { CBA_BOX_RXOR , "reduce_xor_", "ab1", {"a","o"} },
- { CBA_BOX_RNAND , "reduce_nand_", "ab1", {"a","o"} },
- { CBA_BOX_RNOR , "reduce_nor_", "ab1", {"a","o"} },
- { CBA_BOX_RXNOR , "reduce_xnor_", "ab1", {"a","o"} },
- { CBA_BOX_LTHAN , "LessThan_", "1ab1", {"cin","a","b","o"} },
- { CBA_BOX_NMUX , "Mux_", "ab1", {"sel","data","o"} },
- { CBA_BOX_SEL , "Select_", "aaa", {"sel","data","o"} },
- { CBA_BOX_DEC , "Decoder_", "a?", {"a","o"} }, // ? = (1 << a)
- { CBA_BOX_EDEC , "EnabledDecoder_", "1a?", {"en","i","o"} }, // ? = (1 << a)
- { CBA_BOX_PSEL , "PrioSelect_", "1aaa", {"cin","sel","data","o"} },
- { CBA_BOX_RAM , "DualPortRam_", "1abab", {"write_enable","write_address","write_data","read_address","read_data"} },
- { CBA_BOX_RAMR , "ReadPort_", "1a1b", {"read_enable", "read_address", "RAM", "read_data" } },
- { CBA_BOX_RAMW , "WritePort_", "1ab1", {"write_enable","write_address","write_data", "RAM"} },
- { CBA_BOX_RAMWC , "ClockedWritePort_", "11ab1", {"clk","write_enable","write_address","write_data", "RAM"} },
- { CBA_BOX_LUT , "lut", "?", {"i","o"} },
- { CBA_BOX_AND , "and_", "aaa", {"a","b","o"} },
- { CBA_BOX_OR , "or_", "aaa", {"a","b","o"} },
- { CBA_BOX_XOR , "xor_", "aaa", {"a","b","o"} },
- { CBA_BOX_NAND , "nand_", "aaa", {"a","b","o"} },
- { CBA_BOX_NOR , "nor_", "aaa", {"a","b","o"} },
- { CBA_BOX_XNOR , "xnor_", "aaa", {"a","b","o"} },
- { CBA_BOX_BUF , "buf_", "aa", {"i","o"} },
- { CBA_BOX_INV , "inv_", "aa", {"i","o"} },
- { CBA_BOX_TRI , "tri_", "a1a", {"i","c","o"} },
- { CBA_BOX_SUB , "sub_", "aaa", {"a","b","o"} },
- { CBA_BOX_MIN , "unary_minus_", "aa", {"i","o"} },
- { CBA_BOX_EQU , "equal_", "aa1", {"a","b","o"} },
- { CBA_BOX_NEQU , "not_equal_", "aa1", {"a","b","o"} },
- { CBA_BOX_MUX , "mux_", "1aaa", {"cond","d1","d0","o"} }, // changed order
- { CBA_BOX_NMUX , "wide_mux_", "ab?", {"sel","data","o"} }, // ? = b / (1 << a)
- { CBA_BOX_SEL , "wide_select_", "ab?", {"sel","data","o"} }, // ? = b / a
- { CBA_BOX_DFF , "wide_dff_", "aaa1a", {"d","async_val","async_cond","clock","q"} },
- { CBA_BOX_DFFRS , "wide_dlatch_", "aaa1a", {"d","set","reset","clock","q"} },
- { CBA_BOX_LATCHRS , "wide_dffrs_", "aaa1a", {"d","set","reset","clock","q"} },
- { CBA_BOX_LATCH , "wide_dlatchrs_", "aaa1a", {"d","async_val","async_cond","clock","q"} },
- { CBA_BOX_PSEL , "wide_prio_select_", "ab??", {"sel","data","carry_in","o"} }, // ? = b / a
- { CBA_BOX_POW , "pow_", "abc", {"a","b","o"} }, // ? =
- { CBA_BOX_PENC , "PrioEncoder_", "a?", {"sel","o"} },
- { CBA_BOX_ABS , "abs", "aa", {"i","o"} }
-};
-*/
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Count range size.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-static inline int Prs_ManRangeSizeName( Prs_Ntk_t * p, int Name )
-{
- return 1;
-}
-static inline int Prs_ManRangeSizeRange( Prs_Ntk_t * p, int Range )
-{
- char * pStr;
- int Left, Right;
- if ( Range == 0 )
- return 1;
- pStr = Prs_NtkStr( p, Range );
- assert( pStr[0] == '[' );
- Left = Right = atoi( pStr + 1 );
- pStr = strstr( pStr, "=" );
- if ( pStr )
- Right = atoi( pStr + 1 );
- return 1 + (Left > Right ? Left - Right : Right - Left);
-}
-static inline int Prs_ManRangeSizeConst( Prs_Ntk_t * p, int Const )
-{
- return atoi( Prs_NtkStr(p, Const) );
-}
-static inline int Prs_ManRangeSizeConcat( Prs_Ntk_t * p, int Con )
-{
- extern int Prs_ManRangeSizeArray( Prs_Ntk_t * p, Vec_Int_t * vSlices, int Start, int Stop );
- Vec_Int_t * vSigs = Prs_CatSignals(p, Con);
- return Prs_ManRangeSizeArray( p, vSigs, 0, Vec_IntSize(vSigs) );
-}
-static inline int Prs_ManRangeSizeSignal( Prs_Ntk_t * p, int Sig )
-{
- int Value = Abc_Lit2Var2( Sig );
- Prs_ManType_t Type = (Prs_ManType_t)Abc_Lit2Att2( Sig );
- if ( Type == CBA_PRS_NAME )
- return Prs_ManRangeSizeName( p, Value );
- if ( Type == CBA_PRS_SLICE )
- return Prs_ManRangeSizeRange( p, Prs_SliceRange(p, Value) );
- if ( Type == CBA_PRS_CONST )
- return Prs_ManRangeSizeConst( p, Value );
- if ( Type == CBA_PRS_CONCAT )
- return Prs_ManRangeSizeConcat( p, Value );
- assert( 0 );
- return 0;
-}
-int Prs_ManRangeSizeArray( Prs_Ntk_t * p, Vec_Int_t * vSlices, int Start, int Stop )
-{
- int i, Sig, Count = 0;
- assert( Vec_IntSize(vSlices) > 0 );
- Vec_IntForEachEntryStartStop( vSlices, Sig, i, Start, Stop )
- Count += Prs_ManRangeSizeSignal( p, Sig );
- return Count;
-}
-
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-
diff --git a/src/base/cba/cbaPtr.c b/src/base/cba/cbaPtr.c
deleted file mode 100644
index af97a141..00000000
--- a/src/base/cba/cbaPtr.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaPtr.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [Simple interface with external tools.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaPtr.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "base/abc/abc.h"
-#include "base/main/mainInt.h"
-#include "map/mio/mio.h"
-#include "cba.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/*
-design = array containing design name (as the first entry in the array) followed by pointers to modules
-module = array containing module name (as the first entry in the array) followed by pointers to 6 arrays:
- {array of input names; array of output names; array of nodes; array of boxes,
- array of floating-point input-arrival times; array of floating-point output-required times}
-node = array containing output name, followed by node type, followed by input names
-box = array containing model name, instance name, followed by pairs of formal/actual names for each port
-
- Comments:
- - in describing boxes
- - input formal/actual name pairs should be listed before output name pairs
- - the order of formal names should be the same as the order of inputs/outputs in the module description
- - all formal names present in the module description should be listed
- - if an input pin is not driven or an output pin has no fanout, the actual pin name is NULL
- - word-level formal name "a" is written as bit-level names (a[0]. a[1], etc) ordered LSB to MSB
- - the boxes can appear in any order (topological order is not expected)
- - in description of nodes and boxes, primitive names should be given as char*-strings ("AndT", "OrT", etc)
- - constant 0/1 nets should be driven by constant nodes having primitive names "Const0T" and "Const1T"
- - primitive modules should not be written, but the list of primitives and formal names should be provided
- - currently only "boxes" are supported (the array of "nodes" should contain no entries)
- - arrays of input-arrival/output-required times in the module description are optional
-*/
-
-// elementary gates
-typedef enum {
- PTR_GATE_NONE = 0,
- PTR_GATE_C0, // Const0T
- PTR_GATE_C1, // Const1T
- PTR_GATE_BUF, // BufT
- PTR_GATE_INV, // InvT
- PTR_GATE_AND, // AndT
- PTR_GATE_NAND, // NandT
- PTR_GATE_OR, // OrT
- PTR_GATE_NOR, // NorT
- PTR_GATE_XOR, // XorT
- PTR_GATE_XNOR, // XnorT
- PTR_GATE_UNKNOWN
-} Ptr_ObjType_t;
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Free Ptr.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Cba_PtrFreeNtk( Vec_Ptr_t * vNtk )
-{
- Vec_PtrFree( (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1) );
- Vec_PtrFree( (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2) );
- Vec_VecFree( (Vec_Vec_t *)Vec_PtrEntry(vNtk, 3) );
- Vec_VecFree( (Vec_Vec_t *)Vec_PtrEntry(vNtk, 4) );
- if ( Vec_PtrSize(vNtk) > 5 )
- Vec_FltFree( (Vec_Flt_t *)Vec_PtrEntry(vNtk, 5) );
- if ( Vec_PtrSize(vNtk) > 6 )
- Vec_FltFree( (Vec_Flt_t *)Vec_PtrEntry(vNtk, 6) );
- Vec_PtrFree( vNtk );
-}
-void Cba_PtrFree( Vec_Ptr_t * vDes )
-{
- Vec_Ptr_t * vNtk; int i;
- if ( !vDes ) return;
- Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
- Cba_PtrFreeNtk( vNtk );
- Vec_PtrFree( vDes );
-}
-
-/**Function*************************************************************
-
- Synopsis [Count memory used by Ptr.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Cba_PtrMemoryArray( Vec_Ptr_t * vArray )
-{
- return (int)Vec_PtrMemory(vArray);
-}
-int Cba_PtrMemoryArrayArray( Vec_Ptr_t * vArrayArray )
-{
- Vec_Ptr_t * vArray; int i, nBytes = 0;
- Vec_PtrForEachEntry( Vec_Ptr_t *, vArrayArray, vArray, i )
- nBytes += Cba_PtrMemoryArray(vArray);
- return nBytes;
-}
-int Cba_PtrMemoryNtk( Vec_Ptr_t * vNtk )
-{
- int nBytes = (int)Vec_PtrMemory(vNtk);
- nBytes += Cba_PtrMemoryArray( (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1) );
- nBytes += Cba_PtrMemoryArray( (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2) );
- nBytes += Cba_PtrMemoryArrayArray( (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3) );
- nBytes += Cba_PtrMemoryArrayArray( (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4) );
- return nBytes;
-}
-int Cba_PtrMemory( Vec_Ptr_t * vDes )
-{
- Vec_Ptr_t * vNtk; int i, nBytes = (int)Vec_PtrMemory(vDes);
- Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
- nBytes += Cba_PtrMemoryNtk(vNtk);
- return nBytes;
-}
-
-/**Function*************************************************************
-
- Synopsis [Dumping Ptr into a BLIF file.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Cba_PtrDumpSignalsBlif( FILE * pFile, Vec_Ptr_t * vSigs, int fSkipLastComma )
-{
- char * pSig; int i;
- Vec_PtrForEachEntry( char *, vSigs, pSig, i )
- fprintf( pFile, " %s", pSig );
-}
-void Cba_PtrDumpBoxBlif( FILE * pFile, Vec_Ptr_t * vBox )
-{
- char * pName; int i;
- fprintf( pFile, ".subckt" );
- fprintf( pFile, " %s", (char *)Vec_PtrEntry(vBox, 0) );
- //fprintf( pFile, " %s", (char *)Vec_PtrEntry(vBox, 1) ); // do not write intance name in BLIF
- Vec_PtrForEachEntryStart( char *, vBox, pName, i, 2 )
- fprintf( pFile, " %s=%s", pName, (char *)Vec_PtrEntry(vBox, i+1) ), i++;
- fprintf( pFile, "\n" );
-}
-void Cba_PtrDumpBoxesBlif( FILE * pFile, Vec_Ptr_t * vBoxes )
-{
- Vec_Ptr_t * vBox; int i;
- Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
- Cba_PtrDumpBoxBlif( pFile, vBox );
-}
-void Cba_PtrDumpModuleBlif( FILE * pFile, Vec_Ptr_t * vNtk )
-{
- fprintf( pFile, ".model %s\n", (char *)Vec_PtrEntry(vNtk, 0) );
- fprintf( pFile, ".inputs" );
- Cba_PtrDumpSignalsBlif( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1), 0 );
- fprintf( pFile, "\n" );
- fprintf( pFile, ".outputs" );
- Cba_PtrDumpSignalsBlif( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2), 1 );
- fprintf( pFile, "\n" );
- assert( Vec_PtrSize((Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3)) == 0 ); // no nodes; only boxes
- Cba_PtrDumpBoxesBlif( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4) );
- fprintf( pFile, ".end\n\n" );
-}
-void Cba_PtrDumpBlif( char * pFileName, Vec_Ptr_t * vDes )
-{
- FILE * pFile;
- Vec_Ptr_t * vNtk; int i;
- pFile = fopen( pFileName, "wb" );
- if ( pFile == NULL )
- {
- printf( "Cannot open output file \"%s\".\n", pFileName );
- return;
- }
- fprintf( pFile, "// Design \"%s\" written via Ptr in ABC on %s\n\n", (char *)Vec_PtrEntry(vDes, 0), Extra_TimeStamp() );
- Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
- Cba_PtrDumpModuleBlif( pFile, vNtk );
- fclose( pFile );
-}
-
-/**Function*************************************************************
-
- Synopsis [Dumping Ptr into a Verilog file.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Cba_PtrDumpSignalsVerilog( FILE * pFile, Vec_Ptr_t * vSigs, int fAlwaysComma )
-{
- char * pSig; int i;
- Vec_PtrForEachEntry( char *, vSigs, pSig, i )
- fprintf( pFile, " %s%s", pSig, (fAlwaysComma || i < Vec_PtrSize(vSigs) - 1) ? ",":"" );
-}
-void Cba_PtrDumpBoxVerilog( FILE * pFile, Vec_Ptr_t * vBox )
-{
- char * pName; int i;
- fprintf( pFile, " %s", (char *)Vec_PtrEntry(vBox, 0) );
- fprintf( pFile, " %s (", (char *)Vec_PtrEntry(vBox, 1) ); // write intance name in Verilog
- Vec_PtrForEachEntryStart( char *, vBox, pName, i, 2 )
- fprintf( pFile, ".%s(%s)%s", pName, (char *)Vec_PtrEntry(vBox, i+1), i < Vec_PtrSize(vBox) - 2 ? ", ":"" ), i++;
- fprintf( pFile, ");\n" );
-}
-void Cba_PtrDumpBoxesVerilog( FILE * pFile, Vec_Ptr_t * vBoxes )
-{
- Vec_Ptr_t * vBox; int i;
- Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
- Cba_PtrDumpBoxVerilog( pFile, vBox );
-}
-void Cba_PtrDumpModuleVerilog( FILE * pFile, Vec_Ptr_t * vNtk )
-{
- fprintf( pFile, "module %s (\n ", (char *)Vec_PtrEntry(vNtk, 0) );
- Cba_PtrDumpSignalsVerilog( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1), 1 );
- Cba_PtrDumpSignalsVerilog( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2), 0 );
- fprintf( pFile, "\n );\n" );
- fprintf( pFile, " input" );
- Cba_PtrDumpSignalsVerilog( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1), 0 );
- fprintf( pFile, ";\n" );
- fprintf( pFile, " output" );
- Cba_PtrDumpSignalsVerilog( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2), 0 );
- fprintf( pFile, ";\n" );
- assert( Vec_PtrSize((Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3)) == 0 ); // no nodes; only boxes
- Cba_PtrDumpBoxesVerilog( pFile, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4) );
- fprintf( pFile, "endmodule\n\n" );
-}
-void Cba_PtrDumpVerilog( char * pFileName, Vec_Ptr_t * vDes )
-{
- FILE * pFile;
- Vec_Ptr_t * vNtk; int i;
- pFile = fopen( pFileName, "wb" );
- if ( pFile == NULL )
- {
- printf( "Cannot open output file \"%s\".\n", pFileName );
- return;
- }
- fprintf( pFile, "// Design \"%s\" written via Ptr in ABC on %s\n\n", (char *)Vec_PtrEntry(vDes, 0), Extra_TimeStamp() );
- Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
- Cba_PtrDumpModuleVerilog( pFile, vNtk );
- fclose( pFile );
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Collect elementary gates from the library.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Cba_ManCollectGateNameOne( Mio_Library_t * pLib, Ptr_ObjType_t Type, word Truth, Vec_Ptr_t * vGateNames )
-{
- Mio_Gate_t * pGate = Mio_LibraryReadGateByTruth( pLib, Truth );
- if ( pGate != NULL )
- Vec_PtrWriteEntry( vGateNames, Type, Mio_GateReadName(pGate) );
-}
-Vec_Ptr_t * Cba_ManCollectGateNamesByTruth( Mio_Library_t * pLib )
-{
- static word uTruths6[3] = {
- ABC_CONST(0xAAAAAAAAAAAAAAAA),
- ABC_CONST(0xCCCCCCCCCCCCCCCC),
- ABC_CONST(0xF0F0F0F0F0F0F0F0),
- };
- Vec_Ptr_t * vGateNames = Vec_PtrStart( PTR_GATE_UNKNOWN );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_C0, 0, vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_C1, ~(word)0, vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_BUF, uTruths6[0], vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_INV, ~uTruths6[0], vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_AND, (uTruths6[0] & uTruths6[1]), vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_NAND, ~(uTruths6[0] & uTruths6[1]), vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_OR, (uTruths6[0] | uTruths6[1]), vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_NOR, ~(uTruths6[0] | uTruths6[1]), vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_XOR, (uTruths6[0] ^ uTruths6[1]), vGateNames );
- Cba_ManCollectGateNameOne( pLib, PTR_GATE_XNOR, ~(uTruths6[0] ^ uTruths6[1]), vGateNames );
- return vGateNames;
-}
-
-/**Function*************************************************************
-
- Synopsis [This procedure transforms tech-ind Ptr into mapped Ptr.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Cba_PtrUpdateBox( Vec_Ptr_t * vBox, Vec_Ptr_t * vGatesNames )
-{
- Mio_Gate_t * pGate; Mio_Pin_t * pPin; int i = 1;
- Mio_Library_t * pLib = (Mio_Library_t *)Abc_FrameReadLibGen();
- // update gate name
- char * pNameNew, * pName = (char *)Vec_PtrEntry(vBox, 0);
- if ( !strcmp(pName, "Const0T") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_C0);
- else if ( !strcmp(pName, "Const1T") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_C1);
- else if ( !strcmp(pName, "BufT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_BUF);
- else if ( !strcmp(pName, "InvT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_INV);
- else if ( !strcmp(pName, "AndT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_AND);
- else if ( !strcmp(pName, "NandT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_NAND);
- else if ( !strcmp(pName, "OrT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_OR);
- else if ( !strcmp(pName, "NorT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_NOR);
- else if ( !strcmp(pName, "XorT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_XOR);
- else if ( !strcmp(pName, "XnorT") )
- pNameNew = (char *)Vec_PtrEntry(vGatesNames, PTR_GATE_XNOR);
- else // user hierarchy
- return;
- ABC_FREE( pName );
- Vec_PtrWriteEntry( vBox, 0, Abc_UtilStrsav(pNameNew) );
- // remove instance name
- pName = (char *)Vec_PtrEntry(vBox, 1);
- ABC_FREE( pName );
- Vec_PtrWriteEntry( vBox, 1, NULL );
- // update formal input names
- pGate = Mio_LibraryReadGateByName( pLib, pNameNew, NULL );
- Mio_GateForEachPin( pGate, pPin )
- {
- pName = (char *)Vec_PtrEntry( vBox, 2 * i );
- ABC_FREE( pName );
- pNameNew = Mio_PinReadName(pPin);
- Vec_PtrWriteEntry( vBox, 2 * i++, Abc_UtilStrsav(pNameNew) );
- }
- // update output name
- pName = (char *)Vec_PtrEntry( vBox, 2 * i );
- pNameNew = Mio_GateReadOutName(pGate);
- Vec_PtrWriteEntry( vBox, 2 * i++, Abc_UtilStrsav(pNameNew) );
- assert( 2 * i == Vec_PtrSize(vBox) );
-}
-Vec_Ptr_t * Cba_PtrTransformSigs( Vec_Ptr_t * vSig )
-{
- char * pName; int i;
- Vec_Ptr_t * vNew = Vec_PtrAllocExact( Vec_PtrSize(vSig) );
- Vec_PtrForEachEntry( char *, vSig, pName, i )
- Vec_PtrPush( vNew, Abc_UtilStrsav(pName) );
- return vNew;
-}
-Vec_Ptr_t * Cba_PtrTransformBox( Vec_Ptr_t * vBox, Vec_Ptr_t * vGatesNames )
-{
- char * pName; int i;
- Vec_Ptr_t * vNew = Vec_PtrAllocExact( Vec_PtrSize(vBox) );
- Vec_PtrForEachEntry( char *, vBox, pName, i )
- Vec_PtrPush( vNew, Abc_UtilStrsav(pName) );
- if ( vGatesNames )
- Cba_PtrUpdateBox( vNew, vGatesNames );
- return vNew;
-}
-Vec_Ptr_t * Cba_PtrTransformBoxes( Vec_Ptr_t * vBoxes, Vec_Ptr_t * vGatesNames )
-{
- Vec_Ptr_t * vBox; int i;
- Vec_Ptr_t * vNew = Vec_PtrAllocExact( Vec_PtrSize(vBoxes) );
- Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
- Vec_PtrPush( vNew, Cba_PtrTransformBox(vBox, vGatesNames) );
- return vNew;
-}
-Vec_Ptr_t * Cba_PtrTransformNtk( Vec_Ptr_t * vNtk, Vec_Ptr_t * vGatesNames )
-{
- char * pName = (char *)Vec_PtrEntry(vNtk, 0);
- Vec_Ptr_t * vInputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1);
- Vec_Ptr_t * vOutputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2);
- Vec_Ptr_t * vBoxes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4);
- Vec_Ptr_t * vNew = Vec_PtrAllocExact( Vec_PtrSize(vNtk) );
- Vec_PtrPush( vNew, Abc_UtilStrsav(pName) );
- Vec_PtrPush( vNew, Cba_PtrTransformSigs(vInputs) );
- Vec_PtrPush( vNew, Cba_PtrTransformSigs(vOutputs) );
- Vec_PtrPush( vNew, Vec_PtrAllocExact(0) );
- Vec_PtrPush( vNew, Cba_PtrTransformBoxes(vBoxes, vGatesNames) );
- return vNew;
-}
-Vec_Ptr_t * Cba_PtrTransformTest( Vec_Ptr_t * vDes )
-{
- Mio_Library_t * pLib;
- Vec_Ptr_t * vGatesNames;
- Vec_Ptr_t * vNtk, * vNew; int i;
- // dump BLIF before transformation
- Cba_PtrDumpBlif( "test1.blif", vDes );
- if ( Abc_FrameGetGlobalFrame() == NULL )
- {
- printf( "ABC framework is not started.\n" );
- return NULL;
- }
- pLib = (Mio_Library_t *)Abc_FrameReadLibGen();
- if ( pLib == NULL )
- {
- printf( "Standard cell library is not entered.\n" );
- return NULL;
- }
- vGatesNames = Cba_ManCollectGateNamesByTruth( pLib );
- // transform
- vNew = Vec_PtrAllocExact( Vec_PtrSize(vDes) );
- Vec_PtrPush( vNew, Abc_UtilStrsav((char *)Vec_PtrEntry(vDes, 0)) );
- Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
- Vec_PtrPush( vNew, Cba_PtrTransformNtk(vNtk, vGatesNames) );
- // dump BLIF after transformation
- Cba_PtrDumpBlif( "test2.blif", vNew );
- Vec_PtrFree( vGatesNames );
- return vNew;
-}
-
-/**Function*************************************************************
-
- Synopsis [Test the testing procedure.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Cba_PtrTransformTestTest()
-{
- char * pFileName = "c/hie/dump/1/netlist_1.v";
- Abc_Ntk_t * pNtk = Io_ReadNetlist( pFileName, Io_ReadFileType(pFileName), 0 );
- extern Vec_Ptr_t * Ptr_AbcDeriveDes( Abc_Ntk_t * pNtk );
- Vec_Ptr_t * vDes = Ptr_AbcDeriveDes( pNtk );
- Vec_Ptr_t * vNew = Cba_PtrTransformTest( vDes );
- Cba_PtrFree( vDes );
- Cba_PtrFree( vNew );
-}
-
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-
diff --git a/src/base/cba/cbaPtrAbc.c b/src/base/cba/cbaPtrAbc.c
deleted file mode 100644
index 2ca60d0b..00000000
--- a/src/base/cba/cbaPtrAbc.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaPtrAbc.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [Simple interface with external tools.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaPtrAbc.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "cba.h"
-#include "base/abc/abc.h"
-#include "map/mio/mio.h"
-#include "base/main/mainInt.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis [Node type conversions.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-char * Ptr_HopToType( Abc_Obj_t * pObj )
-{
- static word uTruth, uTruths6[3] = {
- ABC_CONST(0xAAAAAAAAAAAAAAAA),
- ABC_CONST(0xCCCCCCCCCCCCCCCC),
- ABC_CONST(0xF0F0F0F0F0F0F0F0),
- };
- assert( Abc_ObjIsNode(pObj) );
- uTruth = Hop_ManComputeTruth6( (Hop_Man_t *)Abc_ObjNtk(pObj)->pManFunc, (Hop_Obj_t *)pObj->pData, Abc_ObjFaninNum(pObj) );
-/*
- if ( uTruth == 0 ) return "CBA_BOX_C0";
- if ( uTruth == ~(word)0 ) return "CBA_BOX_C1";
- if ( uTruth == uTruths6[0] ) return "CBA_BOX_BUF";
- if ( uTruth == ~uTruths6[0] ) return "CBA_BOX_INV";
- if ( uTruth == (uTruths6[0] & uTruths6[1]) ) return "CBA_BOX_AND";
- if ( uTruth ==~(uTruths6[0] & uTruths6[1]) ) return "CBA_BOX_NAND";
- if ( uTruth == (uTruths6[0] | uTruths6[1]) ) return "CBA_BOX_OR";
- if ( uTruth ==~(uTruths6[0] | uTruths6[1]) ) return "CBA_BOX_NOR";
- if ( uTruth == (uTruths6[0] ^ uTruths6[1]) ) return "CBA_BOX_XOR";
- if ( uTruth ==~(uTruths6[0] ^ uTruths6[1]) ) return "CBA_BOX_XNOR";
-*/
- if ( uTruth == 0 ) return "Const0T";
- if ( uTruth == ~(word)0 ) return "Const1T";
- if ( uTruth == uTruths6[0] ) return "BufT";
- if ( uTruth == ~uTruths6[0] ) return "InvT";
- if ( uTruth == (uTruths6[0] & uTruths6[1]) ) return "AndT";
- if ( uTruth ==~(uTruths6[0] & uTruths6[1]) ) return "NandT";
- if ( uTruth == (uTruths6[0] | uTruths6[1]) ) return "OrT";
- if ( uTruth ==~(uTruths6[0] | uTruths6[1]) ) return "NorT";
- if ( uTruth == (uTruths6[0] ^ uTruths6[1]) ) return "XorT";
- if ( uTruth ==~(uTruths6[0] ^ uTruths6[1]) ) return "XnorT";
- assert( 0 );
- return NULL;
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Create Ptr from Abc_Ntk_t.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-char * Ptr_AbcObjName( Abc_Obj_t * pObj )
-{
- if ( Abc_ObjIsNet(pObj) || Abc_ObjIsBox(pObj) )
- return Abc_ObjName(pObj);
- if ( Abc_ObjIsCi(pObj) || Abc_ObjIsNode(pObj) )
- return Ptr_AbcObjName(Abc_ObjFanout0(pObj));
- if ( Abc_ObjIsCo(pObj) )
- return Ptr_AbcObjName(Abc_ObjFanin0(pObj));
- assert( 0 );
- return NULL;
-}
-static int Ptr_CheckArray( Vec_Ptr_t * vArray )
-{
- assert( Vec_PtrSize(vArray) == Vec_PtrCap(vArray) );
- return 1;
-}
-Vec_Ptr_t * Ptr_AbcDeriveNode( Abc_Obj_t * pObj )
-{
- Abc_Obj_t * pFanin; int i;
- Vec_Ptr_t * vNode = Vec_PtrAllocExact( 2 + 2 * (1 + Abc_ObjFaninNum(pObj)) );
- assert( Abc_ObjIsNode(pObj) );
- if ( Abc_NtkHasAig(pObj->pNtk) )
- Vec_PtrPush( vNode, Ptr_HopToType(pObj) );
- else if ( Abc_NtkHasSop(pObj->pNtk) )
- Vec_PtrPush( vNode, Ptr_SopToTypeName((char *)pObj->pData) );
- else assert( 0 );
- Vec_PtrPush( vNode, Ptr_AbcObjName(pObj) );
- assert( Abc_ObjFaninNum(pObj) <= 2 );
- Abc_ObjForEachFanin( pObj, pFanin, i )
- {
- Vec_PtrPush( vNode, (void*)(i ? "r" : "l") );
- Vec_PtrPush( vNode, Ptr_AbcObjName(pFanin) );
- }
- Vec_PtrPush( vNode, (void*)("o") );
- Vec_PtrPush( vNode, Ptr_AbcObjName(pObj) );
- assert( Ptr_CheckArray(vNode) );
- return vNode;
-}
-Vec_Ptr_t * Ptr_AbcDeriveBox( Abc_Obj_t * pObj )
-{
- Abc_Obj_t * pNext; int i;
- Abc_Ntk_t * pNtk = Abc_ObjModel(pObj);
- Vec_Ptr_t * vBox = Vec_PtrAllocExact( 2 + 2 * Abc_ObjFaninNum(pObj) + 2 * Abc_ObjFanoutNum(pObj) );
- assert( Abc_ObjIsBox(pObj) );
- Vec_PtrPush( vBox, Abc_NtkName(pNtk) );
- Vec_PtrPush( vBox, Ptr_AbcObjName(pObj) );
- Abc_ObjForEachFanin( pObj, pNext, i )
- {
- Vec_PtrPush( vBox, Ptr_AbcObjName(Abc_NtkPi(pNtk, i)) );
- Vec_PtrPush( vBox, Ptr_AbcObjName(pNext) );
- }
- Abc_ObjForEachFanout( pObj, pNext, i )
- {
- Vec_PtrPush( vBox, Ptr_AbcObjName(Abc_NtkPo(pNtk, i)) );
- Vec_PtrPush( vBox, Ptr_AbcObjName(pNext) );
- }
- assert( Ptr_CheckArray(vBox) );
- return vBox;
-}
-Vec_Ptr_t * Ptr_AbcDeriveBoxes( Abc_Ntk_t * pNtk )
-{
- Abc_Obj_t * pObj; int i;
- Vec_Ptr_t * vBoxes = Vec_PtrAllocExact( Abc_NtkBoxNum(pNtk) + Abc_NtkNodeNum(pNtk) );
- Abc_NtkForEachBox( pNtk, pObj, i )
- Vec_PtrPush( vBoxes, Ptr_AbcDeriveBox(pObj) );
- Abc_NtkForEachNode( pNtk, pObj, i )
- Vec_PtrPush( vBoxes, Ptr_AbcDeriveNode(pObj) );
- assert( Ptr_CheckArray(vBoxes) );
- return vBoxes;
-}
-
-Vec_Ptr_t * Ptr_AbcDeriveInputs( Abc_Ntk_t * pNtk )
-{
- Abc_Obj_t * pObj; int i;
- Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Abc_NtkPiNum(pNtk) );
- Abc_NtkForEachPi( pNtk, pObj, i )
- Vec_PtrPush( vSigs, Ptr_AbcObjName(pObj) );
- assert( Ptr_CheckArray(vSigs) );
- return vSigs;
-}
-Vec_Ptr_t * Ptr_AbcDeriveOutputs( Abc_Ntk_t * pNtk )
-{
- Abc_Obj_t * pObj; int i;
- Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Abc_NtkPoNum(pNtk) );
- Abc_NtkForEachPo( pNtk, pObj, i )
- Vec_PtrPush( vSigs, Ptr_AbcObjName(pObj) );
- assert( Ptr_CheckArray(vSigs) );
- return vSigs;
-}
-Vec_Ptr_t * Ptr_AbcDeriveNtk( Abc_Ntk_t * pNtk )
-{
- Vec_Ptr_t * vNtk = Vec_PtrAllocExact( 5 );
- Vec_PtrPush( vNtk, Abc_NtkName(pNtk) );
- Vec_PtrPush( vNtk, Ptr_AbcDeriveInputs(pNtk) );
- Vec_PtrPush( vNtk, Ptr_AbcDeriveOutputs(pNtk) );
- Vec_PtrPush( vNtk, Vec_PtrAllocExact(0) );
- Vec_PtrPush( vNtk, Ptr_AbcDeriveBoxes(pNtk) );
- assert( Ptr_CheckArray(vNtk) );
- return vNtk;
-}
-Vec_Ptr_t * Ptr_AbcDeriveDes( Abc_Ntk_t * pNtk )
-{
- Vec_Ptr_t * vDes;
- Abc_Ntk_t * pTemp; int i;
- vDes = Vec_PtrAllocExact( 1 + Vec_PtrSize(pNtk->pDesign->vModules) );
- Vec_PtrPush( vDes, pNtk->pDesign->pName );
- Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
- Vec_PtrPush( vDes, Ptr_AbcDeriveNtk(pTemp) );
- assert( Ptr_CheckArray(vDes) );
- return vDes;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Ptr_ManExperiment( Abc_Ntk_t * pNtk )
-{
- abctime clk = Abc_Clock();
- char * pFileName = Extra_FileNameGenericAppend(pNtk->pDesign->pName, "_out.blif");
- Vec_Ptr_t * vDes = Ptr_AbcDeriveDes( pNtk );
- printf( "Converting to Ptr: Memory = %6.3f MB ", 1.0*Cba_PtrMemory(vDes)/(1<<20) );
- Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
- Cba_PtrDumpBlif( pFileName, vDes );
- printf( "Finished writing output file \"%s\". ", pFileName );
- Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
- Cba_PtrFree( vDes );
-}
-
-/**Function*************************************************************
-
- Synopsis [Create Cba_Man_t from tech-ind Ptr.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-static inline int Ptr_NameToType( char * pSop )
-{
- if ( !strcmp(pSop, "Const0T") ) return CBA_BOX_CF;
- if ( !strcmp(pSop, "Const1T") ) return CBA_BOX_CT;
- if ( !strcmp(pSop, "BufT") ) return CBA_BOX_BUF;
- if ( !strcmp(pSop, "InvT") ) return CBA_BOX_INV;
- if ( !strcmp(pSop, "AndT") ) return CBA_BOX_AND;
- if ( !strcmp(pSop, "NandT") ) return CBA_BOX_NAND;
- if ( !strcmp(pSop, "OrT") ) return CBA_BOX_OR;
- if ( !strcmp(pSop, "NorT") ) return CBA_BOX_NOR;
- if ( !strcmp(pSop, "XorT") ) return CBA_BOX_XOR;
- if ( !strcmp(pSop, "XnorT") ) return CBA_BOX_XNOR;
- return CBA_OBJ_BOX;
-}
-int Ptr_ManCountNtk( Vec_Ptr_t * vNtk )
-{
- Vec_Ptr_t * vInputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1);
- Vec_Ptr_t * vOutputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2);
- Vec_Ptr_t * vNodes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3);
- Vec_Ptr_t * vBoxes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4);
- Vec_Ptr_t * vBox; int i, Counter = 0;
- assert( Vec_PtrSize(vNodes) == 0 );
- Counter += Vec_PtrSize(vInputs);
- Counter += Vec_PtrSize(vOutputs);
- Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
- Counter += Vec_PtrSize(vBox)/2;
- return Counter;
-}
-int Cba_BoxCountOutputs( Cba_Ntk_t * pNtk, char * pBoxNtk )
-{
- int ModuleId = Cba_ManNtkFindId( pNtk->pDesign, pBoxNtk );
- if ( ModuleId == 0 )
- return 1;
- return Cba_NtkPoNumAlloc( Cba_ManNtk(pNtk->pDesign, ModuleId) );
-}
-int Cba_NtkDeriveFromPtr( Cba_Ntk_t * pNtk, Vec_Ptr_t * vNtk, Vec_Int_t * vMap, Vec_Int_t * vBox2Id )
-{
- char * pName, * pModuleName = (char *)Vec_PtrEntry(vNtk, 0);
- Vec_Ptr_t * vInputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1);
- Vec_Ptr_t * vOutputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2);
- Vec_Ptr_t * vBoxes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4), * vBox;
- int i, k, iObj, iTerm, NameId;
- // start network with the given name
- NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pModuleName, NULL );
- assert( Cba_NtkNameId(pNtk) == NameId );
- // map driven NameIds into their ObjIds for PIs
- Vec_PtrForEachEntry( char *, vInputs, pName, i )
- {
- NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
- if ( Vec_IntGetEntryFull(vMap, NameId) != -1 )
- { printf( "PI with name \"%s\" is not unique module \"%s\".\n", pName, pModuleName ); return 0; }
- iObj = Cba_ObjAlloc( pNtk, CBA_OBJ_PI, -1 );
- Cba_ObjSetName( pNtk, iObj, Abc_Var2Lit2(NameId, CBA_NAME_BIN) );
- Vec_IntSetEntryFull( vMap, NameId, iObj );
- Cba_NtkAddInfo( pNtk, Abc_Var2Lit2(NameId, 1), -1, -1 );
- }
- // map driven NameIds into their ObjIds for BOs
- Vec_IntClear( vBox2Id );
- Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
- {
- char * pBoxNtk = (char *)Vec_PtrEntry(vBox, 0);
- char * pBoxName = (char *)Vec_PtrEntry(vBox, 1);
- int nOutputs = Cba_BoxCountOutputs( pNtk, pBoxNtk );
- int nInputs = Vec_PtrSize(vBox)/2 - nOutputs - 1;
- int NtkId = Cba_ManNtkFindId( pNtk->pDesign, pBoxNtk );
- assert( Vec_PtrSize(vBox) % 2 == 0 );
- assert( nOutputs > 0 && 2*(nOutputs + 1) <= Vec_PtrSize(vBox) );
- iObj = Cba_BoxAlloc( pNtk, (Cba_ObjType_t)Ptr_NameToType(pBoxNtk), nInputs, nOutputs, NtkId );
- if ( NtkId > 0 )
- Cba_NtkSetHost( Cba_ManNtk(pNtk->pDesign, NtkId), Cba_NtkId(pNtk), iObj );
- Cba_ObjSetName( pNtk, iObj, Abc_Var2Lit2(Abc_NamStrFindOrAdd(pNtk->pDesign->pStrs, pBoxName, NULL), CBA_NAME_BIN) );
- Cba_BoxForEachBo( pNtk, iObj, iTerm, k )
- {
- pName = (char *)Vec_PtrEntry( vBox, Vec_PtrSize(vBox) - 2*(nOutputs - k) + 1 );
- NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
- if ( Vec_IntGetEntryFull(vMap, NameId) != -1 )
- { printf( "Signal \"%s\" has multiple drivers in module \"%s\".\n", pName, pModuleName ); return 0; }
- Cba_ObjSetName( pNtk, iTerm, Abc_Var2Lit2(NameId, CBA_NAME_BIN) );
- Vec_IntSetEntryFull( vMap, NameId, iTerm );
- }
- Vec_IntPush( vBox2Id, iObj );
- }
- assert( Vec_IntSize(vBox2Id) == Vec_PtrSize(vBoxes) );
- // connect BIs
- Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
- {
- iObj = Vec_IntEntry( vBox2Id, i );
- Cba_BoxForEachBi( pNtk, iObj, iTerm, k )
- {
- pName = (char *)Vec_PtrEntry( vBox, 2*(k + 1) + 1 );
- NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
- if ( Vec_IntGetEntryFull(vMap, NameId) == -1 )
- printf( "Signal \"%s\" in not driven in module \"%s\".\n", pName, pModuleName );
- Cba_ObjSetFanin( pNtk, iTerm, Vec_IntGetEntryFull(vMap, NameId) );
- }
- }
- // connect POs
- Vec_PtrForEachEntry( char *, vOutputs, pName, i )
- {
- NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
- if ( Vec_IntGetEntryFull(vMap, NameId) == -1 )
- printf( "PO with name \"%s\" in not driven in module \"%s\".\n", pName, pModuleName );
- iObj = Cba_ObjAlloc( pNtk, CBA_OBJ_PO, Vec_IntGetEntryFull(vMap, NameId) );
- Cba_NtkAddInfo( pNtk, Abc_Var2Lit2(NameId, 2), -1, -1 );
- }
- // update map
- Cba_NtkForEachCi( pNtk, iObj )
- Vec_IntSetEntryFull( vMap, Cba_ObjNameId(pNtk, iObj), -1 );
- // double check
- Vec_IntForEachEntry( vMap, iObj, i )
- assert( iObj == -1 );
- assert( Cba_NtkObjNum(pNtk) == Vec_StrCap(&pNtk->vType) );
- return 1;
-}
-Cba_Man_t * Cba_PtrTransformToCba( Vec_Ptr_t * vDes )
-{
- char * pName = (char *)Vec_PtrEntry(vDes, 0);
- Cba_Man_t * pNew = Cba_ManAlloc( pName, Vec_PtrSize(vDes) - 1 );
- Vec_Int_t * vMap = Vec_IntStartFull( 1000 );
- Vec_Int_t * vBox2Id = Vec_IntAlloc( 1000 );
- // create interfaces
- Cba_Ntk_t * pNtk; int i;
- Cba_ManForEachNtk( pNew, pNtk, i )
- {
- Vec_Ptr_t * vNtk = (Vec_Ptr_t *)Vec_PtrEntry(vDes, i);
- Vec_Ptr_t * vInputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1);
- Vec_Ptr_t * vOutputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2);
- int NameId = Abc_NamStrFindOrAdd( pNew->pStrs, (char *)Vec_PtrEntry(vNtk, 0), NULL );
- Cba_NtkAlloc( pNtk, NameId, Vec_PtrSize(vInputs), Vec_PtrSize(vOutputs), Ptr_ManCountNtk(vNtk) );
- Cba_NtkStartNames( pNtk );
- }
- // parse the networks
- Cba_ManForEachNtk( pNew, pNtk, i )
- {
- Vec_Ptr_t * vNtk = (Vec_Ptr_t *)Vec_PtrEntry(vDes, i);
- if ( !Cba_NtkDeriveFromPtr( pNtk, vNtk, vMap, vBox2Id ) )
- break;
- }
- if ( i <= Cba_ManNtkNum(pNew) )
- Cba_ManFree(pNew), pNew = NULL;
- Vec_IntFree( vBox2Id );
- Vec_IntFree( vMap );
- return pNew;
-}
-
-
-/**Function*************************************************************
-
- Synopsis [Create Ptr from mapped Cba_Man_t.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Vec_Ptr_t * Cba_NtkTransformToPtrBox( Cba_Ntk_t * p, int iBox )
-{
- int i, iTerm, fUser = Cba_ObjIsBoxUser( p, iBox );
- Cba_Ntk_t * pBoxNtk = Cba_BoxNtk( p, iBox );
- Mio_Library_t * pLib = (Mio_Library_t *)p->pDesign->pMioLib;
- Mio_Gate_t * pGate = pLib ? Mio_LibraryReadGateByName( pLib, Cba_BoxNtkName(p, iBox), NULL ) : NULL;
- Vec_Ptr_t * vBox = Vec_PtrAllocExact( 2*Cba_BoxSize(p, iBox) );
- Vec_PtrPush( vBox, Cba_BoxNtkName(p, iBox) );
- Vec_PtrPush( vBox, Cba_ObjNameStr(p, iBox) );
- Cba_BoxForEachBi( p, iBox, iTerm, i )
- {
- Vec_PtrPush( vBox, fUser ? Cba_ObjNameStr(pBoxNtk, Cba_NtkPi(pBoxNtk, i)) : Mio_GateReadPinName(pGate, i) );
- Vec_PtrPush( vBox, Cba_ObjNameStr(p, iTerm) );
- }
- Cba_BoxForEachBo( p, iBox, iTerm, i )
- {
- Vec_PtrPush( vBox, fUser ? Cba_ObjNameStr(pBoxNtk, Cba_NtkPo(pBoxNtk, i)) : Mio_GateReadOutName(pGate) );
- Vec_PtrPush( vBox, Cba_ObjNameStr(p, iTerm) );
- }
- assert( Ptr_CheckArray(vBox) );
- return vBox;
-}
-Vec_Ptr_t * Cba_NtkTransformToPtrBoxes( Cba_Ntk_t * p )
-{
- int iBox;
- Vec_Ptr_t * vBoxes = Vec_PtrAllocExact( Cba_NtkBoxNum(p) );
- Cba_NtkForEachBox( p, iBox )
- Vec_PtrPush( vBoxes, Cba_NtkTransformToPtrBox(p, iBox) );
- assert( Ptr_CheckArray(vBoxes) );
- return vBoxes;
-}
-
-Vec_Ptr_t * Cba_NtkTransformToPtrInputs( Cba_Ntk_t * p )
-{
- int i, iTerm;
- Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Cba_NtkPiNum(p) );
- Cba_NtkForEachPi( p, iTerm, i )
- Vec_PtrPush( vSigs, Cba_ObjNameStr(p, iTerm) );
- assert( Ptr_CheckArray(vSigs) );
- return vSigs;
-}
-Vec_Ptr_t * Cba_NtkTransformToPtrOutputs( Cba_Ntk_t * p )
-{
- int i, iTerm;
- Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Cba_NtkPoNum(p) );
- Cba_NtkForEachPo( p, iTerm, i )
- Vec_PtrPush( vSigs, Cba_ObjNameStr(p, iTerm) );
- assert( Ptr_CheckArray(vSigs) );
- return vSigs;
-}
-Vec_Ptr_t * Cba_NtkTransformToPtr( Cba_Ntk_t * p )
-{
- Vec_Ptr_t * vNtk = Vec_PtrAllocExact(5);
- Vec_PtrPush( vNtk, Cba_NtkName(p) );
- Vec_PtrPush( vNtk, Cba_NtkTransformToPtrInputs(p) );
- Vec_PtrPush( vNtk, Cba_NtkTransformToPtrOutputs(p) );
- Vec_PtrPush( vNtk, Vec_PtrAllocExact(0) );
- Vec_PtrPush( vNtk, Cba_NtkTransformToPtrBoxes(p) );
- assert( Ptr_CheckArray(vNtk) );
- return vNtk;
-}
-Vec_Ptr_t * Cba_PtrDeriveFromCba( Cba_Man_t * p )
-{
- Vec_Ptr_t * vDes;
- Cba_Ntk_t * pTemp; int i;
- if ( p == NULL )
- return NULL;
- if ( p->pMioLib == NULL )
- {
- printf( "Cannot transform CBA network into Ptr because it is not mapped.\n" );
- return NULL;
- }
- Cba_ManAssignInternWordNames( p );
- vDes = Vec_PtrAllocExact( 1 + Cba_ManNtkNum(p) );
- Vec_PtrPush( vDes, p->pName );
- Cba_ManForEachNtk( p, pTemp, i )
- Vec_PtrPush( vDes, Cba_NtkTransformToPtr(pTemp) );
- assert( Ptr_CheckArray(vDes) );
- return vDes;
-}
-
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-
diff --git a/src/base/cba/cbaReadSmt.c b/src/base/cba/cbaReadSmt.c
deleted file mode 100644
index a9dd83dd..00000000
--- a/src/base/cba/cbaReadSmt.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaReadSmt.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [BLIF parser.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaReadSmt.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "cba.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-
diff --git a/src/base/cba/cbaReadVer.c b/src/base/cba/cbaReadVer.c
index ed825ba1..67a7c3b7 100644
--- a/src/base/cba/cbaReadVer.c
+++ b/src/base/cba/cbaReadVer.c
@@ -447,7 +447,7 @@ static inline int Prs_ManReadSignal( Prs_Man_t * p )
return Abc_Var2Lit2( Item, CBA_PRS_NAME );
}
}
-static int Prs_ManReadSignalList( Prs_Man_t * p, Vec_Int_t * vTemp, char LastSymb, int fAddForm )
+int Prs_ManReadSignalList( Prs_Man_t * p, Vec_Int_t * vTemp, char LastSymb, int fAddForm )
{
Vec_IntClear( vTemp );
while ( 1 )
diff --git a/src/base/cba/cbaWriteSmt.c b/src/base/cba/cbaWriteSmt.c
deleted file mode 100644
index 5d1a0a51..00000000
--- a/src/base/cba/cbaWriteSmt.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/**CFile****************************************************************
-
- FileName [cbaWriteSmt.c]
-
- SystemName [ABC: Logic synthesis and verification system.]
-
- PackageName [Hierarchical word-level netlist.]
-
- Synopsis [Verilog parser.]
-
- Author [Alan Mishchenko]
-
- Affiliation [UC Berkeley]
-
- Date [Ver. 1.0. Started - November 29, 2014.]
-
- Revision [$Id: cbaWriteSmt.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
-
-***********************************************************************/
-
-#include "cba.h"
-
-ABC_NAMESPACE_IMPL_START
-
-////////////////////////////////////////////////////////////////////////
-/// DECLARATIONS ///
-////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////
-/// FUNCTION DEFINITIONS ///
-////////////////////////////////////////////////////////////////////////
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-
-
-////////////////////////////////////////////////////////////////////////
-/// END OF FILE ///
-////////////////////////////////////////////////////////////////////////
-
-
-ABC_NAMESPACE_IMPL_END
-