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
6a4e94e7
Commit
6a4e94e7
authored
Aug 09, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to Cba data-structure.
parent
356217ef
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
69 deletions
+95
-69
src/base/cba/cba.h
+0
-0
src/base/cba/cbaNtk.c
+3
-3
src/base/cba/cbaPrs.h
+45
-47
src/base/cba/cbaReadBlif.c
+1
-1
src/base/cba/cbaReadVer.c
+0
-0
src/base/cba/cbaWriteVer.c
+28
-10
src/misc/util/utilNam.c
+2
-6
src/misc/vec/vecHash.h
+16
-2
No files found.
src/base/cba/cba.h
View file @
6a4e94e7
This diff is collapsed.
Click to expand it.
src/base/cba/cbaNtk.c
View file @
6a4e94e7
...
@@ -489,7 +489,7 @@ void Cba_NtkCollapse_rec( Cba_Ntk_t * pNew, Cba_Ntk_t * p, Vec_Int_t * vSigs, in
...
@@ -489,7 +489,7 @@ void Cba_NtkCollapse_rec( Cba_Ntk_t * pNew, Cba_Ntk_t * p, Vec_Int_t * vSigs, in
}
}
Cba_Man_t
*
Cba_ManCollapse
(
Cba_Man_t
*
p
,
int
TypeBuf
)
Cba_Man_t
*
Cba_ManCollapse
(
Cba_Man_t
*
p
,
int
TypeBuf
)
{
{
Cba_Man_t
*
pNew
=
Cba_ManAlloc
(
p
->
pSpec
,
1
,
Abc_NamRef
(
p
->
pStrs
),
Abc_NamRef
(
p
->
pFuns
),
Abc_NamStart
(
100
,
24
)
);
Cba_Man_t
*
pNew
=
Cba_ManAlloc
(
p
->
pSpec
,
1
,
Abc_NamRef
(
p
->
pStrs
),
Abc_NamRef
(
p
->
pFuns
),
Abc_NamStart
(
100
,
24
)
,
Hash_IntManRef
(
p
->
vHash
)
);
Cba_Ntk_t
*
pRoot
=
Cba_ManRoot
(
p
),
*
pRootNew
;
Cba_Ntk_t
*
pRoot
=
Cba_ManRoot
(
p
),
*
pRootNew
;
Vec_Int_t
*
vSigs
=
Vec_IntAlloc
(
1000
);
Vec_Int_t
*
vSigs
=
Vec_IntAlloc
(
1000
);
int
i
,
iObj
,
iObjNew
,
iFon
,
nObjs
=
0
,
nFins
=
0
,
nFons
=
0
;
int
i
,
iObj
,
iObjNew
,
iFon
,
nObjs
=
0
,
nFins
=
0
,
nFons
=
0
;
...
@@ -660,7 +660,7 @@ void Cba_ManExtractGroupInt( Cba_Ntk_t * pNew, Cba_Ntk_t * p, Vec_Int_t * vObjs,
...
@@ -660,7 +660,7 @@ void Cba_ManExtractGroupInt( Cba_Ntk_t * pNew, Cba_Ntk_t * p, Vec_Int_t * vObjs,
}
}
Cba_Man_t
*
Cba_ManExtractGroup
(
Cba_Man_t
*
p
,
Vec_Int_t
*
vObjs
)
Cba_Man_t
*
Cba_ManExtractGroup
(
Cba_Man_t
*
p
,
Vec_Int_t
*
vObjs
)
{
{
Cba_Man_t
*
pNew
=
Cba_ManAlloc
(
p
->
pSpec
,
1
,
Abc_NamRef
(
p
->
pStrs
),
Abc_NamRef
(
p
->
pFuns
),
Abc_NamStart
(
100
,
24
)
);
Cba_Man_t
*
pNew
=
Cba_ManAlloc
(
p
->
pSpec
,
1
,
Abc_NamRef
(
p
->
pStrs
),
Abc_NamRef
(
p
->
pFuns
),
Abc_NamStart
(
100
,
24
)
,
Hash_IntManRef
(
p
->
vHash
)
);
Cba_Ntk_t
*
pRoot
=
Cba_ManRoot
(
p
),
*
pRootNew
;
Cba_Ntk_t
*
pRoot
=
Cba_ManRoot
(
p
),
*
pRootNew
;
Vec_Int_t
*
vFonIns
=
Cba_NtkCollectInFons
(
pRoot
,
vObjs
);
Vec_Int_t
*
vFonIns
=
Cba_NtkCollectInFons
(
pRoot
,
vObjs
);
Vec_Int_t
*
vFonOuts
=
Cba_NtkCollectOutFons
(
pRoot
,
vObjs
);
Vec_Int_t
*
vFonOuts
=
Cba_NtkCollectOutFons
(
pRoot
,
vObjs
);
...
@@ -743,7 +743,7 @@ static inline int Cba_NtkInsertGiaObj( Cba_Ntk_t * p, Gia_Man_t * pGia, int iObj
...
@@ -743,7 +743,7 @@ static inline int Cba_NtkInsertGiaObj( Cba_Ntk_t * p, Gia_Man_t * pGia, int iObj
}
}
Cba_Man_t
*
Cba_ManDeriveFromGia
(
Gia_Man_t
*
pGia
)
Cba_Man_t
*
Cba_ManDeriveFromGia
(
Gia_Man_t
*
pGia
)
{
{
Cba_Man_t
*
p
=
Cba_ManAlloc
(
pGia
->
pSpec
,
1
,
NULL
,
NULL
,
NULL
);
Cba_Man_t
*
p
=
Cba_ManAlloc
(
pGia
->
pSpec
,
1
,
NULL
,
NULL
,
NULL
,
NULL
);
Cba_Ntk_t
*
pNtk
=
Cba_NtkAlloc
(
p
,
Abc_NamStrFindOrAdd
(
p
->
pStrs
,
pGia
->
pName
,
NULL
),
Gia_ManCiNum
(
pGia
),
Gia_ManCoNum
(
pGia
),
1000
,
2000
,
2000
);
Cba_Ntk_t
*
pNtk
=
Cba_NtkAlloc
(
p
,
Abc_NamStrFindOrAdd
(
p
->
pStrs
,
pGia
->
pName
,
NULL
),
Gia_ManCiNum
(
pGia
),
Gia_ManCoNum
(
pGia
),
1000
,
2000
,
2000
);
Vec_Int_t
*
vLit2Fon
=
Vec_IntStartFull
(
2
*
Gia_ManObjNum
(
pGia
)
);
Vec_Int_t
*
vLit2Fon
=
Vec_IntStartFull
(
2
*
Gia_ManObjNum
(
pGia
)
);
int
i
,
iObj
,
iObjNew
,
NameId
,
iLit0
,
iFon0
;
int
i
,
iObj
,
iObjNew
,
NameId
,
iLit0
,
iFon0
;
...
...
src/base/cba/cbaPrs.h
View file @
6a4e94e7
...
@@ -52,32 +52,33 @@ typedef struct Prs_Ntk_t_ Prs_Ntk_t;
...
@@ -52,32 +52,33 @@ typedef struct Prs_Ntk_t_ Prs_Ntk_t;
struct
Prs_Ntk_t_
struct
Prs_Ntk_t_
{
{
// general info
// general info
int
iModuleName
;
int
iModuleName
;
unsigned
fMapped
:
1
;
unsigned
fMapped
:
1
;
unsigned
fSlices
:
1
;
unsigned
fSlices
:
1
;
unsigned
fHasC0s
:
1
;
unsigned
fHasC0s
:
1
;
unsigned
fHasC1s
:
1
;
unsigned
fHasC1s
:
1
;
unsigned
fHasCXs
:
1
;
unsigned
fHasCXs
:
1
;
unsigned
fHasCZs
:
1
;
unsigned
fHasCZs
:
1
;
Abc_Nam_t
*
pStrs
;
Abc_Nam_t
*
pStrs
;
Abc_Nam_t
*
pFuns
;
Abc_Nam_t
*
pFuns
;
Hash_IntMan_t
*
vHash
;
// interface
// interface
Vec_Int_t
vOrder
;
// order of signals
Vec_Int_t
vOrder
;
// order of signals
// signal names
// signal names
Vec_Int_t
vInouts
;
// inouts
Vec_Int_t
vInouts
;
// inouts
Vec_Int_t
vInputs
;
// inputs
Vec_Int_t
vInputs
;
// inputs
Vec_Int_t
vOutputs
;
// outputs
Vec_Int_t
vOutputs
;
// outputs
Vec_Int_t
vWires
;
// wires
Vec_Int_t
vWires
;
// wires
// signal ranges
// signal ranges
Vec_Int_t
vInoutsR
;
// inouts
Vec_Int_t
vInoutsR
;
// inouts
Vec_Int_t
vInputsR
;
// inputs
Vec_Int_t
vInputsR
;
// inputs
Vec_Int_t
vOutputsR
;
// outputs
Vec_Int_t
vOutputsR
;
// outputs
Vec_Int_t
vWiresR
;
// wires
Vec_Int_t
vWiresR
;
// wires
// slices/concatenations/objects
// slices/concatenations/objects
Vec_Int_t
vSlices
;
// NameId + RangeId
Vec_Int_t
vSlices
;
// NameId + RangeId
Vec_Int_t
vConcats
;
// array of NameId/SliceId/ConstId
Vec_Int_t
vConcats
;
// array of NameId/SliceId/ConstId
Vec_Int_t
vBoxes
;
// ModuleId + InstId + array of pairs {FormNameId, ActSignalId(NameId/SliceId/ConstId/ConcatId)}
Vec_Int_t
vBoxes
;
// ModuleId + InstId + array of pairs {FormNameId, ActSignalId(NameId/SliceId/ConstId/ConcatId)}
Vec_Int_t
vObjs
;
// box handles
Vec_Int_t
vObjs
;
// box handles
};
};
// parser
// parser
...
@@ -85,24 +86,25 @@ typedef struct Prs_Man_t_ Prs_Man_t;
...
@@ -85,24 +86,25 @@ typedef struct Prs_Man_t_ Prs_Man_t;
struct
Prs_Man_t_
struct
Prs_Man_t_
{
{
// input data
// input data
char
*
pName
;
// file name
char
*
pName
;
// file name
char
*
pBuffer
;
// file contents
char
*
pBuffer
;
// file contents
char
*
pLimit
;
// end of file
char
*
pLimit
;
// end of file
char
*
pCur
;
// current position
char
*
pCur
;
// current position
Abc_Nam_t
*
pStrs
;
// string manager
Abc_Nam_t
*
pStrs
;
// string manager
Abc_Nam_t
*
pFuns
;
// cover manager
Abc_Nam_t
*
pFuns
;
// cover manager
Prs_Ntk_t
*
pNtk
;
// current network
Hash_IntMan_t
*
vHash
;
// variable ranges
Vec_Ptr_t
*
vNtks
;
// input networks
Prs_Ntk_t
*
pNtk
;
// current network
Vec_Ptr_t
*
vNtks
;
// input networks
// temporary data
// temporary data
Vec_Str_t
vCover
;
// one SOP cover
Vec_Str_t
vCover
;
// one SOP cover
Vec_Int_t
vTemp
;
// array of tokens
Vec_Int_t
vTemp
;
// array of tokens
Vec_Int_t
vTemp2
;
// array of tokens
Vec_Int_t
vTemp2
;
// array of tokens
// statistics
// statistics
Vec_Int_t
vKnown
;
Vec_Int_t
vKnown
;
Vec_Int_t
vFailed
;
Vec_Int_t
vFailed
;
Vec_Int_t
vSucceeded
;
Vec_Int_t
vSucceeded
;
// error handling
// error handling
int
fUsingTemp2
;
// vTemp2 is in use
int
fUsingTemp2
;
// vTemp2 is in use
char
ErrorStr
[
1000
];
// error
char
ErrorStr
[
1000
];
// error
};
};
...
@@ -188,6 +190,7 @@ static inline void Prs_ManInitializeNtk( Prs_Man_t * p, int iName, int fSlices )
...
@@ -188,6 +190,7 @@ static inline void Prs_ManInitializeNtk( Prs_Man_t * p, int iName, int fSlices )
p
->
pNtk
->
fSlices
=
fSlices
;
p
->
pNtk
->
fSlices
=
fSlices
;
p
->
pNtk
->
pStrs
=
Abc_NamRef
(
p
->
pStrs
);
p
->
pNtk
->
pStrs
=
Abc_NamRef
(
p
->
pStrs
);
p
->
pNtk
->
pFuns
=
Abc_NamRef
(
p
->
pFuns
);
p
->
pNtk
->
pFuns
=
Abc_NamRef
(
p
->
pFuns
);
p
->
pNtk
->
vHash
=
Hash_IntManRef
(
p
->
vHash
);
Vec_PtrPush
(
p
->
vNtks
,
p
->
pNtk
);
Vec_PtrPush
(
p
->
vNtks
,
p
->
pNtk
);
}
}
static
inline
void
Prs_ManFinalizeNtk
(
Prs_Man_t
*
p
)
static
inline
void
Prs_ManFinalizeNtk
(
Prs_Man_t
*
p
)
...
@@ -229,16 +232,6 @@ static inline void Prs_NtkAddBox( Prs_Ntk_t * p, int ModName, int InstName, Vec_
...
@@ -229,16 +232,6 @@ static inline void Prs_NtkAddBox( Prs_Ntk_t * p, int ModName, int InstName, Vec_
Vec_IntPush
(
&
p
->
vBoxes
,
InstName
);
Vec_IntPush
(
&
p
->
vBoxes
,
InstName
);
Vec_IntAppend
(
&
p
->
vBoxes
,
vTemp
);
Vec_IntAppend
(
&
p
->
vBoxes
,
vTemp
);
}
}
// parsing range
static
inline
void
Prs_NtkParseRange
(
Prs_Ntk_t
*
p
,
int
RangeId
,
int
*
pLeft
,
int
*
pRight
)
{
char
*
pRange
=
Prs_NtkStr
(
p
,
RangeId
);
char
*
pPivot
=
strchr
(
pRange
,
':'
);
*
pLeft
=
atoi
(
pRange
+
1
);
*
pRight
=
pPivot
?
atoi
(
pPivot
+
1
)
:
*
pLeft
;
}
static
inline
char
*
Prs_ManLoadFile
(
char
*
pFileName
,
char
**
ppLimit
)
static
inline
char
*
Prs_ManLoadFile
(
char
*
pFileName
,
char
**
ppLimit
)
{
{
char
*
pBuffer
;
char
*
pBuffer
;
...
@@ -280,6 +273,8 @@ static inline Prs_Man_t * Prs_ManAlloc( char * pFileName )
...
@@ -280,6 +273,8 @@ static inline Prs_Man_t * Prs_ManAlloc( char * pFileName )
p
->
pStrs
=
Abc_NamStart
(
1000
,
24
);
p
->
pStrs
=
Abc_NamStart
(
1000
,
24
);
p
->
pFuns
=
Abc_NamStart
(
100
,
24
);
p
->
pFuns
=
Abc_NamStart
(
100
,
24
);
p
->
vNtks
=
Vec_PtrAlloc
(
100
);
p
->
vNtks
=
Vec_PtrAlloc
(
100
);
p
->
vHash
=
Hash_IntManStart
(
1000
);
// Hash_Int2ManInsert( p->vHash, 0, 0, 0 );
return
p
;
return
p
;
}
}
...
@@ -287,6 +282,7 @@ static inline void Prs_NtkFree( Prs_Ntk_t * p )
...
@@ -287,6 +282,7 @@ static inline void Prs_NtkFree( Prs_Ntk_t * p )
{
{
if
(
p
->
pStrs
)
Abc_NamDeref
(
p
->
pStrs
);
if
(
p
->
pStrs
)
Abc_NamDeref
(
p
->
pStrs
);
if
(
p
->
pFuns
)
Abc_NamDeref
(
p
->
pFuns
);
if
(
p
->
pFuns
)
Abc_NamDeref
(
p
->
pFuns
);
if
(
p
->
vHash
)
Hash_IntManDeref
(
p
->
vHash
);
Vec_IntErase
(
&
p
->
vOrder
);
Vec_IntErase
(
&
p
->
vOrder
);
Vec_IntErase
(
&
p
->
vInouts
);
Vec_IntErase
(
&
p
->
vInouts
);
Vec_IntErase
(
&
p
->
vInputs
);
Vec_IntErase
(
&
p
->
vInputs
);
...
@@ -315,6 +311,7 @@ static inline void Prs_ManFree( Prs_Man_t * p )
...
@@ -315,6 +311,7 @@ static inline void Prs_ManFree( Prs_Man_t * p )
{
{
if
(
p
->
pStrs
)
Abc_NamDeref
(
p
->
pStrs
);
if
(
p
->
pStrs
)
Abc_NamDeref
(
p
->
pStrs
);
if
(
p
->
pFuns
)
Abc_NamDeref
(
p
->
pFuns
);
if
(
p
->
pFuns
)
Abc_NamDeref
(
p
->
pFuns
);
if
(
p
->
vHash
)
Hash_IntManDeref
(
p
->
vHash
);
if
(
p
->
vNtks
)
Prs_ManVecFree
(
p
->
vNtks
);
if
(
p
->
vNtks
)
Prs_ManVecFree
(
p
->
vNtks
);
// temporary
// temporary
Vec_StrErase
(
&
p
->
vCover
);
Vec_StrErase
(
&
p
->
vCover
);
...
@@ -424,6 +421,7 @@ static inline char * Ptr_TypeToName( Cba_ObjType_t Type )
...
@@ -424,6 +421,7 @@ static inline char * Ptr_TypeToName( Cba_ObjType_t Type )
if
(
Type
==
CBA_BOX_MAJ
)
return
"maj"
;
if
(
Type
==
CBA_BOX_MAJ
)
return
"maj"
;
if
(
Type
==
CBA_BOX_SHARP
)
return
"sharp"
;
if
(
Type
==
CBA_BOX_SHARP
)
return
"sharp"
;
if
(
Type
==
CBA_BOX_SHARPL
)
return
"sharpl"
;
if
(
Type
==
CBA_BOX_SHARPL
)
return
"sharpl"
;
if
(
Type
==
CBA_BOX_TRI
)
return
"bufifl"
;
assert
(
0
);
assert
(
0
);
return
"???"
;
return
"???"
;
}
}
...
...
src/base/cba/cbaReadBlif.c
View file @
6a4e94e7
...
@@ -592,7 +592,7 @@ Cba_Man_t * Prs_ManBuildCbaBlif( char * pFileName, Vec_Ptr_t * vDes )
...
@@ -592,7 +592,7 @@ Cba_Man_t * Prs_ManBuildCbaBlif( char * pFileName, Vec_Ptr_t * vDes )
Abc_Nam_t
*
pStrs
=
Abc_NamRef
(
pPrsRoot
->
pStrs
);
Abc_Nam_t
*
pStrs
=
Abc_NamRef
(
pPrsRoot
->
pStrs
);
Abc_Nam_t
*
pFuns
=
Abc_NamRef
(
pPrsRoot
->
pFuns
);
Abc_Nam_t
*
pFuns
=
Abc_NamRef
(
pPrsRoot
->
pFuns
);
Abc_Nam_t
*
pMods
=
Abc_NamStart
(
100
,
24
);
Abc_Nam_t
*
pMods
=
Abc_NamStart
(
100
,
24
);
Cba_Man_t
*
p
=
Cba_ManAlloc
(
pFileName
,
Vec_PtrSize
(
vDes
),
pStrs
,
pFuns
,
pMods
);
Cba_Man_t
*
p
=
Cba_ManAlloc
(
pFileName
,
Vec_PtrSize
(
vDes
),
pStrs
,
pFuns
,
pMods
,
NULL
);
// initialize networks
// initialize networks
Vec_PtrForEachEntry
(
Prs_Ntk_t
*
,
vDes
,
pPrsNtk
,
i
)
Vec_PtrForEachEntry
(
Prs_Ntk_t
*
,
vDes
,
pPrsNtk
,
i
)
{
{
...
...
src/base/cba/cbaReadVer.c
View file @
6a4e94e7
This diff is collapsed.
Click to expand it.
src/base/cba/cbaWriteVer.c
View file @
6a4e94e7
...
@@ -112,6 +112,7 @@ static void Prs_ManWriteVerilogBoxes( FILE * pFile, Prs_Ntk_t * p )
...
@@ -112,6 +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
));
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
...
@@ -304,16 +305,31 @@ char * Cba_FonGetName( Cba_Ntk_t * p, int i )
...
@@ -304,16 +305,31 @@ char * Cba_FonGetName( Cba_Ntk_t * p, int i )
char
*
pName
=
Cba_FonNameStr
(
p
,
i
);
char
*
pName
=
Cba_FonNameStr
(
p
,
i
);
if
(
pName
==
NULL
)
if
(
pName
==
NULL
)
return
pName
;
return
pName
;
if
(
Cba_ObjType
(
p
,
Cba_FonObj
(
p
,
i
))
==
CBA_BOX_SLICE
)
return
pName
;
if
(
Cba_NameIsLegalInVerilog
(
pName
)
)
if
(
Cba_NameIsLegalInVerilog
(
pName
)
)
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
*
pName
=
Cba_FonNameStr
(
p
,
iFon
);
if
(
Cba_NameIsLegalInVerilog
(
pName
)
)
if
(
Left
==
Right
)
return
Vec_StrPrintF
(
Abc_NamBuffer
(
Cba_NtkNam
(
p
)),
"%s[%d]"
,
pName
,
Right
);
else
return
Vec_StrPrintF
(
Abc_NamBuffer
(
Cba_NtkNam
(
p
)),
"%s[%d:%d]"
,
pName
,
Left
,
Right
);
else
if
(
Left
==
Right
)
return
Vec_StrPrintF
(
Abc_NamBuffer
(
Cba_NtkNam
(
p
)),
"
\\
%s [%d]"
,
pName
,
Right
);
else
return
Vec_StrPrintF
(
Abc_NamBuffer
(
Cba_NtkNam
(
p
)),
"
\\
%s [%d:%d]"
,
pName
,
Left
,
Right
);
}
void
Cba_ManWriteFonRange
(
Cba_Ntk_t
*
p
,
int
iFon
)
void
Cba_ManWriteFonRange
(
Cba_Ntk_t
*
p
,
int
iFon
)
{
{
Vec_Str_t
*
vStr
=
&
p
->
pDesign
->
vOut
;
Vec_Str_t
*
vStr
=
&
p
->
pDesign
->
vOut
;
if
(
Cba_FonIsConst
(
iFon
)
||
(
Cba_FonRange
(
p
,
iFon
)
==
1
&&
Cba_FonRight
(
p
,
iFon
)
==
0
)
)
if
(
Cba_FonIsConst
(
iFon
)
||
(
Cba_FonRange
Size
(
p
,
iFon
)
==
1
&&
Cba_FonRight
(
p
,
iFon
)
==
0
)
)
return
;
return
;
Vec_StrPrintF
(
vStr
,
"[%d:%d] "
,
Cba_FonLeft
(
p
,
iFon
),
Cba_FonRight
(
p
,
iFon
)
);
Vec_StrPrintF
(
vStr
,
"[%d:%d] "
,
Cba_FonLeft
(
p
,
iFon
),
Cba_FonRight
(
p
,
iFon
)
);
...
@@ -329,7 +345,7 @@ void Cba_ManWriteFonName( Cba_Ntk_t * p, int iFon, int fInlineConcat, int fInput
...
@@ -329,7 +345,7 @@ void Cba_ManWriteFonName( Cba_Ntk_t * p, int iFon, int fInlineConcat, int fInput
Cba_ManWriteCatIn
(
p
,
Cba_FonObj
(
p
,
iFon
)
);
Cba_ManWriteCatIn
(
p
,
Cba_FonObj
(
p
,
iFon
)
);
else
else
{
{
int
Range
=
fInput
?
Cba_FonRange
(
p
,
iFon
)
:
0
;
int
Range
=
fInput
?
Cba_FonRange
Size
(
p
,
iFon
)
:
0
;
if
(
fInput
&&
Range
>
1
)
if
(
fInput
&&
Range
>
1
)
Vec_StrPush
(
vStr
,
'{'
);
Vec_StrPush
(
vStr
,
'{'
);
Vec_StrPrintStr
(
vStr
,
Cba_FonIsConst
(
iFon
)
?
Cba_NtkConst
(
p
,
Cba_FonConst
(
iFon
))
:
Cba_FonGetName
(
p
,
iFon
)
);
Vec_StrPrintStr
(
vStr
,
Cba_FonIsConst
(
iFon
)
?
Cba_NtkConst
(
p
,
Cba_FonConst
(
iFon
))
:
Cba_FonGetName
(
p
,
iFon
)
);
...
@@ -590,8 +606,8 @@ void Cba_ManWriteVerilogNtk( Cba_Ntk_t * p, int fInlineConcat )
...
@@ -590,8 +606,8 @@ void Cba_ManWriteVerilogNtk( Cba_Ntk_t * p, int fInlineConcat )
{
{
int
iFonIn
=
Cba_ObjFinFon
(
p
,
iObj
,
0
);
int
iFonIn
=
Cba_ObjFinFon
(
p
,
iObj
,
0
);
int
iFonOut
=
Cba_ObjFon0
(
p
,
iObj
);
int
iFonOut
=
Cba_ObjFon0
(
p
,
iObj
);
int
nBitsIn
=
Cba_FonRange
(
p
,
iFonIn
);
int
nBitsIn
=
Cba_FonRange
Size
(
p
,
iFonIn
);
int
nBitsOut
=
Cba_FonRange
(
p
,
iFonOut
);
int
nBitsOut
=
Cba_FonRange
Size
(
p
,
iFonOut
);
assert
(
(
1
<<
nBitsIn
)
==
nBitsOut
);
assert
(
(
1
<<
nBitsIn
)
==
nBitsOut
);
// function [15:0] res;
// function [15:0] res;
Vec_StrPrintStr
(
vStr
,
" function "
);
Vec_StrPrintStr
(
vStr
,
" function "
);
...
@@ -606,12 +622,14 @@ void Cba_ManWriteVerilogNtk( Cba_Ntk_t * p, int fInlineConcat )
...
@@ -606,12 +622,14 @@ void Cba_ManWriteVerilogNtk( Cba_Ntk_t * p, int fInlineConcat )
// casez (i)
// casez (i)
Vec_StrPrintStr
(
vStr
,
" casez(i)
\n
"
);
Vec_StrPrintStr
(
vStr
,
" casez(i)
\n
"
);
// 2'b00: res = 4'b0001;
// 2'b00: res = 4'b0001;
Cba_ObjForEachFinFon
(
p
,
iObj
,
iFin
,
iFon
,
i
)
for
(
i
=
0
;
i
<
(
1
<<
nBitsIn
);
i
++
)
{
{
Vec_StrPrintF
(
vStr
,
" %d
\'
b: "
,
nBitsIn
);
Vec_StrPrintF
(
vStr
,
" %d
\'
b"
,
nBitsIn
);
for
(
k
=
nBitsIn
-
1
;
k
>=
0
;
k
--
)
Vec_StrPrintNum
(
vStr
,
(
i
>>
k
)
&
1
);
Vec_StrPrintStr
(
vStr
,
": _func_"
);
Vec_StrPrintStr
(
vStr
,
": _func_"
);
Cba_ManWriteFonName
(
p
,
iFonOut
,
0
,
0
);
Cba_ManWriteFonName
(
p
,
iFonOut
,
0
,
0
);
Vec_StrPrintF
(
vStr
,
" = %d
\'
b%*d;
\n
"
,
nBitsOut
,
nBitsOut
,
0
);
Vec_StrPrintF
(
vStr
,
" = %d
\'
b%
0
*d;
\n
"
,
nBitsOut
,
nBitsOut
,
0
);
Vec_StrWriteEntry
(
vStr
,
Vec_StrSize
(
vStr
)
-
i
-
3
,
'1'
);
Vec_StrWriteEntry
(
vStr
,
Vec_StrSize
(
vStr
)
-
i
-
3
,
'1'
);
}
}
Vec_StrPrintStr
(
vStr
,
" endcase
\n
"
);
Vec_StrPrintStr
(
vStr
,
" endcase
\n
"
);
...
@@ -639,8 +657,8 @@ void Cba_ManWriteVerilogNtk( Cba_Ntk_t * p, int fInlineConcat )
...
@@ -639,8 +657,8 @@ void Cba_ManWriteVerilogNtk( Cba_Ntk_t * p, int fInlineConcat )
int
iFonSet
=
Cba_ObjFinFon
(
p
,
iObj
,
1
);
int
iFonSet
=
Cba_ObjFinFon
(
p
,
iObj
,
1
);
int
iFonRst
=
Cba_ObjFinFon
(
p
,
iObj
,
2
);
int
iFonRst
=
Cba_ObjFinFon
(
p
,
iObj
,
2
);
int
iFonC
=
Cba_ObjFinFon
(
p
,
iObj
,
3
);
int
iFonC
=
Cba_ObjFinFon
(
p
,
iObj
,
3
);
int
Range
=
Cba_FonRange
(
p
,
iFonQ
);
int
Range
=
Cba_FonRange
Size
(
p
,
iFonQ
);
assert
(
Cba_FonRange
(
p
,
iFonSet
)
==
1
&&
Cba_FonRang
e
(
p
,
iFonRst
)
==
1
);
assert
(
Cba_FonRange
Size
(
p
,
iFonSet
)
==
1
&&
Cba_FonRangeSiz
e
(
p
,
iFonRst
)
==
1
);
// reg [3:0] Q;
// reg [3:0] Q;
Vec_StrPrintStr
(
vStr
,
" reg "
);
Vec_StrPrintStr
(
vStr
,
" reg "
);
Cba_ManWriteFonRange
(
p
,
iFonQ
);
Cba_ManWriteFonRange
(
p
,
iFonQ
);
...
...
src/misc/util/utilNam.c
View file @
6a4e94e7
...
@@ -133,13 +133,9 @@ void Abc_NamStop( Abc_Nam_t * p )
...
@@ -133,13 +133,9 @@ void Abc_NamStop( Abc_Nam_t * p )
***********************************************************************/
***********************************************************************/
void
Abc_NamPrint
(
Abc_Nam_t
*
p
)
void
Abc_NamPrint
(
Abc_Nam_t
*
p
)
{
{
int
h
,
i
,
Counter
=
0
;
int
h
,
i
;
Vec_IntForEachEntryStart
(
&
p
->
vInt2Handle
,
h
,
i
,
1
)
Vec_IntForEachEntryStart
(
&
p
->
vInt2Handle
,
h
,
i
,
1
)
if
(
Abc_NamHandleToStr
(
p
,
h
)[
0
]
==
'['
)
Abc_Print
(
1
,
"%d=
\n
%s
\n
"
,
i
,
Abc_NamHandleToStr
(
p
,
h
)
);
Abc_Print
(
1
,
"%s "
,
Abc_NamHandleToStr
(
p
,
h
)
),
Counter
++
;
// Abc_Print( 1, "%d=\n%s\n", i, Abc_NamHandleToStr(p, h) );
// Abc_Print( 1, "\n" );
printf
(
" %d
\n
"
,
Counter
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
...
src/misc/vec/vecHash.h
View file @
6a4e94e7
...
@@ -53,6 +53,7 @@ struct Hash_IntMan_t_
...
@@ -53,6 +53,7 @@ struct Hash_IntMan_t_
{
{
Vec_Int_t
*
vTable
;
// hash table
Vec_Int_t
*
vTable
;
// hash table
Vec_Int_t
*
vObjs
;
// hash objects
Vec_Int_t
*
vObjs
;
// hash objects
int
nRefs
;
// reference counter for the manager
};
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -74,7 +75,7 @@ static inline void Hash_Int2ObjSetData2( Hash_IntMan_t * p, int i, in
...
@@ -74,7 +75,7 @@ static inline void Hash_Int2ObjSetData2( Hash_IntMan_t * p, int i, in
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Hash
ing data entries composed of nSize inte
gers.]
Synopsis [Hash
es pairs of inter
gers.]
Description []
Description []
...
@@ -90,6 +91,7 @@ static inline Hash_IntMan_t * Hash_IntManStart( int nSize )
...
@@ -90,6 +91,7 @@ static inline Hash_IntMan_t * Hash_IntManStart( int nSize )
p
->
vTable
=
Vec_IntStart
(
Abc_PrimeCudd
(
nSize
)
);
p
->
vTable
=
Vec_IntStart
(
Abc_PrimeCudd
(
nSize
)
);
p
->
vObjs
=
Vec_IntAlloc
(
4
*
nSize
);
p
->
vObjs
=
Vec_IntAlloc
(
4
*
nSize
);
Vec_IntFill
(
p
->
vObjs
,
4
,
0
);
Vec_IntFill
(
p
->
vObjs
,
4
,
0
);
p
->
nRefs
=
1
;
return
p
;
return
p
;
}
}
static
inline
void
Hash_IntManStop
(
Hash_IntMan_t
*
p
)
static
inline
void
Hash_IntManStop
(
Hash_IntMan_t
*
p
)
...
@@ -98,6 +100,18 @@ static inline void Hash_IntManStop( Hash_IntMan_t * p )
...
@@ -98,6 +100,18 @@ static inline void Hash_IntManStop( Hash_IntMan_t * p )
Vec_IntFree
(
p
->
vTable
);
Vec_IntFree
(
p
->
vTable
);
ABC_FREE
(
p
);
ABC_FREE
(
p
);
}
}
static
inline
Hash_IntMan_t
*
Hash_IntManRef
(
Hash_IntMan_t
*
p
)
{
p
->
nRefs
++
;
return
p
;
}
static
inline
void
Hash_IntManDeref
(
Hash_IntMan_t
*
p
)
{
if
(
p
==
NULL
)
return
;
if
(
--
p
->
nRefs
==
0
)
Hash_IntManStop
(
p
);
}
static
inline
int
Hash_IntManEntryNum
(
Hash_IntMan_t
*
p
)
static
inline
int
Hash_IntManEntryNum
(
Hash_IntMan_t
*
p
)
{
{
return
Vec_IntSize
(
p
->
vObjs
)
/
4
-
1
;
return
Vec_IntSize
(
p
->
vObjs
)
/
4
-
1
;
...
@@ -172,7 +186,7 @@ static inline int Hash_Int2ManInsert( Hash_IntMan_t * p, int iData0, int iData1,
...
@@ -172,7 +186,7 @@ static inline int Hash_Int2ManInsert( Hash_IntMan_t * p, int iData0, int iData1,
/**Function*************************************************************
/**Function*************************************************************
Synopsis []
Synopsis [
Hashes triples of intergers.
]
Description []
Description []
...
...
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