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
2b98b818
Commit
2b98b818
authored
Apr 29, 2008
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version abc80429
parent
e2e9aed1
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
212 additions
and
40 deletions
+212
-40
src/aig/bdc/bdcCore.c
+1
-1
src/aig/kit/kit.h
+3
-0
src/aig/kit/kitHop.c
+1
-0
src/aig/kit/kitPla.c
+56
-0
src/aig/ntl/ntl.h
+17
-15
src/aig/ntl/ntlExtract.c
+59
-17
src/aig/ntl/ntlUtil.c
+45
-0
src/aig/nwk/nwkDfs.c
+2
-2
src/aig/nwk/nwkMan.c
+4
-0
src/base/abci/abc.c
+20
-4
src/map/if/ifMap.c
+4
-1
No files found.
src/aig/bdc/bdcCore.c
View file @
2b98b818
...
@@ -64,7 +64,7 @@ Bdc_Man_t * Bdc_ManAlloc( Bdc_Par_t * pPars )
...
@@ -64,7 +64,7 @@ Bdc_Man_t * Bdc_ManAlloc( Bdc_Par_t * pPars )
Bdc_Man_t
*
p
;
Bdc_Man_t
*
p
;
p
=
ALLOC
(
Bdc_Man_t
,
1
);
p
=
ALLOC
(
Bdc_Man_t
,
1
);
memset
(
p
,
0
,
sizeof
(
Bdc_Man_t
)
);
memset
(
p
,
0
,
sizeof
(
Bdc_Man_t
)
);
assert
(
pPars
->
nVarsMax
>
2
&&
pPars
->
nVarsMax
<
16
);
assert
(
pPars
->
nVarsMax
>
1
&&
pPars
->
nVarsMax
<
16
);
p
->
pPars
=
pPars
;
p
->
pPars
=
pPars
;
p
->
nWords
=
Kit_TruthWordNum
(
pPars
->
nVarsMax
);
p
->
nWords
=
Kit_TruthWordNum
(
pPars
->
nVarsMax
);
p
->
nDivsLimit
=
200
;
p
->
nDivsLimit
=
200
;
...
...
src/aig/kit/kit.h
View file @
2b98b818
...
@@ -547,6 +547,9 @@ extern int Kit_GraphLeafDepth_rec( Kit_Graph_t * pGraph, Kit_Node_t
...
@@ -547,6 +547,9 @@ extern int Kit_GraphLeafDepth_rec( Kit_Graph_t * pGraph, Kit_Node_t
extern
int
Kit_TruthIsop
(
unsigned
*
puTruth
,
int
nVars
,
Vec_Int_t
*
vMemory
,
int
fTryBoth
);
extern
int
Kit_TruthIsop
(
unsigned
*
puTruth
,
int
nVars
,
Vec_Int_t
*
vMemory
,
int
fTryBoth
);
/*=== kitPla.c ==========================================================*/
/*=== kitPla.c ==========================================================*/
extern
int
Kit_PlaIsConst0
(
char
*
pSop
);
extern
int
Kit_PlaIsConst0
(
char
*
pSop
);
extern
int
Kit_PlaIsConst1
(
char
*
pSop
);
extern
int
Kit_PlaIsBuf
(
char
*
pSop
);
extern
int
Kit_PlaIsInv
(
char
*
pSop
);
extern
int
Kit_PlaGetVarNum
(
char
*
pSop
);
extern
int
Kit_PlaGetVarNum
(
char
*
pSop
);
extern
int
Kit_PlaGetCubeNum
(
char
*
pSop
);
extern
int
Kit_PlaGetCubeNum
(
char
*
pSop
);
extern
int
Kit_PlaIsComplement
(
char
*
pSop
);
extern
int
Kit_PlaIsComplement
(
char
*
pSop
);
...
...
src/aig/kit/kitHop.c
View file @
2b98b818
...
@@ -130,6 +130,7 @@ Hop_Obj_t * Kit_CoverToHop( Hop_Man_t * pMan, Vec_Int_t * vCover, int nVars, Vec
...
@@ -130,6 +130,7 @@ Hop_Obj_t * Kit_CoverToHop( Hop_Man_t * pMan, Vec_Int_t * vCover, int nVars, Vec
Kit_Graph_t
*
pGraph
;
Kit_Graph_t
*
pGraph
;
Hop_Obj_t
*
pFunc
;
Hop_Obj_t
*
pFunc
;
// perform factoring
// perform factoring
Vec_IntClear
(
vMemory
);
pGraph
=
Kit_SopFactor
(
vCover
,
0
,
nVars
,
vMemory
);
pGraph
=
Kit_SopFactor
(
vCover
,
0
,
nVars
,
vMemory
);
// convert graph to the AIG
// convert graph to the AIG
pFunc
=
Kit_GraphToHop
(
pMan
,
pGraph
);
pFunc
=
Kit_GraphToHop
(
pMan
,
pGraph
);
...
...
src/aig/kit/kitPla.c
View file @
2b98b818
...
@@ -47,6 +47,62 @@ int Kit_PlaIsConst0( char * pSop )
...
@@ -47,6 +47,62 @@ int Kit_PlaIsConst0( char * pSop )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Checks if the cover is constant 1.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Kit_PlaIsConst1
(
char
*
pSop
)
{
return
pSop
[
0
]
==
' '
&&
pSop
[
1
]
==
'1'
;
}
/**Function*************************************************************
Synopsis [Checks if the cover is a buffer.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Kit_PlaIsBuf
(
char
*
pSop
)
{
if
(
pSop
[
4
]
!=
0
)
return
0
;
if
(
(
pSop
[
0
]
==
'1'
&&
pSop
[
2
]
==
'1'
)
||
(
pSop
[
0
]
==
'0'
&&
pSop
[
2
]
==
'0'
)
)
return
1
;
return
0
;
}
/**Function*************************************************************
Synopsis [Checks if the cover is an inverter.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Kit_PlaIsInv
(
char
*
pSop
)
{
if
(
pSop
[
4
]
!=
0
)
return
0
;
if
(
(
pSop
[
0
]
==
'0'
&&
pSop
[
2
]
==
'1'
)
||
(
pSop
[
0
]
==
'1'
&&
pSop
[
2
]
==
'0'
)
)
return
1
;
return
0
;
}
/**Function*************************************************************
Synopsis [Reads the number of variables in the cover.]
Synopsis [Reads the number of variables in the cover.]
Description []
Description []
...
...
src/aig/ntl/ntl.h
View file @
2b98b818
...
@@ -198,25 +198,25 @@ static inline void Ntl_ObjSetFanout( Ntl_Obj_t * p, Ntl_Net_t * pNet, int
...
@@ -198,25 +198,25 @@ static inline void Ntl_ObjSetFanout( Ntl_Obj_t * p, Ntl_Net_t * pNet, int
for ( i = 0; (i < Vec_PtrSize(p->vNodes)) && (((pObj) = Vec_PtrEntry(p->vNodes, i)), 1); i++ ) \
for ( i = 0; (i < Vec_PtrSize(p->vNodes)) && (((pObj) = Vec_PtrEntry(p->vNodes, i)), 1); i++ ) \
if ( (pObj) == NULL || !Ntl_ObjIsBox(pObj) ) {} else
if ( (pObj) == NULL || !Ntl_ObjIsBox(pObj) ) {} else
#define Ntl_ModelForEachPi( pN
tl
, pObj, i ) \
#define Ntl_ModelForEachPi( pN
wk
, pObj, i ) \
Vec_PtrForEachEntry( pN
tl
->vPis, pObj, i )
Vec_PtrForEachEntry( pN
wk
->vPis, pObj, i )
#define Ntl_ModelForEachPo( pN
tl
, pObj, i ) \
#define Ntl_ModelForEachPo( pN
wk
, pObj, i ) \
Vec_PtrForEachEntry( pN
tl
->vPos, pObj, i )
Vec_PtrForEachEntry( pN
wk
->vPos, pObj, i )
#define Ntl_ModelForEachObj( pN
tl
, pObj, i ) \
#define Ntl_ModelForEachObj( pN
wk
, pObj, i ) \
for ( i = 0; (i < Vec_PtrSize(pN
tl->vObjs)) && (((pObj) = Vec_PtrEntry(pNtl
->vObjs, i)), 1); i++ ) \
for ( i = 0; (i < Vec_PtrSize(pN
wk->vObjs)) && (((pObj) = Vec_PtrEntry(pNwk
->vObjs, i)), 1); i++ ) \
if ( pObj == NULL ) {} else
if ( pObj == NULL ) {} else
#define Ntl_ModelForEachLatch( pN
tl
, pObj, i ) \
#define Ntl_ModelForEachLatch( pN
wk
, pObj, i ) \
for ( i = 0; (i < Vec_PtrSize(pN
tl->vObjs)) && (((pObj) = Vec_PtrEntry(pNtl
->vObjs, i)), 1); i++ ) \
for ( i = 0; (i < Vec_PtrSize(pN
wk->vObjs)) && (((pObj) = Vec_PtrEntry(pNwk
->vObjs, i)), 1); i++ ) \
if ( (pObj) == NULL || !Ntl_ObjIsLatch(pObj) ) {} else
if ( (pObj) == NULL || !Ntl_ObjIsLatch(pObj) ) {} else
#define Ntl_ModelForEachNode( pN
tl
, pObj, i ) \
#define Ntl_ModelForEachNode( pN
wk
, pObj, i ) \
for ( i = 0; (i < Vec_PtrSize(pN
tl->vObjs)) && (((pObj) = Vec_PtrEntry(pNtl
->vObjs, i)), 1); i++ ) \
for ( i = 0; (i < Vec_PtrSize(pN
wk->vObjs)) && (((pObj) = Vec_PtrEntry(pNwk
->vObjs, i)), 1); i++ ) \
if ( (pObj) == NULL || !Ntl_ObjIsNode(pObj) ) {} else
if ( (pObj) == NULL || !Ntl_ObjIsNode(pObj) ) {} else
#define Ntl_ModelForEachBox( pN
tl
, pObj, i ) \
#define Ntl_ModelForEachBox( pN
wk
, pObj, i ) \
for ( i = 0; (i < Vec_PtrSize(pN
tl->vObjs)) && (((pObj) = Vec_PtrEntry(pNtl
->vObjs, i)), 1); i++ ) \
for ( i = 0; (i < Vec_PtrSize(pN
wk->vObjs)) && (((pObj) = Vec_PtrEntry(pNwk
->vObjs, i)), 1); i++ ) \
if ( (pObj) == NULL || !Ntl_ObjIsBox(pObj) ) {} else
if ( (pObj) == NULL || !Ntl_ObjIsBox(pObj) ) {} else
#define Ntl_ModelForEachNet( pN
tl
, pNet, i ) \
#define Ntl_ModelForEachNet( pN
wk
, pNet, i ) \
for ( i = 0; i < pN
tl
->nTableSize; i++ ) \
for ( i = 0; i < pN
wk
->nTableSize; i++ ) \
for ( pNet = pN
tl
->pTable[i]; pNet; pNet = pNet->pNext )
for ( pNet = pN
wk
->pTable[i]; pNet; pNet = pNet->pNext )
#define Ntl_ObjForEachFanin( pObj, pFanin, i ) \
#define Ntl_ObjForEachFanin( pObj, pFanin, i ) \
for ( i = 0; (i < (pObj)->nFanins) && ((pFanin) = (pObj)->pFanio[i]); i++ )
for ( i = 0; (i < (pObj)->nFanins) && ((pFanin) = (pObj)->pFanio[i]); i++ )
...
@@ -296,6 +296,8 @@ extern void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName );
...
@@ -296,6 +296,8 @@ extern void Ioa_WriteBlif( Ntl_Man_t * p, char * pFileName );
extern
void
Ioa_WriteBlifLogic
(
Nwk_Man_t
*
pNtk
,
Ntl_Man_t
*
p
,
char
*
pFileName
);
extern
void
Ioa_WriteBlifLogic
(
Nwk_Man_t
*
pNtk
,
Ntl_Man_t
*
p
,
char
*
pFileName
);
/*=== ntlUtil.c ==========================================================*/
/*=== ntlUtil.c ==========================================================*/
extern
int
Ntl_ModelCountLut1
(
Ntl_Mod_t
*
pRoot
);
extern
int
Ntl_ModelCountLut1
(
Ntl_Mod_t
*
pRoot
);
extern
int
Ntl_ModelGetFaninMax
(
Ntl_Mod_t
*
pRoot
);
extern
Ntl_Net_t
*
Ntl_ModelFindSimpleNet
(
Ntl_Net_t
*
pNetCo
);
extern
int
Ntl_ManCountSimpleCoDrivers
(
Ntl_Man_t
*
p
);
extern
int
Ntl_ManCountSimpleCoDrivers
(
Ntl_Man_t
*
p
);
extern
Vec_Ptr_t
*
Ntl_ManCollectCiNames
(
Ntl_Man_t
*
p
);
extern
Vec_Ptr_t
*
Ntl_ManCollectCiNames
(
Ntl_Man_t
*
p
);
extern
Vec_Ptr_t
*
Ntl_ManCollectCoNames
(
Ntl_Man_t
*
p
);
extern
Vec_Ptr_t
*
Ntl_ManCollectCoNames
(
Ntl_Man_t
*
p
);
...
...
src/aig/ntl/ntlExtract.c
View file @
2b98b818
...
@@ -277,7 +277,7 @@ Aig_Man_t * Ntl_ManExtract( Ntl_Man_t * p )
...
@@ -277,7 +277,7 @@ Aig_Man_t * Ntl_ManExtract( Ntl_Man_t * p )
Vec_PtrPush
(
p
->
vCos
,
pNet
);
Vec_PtrPush
(
p
->
vCos
,
pNet
);
Aig_ObjCreatePo
(
p
->
pAig
,
pNet
->
pCopy
);
Aig_ObjCreatePo
(
p
->
pAig
,
pNet
->
pCopy
);
}
}
// visit the nodes starting from latch inputs
outputs
// visit the nodes starting from latch inputs
Ntl_ModelForEachLatch
(
pRoot
,
pObj
,
i
)
Ntl_ModelForEachLatch
(
pRoot
,
pObj
,
i
)
{
{
pNet
=
Ntl_ObjFanin0
(
pObj
);
pNet
=
Ntl_ObjFanin0
(
pObj
);
...
@@ -777,21 +777,22 @@ Nwk_Obj_t * Ntl_ManExtractNwk_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, Nwk_Man_t *
...
@@ -777,21 +777,22 @@ Nwk_Obj_t * Ntl_ManExtractNwk_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, Nwk_Man_t *
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Nwk_Man_t
*
Ntl_ManExtractNwk
(
Ntl_Man_t
*
p
,
Aig_Man_t
*
pAig
)
Nwk_Man_t
*
Ntl_ManExtractNwk
(
Ntl_Man_t
*
p
,
Aig_Man_t
*
pAig
,
Tim_Man_t
*
pManTime
)
{
{
Nwk_Man_t
*
pNtk
;
Nwk_Man_t
*
pNtk
;
Nwk_Obj_t
*
pNode
;
Nwk_Obj_t
*
pNode
;
Ntl_Mod_t
*
pRoot
;
Ntl_Mod_t
*
pRoot
;
Ntl_Net_t
*
pNet
;
Ntl_Net_t
*
pNet
,
*
pNetSimple
;
Ntl_Obj_t
*
pObj
;
Ntl_Obj_t
*
pObj
;
Aig_Obj_t
*
pAnd
;
Aig_Obj_t
*
pAnd
;
Vec_Int_t
*
vCover
,
*
vMemory
;
Vec_Int_t
*
vCover
,
*
vMemory
;
int
i
,
k
;
int
i
,
k
;
pRoot
=
Ntl_ManRootModel
(
p
);
pRoot
=
Ntl_ManRootModel
(
p
);
assert
(
Ntl_ModelBoxNum
(
pRoot
)
==
0
);
if
(
Ntl_ModelGetFaninMax
(
pRoot
)
>
6
)
assert
(
Ntl_ModelLatchNum
(
pRoot
)
==
0
);
{
assert
(
Ntl_ModelPiNum
(
pRoot
)
==
Aig_ManPiNum
(
pAig
)
);
printf
(
"The network contains logic nodes with more than 6 inputs.
\n
"
);
assert
(
Ntl_ModelPoNum
(
pRoot
)
==
Aig_ManPoNum
(
pAig
)
);
return
NULL
;
}
vCover
=
Vec_IntAlloc
(
100
);
vCover
=
Vec_IntAlloc
(
100
);
vMemory
=
Vec_IntAlloc
(
1
<<
16
);
vMemory
=
Vec_IntAlloc
(
1
<<
16
);
// count the number of fanouts of each net
// count the number of fanouts of each net
...
@@ -803,30 +804,59 @@ Nwk_Man_t * Ntl_ManExtractNwk( Ntl_Man_t * p, Aig_Man_t * pAig )
...
@@ -803,30 +804,59 @@ Nwk_Man_t * Ntl_ManExtractNwk( Ntl_Man_t * p, Aig_Man_t * pAig )
Ntl_ModelForEachObj
(
pRoot
,
pObj
,
i
)
Ntl_ModelForEachObj
(
pRoot
,
pObj
,
i
)
Ntl_ObjForEachFanin
(
pObj
,
pNet
,
k
)
Ntl_ObjForEachFanin
(
pObj
,
pNet
,
k
)
Ntl_NetIncrementRefs
(
pNet
);
Ntl_NetIncrementRefs
(
pNet
);
// remember netlist objects int the AIG nodes
if
(
pManTime
!=
NULL
)
// logic netlist
{
assert
(
Ntl_ModelPiNum
(
pRoot
)
==
Aig_ManPiNum
(
pAig
)
);
assert
(
Ntl_ModelPoNum
(
pRoot
)
==
Aig_ManPoNum
(
pAig
)
);
Aig_ManForEachPi
(
pAig
,
pAnd
,
i
)
pAnd
->
pData
=
Ntl_ObjFanout0
(
Ntl_ModelPi
(
pRoot
,
i
)
);
Aig_ManForEachPo
(
pAig
,
pAnd
,
i
)
pAnd
->
pData
=
Ntl_ObjFanin0
(
Ntl_ModelPo
(
pRoot
,
i
)
);
}
else
// real netlist
{
assert
(
p
->
vCis
&&
p
->
vCos
);
Aig_ManForEachPi
(
pAig
,
pAnd
,
i
)
pAnd
->
pData
=
Vec_PtrEntry
(
p
->
vCis
,
i
);
Aig_ManForEachPo
(
pAig
,
pAnd
,
i
)
pAnd
->
pData
=
Vec_PtrEntry
(
p
->
vCos
,
i
);
}
// construct the network
// construct the network
pNtk
=
Nwk_ManAlloc
();
pNtk
=
Nwk_ManAlloc
();
pNtk
->
pName
=
Aig_UtilStrsav
(
pAig
->
pName
);
pNtk
->
pName
=
Aig_UtilStrsav
(
pAig
->
pName
);
pNtk
->
pSpec
=
Aig_UtilStrsav
(
pAig
->
pSpec
);
pNtk
->
pSpec
=
Aig_UtilStrsav
(
pAig
->
pSpec
);
Aig_ManSetPioNumbers
(
pAig
);
//
Aig_ManSetPioNumbers( pAig );
Aig_ManForEachObj
(
pAig
,
pAnd
,
i
)
Aig_ManForEachObj
(
pAig
,
pAnd
,
i
)
{
{
if
(
Aig_ObjIsPi
(
pAnd
)
)
if
(
Aig_ObjIsPi
(
pAnd
)
)
{
{
pObj
=
Ntl_ModelPi
(
pRoot
,
Aig_ObjPioNum
(
pAnd
)
);
// pObj = Ntl_ModelPi( pRoot, Aig_ObjPioNum(pAnd) );
pNet
=
Ntl_ObjFanout0
(
pObj
);
// pNet = Ntl_ObjFanout0(pObj);
pNet
=
pAnd
->
pData
;
pNet
->
fMark
=
1
;
pNet
->
fMark
=
1
;
pNet
->
pCopy
=
Nwk_ManCreateCi
(
pNtk
,
(
int
)(
long
)
pNet
->
pCopy
);
pNet
->
pCopy
=
Nwk_ManCreateCi
(
pNtk
,
(
int
)(
long
)
pNet
->
pCopy
);
}
}
else
if
(
Aig_ObjIsPo
(
pAnd
)
)
else
if
(
Aig_ObjIsPo
(
pAnd
)
)
{
{
pObj
=
Ntl_ModelPo
(
pRoot
,
Aig_ObjPioNum
(
pAnd
)
);
//
pObj = Ntl_ModelPo( pRoot, Aig_ObjPioNum(pAnd) );
pNet
=
Ntl_ObjFanin0
(
pObj
);
//
pNet = Ntl_ObjFanin0(pObj);
pNet
->
pCopy
=
Ntl_ManExtractNwk_rec
(
p
,
pNet
,
pNtk
,
vCover
,
vMemory
);
pNet
=
pAnd
->
pData
;
pNode
=
Nwk_ManCreateCo
(
pNtk
);
pNode
=
Nwk_ManCreateCo
(
pNtk
);
if
(
(
pNetSimple
=
Ntl_ModelFindSimpleNet
(
pNet
))
)
{
pNetSimple
->
pCopy
=
Ntl_ManExtractNwk_rec
(
p
,
pNetSimple
,
pNtk
,
vCover
,
vMemory
);
Nwk_ObjAddFanin
(
pNode
,
pNetSimple
->
pCopy
);
pNode
->
fInvert
=
Kit_PlaIsInv
(
pNet
->
pDriver
->
pSop
);
}
else
{
pNet
->
pCopy
=
Ntl_ManExtractNwk_rec
(
p
,
pNet
,
pNtk
,
vCover
,
vMemory
);
Nwk_ObjAddFanin
(
pNode
,
pNet
->
pCopy
);
Nwk_ObjAddFanin
(
pNode
,
pNet
->
pCopy
);
}
}
}
}
Aig_ManCleanPioNumbers
(
pAig
);
}
// Aig_ManCleanPioNumbers( pAig );
Ntl_ModelForEachNet
(
pRoot
,
pNet
,
i
)
Ntl_ModelForEachNet
(
pRoot
,
pNet
,
i
)
{
{
pNet
->
pCopy
=
NULL
;
pNet
->
pCopy
=
NULL
;
...
@@ -835,6 +865,10 @@ Nwk_Man_t * Ntl_ManExtractNwk( Ntl_Man_t * p, Aig_Man_t * pAig )
...
@@ -835,6 +865,10 @@ Nwk_Man_t * Ntl_ManExtractNwk( Ntl_Man_t * p, Aig_Man_t * pAig )
Vec_IntFree
(
vCover
);
Vec_IntFree
(
vCover
);
Vec_IntFree
(
vMemory
);
Vec_IntFree
(
vMemory
);
// create timing manager from the current design
// create timing manager from the current design
if
(
pManTime
)
pNtk
->
pManTime
=
Tim_ManDup
(
pManTime
,
0
);
else
pNtk
->
pManTime
=
Tim_ManDup
(
p
->
pManTime
,
0
);
return
pNtk
;
return
pNtk
;
}
}
...
@@ -861,6 +895,16 @@ Nwk_Man_t * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pMan
...
@@ -861,6 +895,16 @@ Nwk_Man_t * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pMan
return
NULL
;
return
NULL
;
}
}
pRoot
=
Ntl_ManRootModel
(
pNtl
);
pRoot
=
Ntl_ManRootModel
(
pNtl
);
if
(
Ntl_ModelLatchNum
(
pRoot
)
!=
0
)
{
printf
(
"Ntl_ManReadNwk(): The input network has %d registers.
\n
"
,
Ntl_ModelLatchNum
(
pRoot
)
);
return
NULL
;
}
if
(
Ntl_ModelBoxNum
(
pRoot
)
!=
0
)
{
printf
(
"Ntl_ManReadNwk(): The input network has %d boxes.
\n
"
,
Ntl_ModelBoxNum
(
pRoot
)
);
return
NULL
;
}
if
(
Ntl_ModelPiNum
(
pRoot
)
!=
Aig_ManPiNum
(
pAig
)
)
if
(
Ntl_ModelPiNum
(
pRoot
)
!=
Aig_ManPiNum
(
pAig
)
)
{
{
printf
(
"Ntl_ManReadNwk(): The number of primary inputs does not match (%d and %d).
\n
"
,
printf
(
"Ntl_ManReadNwk(): The number of primary inputs does not match (%d and %d).
\n
"
,
...
@@ -873,10 +917,8 @@ Nwk_Man_t * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pMan
...
@@ -873,10 +917,8 @@ Nwk_Man_t * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pMan
Ntl_ModelPoNum
(
pRoot
),
Aig_ManPoNum
(
pAig
)
);
Ntl_ModelPoNum
(
pRoot
),
Aig_ManPoNum
(
pAig
)
);
return
NULL
;
return
NULL
;
}
}
pNtk
=
Ntl_ManExtractNwk
(
pNtl
,
pAig
);
pNtk
=
Ntl_ManExtractNwk
(
pNtl
,
pAig
,
pManTime
);
Ntl_ManFree
(
pNtl
);
Ntl_ManFree
(
pNtl
);
if
(
pManTime
)
pNtk
->
pManTime
=
Tim_ManDup
(
pManTime
,
0
);
return
pNtk
;
return
pNtk
;
}
}
...
...
src/aig/ntl/ntlUtil.c
View file @
2b98b818
...
@@ -51,6 +51,51 @@ int Ntl_ModelCountLut1( Ntl_Mod_t * pRoot )
...
@@ -51,6 +51,51 @@ int Ntl_ModelCountLut1( Ntl_Mod_t * pRoot )
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Reads the maximum number of fanins.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Ntl_ModelGetFaninMax
(
Ntl_Mod_t
*
pRoot
)
{
Ntl_Obj_t
*
pNode
;
int
i
,
nFaninsMax
=
0
;
Ntl_ModelForEachNode
(
pRoot
,
pNode
,
i
)
{
if
(
nFaninsMax
<
Ntl_ObjFaninNum
(
pNode
)
)
nFaninsMax
=
Ntl_ObjFaninNum
(
pNode
);
}
return
nFaninsMax
;
}
/**Function*************************************************************
Synopsis [If the net is driven by an inv/buf, returns its fanin.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Ntl_Net_t
*
Ntl_ModelFindSimpleNet
(
Ntl_Net_t
*
pNetCo
)
{
// skip the case when the net is not driven by a node
if
(
!
Ntl_ObjIsNode
(
pNetCo
->
pDriver
)
)
return
NULL
;
// skip the case when the node is not an inv/buf
if
(
Ntl_ObjFaninNum
(
pNetCo
->
pDriver
)
!=
1
)
return
NULL
;
return
Ntl_ObjFanin0
(
pNetCo
->
pDriver
);
}
/**Function*************************************************************
Synopsis [Connects COs to the internal nodes other than inv/bufs.]
Synopsis [Connects COs to the internal nodes other than inv/bufs.]
Description [Should be called immediately after reading from file.]
Description [Should be called immediately after reading from file.]
...
...
src/aig/nwk/nwkDfs.c
View file @
2b98b818
...
@@ -267,8 +267,8 @@ Vec_Vec_t * Nwk_ManLevelize( Nwk_Man_t * pNtk )
...
@@ -267,8 +267,8 @@ Vec_Vec_t * Nwk_ManLevelize( Nwk_Man_t * pNtk )
vLevels
=
Vec_VecStart
(
nLevels
+
1
);
vLevels
=
Vec_VecStart
(
nLevels
+
1
);
Nwk_ManForEachNode
(
pNtk
,
pObj
,
i
)
Nwk_ManForEachNode
(
pNtk
,
pObj
,
i
)
{
{
assert
(
(
int
)
pObj
->
tArrival
<=
nLevels
);
assert
(
Nwk_ObjLevel
(
pObj
)
<=
nLevels
);
Vec_VecPush
(
vLevels
,
(
int
)
pObj
->
tArrival
,
pObj
);
Vec_VecPush
(
vLevels
,
Nwk_ObjLevel
(
pObj
)
,
pObj
);
}
}
return
vLevels
;
return
vLevels
;
}
}
...
...
src/aig/nwk/nwkMan.c
View file @
2b98b818
...
@@ -118,6 +118,7 @@ void Nwk_ManPrintLutSizes( Nwk_Man_t * p, If_Lib_t * pLutLib )
...
@@ -118,6 +118,7 @@ void Nwk_ManPrintLutSizes( Nwk_Man_t * p, If_Lib_t * pLutLib )
int
Nwk_ManCompareAndSaveBest
(
Nwk_Man_t
*
pNtk
,
void
*
pNtl
)
int
Nwk_ManCompareAndSaveBest
(
Nwk_Man_t
*
pNtk
,
void
*
pNtl
)
{
{
extern
void
Ioa_WriteBlifLogic
(
Nwk_Man_t
*
pNtk
,
void
*
pNtl
,
char
*
pFileName
);
extern
void
Ioa_WriteBlifLogic
(
Nwk_Man_t
*
pNtk
,
void
*
pNtl
,
char
*
pFileName
);
extern
void
Nwk_ManDumpBlif
(
Nwk_Man_t
*
pNtk
,
char
*
pFileName
,
Vec_Ptr_t
*
vPiNames
,
Vec_Ptr_t
*
vPoNames
);
static
struct
ParStruct
{
static
struct
ParStruct
{
char
*
pName
;
// name of the best saved network
char
*
pName
;
// name of the best saved network
int
Depth
;
// depth of the best saved network
int
Depth
;
// depth of the best saved network
...
@@ -154,6 +155,7 @@ int Nwk_ManCompareAndSaveBest( Nwk_Man_t * pNtk, void * pNtl )
...
@@ -154,6 +155,7 @@ int Nwk_ManCompareAndSaveBest( Nwk_Man_t * pNtk, void * pNtl )
ParsBest
.
nPos
=
ParsNew
.
nPos
;
ParsBest
.
nPos
=
ParsNew
.
nPos
;
// writ the network
// writ the network
Ioa_WriteBlifLogic
(
pNtk
,
pNtl
,
"best.blif"
);
Ioa_WriteBlifLogic
(
pNtk
,
pNtl
,
"best.blif"
);
// Nwk_ManDumpBlif( pNtk, "best_map.blif", NULL, NULL );
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -211,6 +213,8 @@ void Nwk_ManPrintStats( Nwk_Man_t * pNtk, If_Lib_t * pLutLib, int fSaveBest, int
...
@@ -211,6 +213,8 @@ void Nwk_ManPrintStats( Nwk_Man_t * pNtk, If_Lib_t * pLutLib, int fSaveBest, int
char
*
pNameGen
=
pNtk
->
pSpec
?
Nwk_FileNameGeneric
(
pNtk
->
pSpec
)
:
"nameless_"
;
char
*
pNameGen
=
pNtk
->
pSpec
?
Nwk_FileNameGeneric
(
pNtk
->
pSpec
)
:
"nameless_"
;
sprintf
(
Buffer
,
"%s_dump.blif"
,
pNameGen
);
sprintf
(
Buffer
,
"%s_dump.blif"
,
pNameGen
);
Ioa_WriteBlifLogic
(
pNtk
,
pNtl
,
Buffer
);
Ioa_WriteBlifLogic
(
pNtk
,
pNtl
,
Buffer
);
// sprintf( Buffer, "%s_dump_map.blif", pNameGen );
// Nwk_ManDumpBlif( pNtk, Buffer, NULL, NULL );
if
(
pNtk
->
pSpec
)
free
(
pNameGen
);
if
(
pNtk
->
pSpec
)
free
(
pNameGen
);
}
}
...
...
src/base/abci/abc.c
View file @
2b98b818
...
@@ -14874,16 +14874,21 @@ int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -14874,16 +14874,21 @@ int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv )
FILE
*
pFile
;
FILE
*
pFile
;
char
*
pFileName
;
char
*
pFileName
;
int
c
;
int
c
;
int
fMapped
;
extern
void
*
Ioa_ReadBlif
(
char
*
pFileName
,
int
fCheck
);
extern
void
*
Ioa_ReadBlif
(
char
*
pFileName
,
int
fCheck
);
extern
Aig_Man_t
*
Ntl_ManExtract
(
void
*
p
);
extern
Aig_Man_t
*
Ntl_ManExtract
(
void
*
p
);
extern
void
*
Ntl_ManExtractNwk
(
void
*
p
,
Aig_Man_t
*
pAig
,
Tim_Man_t
*
pManTime
);
// set defaults
// set defaults
fMapped
=
0
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"h"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"
m
h"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
case
'm'
:
fMapped
^=
1
;
break
;
case
'h'
:
case
'h'
:
goto
usage
;
goto
usage
;
default:
default:
...
@@ -14916,12 +14921,18 @@ int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -14916,12 +14921,18 @@ int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv )
printf
(
"Abc_CommandAbc8Read(): AIG extraction has failed.
\n
"
);
printf
(
"Abc_CommandAbc8Read(): AIG extraction has failed.
\n
"
);
return
1
;
return
1
;
}
}
if
(
fMapped
)
{
pAbc
->
pAbc8Nwk
=
Ntl_ManExtractNwk
(
pAbc
->
pAbc8Ntl
,
pAbc
->
pAbc8Aig
,
NULL
);
if
(
pAbc
->
pAbc8Nwk
==
NULL
)
printf
(
"Abc_CommandAbc8Read(): Warning! Mapped network is not extracted.
\n
"
);
}
return
0
;
return
0
;
usage:
usage:
fprintf
(
stdout
,
"usage: *r [-h]
\n
"
);
fprintf
(
stdout
,
"usage: *r [-
m
h]
\n
"
);
fprintf
(
stdout
,
"
\t
reads the design with whiteboxes
\n
"
);
fprintf
(
stdout
,
"
\t
reads the design with whiteboxes
\n
"
);
fprintf
(
stdout
,
"
\t
-m : toggle extracting mapped network [default = %s]
\n
"
,
fMapped
?
"yes"
:
"no"
);
fprintf
(
stdout
,
"
\t
-h : print the command usage
\n
"
);
fprintf
(
stdout
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -15365,6 +15376,11 @@ int Abc_CommandAbc8Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -15365,6 +15376,11 @@ int Abc_CommandAbc8Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
}
}
if
(
pAbc
->
pAbc8Nwk
)
if
(
pAbc
->
pAbc8Nwk
)
{
{
if
(
pAbc
->
pAbc8Lib
==
NULL
)
{
printf
(
"LUT library is not given. Using default 6-LUT library.
\n
"
);
pAbc
->
pAbc8Lib
=
If_SetSimpleLutLib
(
6
);
}
printf
(
"MAPPED: "
);
printf
(
"MAPPED: "
);
Nwk_ManPrintStats
(
pAbc
->
pAbc8Nwk
,
pAbc
->
pAbc8Lib
,
fSaveBest
,
fDumpResult
,
pAbc
->
pAbc8Ntl
);
Nwk_ManPrintStats
(
pAbc
->
pAbc8Nwk
,
pAbc
->
pAbc8Lib
,
fSaveBest
,
fDumpResult
,
pAbc
->
pAbc8Ntl
);
}
}
...
...
src/map/if/ifMap.c
View file @
2b98b818
...
@@ -88,7 +88,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
...
@@ -88,7 +88,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
{
{
// recompute the parameters of the best cut
// recompute the parameters of the best cut
pCut
->
Delay
=
If_CutDelay
(
p
,
pCut
);
pCut
->
Delay
=
If_CutDelay
(
p
,
pCut
);
assert
(
pCut
->
Delay
<=
pObj
->
Required
+
p
->
fEpsilon
);
// assert( pCut->Delay <= pObj->Required + p->fEpsilon );
if
(
pCut
->
Delay
>
pObj
->
Required
+
p
->
fEpsilon
)
printf
(
"If_ObjPerformMappingAnd(): Warning! Delay of node %d (%f) exceeds the required times (%f).
\n
"
,
pObj
->
Id
,
pCut
->
Delay
,
pObj
->
Required
+
p
->
fEpsilon
);
pCut
->
Area
=
(
Mode
==
2
)
?
If_CutAreaDerefed
(
p
,
pCut
)
:
If_CutAreaFlow
(
p
,
pCut
);
pCut
->
Area
=
(
Mode
==
2
)
?
If_CutAreaDerefed
(
p
,
pCut
)
:
If_CutAreaFlow
(
p
,
pCut
);
if
(
p
->
pPars
->
fEdge
)
if
(
p
->
pPars
->
fEdge
)
pCut
->
Edge
=
(
Mode
==
2
)
?
If_CutEdgeDerefed
(
p
,
pCut
)
:
If_CutEdgeFlow
(
p
,
pCut
);
pCut
->
Edge
=
(
Mode
==
2
)
?
If_CutEdgeDerefed
(
p
,
pCut
)
:
If_CutEdgeFlow
(
p
,
pCut
);
...
...
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