Commit 8a30b675 by Alan Mishchenko

Improvements to Cba data-structure.

parent 6a4e94e7
...@@ -367,6 +367,7 @@ static inline int Cba_FonLeft( Cba_Ntk_t * p, int f ) { r ...@@ -367,6 +367,7 @@ static inline int Cba_FonLeft( Cba_Ntk_t * p, int f ) { r
static inline int Cba_FonRight( Cba_Ntk_t * p, int f ) { return Cba_NtkRangeRight(p, Cba_FonRange(p, f)); } static inline int Cba_FonRight( Cba_Ntk_t * p, int f ) { return Cba_NtkRangeRight(p, Cba_FonRange(p, f)); }
static inline int Cba_FonRangeSize( Cba_Ntk_t * p, int f ) { return Cba_FonIsConst(f) ? Cba_FonConstRange(p, f):Cba_NtkRangeSize(p, Cba_FonRange(p, f)); } static inline int Cba_FonRangeSize( Cba_Ntk_t * p, int f ) { return Cba_FonIsConst(f) ? Cba_FonConstRange(p, f):Cba_NtkRangeSize(p, Cba_FonRange(p, f)); }
static inline void Cba_FonSetRange( Cba_Ntk_t * p, int f, int x ) { assert(Cba_NtkHasFonRanges(p)); Vec_IntSetEntry(&p->vFonRange, f, x); } static inline void Cba_FonSetRange( Cba_Ntk_t * p, int f, int x ) { assert(Cba_NtkHasFonRanges(p)); Vec_IntSetEntry(&p->vFonRange, f, x); }
static inline void Cba_FonHashRange( Cba_Ntk_t * p, int f, int l, int r ) { Cba_FonSetRange( p, f, Cba_NtkHashRange(p, l, r) ); }
static inline int Cba_FonCopy( Cba_Ntk_t * p, int f ) { return Cba_FonIsReal(f) ? Vec_IntEntry(&p->vFonCopy, f) : f; } static inline int Cba_FonCopy( Cba_Ntk_t * p, int f ) { return Cba_FonIsReal(f) ? Vec_IntEntry(&p->vFonCopy, f) : f; }
static inline void Cba_FonSetCopy( Cba_Ntk_t * p, int f, int x ) { assert(Cba_FonIsReal(f)); assert(Cba_FonCopy(p, f) == 0); Vec_IntWriteEntry(&p->vFonCopy, f, x); } static inline void Cba_FonSetCopy( Cba_Ntk_t * p, int f, int x ) { assert(Cba_FonIsReal(f)); assert(Cba_FonCopy(p, f) == 0); Vec_IntWriteEntry(&p->vFonCopy, f, x); }
static inline int Cba_FonName( Cba_Ntk_t * p, int f ) { assert(Cba_NtkHasFonNames(p)); assert(Cba_FonIsReal(f)); return Vec_IntGetEntry( &p->vFonName, f ); } static inline int Cba_FonName( Cba_Ntk_t * p, int f ) { assert(Cba_NtkHasFonNames(p)); assert(Cba_FonIsReal(f)); return Vec_IntGetEntry( &p->vFonName, f ); }
...@@ -1050,7 +1051,7 @@ extern void Prs_ManWriteBlif( char * pFileName, Vec_Ptr_t * p ); ...@@ -1050,7 +1051,7 @@ extern void Prs_ManWriteBlif( char * pFileName, Vec_Ptr_t * p );
extern void Cba_ManWriteBlif( char * pFileName, Cba_Man_t * p ); extern void Cba_ManWriteBlif( char * pFileName, Cba_Man_t * p );
/*=== cbaWriteVer.c ==========================================================*/ /*=== cbaWriteVer.c ==========================================================*/
extern void Cba_ManCreatePrimMap( char ** pMap ); extern void Cba_ManCreatePrimMap( char ** pMap );
extern char * Cba_ManGetSliceName( Cba_Ntk_t * p, int iFon, int Left, int Right ); extern char * Cba_ManGetSliceName( Cba_Ntk_t * p, int iFon, int RangeId );
extern void Prs_ManWriteVerilog( char * pFileName, Vec_Ptr_t * p ); extern void Prs_ManWriteVerilog( char * pFileName, Vec_Ptr_t * p );
extern void Cba_ManWriteVerilog( char * pFileName, Cba_Man_t * p, int fInlineConcat ); extern void Cba_ManWriteVerilog( char * pFileName, Cba_Man_t * p, int fInlineConcat );
......
...@@ -1013,7 +1013,7 @@ int Prs_CreateSlice( Cba_Ntk_t * p, int iFon, Prs_Ntk_t * pNtk, int Range ) ...@@ -1013,7 +1013,7 @@ int Prs_CreateSlice( Cba_Ntk_t * p, int iFon, Prs_Ntk_t * pNtk, int Range )
int iObj, iFonNew, NameId; int iObj, iFonNew, NameId;
assert( Cba_FonIsReal(iFon) ); assert( Cba_FonIsReal(iFon) );
// check existing slice // check existing slice
NameId = Cba_NtkNewStrId( p, Cba_ManGetSliceName(p, iFon, Cba_NtkRangeLeft(p, Range), Cba_NtkRangeRight(p, Range)) ); NameId = Cba_NtkNewStrId( p, Cba_ManGetSliceName(p, iFon, Range) );
iFonNew = Cba_NtkGetMap( p, NameId ); iFonNew = Cba_NtkGetMap( p, NameId );
if ( iFonNew ) if ( iFonNew )
return iFonNew; return iFonNew;
......
...@@ -112,7 +112,7 @@ static void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p ) ...@@ -112,7 +112,7 @@ static void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p )
Prs_NtkForEachBox( p, vBox, i ) Prs_NtkForEachBox( p, vBox, i )
{ {
Cba_ObjType_t NtkId = Prs_BoxNtk(p, i); Cba_ObjType_t NtkId = Prs_BoxNtk(p, i);
char * pNtkName = Prs_NtkStr(p, Prs_BoxName(p, i)); //char * pNtkName = Prs_NtkStr(p, Prs_BoxName(p, i));
if ( NtkId == CBA_BOX_MUX ) if ( NtkId == CBA_BOX_MUX )
Prs_ManWriteVerilogMux( pFile, p, vBox ); Prs_ManWriteVerilogMux( pFile, p, vBox );
else if ( Prs_BoxIsNode(p, i) ) // node ------- check order of fanins else if ( Prs_BoxIsNode(p, i) ) // node ------- check order of fanins
...@@ -123,7 +123,6 @@ static void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p ) ...@@ -123,7 +123,6 @@ static void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p )
} }
else // box else // box
{ {
//char * s = Prs_NtkStr(p, Vec_IntEntry(vBox, 0));
fprintf( pFile, " %s %s (", Prs_NtkStr(p, NtkId), Prs_BoxName(p, i) ? Prs_NtkStr(p, Prs_BoxName(p, i)) : "" ); fprintf( pFile, " %s %s (", Prs_NtkStr(p, NtkId), Prs_BoxName(p, i) ? Prs_NtkStr(p, Prs_BoxName(p, i)) : "" );
Prs_ManWriteVerilogArray2( pFile, p, vBox ); Prs_ManWriteVerilogArray2( pFile, p, vBox );
fprintf( pFile, ");\n" ); fprintf( pFile, ");\n" );
...@@ -311,8 +310,10 @@ char * Cba_FonGetName( Cba_Ntk_t * p, int i ) ...@@ -311,8 +310,10 @@ char * Cba_FonGetName( Cba_Ntk_t * p, int i )
return pName; return pName;
return Vec_StrPrintF( Abc_NamBuffer(Cba_NtkNam(p)), "\\%s ", pName ); return Vec_StrPrintF( Abc_NamBuffer(Cba_NtkNam(p)), "\\%s ", pName );
} }
char * Cba_ManGetSliceName( Cba_Ntk_t * p, int iFon, int Left, int Right ) char * Cba_ManGetSliceName( Cba_Ntk_t * p, int iFon, int RangeId )
{ {
int Left = Cba_NtkRangeLeft(p, RangeId);
int Right = Cba_NtkRangeRight(p, RangeId);
char * pName = Cba_FonNameStr(p, iFon); char * pName = Cba_FonNameStr(p, iFon);
if ( Cba_NameIsLegalInVerilog(pName) ) if ( Cba_NameIsLegalInVerilog(pName) )
if ( Left == Right ) if ( Left == Right )
......
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