diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/base/cba/cba.h | 87 | ||||
-rw-r--r-- | src/base/cba/cbaBuild.c | 65 | ||||
-rw-r--r-- | src/base/cba/cbaCom.c | 12 | ||||
-rw-r--r-- | src/base/cba/cbaPrs.h | 2 | ||||
-rw-r--r-- | src/base/cba/cbaReadBlif.c | 8 | ||||
-rw-r--r-- | src/base/cba/cbaReadVer.c | 14 | ||||
-rw-r--r-- | src/base/cba/cbaSimple.c | 50 | ||||
-rw-r--r-- | src/base/cba/cbaWriteBlif.c | 41 | ||||
-rw-r--r-- | src/base/cba/cbaWriteVer.c | 10 |
9 files changed, 178 insertions, 111 deletions
diff --git a/src/base/cba/cba.h b/src/base/cba/cba.h index 8ef5d868..56db6f29 100644 --- a/src/base/cba/cba.h +++ b/src/base/cba/cba.h @@ -54,25 +54,26 @@ typedef enum { CBA_OBJ_NODE, // 6: node CBA_OBJ_BOX, // 7: box CBA_OBJ_LATCH, // 8: latch - CBA_OBJ_UNKNOWN // 9: unknown + CBA_OBJ_CONCAT, // 9: concatenation + CBA_OBJ_UNKNOWN // 10: unknown } Cba_ObjType_t; // Verilog predefined models typedef enum { - CBA_NODE_NONE = 0, // 0: unused - CBA_NODE_CONST, // 1: constant - CBA_NODE_BUF, // 2: buffer - CBA_NODE_INV, // 3: inverter - CBA_NODE_AND, // 4: AND - CBA_NODE_NAND, // 5: NAND - CBA_NODE_OR, // 6: OR - CBA_NODE_NOR, // 7: NOR - CBA_NODE_XOR, // 8: XOR - CBA_NODE_XNOR, // 9 .XNOR - CBA_NODE_MUX, // 10: MUX - CBA_NODE_MAJ, // 11: MAJ - CBA_NODE_KNOWN, // 12: unknown - CBA_NODE_UNKNOWN // 13: unknown + CBA_NODE_NONE = 0, // 0: unused + CBA_NODE_CONST, // 1: constant + CBA_NODE_BUF, // 2: buffer + CBA_NODE_INV, // 3: inverter + CBA_NODE_AND, // 4: AND + CBA_NODE_NAND, // 5: NAND + CBA_NODE_OR, // 6: OR + CBA_NODE_NOR, // 7: NOR + CBA_NODE_XOR, // 8: XOR + CBA_NODE_XNOR, // 9 .XNOR + CBA_NODE_MUX, // 10: MUX + CBA_NODE_MAJ, // 11: MAJ + CBA_NODE_KNOWN, // 12: unknown + CBA_NODE_UNKNOWN // 13: unknown } Cba_NodeType_t; @@ -102,7 +103,6 @@ struct Cba_Man_t_ typedef struct Cba_Ntk_t_ Cba_Ntk_t; struct Cba_Ntk_t_ { - char * pName; // name Cba_Man_t * pDesign; // design int Id; // network ID int iBoxNtk; // instance network ID @@ -135,9 +135,9 @@ static inline Vec_Set_t * Cba_ManMem( Cba_Man_t * p ) { r static inline int Cba_ManMemSave( Cba_Man_t * p, int * d, int s ) { return Vec_SetAppend(Cba_ManMem(p), d, s); } static inline int * Cba_ManMemRead( Cba_Man_t * p, int h ) { return h ? (int *)Vec_SetEntry(Cba_ManMem(p), h) : NULL; } -static inline int Cba_NtkId( Cba_Ntk_t * p ) { return p->Id; } -static inline char * Cba_NtkName( Cba_Ntk_t * p ) { return p->pName; } static inline Cba_Man_t * Cba_NtkMan( Cba_Ntk_t * p ) { return p->pDesign; } +static inline int Cba_NtkId( Cba_Ntk_t * p ) { return p->Id; } +static inline char * Cba_NtkName( Cba_Ntk_t * p ) { return Abc_NamStr(Cba_NtkMan(p)->pModels, Cba_NtkId(p)); } static inline int Cba_NtkObjNum( Cba_Ntk_t * p ) { return Vec_IntSize(&p->vFanins); } static inline int Cba_NtkPiNum( Cba_Ntk_t * p ) { return Vec_IntSize(&p->vInputs); } static inline int Cba_NtkPoNum( Cba_Ntk_t * p ) { return Vec_IntSize(&p->vOutputs); } @@ -169,13 +169,14 @@ static inline int Cba_ObjIsBi( Cba_Ntk_t * p, int i ) { r static inline int Cba_ObjIsBo( Cba_Ntk_t * p, int i ) { return Cba_ObjType(p, i) == CBA_OBJ_BO; } static inline int Cba_ObjIsNode( Cba_Ntk_t * p, int i ) { return Cba_ObjType(p, i) == CBA_OBJ_NODE; } static inline int Cba_ObjIsBox( Cba_Ntk_t * p, int i ) { return Cba_ObjType(p, i) == CBA_OBJ_BOX; } +static inline int Cba_ObjIsConcat( Cba_Ntk_t * p, int i ) { return Cba_ObjType(p, i) == CBA_OBJ_CONCAT; } static inline int Cba_ObjIsCi( Cba_Ntk_t * p, int i ) { return Cba_ObjIsPi(p, i) || Cba_ObjIsBo(p, i); } static inline int Cba_ObjIsCo( Cba_Ntk_t * p, int i ) { return Cba_ObjIsPo(p, i) || Cba_ObjIsBi(p, i); } static inline int Cba_ObjIsCio( Cba_Ntk_t * p, int i ) { return Cba_ObjIsCi(p, i) || Cba_ObjIsCo(p, i); } static inline int Cba_ObjIsBio( Cba_Ntk_t * p, int i ) { return Cba_ObjIsBi(p, i) || Cba_ObjIsBo(p, i); } static inline int Cba_ObjFanin0( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsPo(p, i) || Cba_ObjIsBio(p, i)); return Cba_ObjFuncId(p, i); } -static inline int * Cba_ObjFaninArray( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsNode(p, i)); return Cba_NtkMemRead(p, Cba_ObjFaninId(p, i)); } +static inline int * Cba_ObjFaninArray( Cba_Ntk_t * p, int i ) { assert(Cba_ObjType(p, i) >= CBA_OBJ_NODE); return Cba_NtkMemRead(p, Cba_ObjFaninId(p, i)); } static inline int Cba_ObjFaninNum( Cba_Ntk_t * p, int i ) { return *Cba_ObjFaninArray(p, i); } static inline int * Cba_ObjFanins( Cba_Ntk_t * p, int i ) { return Cba_ObjFaninArray(p, i) + 1; } static inline Vec_Int_t * Cba_ObjFaninVec( Cba_Ntk_t * p, int i ) { static Vec_Int_t V; V.pArray = Cba_ObjFaninArray(p, i); V.nSize = V.nCap = V.pArray ? *V.pArray++ : 0; return &V; } @@ -183,8 +184,10 @@ static inline Vec_Int_t * Cba_ObjFaninVec2( Cba_Ntk_t * p, int i ) { s static inline Cba_NodeType_t Cba_ObjNodeType( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsNode(p, i)); return Cba_ObjFaninId(p, i); } static inline int Cba_ObjBoxModelId( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsBox(p, i)); return Cba_ObjFuncId(p, i); } static inline Cba_Ntk_t * Cba_ObjBoxModel( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsBox(p, i)); return Cba_ManNtk(p->pDesign, Cba_ObjBoxModelId(p, i)); } -static inline int Cba_ObjBoxBi( Cba_Ntk_t * p, int b, int i ) { assert(Cba_ObjIsBox(p, i)); return b - Cba_NtkPiNum(Cba_ObjBoxModel(p, b)) + i; } -static inline int Cba_ObjBoxBo( Cba_Ntk_t * p, int b, int i ) { assert(Cba_ObjIsBox(p, i)); return b + 1 + i; } +static inline int Cba_ObjBoxBiNum( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsBox(p, i)); return Cba_NtkPiNum(Cba_ObjBoxModel(p, i)); } +static inline int Cba_ObjBoxBoNum( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsBox(p, i)); return Cba_NtkPoNum(Cba_ObjBoxModel(p, i)); } +static inline int Cba_ObjBoxBi( Cba_Ntk_t * p, int b, int i ) { assert(Cba_ObjIsBox(p, b)); return b - Cba_ObjBoxBiNum(p, b) + i; } +static inline int Cba_ObjBoxBo( Cba_Ntk_t * p, int b, int i ) { assert(Cba_ObjIsBox(p, b)); return b + 1 + i; } static inline int Cba_ObjBiModelId( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsBi(p, i)); while (!Cba_ObjIsBox(p, i)) i++; return Cba_ObjBoxModelId(p, i); } static inline int Cba_ObjBoModelId( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsBo(p, i)); return Cba_ObjBoxModelId(p, Cba_ObjFanin0(p, i)); } static inline Cba_Ntk_t * Cba_ObjBiModel( Cba_Ntk_t * p, int i ) { return Cba_ManNtk( p->pDesign, Cba_ObjBiModelId(p, i) ); } @@ -216,8 +219,6 @@ static inline char * Cba_ObjRangeStr( Cba_Ntk_t * p, int i ) { r #define Cba_NtkForEachObjType( p, Type, i ) \ for ( i = 0; (i < Cba_NtkObjNum(p)) && (((Type) = Cba_ObjType(p, i)), 1); i++ ) -#define Cba_NtkForEachObjTypeFuncFanins( p, Type, Func, vFanins, i ) \ - for ( i = 0; (i < Cba_NtkObjNum(p)) && (((Type) = Cba_ObjType(p, i)), 1) && (((Func) = Cba_ObjFuncId(p, i)), 1) && (((vFanins) = Cba_ObjFaninVec(p, i)), 1); i++ ) #define Cba_NtkForEachBox( p, iObj, i ) \ for ( i = 0; (i < Cba_NtkBoxNum(p)) && (((iObj) = Vec_IntEntry(&p->vBoxes, i)), 1); i++ ) @@ -229,6 +230,11 @@ static inline char * Cba_ObjRangeStr( Cba_Ntk_t * p, int i ) { r #define Cba_NtkForEachCo( p, i ) \ for ( i = 0; (i < Cba_NtkObjNum(p)); i++ ) if ( Cba_ObjType(p, i) != CBA_OBJ_PO && Cba_ObjType(p, i) != CBA_OBJ_BI ) {} else +#define Cba_BoxForEachBi( p, iBox, iTerm, i ) \ + for ( iTerm = iBox - Cba_ObjBoxBiNum(p, iBox), i = 0; iTerm < iBox; iTerm++, i++ ) +#define Cba_BoxForEachBo( p, iBox, iTerm, i ) \ + for ( iTerm = iBox + 1, i = 0; iTerm < iBox + 1 + Cba_ObjBoxBoNum(p, iBox); iTerm++, i++ ) + //////////////////////////////////////////////////////////////////////// /// FUNCTION DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -272,12 +278,15 @@ static inline void Cba_ManFetchArray( Cba_Man_t * p, Vec_Int_t * vTo, int nSize // constructors desctructors static inline Cba_Ntk_t * Cba_NtkAlloc( Cba_Man_t * p, char * pName ) { + int iModelId = Abc_NamStrFindOrAdd( p->pModels, pName, NULL ); Cba_Ntk_t * pNtk = Vec_SetFetch( Cba_ManMem(p), sizeof(Cba_Ntk_t) ); memset( pNtk, 0, sizeof(Cba_Ntk_t) ); pNtk->pDesign = p; - pNtk->pName = Vec_SetStrsav( Cba_ManMem(p), pName ); - pNtk->Id = Vec_PtrSize(&p->vNtks); + pNtk->Id = Vec_PtrSize(&p->vNtks); Vec_PtrPush( &p->vNtks, pNtk ); + assert( iModelId <= pNtk->Id ); + if ( iModelId < pNtk->Id ) + printf( "Model with name %s already exists.\n", pName ); return pNtk; } static inline Cba_Man_t * Cba_ManAlloc( char * pFileName ) @@ -290,8 +299,23 @@ static inline Cba_Man_t * Cba_ManAlloc( char * pFileName ) p->pFuncs = Abc_NamStart( 1000, 20 ); Vec_SetAlloc_( &p->Mem, 20 ); Vec_PtrPush( &p->vNtks, NULL ); + p->iRoot = 1; + return p; +} +static inline Cba_Man_t * Cba_ManClone( Cba_Man_t * pOld ) +{ + Cba_Man_t * p = ABC_CALLOC( Cba_Man_t, 1 ); + p->pName = Extra_FileDesignName( pOld->pName ); + p->pSpec = Abc_UtilStrsav( pOld->pSpec ); + p->pNames = Abc_NamRef( pOld->pNames ); + p->pModels = Abc_NamRef( pOld->pModels ); + p->pFuncs = Abc_NamRef( pOld->pFuncs ); + Vec_SetAlloc_( &p->Mem, 20 ); + Vec_PtrPush( &p->vNtks, NULL ); + p->iRoot = 1; return p; } + static inline void Cba_ManFree( Cba_Man_t * p ) { Vec_IntFreeP( &p->vBuf2LeafNtk ); @@ -301,9 +325,9 @@ static inline void Cba_ManFree( Cba_Man_t * p ) ABC_FREE( p->vCopies.pArray ); ABC_FREE( p->vNtks.pArray ); Vec_SetFree_( &p->Mem ); - Abc_NamStop( p->pNames ); - Abc_NamStop( p->pModels ); - Abc_NamStop( p->pFuncs ); + Abc_NamDeref( p->pNames ); + Abc_NamDeref( p->pModels ); + Abc_NamDeref( p->pFuncs ); ABC_FREE( p->pName ); ABC_FREE( p->pSpec ); ABC_FREE( p ); @@ -324,12 +348,13 @@ static inline int Cba_ManMemory( Cba_Man_t * p ) extern Cba_Man_t * Cba_ManBuild( Cba_Man_t * p ); /*=== cbaReadBlif.c =========================================================*/ extern Cba_Man_t * Cba_PrsReadBlif( char * pFileName ); -/*=== cbaWriteBlif.c ========================================================*/ -extern void Cba_PrsWriteBlif( char * pFileName, Cba_Man_t * pDes ); /*=== cbaReadVer.c ==========================================================*/ extern Cba_Man_t * Cba_PrsReadVerilog( char * pFileName ); +/*=== cbaWriteBlif.c ========================================================*/ +extern void Cba_PrsWriteBlif( char * pFileName, Cba_Man_t * p ); +extern void Cba_ManWriteBlif( char * pFileName, Cba_Man_t * p ); /*=== cbaWriteVer.c =========================================================*/ -extern void Cba_PrsWriteVerilog( char * pFileName, Cba_Man_t * pDes ); +extern void Cba_PrsWriteVerilog( char * pFileName, Cba_Man_t * p ); /*=== cbaNtk.c =========================================================*/ extern void Cba_ManAssignInternNames( Cba_Man_t * p ); extern int Cba_NtkNodeNum( Cba_Ntk_t * p ); diff --git a/src/base/cba/cbaBuild.c b/src/base/cba/cbaBuild.c index 41830208..d47563d1 100644 --- a/src/base/cba/cbaBuild.c +++ b/src/base/cba/cbaBuild.c @@ -56,6 +56,8 @@ void Cba_BoxRemap( Cba_Ntk_t * pNtk, int iBox, Vec_Int_t * vMap ) Cba_Ntk_t * pBoxModel = Cba_ObjBoxModel( pNtk, iBox ); Vec_Int_t * vFanins = Cba_ObjFaninVec( pNtk, iBox ); int i, NameId; + Vec_IntForEachEntry( vMap, NameId, i ) + assert( NameId == -1 ); // map formal names into I/O indexes Cba_NtkForEachPi( pBoxModel, NameId, i ) { @@ -217,9 +219,7 @@ Cba_Ntk_t * Cba_NtkBuild( Cba_Man_t * pNew, Cba_Ntk_t * pNtk, Vec_Int_t * vMap, int i, iObj, ObjId, FaninId, Type, Index, NameId, nBoxes = 0; // start network - pNtkNew = Cba_NtkAlloc( pNew, Cba_NtkName(pNtk) ); - Cba_ManFetchArray( pNew, &pNtkNew->vInputs, Cba_NtkPiNum(pNtk) ); - Cba_ManFetchArray( pNew, &pNtkNew->vOutputs, Cba_NtkPoNum(pNtk) ); + pNtkNew = Cba_ManNtk( pNew, Cba_NtkId(pNtk) ); Cba_ManFetchArray( pNew, &pNtkNew->vTypes, nObjCount ); Cba_ManFetchArray( pNew, &pNtkNew->vFuncs, nObjCount ); Cba_ManFetchArray( pNew, &pNtkNew->vFanins, nObjCount ); @@ -230,9 +230,12 @@ Cba_Ntk_t * Cba_NtkBuild( Cba_Man_t * pNew, Cba_Ntk_t * pNtk, Vec_Int_t * vMap, Cba_NtkForEachPi( pNtk, NameId, i ) { ObjId = Vec_IntEntry( vMap, NameId ); - Vec_IntWriteEntry( &pNtkNew->vInputs, i, ObjId ); + Vec_IntWriteEntry( &pNtkNew->vInputs, i, ObjId ); + Vec_IntWriteEntry( &pNtkNew->vTypes, ObjId, CBA_OBJ_PI ); + Vec_IntWriteEntry( &pNtkNew->vFuncs, ObjId, i ); Vec_IntWriteEntry( &pNtkNew->vNameIds, ObjId, NameId ); } + Cba_NtkForEachObjType( pNtk, Type, iObj ) { vFanins = Cba_ObjFaninVec( pNtk, iObj ); @@ -252,7 +255,7 @@ Cba_Ntk_t * Cba_NtkBuild( Cba_Man_t * pNew, Cba_Ntk_t * pNtk, Vec_Int_t * vMap, } else if ( Type == CBA_OBJ_BOX ) { - ObjId = Vec_IntEntry( vBoxes, nBoxes++ ); + ObjId = Vec_IntEntry( &pNtkNew->vBoxes, nBoxes++ ); pNtkBox = Cba_ObjBoxModel( pNtk, iObj ); Cba_NtkSetHost( pNtkBox, Cba_NtkId(pNtk), ObjId ); // collect fanins @@ -262,33 +265,38 @@ Cba_Ntk_t * Cba_NtkBuild( Cba_Man_t * pNew, Cba_Ntk_t * pNtk, Vec_Int_t * vMap, i++; NameId = Vec_IntEntry( vFanins, i ); assert( Vec_IntEntry(vMap, NameId) != -1 ); if ( Index < Cba_NtkPiNum(pNtkBox) ) + { Vec_IntWriteEntry( vTemp, Index, Vec_IntEntry(vMap, NameId) ); + Vec_IntWriteEntry( &pNtkNew->vNameIds, ObjId - Cba_NtkPiNum(pNtkBox) + Index, NameId ); + } else + { + assert( Vec_IntEntry(vMap, NameId) == ObjId + 1 + Index - Cba_NtkPiNum(pNtkBox) ); Vec_IntWriteEntry( &pNtkNew->vNameIds, Vec_IntEntry(vMap, NameId), NameId ); + } } Vec_IntForEachEntry( vTemp, Index, i ) assert( Index >= 0 ); + // create box + Vec_IntWriteEntry( &pNtkNew->vTypes, ObjId, CBA_OBJ_BOX ); + Vec_IntWriteEntry( &pNtkNew->vFuncs, ObjId, Cba_ManNtkId(pNew, Cba_NtkName(pNtkBox)) ); // create box inputs - for ( i = 0; i < Cba_NtkPiNum(pNtkBox); i++ ) + Cba_BoxForEachBi( pNtkNew, ObjId, FaninId, i ) { - Vec_IntWriteEntry( &pNtkNew->vTypes, ObjId - Cba_NtkPiNum(pNtkBox) + i, CBA_OBJ_BI ); - Vec_IntWriteEntry( &pNtkNew->vFuncs, ObjId - Cba_NtkPiNum(pNtkBox) + i, i ); - Vec_IntWriteEntry( &pNtkNew->vFanins, ObjId - Cba_NtkPiNum(pNtkBox) + i, Cba_ManHandleBuffer(pNew, Vec_IntEntry(vTemp, i)) ); + Vec_IntWriteEntry( &pNtkNew->vTypes, FaninId, CBA_OBJ_BI ); + Vec_IntWriteEntry( &pNtkNew->vFuncs, FaninId, i ); + Vec_IntWriteEntry( &pNtkNew->vFanins, FaninId, Cba_ManHandleBuffer(pNew, Vec_IntEntry(vTemp, i)) ); } - // craete box - Vec_IntWriteEntry( &pNtkNew->vTypes, ObjId, CBA_OBJ_BOX ); - Vec_IntWriteEntry( &pNtkNew->vFuncs, ObjId, Cba_ManNtkId(pNew, Cba_NtkName(pNtkBox)) ); - Vec_IntWriteEntry( &pNtkNew->vFanins, ObjId, Cba_ManHandleArray(pNew, vTemp) ); // create box outputs - for ( i = 1; i <= Cba_NtkPoNum(pNtkBox); i++ ) + Cba_BoxForEachBo( pNtkNew, ObjId, FaninId, i ) { - Vec_IntWriteEntry( &pNtkNew->vTypes, ObjId + i, CBA_OBJ_BO ); - Vec_IntWriteEntry( &pNtkNew->vFuncs, ObjId + i, i-1 ); - Vec_IntWriteEntry( &pNtkNew->vFanins, ObjId + i, Cba_ManHandleBuffer(pNew, ObjId) ); + Vec_IntWriteEntry( &pNtkNew->vTypes, FaninId, CBA_OBJ_BO ); + Vec_IntWriteEntry( &pNtkNew->vFuncs, FaninId, i ); + Vec_IntWriteEntry( &pNtkNew->vFanins, FaninId, Cba_ManHandleBuffer(pNew, ObjId) ); } } } - assert( nBoxes == Vec_IntSize(vBoxes) ); + assert( nBoxes == Vec_IntSize(&pNtkNew->vBoxes) ); Cba_NtkForEachPo( pNtk, NameId, i ) { ObjId = nObjCount - Cba_NtkPoNum(pNtk) + i; @@ -296,23 +304,34 @@ Cba_Ntk_t * Cba_NtkBuild( Cba_Man_t * pNew, Cba_Ntk_t * pNtk, Vec_Int_t * vMap, assert( FaninId != -1 ); Vec_IntWriteEntry( &pNtkNew->vOutputs, i, ObjId ); Vec_IntWriteEntry( &pNtkNew->vTypes, ObjId, CBA_OBJ_PO ); - Vec_IntWriteEntry( &pNtkNew->vFuncs, ObjId, -1 ); + Vec_IntWriteEntry( &pNtkNew->vFuncs, ObjId, i ); Vec_IntWriteEntry( &pNtkNew->vFanins, ObjId, Cba_ManHandleBuffer(pNew, FaninId) ); // remove NameId from the driver and assign it to the output - Vec_IntWriteEntry( &pNtkNew->vNameIds, FaninId, -1 ); + //Vec_IntWriteEntry( &pNtkNew->vNameIds, FaninId, -1 ); Vec_IntWriteEntry( &pNtkNew->vNameIds, ObjId, NameId ); } return pNtkNew; } +Cba_Man_t * Cba_ManPreBuild( Cba_Man_t * p ) +{ + Cba_Man_t * pNew = Cba_ManClone( p ); + Cba_Ntk_t * pNtk, * pNtkNew; int i; + Cba_ManForEachNtk( p, pNtk, i ) + { + pNtkNew = Cba_NtkAlloc( pNew, Cba_NtkName(pNtk) ); + Cba_ManFetchArray( pNew, &pNtkNew->vInputs, Cba_NtkPiNum(pNtk) ); + Cba_ManFetchArray( pNew, &pNtkNew->vOutputs, Cba_NtkPoNum(pNtk) ); + } + assert( Cba_ManNtkNum(pNew) == Cba_ManNtkNum(p) ); + return pNew; +} Cba_Man_t * Cba_ManBuild( Cba_Man_t * p ) { - Cba_Man_t * pNew = Cba_ManAlloc( Cba_ManName(p) ); + Cba_Man_t * pNew = Cba_ManPreBuild( p ); Vec_Int_t * vMap = Vec_IntStartFull( Abc_NamObjNumMax(p->pNames) + 1 ); Vec_Int_t * vBoxes = Vec_IntAlloc( 1000 ); Vec_Int_t * vTemp = Vec_IntAlloc( 1000 ); Cba_Ntk_t * pNtk; int i, nObjs; - Cba_ManForEachNtk( p, pNtk, i ) - Abc_NamStrFindOrAdd( p->pModels, Cba_NtkName(pNtk), NULL ); assert( Abc_NamObjNumMax(p->pModels) == Cba_ManNtkNum(p) + 1 ); Cba_ManForEachNtk( p, pNtk, i ) { diff --git a/src/base/cba/cbaCom.c b/src/base/cba/cbaCom.c index 389bd9a1..9e534a51 100644 --- a/src/base/cba/cbaCom.c +++ b/src/base/cba/cbaCom.c @@ -174,7 +174,7 @@ int Cba_CommandWrite( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; } if ( argc == globalUtilOptind ) - pFileName = Extra_FileNameGenericAppend( pNtk->pName, "_out.v" ); + pFileName = Extra_FileNameGenericAppend( Cba_NtkMan(pNtk)->pName, "_out.v" ); else if ( argc == globalUtilOptind + 1 ) pFileName = argv[globalUtilOptind]; else @@ -314,7 +314,10 @@ usage: ******************************************************************************/ int Cba_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) { + extern void Cba_ManReadDesExperiment( Abc_Ntk_t * pNtk ); + Abc_Ntk_t * pAbcNtk; Cba_Ntk_t * pNtk = Cba_AbcGetNtk(pAbc); + char * pFileName = "c/hie/dump/1/netlist_1.v"; int c, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) @@ -330,14 +333,17 @@ int Cba_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } +/* if ( pNtk == NULL ) { Abc_Print( 1, "Cba_CommandTest(): There is no current design.\n" ); return 0; } +*/ // transform -// pNtk = Cba_NtkUifNodePairs( pNtk, NULL ); - Cba_AbcUpdateNtk( pAbc, pNtk ); + pAbcNtk = Io_ReadNetlist( pFileName, Io_ReadFileType(pFileName), 0 ); + Cba_ManReadDesExperiment( pAbcNtk ); + Abc_NtkDelete( pAbcNtk ); return 0; usage: Abc_Print( -2, "usage: @test [-vh]\n" ); diff --git a/src/base/cba/cbaPrs.h b/src/base/cba/cbaPrs.h index 76745d8c..3715935e 100644 --- a/src/base/cba/cbaPrs.h +++ b/src/base/cba/cbaPrs.h @@ -32,6 +32,7 @@ ABC_NAMESPACE_HEADER_START +/* // parser objects (object types after parsing) typedef enum { CBA_PRS_NONE = 0, // 0: unused @@ -41,6 +42,7 @@ typedef enum { CBA_PRS_CONCAT, // 4: concatenation CBA_PRS_UNKNOWN // 5: unknown } Cba_PrsType_t; +*/ //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// diff --git a/src/base/cba/cbaReadBlif.c b/src/base/cba/cbaReadBlif.c index 88440aca..08152075 100644 --- a/src/base/cba/cbaReadBlif.c +++ b/src/base/cba/cbaReadBlif.c @@ -265,7 +265,7 @@ static inline int Cba_PrsReadNode( Cba_Prs_t * p ) { if ( Cba_PrsReadList2(p) ) return 1; // save results - Vec_IntPush( &p->vTypesCur, CBA_PRS_NODE ); + Vec_IntPush( &p->vTypesCur, CBA_OBJ_NODE ); Vec_IntPush( &p->vFuncsCur, 1 ); // default const 0 function Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, &p->vTemp) ); return 0; @@ -276,7 +276,7 @@ static inline int Cba_PrsReadBox( Cba_Prs_t * p, int fGate ) if ( iToken == 0 ) return Cba_PrsErrorSet(p, "Cannot read model name.", 1); if ( Cba_PrsReadList3(p) ) return 1; // save results - Vec_IntPush( &p->vTypesCur, CBA_PRS_BOX ); + Vec_IntPush( &p->vTypesCur, CBA_OBJ_BOX ); Vec_IntPush( &p->vFuncsCur, iToken ); Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, &p->vTemp) ); return 0; @@ -299,7 +299,7 @@ static inline int Cba_PrsReadLatch( Cba_Prs_t * p ) iToken = 2; Cba_PrsSkipToChar( p, '\n' ); // save results - Vec_IntPush( &p->vTypesCur, CBA_PRS_LATCH ); + Vec_IntPush( &p->vTypesCur, CBA_OBJ_LATCH ); Vec_IntPush( &p->vFuncsCur, iToken ); Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, &p->vTemp) ); return 0; @@ -316,7 +316,7 @@ static inline int Cba_PrsReadShort( Cba_Prs_t * p ) Cba_PrsSkipSpaces( p ); if ( !Cba_PrsIsChar(p, '\n') ) return Cba_PrsErrorSet(p, "Trailing symbols on .short line.", 1); // save results - Vec_IntPush( &p->vTypesCur, CBA_PRS_NODE ); + Vec_IntPush( &p->vTypesCur, CBA_OBJ_NODE ); Vec_IntPush( &p->vFuncsCur, 2 ); // default buffer function Vec_IntPush( &p->vFaninsCur, Cba_ManHandleArray(p->pDesign, &p->vTemp) ); return 0; diff --git a/src/base/cba/cbaReadVer.c b/src/base/cba/cbaReadVer.c index b5ff9ea4..c5718dc1 100644 --- a/src/base/cba/cbaReadVer.c +++ b/src/base/cba/cbaReadVer.c @@ -367,7 +367,7 @@ static inline int Cba_PrsReadConcat( Cba_Prs_t * p, Vec_Int_t * vTemp2 ) assert( Vec_IntSize(vTemp2) > 2 ); assert( Vec_IntSize(vTemp2) % 2 == 0 ); // create new concatentation - Vec_IntPush( &p->vTypesCur, CBA_PRS_CONCAT ); + 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) ); @@ -497,7 +497,7 @@ static inline int Cba_PrsReadAssign( Cba_Prs_t * p ) // check unary operator if ( Cba_PrsIsChar(p, ';') ) { - Vec_IntPush( &p->vTypesCur, CBA_PRS_NODE ); + 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) ); @@ -532,7 +532,7 @@ static inline int Cba_PrsReadAssign( Cba_Prs_t * p ) if ( !Cba_PrsIsChar(p, ';') ) return Cba_PrsErrorSet(p, "Expected semicolon at the end of the assign-statement.", 0); } // write binary operator - Vec_IntPush( &p->vTypesCur, CBA_PRS_NODE ); + 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) ); @@ -550,12 +550,12 @@ static inline int Cba_PrsReadInstance( Cba_Prs_t * p, int Func ) p->pCur++; if ( Cba_PrsUtilSkipSpaces(p) ) return 0; if ( Cba_PrsIsChar(p, '.') ) // node - Status = Cba_PrsReadSignalList2(p, &p->vTemp), Type = CBA_PRS_BOX; + Status = Cba_PrsReadSignalList2(p, &p->vTemp), Type = CBA_OBJ_BOX; else - Status = Cba_PrsReadSignalList1(p, &p->vTemp), Type = CBA_PRS_NODE; + Status = Cba_PrsReadSignalList1(p, &p->vTemp), Type = CBA_OBJ_NODE; if ( Status == 0 ) return 0; // translate elementary gate - if ( Type == CBA_PRS_NODE ) + if ( Type == CBA_OBJ_NODE ) { int iFuncNew = Cba_PrsIsKnownModule(p, Abc_NamStr(p->pDesign->pNames, Func)); if ( iFuncNew == 0 ) return Cba_PrsErrorSet(p, "Cannot find elementary gate.", 0); @@ -726,7 +726,7 @@ Cba_Man_t * Cba_PrsReadVerilog( char * pFileName ) void Cba_PrsReadVerilogTest( char * pFileName ) { abctime clk = Abc_Clock(); - extern void Cba_PrsWriteVerilog( char * pFileName, Cba_Man_t * pDes ); + extern void Cba_PrsWriteVerilog( char * pFileName, Cba_Man_t * p ); // Cba_Man_t * p = Cba_PrsReadVerilog( "c/hie/dump/1/netlist_1.v" ); // Cba_Man_t * p = Cba_PrsReadVerilog( "aga/me/me_wide.v" ); Cba_Man_t * p = Cba_PrsReadVerilog( "aga/ray/ray_wide.v" ); diff --git a/src/base/cba/cbaSimple.c b/src/base/cba/cbaSimple.c index eb7dde09..fb04b657 100644 --- a/src/base/cba/cbaSimple.c +++ b/src/base/cba/cbaSimple.c @@ -89,7 +89,7 @@ char * Ptr_TypeToName( Ptr_ObjType_t Type ) assert( 0 ); return "???"; } -char * Ptr_TypeToSop( Ptr_ObjType_t Type ) +char * Ptr_TypeToSop( int Type ) { if ( Type == PTR_OBJ_BUF ) return "1 1\n"; if ( Type == PTR_OBJ_INV ) return "0 1\n"; @@ -277,7 +277,7 @@ void Ptr_ManDumpNodeBlif( FILE * pFile, Vec_Ptr_t * vNode ) Vec_PtrForEachEntryStart( char *, vNode, pName, i, 2 ) fprintf( pFile, " %s", pName ); fprintf( pFile, " %s\n", (char *)Vec_PtrEntry(vNode, 0) ); - fprintf( pFile, "%s", Ptr_TypeToSop( (Ptr_ObjType_t)Abc_Ptr2Int(Vec_PtrEntry(vNode, 1)) ) ); + fprintf( pFile, "%s", Ptr_TypeToSop( Abc_Ptr2Int(Vec_PtrEntry(vNode, 1)) ) ); } void Ptr_ManDumpNodesBlif( FILE * pFile, Vec_Ptr_t * vNodes ) { @@ -544,7 +544,7 @@ Vec_Ptr_t * Ptr_CbaDeriveNodes( Cba_Ntk_t * pNtk ) int Type, iObj; Vec_Ptr_t * vNodes = Vec_PtrAlloc( Cba_NtkNodeNum(pNtk) ); Cba_NtkForEachObjType( pNtk, Type, iObj ) - if ( Type == CBA_PRS_NODE ) + if ( Type == CBA_OBJ_NODE ) Vec_PtrPush( vNodes, Ptr_CbaDeriveNode(pNtk, iObj) ); assert( Ptr_CheckArray(vNodes) ); return vNodes; @@ -578,7 +578,7 @@ Vec_Ptr_t * Ptr_CbaDeriveBoxes( Cba_Ntk_t * pNtk ) int Type, iObj; Vec_Ptr_t * vBoxes = Vec_PtrAlloc( Cba_NtkBoxNum(pNtk) ); Cba_NtkForEachObjType( pNtk, Type, iObj ) - if ( Type == CBA_PRS_BOX ) + if ( Type == CBA_OBJ_BOX ) Vec_PtrPush( vBoxes, Ptr_CbaDeriveBox(pNtk, iObj) ); assert( Ptr_CheckArray(vBoxes) ); return vBoxes; @@ -650,7 +650,7 @@ void Cba_PrsReadNodes( Cba_Man_t * p, Vec_Ptr_t * vNodes, Vec_Int_t * vTypesCur, Vec_Ptr_t * vNode; int i; Vec_PtrForEachEntry( Vec_Ptr_t *, vNodes, vNode, i ) { - Vec_IntPush( vTypesCur, CBA_PRS_NODE ); + Vec_IntPush( vTypesCur, CBA_OBJ_NODE ); Vec_IntPush( vFuncsCur, (Ptr_ObjType_t)Abc_Ptr2Int(Vec_PtrEntry(vNode, 1)) ); Vec_IntPush( vInstIdsCur, 0 ); Vec_IntPush( vFaninsCur, Cba_ManHandleArray(p, Cba_PrsReadList(p, vNode, vList, 1, -1)) ); @@ -661,8 +661,8 @@ void Cba_PrsReadBoxes( Cba_Man_t * p, Vec_Ptr_t * vBoxes, Vec_Int_t * vTypesCur, Vec_Ptr_t * vBox; int i; Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i ) { - Vec_IntPush( vTypesCur, CBA_PRS_BOX ); - Vec_IntPush( vFuncsCur, Abc_NamStrFindOrAdd(p->pNames, Vec_PtrEntry(vBox, 0), NULL) ); + 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)) ); } @@ -698,7 +698,7 @@ void Cba_PrsReadModule( Cba_Man_t * p, Vec_Ptr_t * vNtk ) Vec_IntFree( vFaninsCur ); Vec_IntFree( vList ); } -Cba_Man_t * Cba_PrsReadDes( Vec_Ptr_t * vDes ) +Cba_Man_t * Cba_PrsReadPtr( Vec_Ptr_t * vDes ) { Vec_Ptr_t * vNtk; int i; Cba_Man_t * p = Cba_ManAlloc( (char *)Vec_PtrEntry(vDes, 0) ); @@ -722,25 +722,37 @@ Cba_Man_t * Cba_PrsReadDes( Vec_Ptr_t * vDes ) void Cba_ManReadDesExperiment( Abc_Ntk_t * pNtk ) { abctime clk = Abc_Clock(); - char * pFileName1 = Extra_FileNameGenericAppend(pNtk->pDesign->pName, "_out1.blif"); - char * pFileName2 = Extra_FileNameGenericAppend(pNtk->pDesign->pName, "_out2.blif"); - Cba_Man_t * p; + Cba_Man_t * p, * pTemp; + char * pFileName; + // derive Ptr from ABC Vec_Ptr_t * vDes = Ptr_AbcDeriveDes( pNtk ); printf( "Converting to Ptr: Memory = %6.3f MB ", 1.0*Ptr_ManMemDes(vDes)/(1<<20) ); Abc_PrintTime( 1, "Time", Abc_Clock() - clk ); - - Ptr_ManDumpBlif( pFileName1, vDes ); - printf( "Finished writing output file \"%s\". ", pFileName1 ); + // dump + pFileName = Extra_FileNameGenericAppend(pNtk->pDesign->pName, "_out1.blif"); + Ptr_ManDumpBlif( pFileName, vDes ); + printf( "Finished writing output file \"%s\". ", pFileName ); Abc_PrintTime( 1, "Time", Abc_Clock() - clk ); - p = Cba_PrsReadDes( vDes ); + // derive CBA from Ptr + p = Cba_PrsReadPtr( vDes ); Ptr_ManFreeDes( vDes ); - - // Abc_NamPrint( p->pDesign->pNames ); - Cba_PrsWriteBlif( pFileName2, p ); + // dump + pFileName = Extra_FileNameGenericAppend(pNtk->pDesign->pName, "_out2.blif"); + Cba_PrsWriteBlif( pFileName, p ); + printf( "Finished writing output file \"%s\". ", pFileName ); + Abc_PrintTime( 1, "Time", Abc_Clock() - clk ); + // Abc_NamPrint( p->pNames ); + + // build CBA from CBA + p = Cba_ManBuild( pTemp = p ); + Cba_ManFree( pTemp ); + // dump + pFileName = Extra_FileNameGenericAppend(pNtk->pDesign->pName, "_out3.blif"); + Cba_ManWriteBlif( pFileName, p ); Cba_ManFree( p ); - printf( "Finished writing output file \"%s\". ", pFileName2 ); + printf( "Finished writing output file \"%s\". ", pFileName ); Abc_PrintTime( 1, "Time", Abc_Clock() - clk ); } diff --git a/src/base/cba/cbaWriteBlif.c b/src/base/cba/cbaWriteBlif.c index a3966cda..001a291c 100644 --- a/src/base/cba/cbaWriteBlif.c +++ b/src/base/cba/cbaWriteBlif.c @@ -27,6 +27,8 @@ ABC_NAMESPACE_IMPL_START /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// +extern char * Ptr_TypeToSop( int Type ); + //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// @@ -61,27 +63,28 @@ void Cba_PrsWriteBlifArray2( FILE * pFile, Cba_Ntk_t * p, Vec_Int_t * vFanins ) } void Cba_PrsWriteBlifLines( FILE * pFile, Cba_Ntk_t * p ) { - Vec_Int_t * vFanins; - int Type, Func, i; - Cba_NtkForEachObjTypeFuncFanins( p, Type, Func, vFanins, i ) - if ( Type == CBA_PRS_NODE ) // .names/assign/box2 (no formal/actual binding) + int i, Type; + Cba_NtkForEachObjType( p, Type, i ) + if ( Type == CBA_OBJ_NODE ) // .names/assign/box2 (no formal/actual binding) { fprintf( pFile, ".names" ); - Cba_PrsWriteBlifArray( pFile, p, vFanins, 1 ); - fprintf( pFile, "%s", Cba_NtkFuncStr(p, Func) ); + Cba_PrsWriteBlifArray( pFile, p, Cba_ObjFaninVec(p, i), 1 ); + //fprintf( pFile, "%s", Cba_NtkFuncStr(p, Cba_ObjFuncId(p, i)) ); + fprintf( pFile, "%s", Ptr_TypeToSop( Cba_ObjFuncId(p, i) ) ); } - else if ( Type == CBA_PRS_BOX ) // .names/assign/box2 (no formal/actual binding) + else if ( Type == CBA_OBJ_BOX ) // .names/assign/box2 (no formal/actual binding) { fprintf( pFile, ".subckt" ); - fprintf( pFile, " %s", Cba_NtkStr(p, Func) ); - Cba_PrsWriteBlifArray2( pFile, p, vFanins ); + fprintf( pFile, " %s", Cba_ObjFuncStr(p, i) ); + Cba_PrsWriteBlifArray2( pFile, p, Cba_ObjFaninVec(p, i) ); } - else if ( Type == CBA_PRS_LATCH ) // .names/assign/box2 (no formal/actual binding) + else if ( Type == CBA_OBJ_LATCH ) // .names/assign/box2 (no formal/actual binding) { + Vec_Int_t * vFanins = Cba_ObjFaninVec(p, i); fprintf( pFile, ".latch" ); fprintf( pFile, " %s", Cba_NtkStr(p, Vec_IntEntry(vFanins, 1)) ); fprintf( pFile, " %s", Cba_NtkStr(p, Vec_IntEntry(vFanins, 0)) ); - fprintf( pFile, " %c\n", '0' + Func ); + fprintf( pFile, " %c\n", '0' + Cba_ObjFuncId(p, i) ); } } void Cba_PrsWriteBlifNtk( FILE * pFile, Cba_Ntk_t * p ) @@ -102,7 +105,7 @@ void Cba_PrsWriteBlifNtk( FILE * pFile, Cba_Ntk_t * p ) Cba_PrsWriteBlifLines( pFile, p ); fprintf( pFile, ".end\n\n" ); } -void Cba_PrsWriteBlif( char * pFileName, Cba_Man_t * pDes ) +void Cba_PrsWriteBlif( char * pFileName, Cba_Man_t * p ) { FILE * pFile; Cba_Ntk_t * pNtk; @@ -113,8 +116,8 @@ void Cba_PrsWriteBlif( char * pFileName, Cba_Man_t * pDes ) printf( "Cannot open output file \"%s\".\n", pFileName ); return; } - fprintf( pFile, "// Design \"%s\" written by ABC on %s\n\n", Cba_ManName(pDes), Extra_TimeStamp() ); - Cba_ManForEachNtk( pDes, pNtk, i ) + fprintf( pFile, "// Design \"%s\" written by ABC on %s\n\n", Cba_ManName(p), Extra_TimeStamp() ); + Cba_ManForEachNtk( p, pNtk, i ) Cba_PrsWriteBlifNtk( pFile, pNtk ); fclose( pFile ); } @@ -142,12 +145,11 @@ void Cba_ManWriteBlifArray( FILE * pFile, Cba_Ntk_t * p, Vec_Int_t * vFanins, in void Cba_ManWriteBlifArray2( FILE * pFile, Cba_Ntk_t * p, int iObj ) { int iTerm, i; - Vec_Int_t * vFanins = Cba_ObjFaninVec( p, iObj ); Cba_Ntk_t * pModel = Cba_ObjBoxModel( p, iObj ); Cba_NtkForEachPi( pModel, iTerm, i ) - fprintf( pFile, " %s=%s", Cba_ObjNameStr(pModel, iTerm), Cba_ObjNameStr(p, Vec_IntEntry(vFanins, i)) ); + fprintf( pFile, " %s=%s", Cba_ObjNameStr(pModel, iTerm), Cba_ObjNameStr(p, Cba_ObjBoxBi(p, iObj, i)) ); Cba_NtkForEachPo( pModel, iTerm, i ) - fprintf( pFile, " %s=%s", Cba_ObjNameStr(pModel, iTerm), Cba_ObjNameStr(p, iObj + 1 + i) ); + fprintf( pFile, " %s=%s", Cba_ObjNameStr(pModel, iTerm), Cba_ObjNameStr(p, Cba_ObjBoxBo(p, iObj, i)) ); fprintf( pFile, "\n" ); } void Cba_ManWriteBlifLines( FILE * pFile, Cba_Ntk_t * p ) @@ -159,12 +161,13 @@ void Cba_ManWriteBlifLines( FILE * pFile, Cba_Ntk_t * p ) { fprintf( pFile, ".names" ); Cba_ManWriteBlifArray( pFile, p, Cba_ObjFaninVec(p, i), i ); - fprintf( pFile, "%s", Cba_ObjFuncStr(p, i) ); + //fprintf( pFile, "%s", Cba_NtkFuncStr(p, Cba_ObjFuncId(p, i)) ); + fprintf( pFile, "%s", Ptr_TypeToSop( Cba_ObjFuncId(p, i) ) ); } else if ( Type == CBA_OBJ_BOX ) // .names/assign/box2 (no formal/actual binding) { fprintf( pFile, ".subckt" ); - fprintf( pFile, " %s", Cba_ObjFuncStr(p, i) ); + fprintf( pFile, " %s", Cba_NtkName(Cba_ObjBoxModel(p, i)) ); Cba_ManWriteBlifArray2( pFile, p, i ); } else if ( Type == CBA_OBJ_LATCH ) // .names/assign/box2 (no formal/actual binding) diff --git a/src/base/cba/cbaWriteVer.c b/src/base/cba/cbaWriteVer.c index d95a36c7..39ab1faf 100644 --- a/src/base/cba/cbaWriteVer.c +++ b/src/base/cba/cbaWriteVer.c @@ -134,7 +134,7 @@ void Cba_PrsWriteVerilogNodes( FILE * pFile, Cba_Ntk_t * p ) { int Type, Func, i; Cba_NtkForEachObjType( p, Type, i ) - if ( Type == CBA_PRS_NODE ) // .names/assign/box2 (no formal/actual binding) + if ( Type == CBA_OBJ_NODE ) // .names/assign/box2 (no formal/actual binding) { Func = Cba_ObjFuncId(p, i); if ( Func >= CBA_NODE_BUF && Func <= CBA_NODE_XNOR ) @@ -156,7 +156,7 @@ void Cba_PrsWriteVerilogBoxes( FILE * pFile, Cba_Ntk_t * p ) { int Type, i; Cba_NtkForEachObjType( p, Type, i ) - if ( Type == CBA_PRS_BOX ) // .subckt/.gate/box (formal/actual binding) + if ( Type == CBA_OBJ_BOX ) // .subckt/.gate/box (formal/actual binding) { fprintf( pFile, " %s %s (", Cba_ObjFuncStr(p, i), Cba_ObjInstStr(p, i) ); Cba_PrsWriteVerilogArray3( pFile, p, Cba_ObjFaninVec(p, i) ); @@ -204,7 +204,7 @@ void Cba_PrsWriteVerilogNtk( FILE * pFile, Cba_Ntk_t * p ) Cba_PrsWriteVerilogBoxes( pFile, p ); fprintf( pFile, "endmodule\n\n" ); } -void Cba_PrsWriteVerilog( char * pFileName, Cba_Man_t * pDes ) +void Cba_PrsWriteVerilog( char * pFileName, Cba_Man_t * p ) { FILE * pFile; Cba_Ntk_t * pNtk; @@ -215,8 +215,8 @@ void Cba_PrsWriteVerilog( char * pFileName, Cba_Man_t * pDes ) printf( "Cannot open output file \"%s\".\n", pFileName ); return; } - fprintf( pFile, "// Design \"%s\" written by ABC on %s\n\n", Cba_ManName(pDes), Extra_TimeStamp() ); - Cba_ManForEachNtk( pDes, pNtk, i ) + fprintf( pFile, "// Design \"%s\" written by ABC on %s\n\n", Cba_ManName(p), Extra_TimeStamp() ); + Cba_ManForEachNtk( p, pNtk, i ) Cba_PrsWriteVerilogNtk( pFile, pNtk ); fclose( pFile ); } |