Commit dc8926a9 by Alan Mishchenko

Word-level extension of Cba_Ntk_t.

parent d688af26
......@@ -46,19 +46,20 @@ ABC_NAMESPACE_IMPL_START
***********************************************************************/
void Cba_ManPrepareGates( Cba_Man_t * p )
{
int i;
Dec_Graph_t ** ppGraphs; int i;
if ( p->pMioLib == NULL )
return;
assert( p->ppGraphs == NULL );
p->ppGraphs = (Dec_Graph_t **)ABC_ALLOC( Dec_Graph_t *, Abc_NamObjNumMax(p->pFuncs) );
p->ppGraphs[0] = NULL;
ppGraphs = ABC_ALLOC( Dec_Graph_t *, Abc_NamObjNumMax(p->pFuncs) );
ppGraphs[0] = NULL;
for ( i = 1; i < Abc_NamObjNumMax(p->pFuncs); i++ )
{
char * pGateName = Abc_NamStr( p->pFuncs, i );
Mio_Gate_t * pGate = Mio_LibraryReadGateByName( (Mio_Library_t *)p->pMioLib, pGateName, NULL );
char * pSop = Mio_GateReadSop( pGate );
p->ppGraphs[i] = Dec_Factor( pSop );
ppGraphs[i] = Dec_Factor( pSop );
}
assert( p->ppGraphs == NULL );
p->ppGraphs = ppGraphs;
}
void Cba_ManUndoGates( Cba_Man_t * p )
{
......@@ -66,7 +67,7 @@ void Cba_ManUndoGates( Cba_Man_t * p )
if ( p->pMioLib == NULL )
return;
for ( i = 1; i < Abc_NamObjNumMax(p->pFuncs); i++ )
Dec_GraphFree( p->ppGraphs[i] );
Dec_GraphFree( (Dec_Graph_t *)p->ppGraphs[i] );
ABC_FREE( p->ppGraphs );
}
......
......@@ -169,7 +169,7 @@ Cba_Ntk_t * Cba_NtkBuild( Cba_Man_t * pNew, Cba_Ntk_t * pNtk, Vec_Int_t * vMap,
// start network
pNtkNew = Cba_ManNtk( pNew, Cba_NtkId(pNtk) );
Cba_NtkResize( pNtkNew, nObjCount );
Cba_NtkResize( pNtkNew, nObjCount, 0 );
// fill object information
Cba_NtkForEachPi( pNtk, NameId, i )
......
......@@ -137,7 +137,7 @@ Cba_Man_t * Cba_ManDupStart( Cba_Man_t * p, Vec_Int_t * vNtkSizes )
Cba_Ntk_t * pNtk; int i;
Cba_Man_t * pNew = Cba_ManClone( p );
Cba_ManForEachNtk( p, pNtk, i )
Cba_NtkResize( Cba_ManNtk(pNew, i), vNtkSizes ? Vec_IntEntry(vNtkSizes, i) : Cba_NtkObjNum(pNtk) );
Cba_NtkResize( Cba_ManNtk(pNew, i), vNtkSizes ? Vec_IntEntry(vNtkSizes, i) : Cba_NtkObjNum(pNtk), Cba_NtkIsWordLevel(pNtk) );
Vec_IntFill( &p->vCopies, Cba_ManObjNum(p), -1 );
Cba_ManForEachNtk( p, pNtk, i )
Cba_NtkDupStart( Cba_ManNtk(pNew, i), pNtk );
......
......@@ -69,8 +69,8 @@ struct Cba_Prs_t_
// objects collected by the parser
Vec_Int_t vTypesCur; // Cba_PrsType_t
Vec_Int_t vFuncsCur; // functions (node->func; box->module; gate->cell; latch->init; concat->unused)
Vec_Int_t vInstIdsCur; // instance names
Vec_Int_t vFaninsCur; // instances
Vec_Int_t vInstIdsCur; // instance names
// temporary data
Vec_Str_t vCover; // one SOP cover
Vec_Int_t vTemp; // array of tokens
......@@ -124,8 +124,8 @@ static inline Cba_Ntk_t * Cba_PrsAddCurrentModel( Cba_Prs_t * p, int iNameId )
Cba_ManSetupArray( p->pDesign, &pNtk->vWires, &p->vWiresCur );
Cba_ManSetupArray( p->pDesign, &pNtk->vTypes, &p->vTypesCur );
Cba_ManSetupArray( p->pDesign, &pNtk->vFuncs, &p->vFuncsCur );
Cba_ManSetupArray( p->pDesign, &pNtk->vInstIds, &p->vInstIdsCur );
Cba_ManSetupArray( p->pDesign, &pNtk->vFanins, &p->vFaninsCur );
Cba_ManSetupArray( p->pDesign, &pNtk->vInstIds, &p->vInstIdsCur );
return pNtk;
}
......@@ -182,8 +182,8 @@ static inline void Cba_PrsFree( Cba_Prs_t * p )
Vec_IntErase( &p->vTypesCur );
Vec_IntErase( &p->vFuncsCur );
Vec_IntErase( &p->vInstIdsCur );
Vec_IntErase( &p->vFaninsCur );
Vec_IntErase( &p->vInstIdsCur );
// temporary
Vec_StrErase( &p->vCover );
Vec_IntErase( &p->vTemp );
......
......@@ -369,8 +369,8 @@ static inline int Cba_PrsReadConcat( Cba_Prs_t * p, Vec_Int_t * vTemp2 )
// create new concatentation
Vec_IntPush( &p->vTypesCur, CBA_OBJ_CONCAT );
Vec_IntPush( &p->vFuncsCur, 0 );
Vec_IntPush( &p->vInstIdsCur, 0 );
Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, vTemp2) );
Vec_IntPush( &p->vInstIdsCur, 0 );
return Vec_IntSize(&p->vFaninsCur);
}
static inline int Cba_PrsReadSignalOrConcat( Cba_Prs_t * p, int * pName, int * pRange )
......@@ -499,8 +499,8 @@ static inline int Cba_PrsReadAssign( Cba_Prs_t * p )
{
Vec_IntPush( &p->vTypesCur, CBA_OBJ_NODE );
Vec_IntPush( &p->vFuncsCur, fCompl ? CBA_NODE_INV : CBA_NODE_BUF );
Vec_IntPush( &p->vInstIdsCur, 0 );
Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, &p->vTemp) );
Vec_IntPush( &p->vInstIdsCur, 0 );
return 1;
}
if ( Cba_PrsIsChar(p, '&') )
......@@ -534,8 +534,8 @@ static inline int Cba_PrsReadAssign( Cba_Prs_t * p )
// write binary operator
Vec_IntPush( &p->vTypesCur, CBA_OBJ_NODE );
Vec_IntPush( &p->vFuncsCur, Oper );
Vec_IntPush( &p->vInstIdsCur, 0 );
Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, &p->vTemp) );
Vec_IntPush( &p->vInstIdsCur, 0 );
return 1;
}
static inline int Cba_PrsReadInstance( Cba_Prs_t * p, int Func )
......@@ -564,8 +564,8 @@ static inline int Cba_PrsReadInstance( Cba_Prs_t * p, int Func )
// assign
Vec_IntPush( &p->vTypesCur, Type );
Vec_IntPush( &p->vFuncsCur, Func );
Vec_IntPush( &p->vInstIdsCur, InstId );
Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, &p->vTemp) );
Vec_IntPush( &p->vInstIdsCur, InstId );
return 1;
}
......@@ -633,9 +633,9 @@ static inline int Cba_PrsReadModule( Cba_Prs_t * p )
Vec_IntPush( &p->vFailed, p->iModuleName );
// cleanup
Vec_IntClear( &p->vWiresCur );
Vec_IntClear( &p->vFaninsCur );
Vec_IntClear( &p->vTypesCur );
Vec_IntClear( &p->vFuncsCur );
Vec_IntClear( &p->vFaninsCur );
Vec_IntClear( &p->vInstIdsCur );
// add
Cba_PrsAddCurrentModel( p, p->iModuleName );
......
......@@ -583,26 +583,26 @@ Vec_Int_t * Cba_PrsReadList( Cba_Man_t * p, Vec_Ptr_t * vNames, Vec_Int_t * vLis
Vec_IntPush( vList, Abc_NamStrFindOrAdd(p->pNames, pName, NULL) );
return vList;
}
void Cba_PrsReadNodes( Cba_Man_t * p, Vec_Ptr_t * vNodes, Vec_Int_t * vTypesCur, Vec_Int_t * vFuncsCur, Vec_Int_t * vInstIdsCur, Vec_Int_t * vFaninsCur, Vec_Int_t * vList )
void Cba_PrsReadNodes( Cba_Man_t * p, Vec_Ptr_t * vNodes, Vec_Int_t * vTypesCur, Vec_Int_t * vFuncsCur, Vec_Int_t * vFaninsCur, Vec_Int_t * vInstIdsCur, Vec_Int_t * vList )
{
Vec_Ptr_t * vNode; int i;
Vec_PtrForEachEntry( Vec_Ptr_t *, vNodes, vNode, i )
{
Vec_IntPush( vTypesCur, CBA_OBJ_NODE );
Vec_IntPush( vFuncsCur, (Cba_NodeType_t)Abc_Ptr2Int(Vec_PtrEntry(vNode, 1)) );
Vec_IntPush( vInstIdsCur, 0 );
Vec_IntPush( vFaninsCur, Cba_ManHandleArray(p, Cba_PrsReadList(p, vNode, vList, 1, -1)) );
Vec_IntPush( vInstIdsCur, 0 );
}
}
void Cba_PrsReadBoxes( Cba_Man_t * p, Vec_Ptr_t * vBoxes, Vec_Int_t * vTypesCur, Vec_Int_t * vFuncsCur, Vec_Int_t * vInstIdsCur, Vec_Int_t * vFaninsCur, Vec_Int_t * vList )
void Cba_PrsReadBoxes( Cba_Man_t * p, Vec_Ptr_t * vBoxes, Vec_Int_t * vTypesCur, Vec_Int_t * vFuncsCur, Vec_Int_t * vFaninsCur, Vec_Int_t * vInstIdsCur, Vec_Int_t * vList )
{
Vec_Ptr_t * vBox; int i;
Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
{
Vec_IntPush( vTypesCur, CBA_OBJ_BOX );
Vec_IntPush( vFuncsCur, Abc_NamStrFindOrAdd(p->pModels, Vec_PtrEntry(vBox, 0), NULL) );
Vec_IntPush( vInstIdsCur, Abc_NamStrFindOrAdd(p->pNames, Vec_PtrEntry(vBox, 1), NULL) );
Vec_IntPush( vFaninsCur, Cba_ManHandleArray(p, Cba_PrsReadList(p, vBox, vList, 0, 1)) );
Vec_IntPush( vInstIdsCur, Abc_NamStrFindOrAdd(p->pNames, Vec_PtrEntry(vBox, 1), NULL) );
}
}
void Cba_PrsReadModule( Cba_Man_t * p, Cba_Ntk_t * pNtk, Vec_Ptr_t * vNtk, Vec_Int_t * vList )
......@@ -616,13 +616,13 @@ void Cba_PrsReadModule( Cba_Man_t * p, Cba_Ntk_t * pNtk, Vec_Ptr_t * vNtk, Vec_I
Cba_ManAllocArray( p, &pNtk->vOutputs, Vec_PtrSize(vOutputs) );
Cba_ManAllocArray( p, &pNtk->vTypes, Vec_PtrSize(vNodes) + Vec_PtrSize(vBoxes) );
Cba_ManAllocArray( p, &pNtk->vFuncs, Vec_PtrSize(vNodes) + Vec_PtrSize(vBoxes) );
Cba_ManAllocArray( p, &pNtk->vInstIds, Vec_PtrSize(vNodes) + Vec_PtrSize(vBoxes) );
Cba_ManAllocArray( p, &pNtk->vFanins, Vec_PtrSize(vNodes) + Vec_PtrSize(vBoxes) );
Cba_ManAllocArray( p, &pNtk->vInstIds, Vec_PtrSize(vNodes) + Vec_PtrSize(vBoxes) );
Cba_PrsReadList( p, vInputs, &pNtk->vInputs, -1, -1 );
Cba_PrsReadList( p, vOutputs, &pNtk->vOutputs, -1, -1 );
Cba_PrsReadNodes( p, vNodes, &pNtk->vTypes, &pNtk->vFuncs, &pNtk->vInstIds, &pNtk->vFanins, vList );
Cba_PrsReadBoxes( p, vBoxes, &pNtk->vTypes, &pNtk->vFuncs, &pNtk->vInstIds, &pNtk->vFanins, vList );
Cba_PrsReadNodes( p, vNodes, &pNtk->vTypes, &pNtk->vFuncs, &pNtk->vFanins, &pNtk->vInstIds, vList );
Cba_PrsReadBoxes( p, vBoxes, &pNtk->vTypes, &pNtk->vFuncs, &pNtk->vFanins, &pNtk->vInstIds, vList );
}
Cba_Man_t * Cba_PrsReadPtr( Vec_Ptr_t * vDes )
{
......
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