Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
e7b467f9
Commit
e7b467f9
authored
Feb 16, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several improvements to CBA data-structure.
parent
7a4a63d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
0 deletions
+91
-0
src/base/cba/cba.h
+3
-0
src/base/cba/cbaWriteVer.c
+88
-0
No files found.
src/base/cba/cba.h
View file @
e7b467f9
...
...
@@ -181,6 +181,7 @@ struct Cba_Man_t_
Cba_Ntk_t
*
pNtks
;
// networks
// user data
Vec_Str_t
*
vOut
;
Vec_Str_t
*
vOut2
;
Vec_Int_t
vBuf2RootNtk
;
Vec_Int_t
vBuf2RootObj
;
Vec_Int_t
vBuf2LeafNtk
;
...
...
@@ -271,6 +272,7 @@ static inline int Cba_ObjIsGate( Cba_Ntk_t * p, int i ) { r
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_ObjType
(
p
,
i
)
<
CBA_OBJ_BOX
;
}
static
inline
int
Cba_ObjIsConst
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_ObjType
(
p
,
i
)
>=
CBA_BOX_CF
&&
Cba_ObjType
(
p
,
i
)
<=
CBA_BOX_CZ
;
}
static
inline
int
Cba_ObjFanin
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjIsCo
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vFanin
,
i
);
}
static
inline
int
Cba_ObjIndex
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
Cba_ObjIsCio
(
p
,
i
));
return
Vec_IntEntry
(
&
p
->
vIndex
,
i
);
}
...
...
@@ -289,6 +291,7 @@ static inline void Cba_ObjSetFanin( Cba_Ntk_t * p, int i, int x ) { a
static
inline
void
Cba_ObjSetIndex
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjIndex
(
p
,
i
)
==
-
1
);
Vec_IntSetEntry
(
&
p
->
vIndex
,
i
,
x
);
}
static
inline
void
Cba_ObjSetName
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjName
(
p
,
i
)
==
0
&&
!
Cba_ObjIsCo
(
p
,
i
));
Vec_IntSetEntry
(
&
p
->
vName
,
i
,
x
);
}
static
inline
void
Cba_ObjSetCopy
(
Cba_Ntk_t
*
p
,
int
i
,
int
x
)
{
assert
(
Cba_ObjCopy
(
p
,
i
)
==
-
1
);
Vec_IntSetEntry
(
&
p
->
vCopy
,
i
,
x
);
}
static
inline
int
Cba_ObjGetConst
(
Cba_Ntk_t
*
p
,
int
i
)
{
int
f
=
Cba_ObjFanin
(
p
,
i
);
return
Cba_ObjIsBo
(
p
,
f
)
&&
Cba_ObjIsConst
(
p
,
f
-
1
)
?
-
Cba_ObjType
(
p
,
f
-
1
)
:
0
;
}
static
inline
int
Cba_BoxBiNum
(
Cba_Ntk_t
*
p
,
int
i
)
{
int
s
=
i
-
1
;
assert
(
Cba_ObjIsBox
(
p
,
i
));
while
(
--
i
>=
0
&&
Cba_ObjIsBi
(
p
,
i
));
return
s
-
i
;
}
static
inline
int
Cba_BoxBoNum
(
Cba_Ntk_t
*
p
,
int
i
)
{
int
s
=
i
+
1
;
assert
(
Cba_ObjIsBox
(
p
,
i
));
while
(
++
i
<
Cba_NtkObjNum
(
p
)
&&
Cba_ObjIsBo
(
p
,
i
));
return
i
-
s
;
}
...
...
src/base/cba/cbaWriteVer.c
View file @
e7b467f9
...
...
@@ -231,6 +231,92 @@ void Cba_ManWriteSig( Cba_Ntk_t * p, int iObj )
Cba_ManWriteLit
(
p
,
Cba_NtkInfoName
(
p
,
Abc_Lit2Var2
(
iNameId
)),
Cba_NtkInfoIndex
(
p
,
Abc_Lit2Var2
(
iNameId
),
0
)
);
else
assert
(
0
);
}
/*
void Cba_ManWriteSlices( Cba_Ntk_t * p, Vec_Int_t * vSigs )
{
int Entry, NameId, Beg, End, j;
Vec_Str_t * vStr = p->pDesign->vOut;
Vec_StrClear( vStr );
Vec_StrPrintStr( vStr, "{" );
Vec_IntForEachEntry( vSigs, NameId, Beg )
{
if ( Vec_StrEntryLast(vStr) != '{' )
Vec_StrPrintStr( vStr, ", " );
if ( NameId < 0 ) // constant
{
Vec_IntForEachEntryStart( vSigs, Entry, End, Beg+1 )
if ( Entry >= 0 )
break;
Vec_StrPrintNum( vStr, End - Beg );
Vec_StrPrintStr( vStr, "b\'" );
Vec_IntForEachEntryStartStop( vSigs, NameId, j, Beg, End )
{
if ( -NameId == CBA_BOX_CF )
Vec_StrPush( vStr, '0' );
else if ( -NameId == CBA_BOX_CT )
Vec_StrPush( vStr, '1' );
else if ( -NameId == CBA_BOX_CX )
Vec_StrPush( vStr, 'x' );
else if ( -NameId == CBA_BOX_CZ )
Vec_StrPush( vStr, 'z' );
else assert( 0 );
}
}
else if ( Cba_NameType(NameId) == CBA_NAME_BIN ) // bin
{
Cba_ManWriteLit( p, Abc_Lit2Var2(NameId), -1 );
}
else if ( Cba_NameType(NameId) == CBA_NAME_WORD || Cba_NameType(NameId) == CBA_NAME_INDEX ) // word
{
Vec_IntForEachEntryStart( vSigs, Entry, End, Beg+1 )
if ( Cba_NameType(Entry) != CBA_NAME_INDEX )
break;
// the whole word is there
if ( Cba_NameType(NameId) == CBA_NAME_WORD && Cba_ObjGetRange(p, 0) == End - Beg )
Cba_ManWriteLit( p, Abc_Lit2Var2(NameId), -1 );
else if ( End - Beg == 1 )
Cba_ManWriteLit( p, Abc_Lit2Var2(NameId), Beg );
else
{
Cba_ManWriteLit( p, Abc_Lit2Var2(NameId), -1 );
Cba_ManWriteRange( p, Beg, End-1 );
}
}
else assert( 0 );
}
Vec_StrPrintStr( vStr, "}" );
Vec_StrReverseOrder( vStr );
Vec_StrPush( vStr, '\0' );
}
void Cba_ManWriteConcat( Cba_Ntk_t * p, int iStart, int nObjs )
{
Vec_Str_t * vStr = p->pDesign->vOut; int i;
assert( nObjs >= 1 );
if ( nObjs == 1 )
Cba_ManWriteSig( p, iStart );
else
{
// collect fanins
Vec_IntClear( &p->vArray );
for ( i = 0; i < nObjs; i++ )
{
if ( Cba_ObjIsBo(p, iStart) )
Vec_IntPush( &p->vArray, iStart + i );
else if ( Cba_ObjIsBi(p, iStart) )
{
int iFanin = Cba_ObjFanin(p, iStart - i);
int Const = Cba_ObjGetConst(p, iFanin);
Vec_IntPush( &p->vArray, Const ? Const : Cba_ObjName(p, iFanin) );
}
else assert( 0 );
}
ABC_SWAP( Vec_Str_t *, p->pDesign->vOut, p->pDesign->vOut2 );
Cba_ManWriteSlices( p, &p->vArray );
ABC_SWAP( Vec_Str_t *, p->pDesign->vOut, p->pDesign->vOut2 );
Vec_StrAppend( vStr, Vec_StrArray(p->pDesign->vOut2) );
}
}
*/
void
Cba_ManWriteConcat
(
Cba_Ntk_t
*
p
,
int
iStart
,
int
nObjs
)
{
Vec_Str_t
*
vStr
=
p
->
pDesign
->
vOut
;
int
i
;
...
...
@@ -477,6 +563,7 @@ void Cba_ManWriteVerilog( char * pFileName, Cba_Man_t * p )
}
// derive the stream
p
->
vOut
=
Vec_StrAlloc
(
10000
);
p
->
vOut2
=
Vec_StrAlloc
(
1000
);
Cba_ManAssignInternNames
(
p
);
Cba_ManForEachNtk
(
p
,
pNtk
,
i
)
Cba_ManWriteVerilogNtk
(
pNtk
);
...
...
@@ -493,6 +580,7 @@ void Cba_ManWriteVerilog( char * pFileName, Cba_Man_t * p )
}
}
Vec_StrFreeP
(
&
p
->
vOut
);
Vec_StrFreeP
(
&
p
->
vOut2
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment