Commit 477ecc17 by Alan Mishchenko

Renaming Cba into Bac.

parent ddda9320
......@@ -782,120 +782,172 @@ SOURCE=.\src\base\wlc\wlcStdin.c
SOURCE=.\src\base\wlc\wlcWriteVer.c
# End Source File
# End Group
# Begin Group "cba"
# Begin Group "pla"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\base\cba\cba.h
SOURCE=.\src\base\pla\pla.h
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaBlast.c
SOURCE=.\src\base\pla\plaCom.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaCba.c
SOURCE=.\src\base\pla\plaFxch.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaCom.c
SOURCE=.\src\base\pla\plaHash.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaLib.c
SOURCE=.\src\base\pla\plaMan.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaNtk.c
SOURCE=.\src\base\pla\plaMerge.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaOper.c
SOURCE=.\src\base\pla\plaRead.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaPrs.h
SOURCE=.\src\base\pla\plaSimple.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaPrsBuild.c
SOURCE=.\src\base\pla\plaWrite.c
# End Source File
# End Group
# Begin Group "bac"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\base\cba\cbaPrsTrans.c
SOURCE=.\src\base\bac\bac.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaPtr.c
SOURCE=.\src\base\bac\bac.h
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaPtrAbc.c
SOURCE=.\src\base\bac\bacBac.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaReadBlif.c
SOURCE=.\src\base\bac\bacBlast.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaReadSmt.c
SOURCE=.\src\base\bac\bacCom.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaReadVer.c
SOURCE=.\src\base\bac\bacLib.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaWriteBlif.c
SOURCE=.\src\base\bac\bacNtk.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaWriteSmt.c
SOURCE=.\src\base\bac\bacOper.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaWriteVer.c
SOURCE=.\src\base\bac\bacPrs.h
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacPrsBuild.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacPrsTrans.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacPrtAbc.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacPtr.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacReadBlif.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacReadSmt.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacReadVec.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacWriteBlif.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacWriteSmt.c
# End Source File
# Begin Source File
SOURCE=.\src\base\bac\bacWriteVer.c
# End Source File
# End Group
# Begin Group "pla"
# Begin Group "cba"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\base\pla\pla.h
SOURCE=.\src\base\cba\cba.c
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaCom.c
SOURCE=.\src\base\cba\cba.h
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaFxch.c
SOURCE=.\src\base\cba\cbaBlast.c
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaHash.c
SOURCE=.\src\base\cba\cbaCba.c
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaMan.c
SOURCE=.\src\base\cba\cbaCom.c
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaMerge.c
SOURCE=.\src\base\cba\cbaNtk.c
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaRead.c
SOURCE=.\src\base\cba\cbaPrs.h
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaSimple.c
SOURCE=.\src\base\cba\cbaReadBlif.c
# End Source File
# Begin Source File
SOURCE=.\src\base\pla\plaWrite.c
SOURCE=.\src\base\cba\cbaReadVer.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaWriteBlif.c
# End Source File
# Begin Source File
SOURCE=.\src\base\cba\cbaWriteVer.c
# End Source File
# End Group
# End Group
......
......@@ -12,7 +12,7 @@
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - November 29, 2014.]
Date [Ver. 1.0. Started - July 21, 2015.]
Revision [$Id: cba.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
......
/**CFile****************************************************************
FileName [cbaCba.c]
FileName [cba.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Hierarchical word-level netlist.]
PackageName [Verilog parser.]
Synopsis [Verilog parser.]
Synopsis [Parses several flavors of word-level Verilog.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - November 29, 2014.]
Date [Ver. 1.0. Started - July 21, 2015.]
Revision [$Id: cbaCba.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
Revision [$Id: cba.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
***********************************************************************/
......@@ -30,10 +30,9 @@ ABC_NAMESPACE_IMPL_START
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Read CBA.]
Synopsis []
Description []
......@@ -42,252 +41,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
int CbaManReadCbaLine( Vec_Str_t * vOut, int * pPos, char * pBuffer, char * pLimit )
{
char c;
while ( (c = Vec_StrEntry(vOut, (*pPos)++)) != '\n' && pBuffer < pLimit )
*pBuffer++ = c;
*pBuffer = 0;
return pBuffer < pLimit;
}
int CbaManReadCbaNameAndNums( char * pBuffer, int * Num1, int * Num2, int * Num3, int * Num4 )
{
*Num1 = *Num2 = *Num3 = *Num4 = -1;
// read name
while ( *pBuffer && *pBuffer != ' ' )
pBuffer++;
if ( !*pBuffer )
return 0;
assert( *pBuffer == ' ' );
*pBuffer = 0;
// read Num1
*Num1 = atoi(++pBuffer);
while ( *pBuffer && *pBuffer != ' ' )
pBuffer++;
if ( !*pBuffer )
return 0;
// read Num2
assert( *pBuffer == ' ' );
*Num2 = atoi(++pBuffer);
while ( *pBuffer && *pBuffer != ' ' )
pBuffer++;
if ( !*pBuffer )
return 1;
// read Num3
assert( *pBuffer == ' ' );
*Num3 = atoi(++pBuffer);
while ( *pBuffer && *pBuffer != ' ' )
pBuffer++;
if ( !*pBuffer )
return 1;
// read Num4
assert( *pBuffer == ' ' );
*Num4 = atoi(++pBuffer);
return 1;
}
void Cba_ManReadCbaVecStr( Vec_Str_t * vOut, int * pPos, Vec_Str_t * p, int nSize )
{
memcpy( Vec_StrArray(p), Vec_StrArray(vOut) + *pPos, nSize );
*pPos += nSize;
p->nSize = nSize;
assert( Vec_StrSize(p) == Vec_StrCap(p) );
}
void Cba_ManReadCbaVecInt( Vec_Str_t * vOut, int * pPos, Vec_Int_t * p, int nSize )
{
memcpy( Vec_IntArray(p), Vec_StrArray(vOut) + *pPos, nSize );
*pPos += nSize;
p->nSize = nSize / 4;
assert( Vec_IntSize(p) == Vec_IntCap(p) );
}
void Cba_ManReadCbaNtk( Vec_Str_t * vOut, int * pPos, Cba_Ntk_t * pNtk )
{
int i, Type;
//char * pName; int iObj, NameId;
Cba_ManReadCbaVecStr( vOut, pPos, &pNtk->vType, Cba_NtkObjNumAlloc(pNtk) );
Cba_ManReadCbaVecInt( vOut, pPos, &pNtk->vFanin, 4 * Cba_NtkObjNumAlloc(pNtk) );
Cba_ManReadCbaVecInt( vOut, pPos, &pNtk->vInfo, 12 * Cba_NtkInfoNumAlloc(pNtk) );
Cba_NtkForEachObjType( pNtk, Type, i )
{
if ( Type == CBA_OBJ_PI )
Vec_IntPush( &pNtk->vInputs, i );
if ( Type == CBA_OBJ_PO )
Vec_IntPush( &pNtk->vOutputs, i );
}
assert( Cba_NtkPiNum(pNtk) == Cba_NtkPiNumAlloc(pNtk) );
assert( Cba_NtkPoNum(pNtk) == Cba_NtkPoNumAlloc(pNtk) );
assert( Cba_NtkObjNum(pNtk) == Cba_NtkObjNumAlloc(pNtk) );
assert( Cba_NtkInfoNum(pNtk) == Cba_NtkInfoNumAlloc(pNtk) );
/*
// read input/output/box names
Cba_NtkForEachPiMain( pNtk, iObj, i )
{
pName = Vec_StrEntryP( vOut, Pos );
NameId = Abc_NamStrFindOrAdd( p->pStrs, pName, NULL );
Pos += strlen(pName) + 1;
}
Cba_NtkForEachPoMain( pNtk, iObj, i )
{
pName = Vec_StrEntryP( vOut, Pos );
NameId = Abc_NamStrFindOrAdd( p->pStrs, pName, NULL );
Pos += strlen(pName) + 1;
}
Cba_NtkForEachBox( pNtk, iObj )
{
pName = Vec_StrEntryP( vOut, Pos );
NameId = Abc_NamStrFindOrAdd( p->pStrs, pName, NULL );
Pos += strlen(pName) + 1;
}
*/
}
Cba_Man_t * Cba_ManReadCbaInt( Vec_Str_t * vOut )
{
Cba_Man_t * p;
Cba_Ntk_t * pNtk;
char Buffer[1000] = "#";
int i, NameId, Pos = 0, nNtks, Num1, Num2, Num3, Num4;
while ( Buffer[0] == '#' )
if ( !CbaManReadCbaLine(vOut, &Pos, Buffer, Buffer+1000) )
return NULL;
if ( !CbaManReadCbaNameAndNums(Buffer, &nNtks, &Num2, &Num3, &Num4) )
return NULL;
// start manager
assert( nNtks > 0 );
p = Cba_ManAlloc( Buffer, nNtks );
// start networks
Cba_ManForEachNtk( p, pNtk, i )
{
if ( !CbaManReadCbaLine(vOut, &Pos, Buffer, Buffer+1000) )
{
Cba_ManFree( p );
return NULL;
}
if ( !CbaManReadCbaNameAndNums(Buffer, &Num1, &Num2, &Num3, &Num4) )
{
Cba_ManFree( p );
return NULL;
}
assert( Num1 >= 0 && Num2 >= 0 && Num3 >= 0 );
NameId = Abc_NamStrFindOrAdd( p->pStrs, Buffer, NULL );
Cba_NtkAlloc( pNtk, NameId, Num1, Num2, Num3 );
Vec_IntFill( &pNtk->vInfo, 3 * Num4, -1 );
}
// read networks
Cba_ManForEachNtk( p, pNtk, i )
Cba_ManReadCbaNtk( vOut, &Pos, pNtk );
assert( Cba_ManNtkNum(p) == nNtks );
assert( Pos == Vec_StrSize(vOut) );
return p;
}
Cba_Man_t * Cba_ManReadCba( char * pFileName )
{
Cba_Man_t * p;
FILE * pFile;
Vec_Str_t * vOut;
int nFileSize;
pFile = fopen( pFileName, "rb" );
if ( pFile == NULL )
{
printf( "Cannot open file \"%s\" for reading.\n", pFileName );
return NULL;
}
// get the file size, in bytes
fseek( pFile, 0, SEEK_END );
nFileSize = ftell( pFile );
rewind( pFile );
// load the contents
vOut = Vec_StrAlloc( nFileSize );
vOut->nSize = vOut->nCap;
assert( nFileSize == Vec_StrSize(vOut) );
nFileSize = fread( Vec_StrArray(vOut), 1, Vec_StrSize(vOut), pFile );
assert( nFileSize == Vec_StrSize(vOut) );
fclose( pFile );
// read the networks
p = Cba_ManReadCbaInt( vOut );
if ( p != NULL )
{
ABC_FREE( p->pSpec );
p->pSpec = Abc_UtilStrsav( pFileName );
}
Vec_StrFree( vOut );
return p;
}
/**Function*************************************************************
Synopsis [Write CBA.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Cba_ManWriteCbaNtk( Vec_Str_t * vOut, Cba_Ntk_t * pNtk )
{
//char * pName; int iObj, NameId;
Vec_StrPushBuffer( vOut, (char *)Vec_StrArray(&pNtk->vType), Cba_NtkObjNum(pNtk) );
Vec_StrPushBuffer( vOut, (char *)Vec_IntArray(&pNtk->vFanin), 4 * Cba_NtkObjNum(pNtk) );
Vec_StrPushBuffer( vOut, (char *)Vec_IntArray(&pNtk->vInfo), 12 * Cba_NtkInfoNum(pNtk) );
/*
// write input/output/box names
Cba_NtkForEachPiMain( pNtk, iObj, i )
{
pName = Cba_ObjNameStr( pNtk, iObj );
Vec_StrPrintStr( vOut, pName );
Vec_StrPush( vOut, '\0' );
}
Cba_NtkForEachPoMain( pNtk, iObj, i )
{
pName = Cba_ObjNameStr( pNtk, iObj );
Vec_StrPrintStr( vOut, pName );
Vec_StrPush( vOut, '\0' );
}
Cba_NtkForEachBox( pNtk, iObj )
{
pName = Cba_ObjNameStr( pNtk, iObj );
Vec_StrPrintStr( vOut, pName );
Vec_StrPush( vOut, '\0' );
}
*/
}
void Cba_ManWriteCbaInt( Vec_Str_t * vOut, Cba_Man_t * p )
{
char Buffer[1000];
Cba_Ntk_t * pNtk; int i;
sprintf( Buffer, "# Design \"%s\" written by ABC on %s\n", Cba_ManName(p), Extra_TimeStamp() );
Vec_StrPrintStr( vOut, Buffer );
// write short info
sprintf( Buffer, "%s %d \n", Cba_ManName(p), Cba_ManNtkNum(p) );
Vec_StrPrintStr( vOut, Buffer );
Cba_ManForEachNtk( p, pNtk, i )
{
sprintf( Buffer, "%s %d %d %d %d \n", Cba_NtkName(pNtk),
Cba_NtkPiNum(pNtk), Cba_NtkPoNum(pNtk), Cba_NtkObjNum(pNtk), Cba_NtkInfoNum(pNtk) );
Vec_StrPrintStr( vOut, Buffer );
}
Cba_ManForEachNtk( p, pNtk, i )
Cba_ManWriteCbaNtk( vOut, pNtk );
}
void Cba_ManWriteCba( char * pFileName, Cba_Man_t * p )
{
Vec_Str_t * vOut;
assert( p->pMioLib == NULL );
vOut = Vec_StrAlloc( 10000 );
Cba_ManWriteCbaInt( vOut, p );
if ( Vec_StrSize(vOut) > 0 )
{
FILE * pFile = fopen( pFileName, "wb" );
if ( pFile == NULL )
printf( "Cannot open file \"%s\" for writing.\n", pFileName );
else
{
fwrite( Vec_StrArray(vOut), 1, Vec_StrSize(vOut), pFile );
fclose( pFile );
}
}
Vec_StrFree( vOut );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
......
......@@ -47,48 +47,6 @@ static inline void Cba_AbcUpdateMan( Abc_Frame_t * pAbc, Cba_Man_t * p )
/**Function********************************************************************
Synopsis [Accessing current Cba_Ntk_t.]
Description []
SideEffects []
SeeAlso []
******************************************************************************/
void Abc_FrameImportPtr( Vec_Ptr_t * vPtr )
{
Cba_Man_t * p;
if ( Abc_FrameGetGlobalFrame() == NULL )
{
printf( "ABC framework is not started.\n" );
return;
}
p = Cba_PtrTransformToCba( vPtr );
if ( p == NULL )
printf( "Converting from Ptr failed.\n" );
Cba_AbcUpdateMan( Abc_FrameGetGlobalFrame(), p );
}
Vec_Ptr_t * Abc_FrameExportPtr()
{
Vec_Ptr_t * vPtr;
Cba_Man_t * p;
if ( Abc_FrameGetGlobalFrame() == NULL )
{
printf( "ABC framework is not started.\n" );
return NULL;
}
p = Cba_AbcGetMan( Abc_FrameGetGlobalFrame() );
if ( p == NULL )
printf( "There is no CBA design present.\n" );
vPtr = Cba_PtrDeriveFromCba( p );
if ( vPtr == NULL )
printf( "Converting to Ptr has failed.\n" );
return vPtr;
}
/**Function********************************************************************
Synopsis []
Description []
......@@ -181,6 +139,8 @@ int Cba_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
}
fclose( pFile );
#if 0
// perform reading
if ( fUseAbc || fUsePtr )
{
......@@ -230,6 +190,8 @@ int Cba_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
}
Cba_AbcUpdateMan( pAbc, p );
#endif
return 0;
usage:
Abc_Print( -2, "usage: @read [-apvh] <file_name>\n" );
......@@ -284,6 +246,8 @@ int Cba_CommandWrite( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Cba_CommandWrite(): There is no current design.\n" );
return 0;
}
#if 0
if ( argc == globalUtilOptind + 1 )
pFileName = argv[globalUtilOptind];
else if ( argc == globalUtilOptind && p )
......@@ -319,6 +283,8 @@ int Cba_CommandWrite( Abc_Frame_t * pAbc, int argc, char ** argv )
printf( "Unrecognized output file extension.\n" );
return 0;
}
#endif
return 0;
usage:
Abc_Print( -2, "usage: @write [-apvh]\n" );
......@@ -376,7 +342,11 @@ int Cba_CommandPs( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Cba_CommandPs(): There is no current design.\n" );
return 0;
}
#if 0
Cba_ManPrintStats( p, nModules, fVerbose );
#endif
return 0;
usage:
Abc_Print( -2, "usage: @ps [-M num] [-vh]\n" );
......@@ -425,6 +395,8 @@ int Cba_CommandPut( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Cba_CommandPut(): There is no current design.\n" );
return 0;
}
#if 0
pGia = Cba_ManExtract( p, fBarBufs, fVerbose );
if ( pGia == NULL )
{
......@@ -432,6 +404,8 @@ int Cba_CommandPut( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
}
Abc_FrameUpdateGia( pAbc, pGia );
#endif
return 0;
usage:
Abc_Print( -2, "usage: @put [-bvh]\n" );
......@@ -479,6 +453,8 @@ int Cba_CommandGet( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Cba_CommandGet(): There is no current design.\n" );
return 0;
}
#if 0
if ( fMapped )
{
if ( pAbc->pNtkCur == NULL )
......@@ -498,10 +474,12 @@ int Cba_CommandGet( Abc_Frame_t * pAbc, int argc, char ** argv )
pNew = Cba_ManInsertGia( p, pAbc->pGia );
}
Cba_AbcUpdateMan( pAbc, pNew );
#endif
return 0;
usage:
Abc_Print( -2, "usage: @get [-mvh]\n" );
Abc_Print( -2, "\t inserts AIG or mapped network into the hierarchical design\n" );
Abc_Print( -2, "\t extracts AIG or mapped network into the hierarchical design\n" );
Abc_Print( -2, "\t-m : toggle using mapped network from main-space [default = %s]\n", fMapped? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
......@@ -542,8 +520,12 @@ int Cba_CommandClp( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Cba_CommandGet(): There is no current design.\n" );
return 0;
}
#if 0
pNew = Cba_ManCollapse( p );
Cba_AbcUpdateMan( pAbc, pNew );
#endif
return 0;
usage:
Abc_Print( -2, "usage: @clp [-vh]\n" );
......@@ -593,6 +575,8 @@ int Cba_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Cba_CommandCec(): There is no current design.\n" );
return 0;
}
#if 0
pArgvNew = argv + globalUtilOptind;
nArgcNew = argc - globalUtilOptind;
if ( nArgcNew != 1 )
......@@ -658,6 +642,8 @@ int Cba_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv )
}
Gia_ManStop( pFirst );
Gia_ManStop( pSecond );
#endif
return 0;
usage:
Abc_Print( -2, "usage: @cec [-vh]\n" );
......@@ -680,10 +666,7 @@ usage:
******************************************************************************/
int Cba_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Prs_ManReadBlifTest();
extern void Prs_ManReadVerilogTest();
extern void Prs_SmtReadSmtTest();
//Cba_Man_t * p = Cba_AbcGetMan(pAbc);
Cba_Man_t * p = Cba_AbcGetMan(pAbc);
int c, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
......@@ -699,16 +682,11 @@ int Cba_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage;
}
}
/*
if ( p == NULL )
{
Abc_Print( 1, "Cba_CommandTest(): There is no current design.\n" );
return 0;
}
*/
//Cba_PtrTransformTestTest();
//Prs_ManReadVerilogTest();
//Prs_SmtReadSmtTest();
return 0;
usage:
Abc_Print( -2, "usage: @test [-vh]\n" );
......
......@@ -288,6 +288,14 @@ static inline void Prs_NtkFree( Prs_Ntk_t * p )
ABC_FREE( p );
}
static inline 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 );
}
static inline void Prs_ManFree( Prs_Man_t * p )
{
if ( p->pStrs )
......@@ -333,6 +341,100 @@ static inline int Prs_ManMemory( Vec_Ptr_t * vPrs )
}
/**Function*************************************************************
Synopsis [Other APIs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline Cba_ObjType_t Ptr_SopToType( char * pSop )
{
if ( !strcmp(pSop, " 0\n") ) return CBA_BOX_CF;
if ( !strcmp(pSop, " 1\n") ) return CBA_BOX_CT;
if ( !strcmp(pSop, "1 1\n") ) return CBA_BOX_BUF;
if ( !strcmp(pSop, "0 1\n") ) return CBA_BOX_INV;
if ( !strcmp(pSop, "11 1\n") ) return CBA_BOX_AND;
if ( !strcmp(pSop, "00 1\n") ) return CBA_BOX_NOR;
if ( !strcmp(pSop, "00 0\n") ) return CBA_BOX_OR;
if ( !strcmp(pSop, "-1 1\n1- 1\n") ) return CBA_BOX_OR;
if ( !strcmp(pSop, "1- 1\n-1 1\n") ) return CBA_BOX_OR;
if ( !strcmp(pSop, "01 1\n10 1\n") ) return CBA_BOX_XOR;
if ( !strcmp(pSop, "10 1\n01 1\n") ) return CBA_BOX_XOR;
if ( !strcmp(pSop, "11 1\n00 1\n") ) return CBA_BOX_XNOR;
if ( !strcmp(pSop, "00 1\n11 1\n") ) return CBA_BOX_XNOR;
if ( !strcmp(pSop, "10 1\n") ) return CBA_BOX_SHARP;
if ( !strcmp(pSop, "01 1\n") ) return CBA_BOX_SHARPL;
assert( 0 );
return CBA_OBJ_NONE;
}
static inline char * Ptr_SopToTypeName( char * pSop )
{
if ( !strcmp(pSop, " 0\n") ) return "CBA_BOX_C0";
if ( !strcmp(pSop, " 1\n") ) return "CBA_BOX_C1";
if ( !strcmp(pSop, "1 1\n") ) return "CBA_BOX_BUF";
if ( !strcmp(pSop, "0 1\n") ) return "CBA_BOX_INV";
if ( !strcmp(pSop, "11 1\n") ) return "CBA_BOX_AND";
if ( !strcmp(pSop, "00 1\n") ) return "CBA_BOX_NOR";
if ( !strcmp(pSop, "00 0\n") ) return "CBA_BOX_OR";
if ( !strcmp(pSop, "-1 1\n1- 1\n") ) return "CBA_BOX_OR";
if ( !strcmp(pSop, "1- 1\n-1 1\n") ) return "CBA_BOX_OR";
if ( !strcmp(pSop, "01 1\n10 1\n") ) return "CBA_BOX_XOR";
if ( !strcmp(pSop, "10 1\n01 1\n") ) return "CBA_BOX_XOR";
if ( !strcmp(pSop, "11 1\n00 1\n") ) return "CBA_BOX_XNOR";
if ( !strcmp(pSop, "00 1\n11 1\n") ) return "CBA_BOX_XNOR";
if ( !strcmp(pSop, "10 1\n") ) return "CBA_BOX_SHARP";
if ( !strcmp(pSop, "01 1\n") ) return "CBA_BOX_SHARPL";
assert( 0 );
return NULL;
}
static inline char * Ptr_TypeToName( Cba_ObjType_t Type )
{
if ( Type == CBA_BOX_CF ) return "const0";
if ( Type == CBA_BOX_CT ) return "const1";
if ( Type == CBA_BOX_CX ) return "constX";
if ( Type == CBA_BOX_CZ ) return "constZ";
if ( Type == CBA_BOX_BUF ) return "buf";
if ( Type == CBA_BOX_INV ) return "not";
if ( Type == CBA_BOX_AND ) return "and";
if ( Type == CBA_BOX_NAND ) return "nand";
if ( Type == CBA_BOX_OR ) return "or";
if ( Type == CBA_BOX_NOR ) return "nor";
if ( Type == CBA_BOX_XOR ) return "xor";
if ( Type == CBA_BOX_XNOR ) return "xnor";
if ( Type == CBA_BOX_MUX ) return "mux";
if ( Type == CBA_BOX_MAJ ) return "maj";
if ( Type == CBA_BOX_SHARP ) return "sharp";
if ( Type == CBA_BOX_SHARPL) return "sharpl";
assert( 0 );
return "???";
}
static inline char * Ptr_TypeToSop( Cba_ObjType_t Type )
{
if ( Type == CBA_BOX_CF ) return " 0\n";
if ( Type == CBA_BOX_CT ) return " 1\n";
if ( Type == CBA_BOX_CX ) return " 0\n";
if ( Type == CBA_BOX_CZ ) return " 0\n";
if ( Type == CBA_BOX_BUF ) return "1 1\n";
if ( Type == CBA_BOX_INV ) return "0 1\n";
if ( Type == CBA_BOX_AND ) return "11 1\n";
if ( Type == CBA_BOX_NAND ) return "11 0\n";
if ( Type == CBA_BOX_OR ) return "00 0\n";
if ( Type == CBA_BOX_NOR ) return "00 1\n";
if ( Type == CBA_BOX_XOR ) return "01 1\n10 1\n";
if ( Type == CBA_BOX_XNOR ) return "00 1\n11 1\n";
if ( Type == CBA_BOX_SHARP ) return "10 1\n";
if ( Type == CBA_BOX_SHARPL) return "01 1\n";
if ( Type == CBA_BOX_MUX ) return "11- 1\n0-1 1\n";
if ( Type == CBA_BOX_MAJ ) return "11- 1\n1-1 1\n-11 1\n";
assert( 0 );
return "???";
}
////////////////////////////////////////////////////////////////////////
/// ITERATORS ///
......
......@@ -43,7 +43,7 @@ typedef enum {
PRS_BLIF_UNKNOWN // 11: unknown
} Cba_BlifType_t;
const char * s_BlifTypes[PRS_BLIF_UNKNOWN+1] = {
static const char * s_BlifTypes[PRS_BLIF_UNKNOWN+1] = {
NULL, // 0: unused
".model", // 1: .model
".inouts", // 2: .inputs
......
......@@ -45,7 +45,7 @@ typedef enum {
PRS_VER_UNKNOWN // 13: unknown
} Cba_VerType_t;
const char * s_VerTypes[PRS_VER_UNKNOWN+1] = {
static const char * s_VerTypes[PRS_VER_UNKNOWN+1] = {
NULL, // 0: unused
"input", // 1: input
"output", // 2: output
......@@ -101,7 +101,7 @@ static inline int Prs_ManIsDigit( Prs_Man_t * p ) { return Prs_CharIsD
***********************************************************************/
// collect predefined modules names
const char * s_VerilogModules[100] =
static const char * s_VerilogModules[100] =
{
"const0", // CBA_BOX_CF,
"const1", // CBA_BOX_CT,
......@@ -120,7 +120,7 @@ const char * s_VerilogModules[100] =
"maj", // CBA_BOX_MAJ,
NULL
};
const char * s_KnownModules[100] =
static const char * s_KnownModules[100] =
{
"VERIFIC_",
"add_",
......@@ -447,7 +447,7 @@ static inline int Prs_ManReadSignal( Prs_Man_t * p )
return Abc_Var2Lit2( Item, CBA_PRS_NAME );
}
}
int Prs_ManReadSignalList( Prs_Man_t * p, Vec_Int_t * vTemp, char LastSymb, int fAddForm )
static int Prs_ManReadSignalList( Prs_Man_t * p, Vec_Int_t * vTemp, char LastSymb, int fAddForm )
{
Vec_IntClear( vTemp );
while ( 1 )
......
......@@ -44,14 +44,14 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
void Prs_ManWriteBlifArray( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vFanins )
static void Prs_ManWriteBlifArray( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vFanins )
{
int i, NameId;
Vec_IntForEachEntry( vFanins, NameId, i )
fprintf( pFile, " %s", Prs_NtkStr(p, NameId) );
fprintf( pFile, "\n" );
}
void Prs_ManWriteBlifLines( FILE * pFile, Prs_Ntk_t * p )
static void Prs_ManWriteBlifLines( FILE * pFile, Prs_Ntk_t * p )
{
Vec_Int_t * vBox;
int i, k, FormId, ActId;
......@@ -84,7 +84,7 @@ void Prs_ManWriteBlifLines( FILE * pFile, Prs_Ntk_t * p )
}
}
}
void Prs_ManWriteBlifNtk( FILE * pFile, Prs_Ntk_t * p )
static void Prs_ManWriteBlifNtk( FILE * pFile, Prs_Ntk_t * p )
{
// write header
fprintf( pFile, ".model %s\n", Prs_NtkStr(p, p->iModuleName) );
......@@ -116,6 +116,7 @@ void Prs_ManWriteBlif( char * pFileName, Vec_Ptr_t * vPrs )
}
#if 0
/**Function*************************************************************
......@@ -226,6 +227,7 @@ void Cba_ManWriteBlif( char * pFileName, Cba_Man_t * p )
fclose( pFile );
}
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
......
......@@ -44,7 +44,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
void Prs_ManWriteVerilogConcat( FILE * pFile, Prs_Ntk_t * p, int Con )
static void Prs_ManWriteVerilogConcat( FILE * pFile, Prs_Ntk_t * p, int Con )
{
extern void Prs_ManWriteVerilogArray( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs, int Start, int Stop, int fOdd );
Vec_Int_t * vSigs = Prs_CatSignals(p, Con);
......@@ -52,7 +52,7 @@ void Prs_ManWriteVerilogConcat( FILE * pFile, Prs_Ntk_t * p, int Con )
Prs_ManWriteVerilogArray( pFile, p, vSigs, 0, Vec_IntSize(vSigs), 0 );
fprintf( pFile, "}" );
}
void Prs_ManWriteVerilogSignal( FILE * pFile, Prs_Ntk_t * p, int Sig )
static void Prs_ManWriteVerilogSignal( FILE * pFile, Prs_Ntk_t * p, int Sig )
{
int Value = Abc_Lit2Var2( Sig );
Prs_ManType_t Type = (Prs_ManType_t)Abc_Lit2Att2( Sig );
......@@ -64,7 +64,7 @@ void Prs_ManWriteVerilogSignal( FILE * pFile, Prs_Ntk_t * p, int Sig )
Prs_ManWriteVerilogConcat( pFile, p, Value );
else assert( 0 );
}
void Prs_ManWriteVerilogArray( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs, int Start, int Stop, int fOdd )
static void Prs_ManWriteVerilogArray( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs, int Start, int Stop, int fOdd )
{
int i, Sig;
assert( Vec_IntSize(vSigs) > 0 );
......@@ -76,7 +76,7 @@ void Prs_ManWriteVerilogArray( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs, i
fprintf( pFile, "%s", i == Stop - 1 ? "" : ", " );
}
}
void Prs_ManWriteVerilogArray2( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs )
static void Prs_ManWriteVerilogArray2( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs )
{
int i, FormId, ActSig;
assert( Vec_IntSize(vSigs) % 2 == 0 );
......@@ -89,7 +89,7 @@ void Prs_ManWriteVerilogArray2( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs )
fprintf( pFile, ")%s", (i == Vec_IntSize(vSigs) - 2) ? "" : ", " );
}
}
void Prs_ManWriteVerilogMux( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs )
static void Prs_ManWriteVerilogMux( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs )
{
int i, FormId, ActSig;
char * pStrs[4] = { " = ", " ? ", " : ", ";\n" };
......@@ -105,7 +105,7 @@ void Prs_ManWriteVerilogMux( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vSigs )
break;
}
}
void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p )
static void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p )
{
Vec_Int_t * vBox; int i;
Prs_NtkForEachBox( p, vBox, i )
......@@ -131,7 +131,7 @@ void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p )
}
}
}
void Prs_ManWriteVerilogIos( FILE * pFile, Prs_Ntk_t * p, int SigType )
static void Prs_ManWriteVerilogIos( FILE * pFile, Prs_Ntk_t * p, int SigType )
{
int NameId, RangeId, i;
char * pSigNames[4] = { "inout", "input", "output", "wire" };
......@@ -142,13 +142,13 @@ void Prs_ManWriteVerilogIos( FILE * pFile, Prs_Ntk_t * p, int SigType )
Vec_IntForEachEntryTwo( vSigs[SigType], vSigsR[SigType], NameId, RangeId, i )
fprintf( pFile, " %s %s%s;\n", pSigNames[SigType], RangeId ? Prs_NtkStr(p, RangeId) : "", Prs_NtkStr(p, NameId) );
}
void Prs_ManWriteVerilogIoOrder( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vOrder )
static void Prs_ManWriteVerilogIoOrder( FILE * pFile, Prs_Ntk_t * p, Vec_Int_t * vOrder )
{
int i, NameId;
Vec_IntForEachEntry( vOrder, NameId, i )
fprintf( pFile, "%s%s", Prs_NtkStr(p, NameId), i == Vec_IntSize(vOrder) - 1 ? "" : ", " );
}
void Prs_ManWriteVerilogNtk( FILE * pFile, Prs_Ntk_t * p )
static void Prs_ManWriteVerilogNtk( FILE * pFile, Prs_Ntk_t * p )
{
int s;
// write header
......@@ -179,6 +179,7 @@ void Prs_ManWriteVerilog( char * pFileName, Vec_Ptr_t * vPrs )
}
#if 0
/**Function*************************************************************
......@@ -693,6 +694,7 @@ void Cba_ManWriteVerilog( char * pFileName, Cba_Man_t * p, int fUseAssign )
Vec_StrFreeP( &p->vOut2 );
}
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
......
SRC += src/base/cba/cbaBlast.c \
src/base/cba/cbaCba.c \
src/base/cba/cbaCom.c \
src/base/cba/cbaLib.c \
src/base/cba/cbaNtk.c \
src/base/cba/cbaPrsBuild.c \
src/base/cba/cbaPrsTrans.c \
src/base/cba/cbaPtr.c \
src/base/cba/cbaPtrAbc.c \
src/base/cba/cbaReadBlif.c \
src/base/cba/cbaReadSmt.c \
src/base/cba/cbaReadVer.c \
src/base/cba/cbaWriteBlif.c \
src/base/cba/cbaWriteSmt.c \
src/base/cba/cbaWriteVer.c
......@@ -49,6 +49,8 @@ extern void Scl_Init( Abc_Frame_t * pAbc );
extern void Scl_End( Abc_Frame_t * pAbc );
extern void Wlc_Init( Abc_Frame_t * pAbc );
extern void Wlc_End( Abc_Frame_t * pAbc );
extern void Bac_Init( Abc_Frame_t * pAbc );
extern void Bac_End( Abc_Frame_t * pAbc );
extern void Cba_Init( Abc_Frame_t * pAbc );
extern void Cba_End( Abc_Frame_t * pAbc );
extern void Pla_Init( Abc_Frame_t * pAbc );
......@@ -108,6 +110,7 @@ void Abc_FrameInit( Abc_Frame_t * pAbc )
Load_Init( pAbc );
Scl_Init( pAbc );
Wlc_Init( pAbc );
Bac_Init( pAbc );
Cba_Init( pAbc );
Pla_Init( pAbc );
Test_Init( pAbc );
......@@ -145,6 +148,7 @@ void Abc_FrameEnd( Abc_Frame_t * pAbc )
Load_End( pAbc );
Scl_End( pAbc );
Wlc_End( pAbc );
Bac_End( pAbc );
Cba_End( pAbc );
Pla_End( pAbc );
Test_End( pAbc );
......
......@@ -1939,6 +1939,27 @@ static inline void Vec_IntAppendSkip( Vec_Int_t * vVec1, Vec_Int_t * vVec2, int
Vec_IntPush( vVec1, Entry );
}
/**Function*************************************************************
Synopsis [Remapping attributes after objects were duplicated.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline void Vec_IntRemapArray( Vec_Int_t * vOld2New, Vec_Int_t * vOld, Vec_Int_t * vNew, int nNew )
{
int iOld, iNew;
if ( Vec_IntSize(vOld) == 0 )
return;
Vec_IntFill( vNew, nNew, 0 );
Vec_IntForEachEntry( vOld2New, iNew, iOld )
if ( iNew > 0 && iNew < nNew && Vec_IntEntry(vOld, iOld) != 0 )
Vec_IntWriteEntry( vNew, iNew, Vec_IntEntry(vOld, iOld) );
}
ABC_NAMESPACE_HEADER_END
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment