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
bb7837ff
Commit
bb7837ff
authored
Aug 30, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to Cba data-structure.
parent
4530ef64
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
14 deletions
+33
-14
src/base/cba/cba.h
+10
-5
src/base/cba/cbaCom.c
+4
-1
src/base/cba/cbaPrs.h
+19
-8
src/base/cba/cbaReadVer.c
+0
-0
src/base/cba/cbaWriteVer.c
+0
-0
No files found.
src/base/cba/cba.h
View file @
bb7837ff
...
...
@@ -109,6 +109,7 @@ typedef enum {
CBA_BOX_REM
,
CBA_BOX_POW
,
CBA_BOX_MIN
,
CBA_BOX_SQRT
,
CBA_BOX_ABS
,
CBA_BOX_SLTHAN
,
...
...
@@ -121,6 +122,7 @@ typedef enum {
CBA_BOX_SHIL
,
CBA_BOX_SHIR
,
CBA_BOX_SHILA
,
CBA_BOX_SHIRA
,
CBA_BOX_ROTL
,
CBA_BOX_ROTR
,
...
...
@@ -142,6 +144,7 @@ typedef enum {
CBA_BOX_LATCH
,
CBA_BOX_LATCHRS
,
CBA_BOX_DFF
,
CBA_BOX_DFFCPL
,
CBA_BOX_DFFRS
,
CBA_BOX_LAST
// 67
...
...
@@ -284,7 +287,7 @@ static inline void Cba_NtkCleanObjNames( Cba_Ntk_t * p ) { V
static
inline
void
Cba_NtkCleanObjAttrs
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vObjAttr
,
Vec_StrCap
(
&
p
->
vObjType
),
0
);
Vec_IntFill
(
&
p
->
vAttrSto
,
1
,
-
1
);
}
static
inline
void
Cba_NtkCleanFonCopies
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vFonCopy
,
Vec_IntCap
(
&
p
->
vFonObj
),
0
);
}
static
inline
void
Cba_NtkCleanFonNames
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vFonName
,
Vec_IntCap
(
&
p
->
vFonObj
),
0
);
}
static
inline
void
Cba_NtkCleanFonRanges
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vFonRange
,
Vec_IntCap
(
&
p
->
vFonObj
),
0
);
}
static
inline
void
Cba_NtkCleanFonRanges
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vFonRange
,
Vec_IntCap
(
&
p
->
vFonObj
),
0
);
}
static
inline
void
Cba_NtkCleanFonPrevs
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vFonPrev
,
Vec_IntCap
(
&
p
->
vFonObj
),
0
);
}
static
inline
void
Cba_NtkCleanFonNexts
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vFonNext
,
Vec_IntCap
(
&
p
->
vFonObj
),
0
);
}
static
inline
void
Cba_NtkCleanFinFon0
(
Cba_Ntk_t
*
p
)
{
Vec_IntFill
(
&
p
->
vFinFon0
,
Vec_IntCap
(
&
p
->
vFinFon
),
0
);
}
...
...
@@ -296,7 +299,7 @@ static inline int Cba_NtkHasObjNames( Cba_Ntk_t * p ) { r
static
inline
int
Cba_NtkHasObjAttrs
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vObjAttr
)
>
0
;
}
static
inline
int
Cba_NtkHasFonCopies
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vFonCopy
)
>
0
;
}
static
inline
int
Cba_NtkHasFonNames
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vFonName
)
>
0
;
}
static
inline
int
Cba_NtkHasFonRanges
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vFonRange
)
>
0
;
}
static
inline
int
Cba_NtkHasFonRanges
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vFonRange
)
>
0
;
}
static
inline
int
Cba_NtkHasFonPrevs
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vFonPrev
)
>
0
;
}
static
inline
int
Cba_NtkHasFonNexts
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vFonNext
)
>
0
;
}
static
inline
int
Cba_NtkHasFinFon0
(
Cba_Ntk_t
*
p
)
{
return
Vec_IntSize
(
&
p
->
vFinFon0
)
>
0
;
}
...
...
@@ -318,7 +321,7 @@ static inline Cba_ObjType_t Cba_ObjType( Cba_Ntk_t * p, int i ) { a
static
inline
void
Cba_ObjCleanType
(
Cba_Ntk_t
*
p
,
int
i
)
{
assert
(
i
>
0
);
Vec_StrWriteEntry
(
&
p
->
vObjType
,
i
,
(
char
)
CBA_OBJ_NONE
);
}
static
inline
int
Cba_TypeIsBox
(
Cba_ObjType_t
Type
)
{
return
Type
>=
CBA_OBJ_BOX
&&
Type
<
CBA_BOX_LAST
;
}
static
inline
int
Cba_TypeIsSeq
(
Cba_ObjType_t
Type
)
{
return
Type
>=
CBA_BOX_RAM
&&
Type
<=
CBA_BOX_DFFRS
;
}
static
inline
int
Cba_TypeIsUnary
(
Cba_ObjType_t
Type
)
{
return
Type
==
CBA_BOX_BUF
||
Type
==
CBA_BOX_INV
||
Type
==
CBA_BOX_LNOT
||
Type
==
CBA_BOX_MIN
||
Type
==
CBA_BOX_ABS
||
(
Type
>=
CBA_BOX_RAND
&&
Type
<=
CBA_BOX_RXNOR
);
}
static
inline
int
Cba_TypeIsUnary
(
Cba_ObjType_t
Type
)
{
return
Type
==
CBA_BOX_BUF
||
Type
==
CBA_BOX_INV
||
Type
==
CBA_BOX_LNOT
||
Type
==
CBA_BOX_MIN
||
Type
==
CBA_BOX_
SQRT
||
Type
==
CBA_BOX_
ABS
||
(
Type
>=
CBA_BOX_RAND
&&
Type
<=
CBA_BOX_RXNOR
);
}
static
inline
int
Cba_TypeIsMux
(
Cba_ObjType_t
Type
)
{
return
Type
==
CBA_BOX_MUX
||
Type
==
CBA_BOX_NMUX
||
Type
==
CBA_BOX_SEL
||
Type
==
CBA_BOX_PSEL
;
}
static
inline
int
Cba_ObjIsPi
(
Cba_Ntk_t
*
p
,
int
i
)
{
return
Cba_ObjType
(
p
,
i
)
==
CBA_OBJ_PI
;
}
...
...
@@ -375,11 +378,13 @@ static inline int Cba_FonFromConst( int c ) { a
static
inline
int
Cba_FonConstRange
(
Cba_Ntk_t
*
p
,
int
f
)
{
assert
(
Cba_FonIsConst
(
f
));
return
atoi
(
Cba_NtkConst
(
p
,
Cba_FonConst
(
f
)));
}
static
inline
int
Cba_FonObj
(
Cba_Ntk_t
*
p
,
int
f
)
{
return
Cba_FonIsReal
(
f
)
?
Vec_IntEntry
(
&
p
->
vFonObj
,
f
)
:
0
;
}
static
inline
int
Cba_FonRange
(
Cba_Ntk_t
*
p
,
int
f
)
{
assert
(
Cba_FonIsReal
(
f
));
return
Cba_NtkHasFonRanges
(
p
)?
Vec_IntGetEntry
(
&
p
->
vFonRange
,
f
):
0
;}
static
inline
int
Cba_FonRange
(
Cba_Ntk_t
*
p
,
int
f
)
{
assert
(
Cba_FonIsReal
(
f
));
return
Cba_NtkHasFonRanges
(
p
)?
Abc_Lit2Var
(
Vec_IntGetEntry
(
&
p
->
vFonRange
,
f
)):
0
;
}
static
inline
int
Cba_FonSigned
(
Cba_Ntk_t
*
p
,
int
f
)
{
assert
(
Cba_FonIsReal
(
f
));
return
Cba_NtkHasFonRanges
(
p
)?
Abc_LitIsCompl
(
Vec_IntGetEntry
(
&
p
->
vFonRange
,
f
)):
0
;
}
static
inline
int
Cba_FonLeft
(
Cba_Ntk_t
*
p
,
int
f
)
{
return
Cba_NtkRangeLeft
(
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
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_FonSetRangeSign
(
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
,
Abc_Var2Lit
(
f
,
0
),
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
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
);
}
...
...
src/base/cba/cbaCom.c
View file @
bb7837ff
...
...
@@ -213,7 +213,10 @@ int Cba_CommandWrite( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
argc
==
globalUtilOptind
+
1
)
pFileName
=
argv
[
globalUtilOptind
];
else
if
(
argc
==
globalUtilOptind
&&
p
)
pFileName
=
Extra_FileNameGenericAppend
(
Cba_ManName
(
p
),
"_out.v"
);
{
pFileName
=
Extra_FileNameGenericAppend
(
Cba_ManSpec
(
p
)
?
Cba_ManSpec
(
p
)
:
Cba_ManName
(
p
),
"_out.v"
);
printf
(
"Generated output file name
\"
%s
\"
.
\n
"
,
pFileName
);
}
else
{
printf
(
"Output file name should be given on the command line.
\n
"
);
...
...
src/base/cba/cbaPrs.h
View file @
bb7837ff
...
...
@@ -42,15 +42,19 @@ typedef enum {
PRS_VER_OUTPUT
,
// 2: output
PRS_VER_INOUT
,
// 3: inout
PRS_VER_WIRE
,
// 4: wire
PRS_VER_
MODULE
,
// 5: module
PRS_VER_
ASSIGN
,
// 6: assign
PRS_VER_
REG
,
// 7: reg
PRS_VER_
REG
,
// 5: reg
PRS_VER_
MODULE
,
// 6: module
PRS_VER_
ASSIGN
,
// 7: assign
PRS_VER_ALWAYS
,
// 8: always
PRS_VER_DEFPARAM
,
// 9: always
PRS_VER_BEGIN
,
// 10: begin
PRS_VER_END
,
// 11: end
PRS_VER_ENDMODULE
,
// 12: endmodule
PRS_VER_UNKNOWN
// 13: unknown
PRS_VER_FUNCTION
,
// 9: function
PRS_VER_DEFPARAM
,
// 10: defparam
PRS_VER_BEGIN
,
// 11: begin
PRS_VER_END
,
// 12: end
PRS_VER_CASE
,
// 13: case
PRS_VER_ENDCASE
,
// 14: endcase
PRS_VER_SIGNED
,
// 15: signed
PRS_VER_ENDMODULE
,
// 16: endmodule
PRS_VER_UNKNOWN
// 17: unknown
}
Cba_VerType_t
;
// parser name types
...
...
@@ -117,12 +121,16 @@ struct Prs_Man_t_
Vec_Str_t
vCover
;
// one SOP cover
Vec_Int_t
vTemp
;
// array of tokens
Vec_Int_t
vTemp2
;
// array of tokens
Vec_Int_t
vTemp3
;
// array of tokens
Vec_Int_t
vTemp4
;
// array of tokens
// statistics
Vec_Int_t
vKnown
;
Vec_Int_t
vFailed
;
Vec_Int_t
vSucceeded
;
// error handling
int
fUsingTemp2
;
// vTemp2 is in use
int
FuncNameId
;
// temp value
int
FuncRangeId
;
// temp value
char
ErrorStr
[
1000
];
// error
};
...
...
@@ -142,6 +150,7 @@ static inline char * Prs_NtkSop( Prs_Ntk_t * p, int h ) { return
static
inline
char
*
Prs_NtkConst
(
Prs_Ntk_t
*
p
,
int
h
)
{
return
Abc_NamStr
(
p
->
pFuns
,
h
);
}
static
inline
char
*
Prs_NtkName
(
Prs_Ntk_t
*
p
)
{
return
Prs_NtkStr
(
p
,
Prs_NtkId
(
p
));
}
static
inline
int
Prs_NtkSigName
(
Prs_Ntk_t
*
p
,
int
i
)
{
if
(
!
p
->
fSlices
)
return
i
;
assert
(
Abc_Lit2Att2
(
i
)
==
CBA_PRS_NAME
);
return
Abc_Lit2Var2
(
i
);
}
static
inline
int
Ptr_NtkRangeSize
(
Prs_Ntk_t
*
p
,
int
h
)
{
int
l
=
Hash_IntObjData0
(
p
->
vHash
,
h
),
r
=
Hash_IntObjData1
(
p
->
vHash
,
h
);
return
1
+
(
l
>
r
?
l
-
r
:
r
-
l
);
}
static
inline
int
Prs_SliceName
(
Prs_Ntk_t
*
p
,
int
h
)
{
return
Vec_IntEntry
(
&
p
->
vSlices
,
h
);
}
static
inline
int
Prs_SliceRange
(
Prs_Ntk_t
*
p
,
int
h
)
{
return
Vec_IntEntry
(
&
p
->
vSlices
,
h
+
1
);
}
...
...
@@ -353,6 +362,8 @@ static inline void Prs_ManFree( Prs_Man_t * p )
Vec_StrErase
(
&
p
->
vCover
);
Vec_IntErase
(
&
p
->
vTemp
);
Vec_IntErase
(
&
p
->
vTemp2
);
Vec_IntErase
(
&
p
->
vTemp3
);
Vec_IntErase
(
&
p
->
vTemp4
);
Vec_IntErase
(
&
p
->
vKnown
);
Vec_IntErase
(
&
p
->
vFailed
);
Vec_IntErase
(
&
p
->
vSucceeded
);
...
...
src/base/cba/cbaReadVer.c
View file @
bb7837ff
This diff is collapsed.
Click to expand it.
src/base/cba/cbaWriteVer.c
View file @
bb7837ff
This diff is collapsed.
Click to expand it.
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