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
62a6152b
Commit
62a6152b
authored
Sep 29, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with mini AIG manager.
parent
74c9a068
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
66 deletions
+76
-66
abclib.dsp
+4
-0
src/base/abci/abcMini.c
+72
-66
No files found.
abclib.dsp
View file @
62a6152b
...
@@ -177,6 +177,10 @@ SOURCE=.\src\base\abc\abcSop.c
...
@@ -177,6 +177,10 @@ SOURCE=.\src\base\abc\abcSop.c
SOURCE=.\src\base\abc\abcUtil.c
SOURCE=.\src\base\abc\abcUtil.c
# End Source File
# End Source File
# Begin Source File
SOURCE=.\src\base\abc\miniaig.h
# End Source File
# End Group
# End Group
# Begin Group "abci"
# Begin Group "abci"
...
...
src/base/abci/abcMini.c
View file @
62a6152b
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
***********************************************************************/
***********************************************************************/
#include "base/abc/abc.h"
#include "base/abc/abc.h"
#include "base/main/main.h"
#include "base/abc/miniaig.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -27,8 +29,8 @@ ABC_NAMESPACE_IMPL_START
...
@@ -27,8 +29,8 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
static
Hop_Man
_t
*
Abc_NtkToMini
(
Abc_Ntk_t
*
pNtk
);
static
Mini_Aig
_t
*
Abc_NtkToMini
(
Abc_Ntk_t
*
pNtk
);
static
Abc_Ntk_t
*
Abc_NtkFromMini
(
Abc_Ntk_t
*
pNtkOld
,
Hop_Man_t
*
pMan
);
static
Abc_Ntk_t
*
Abc_NtkFromMini
(
Abc_Ntk_t
*
pNtkOld
,
Mini_Aig_t
*
p
);
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
...
@@ -36,7 +38,7 @@ static Abc_Ntk_t * Abc_NtkFromMini( Abc_Ntk_t * pNtkOld, Hop_Man_t * pMan );
...
@@ -36,7 +38,7 @@ static Abc_Ntk_t * Abc_NtkFromMini( Abc_Ntk_t * pNtkOld, Hop_Man_t * pMan );
/**Function*************************************************************
/**Function*************************************************************
Synopsis [
Gives the current ABC network to AIG manager for processing
.]
Synopsis [
Converts the network from the AIG manager into ABC
.]
Description []
Description []
...
@@ -45,40 +47,55 @@ static Abc_Ntk_t * Abc_NtkFromMini( Abc_Ntk_t * pNtkOld, Hop_Man_t * pMan );
...
@@ -45,40 +47,55 @@ static Abc_Ntk_t * Abc_NtkFromMini( Abc_Ntk_t * pNtkOld, Hop_Man_t * pMan );
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Abc_
Ntk_t
*
Abc_NtkMiniBalance
(
Abc_Ntk_t
*
pNtk
)
Abc_
Obj_t
*
Abc_NodeFanin0Copy
(
Abc_Ntk_t
*
pNtk
,
Vec_Int_t
*
vCopies
,
Mini_Aig_t
*
p
,
int
Id
)
{
{
Abc_Ntk_t
*
pNtkAig
;
int
Lit
=
Mini_AigNodeFanin0
(
p
,
Id
);
Hop_Man_t
*
pMan
,
*
pTemp
;
Lit
=
Abc_LitNotCond
(
Vec_IntEntry
(
vCopies
,
Abc_Lit2Var
(
Lit
)),
Abc_LitIsCompl
(
Lit
)
);
assert
(
Abc_NtkIsStrash
(
pNtk
)
);
return
Abc_ObjNotCond
(
Abc_NtkObj
(
pNtk
,
Abc_Lit2Var
(
Lit
)),
Abc_LitIsCompl
(
Lit
)
);
// convert to the AIG manager
}
pMan
=
Abc_NtkToMini
(
pNtk
);
Abc_Obj_t
*
Abc_NodeFanin1Copy
(
Abc_Ntk_t
*
pNtk
,
Vec_Int_t
*
vCopies
,
Mini_Aig_t
*
p
,
int
Id
)
if
(
pMan
==
NULL
)
{
return
NULL
;
int
Lit
=
Mini_AigNodeFanin1
(
p
,
Id
);
if
(
!
Hop_ManCheck
(
pMan
)
)
Lit
=
Abc_LitNotCond
(
Vec_IntEntry
(
vCopies
,
Abc_Lit2Var
(
Lit
)),
Abc_LitIsCompl
(
Lit
)
);
{
return
Abc_ObjNotCond
(
Abc_NtkObj
(
pNtk
,
Abc_Lit2Var
(
Lit
)),
Abc_LitIsCompl
(
Lit
)
);
printf
(
"AIG check has failed.
\n
"
);
}
Hop_ManStop
(
pMan
);
int
Abc_NodeToLit
(
Abc_Obj_t
*
pObj
)
return
NULL
;
{
}
return
Abc_LitNotCond
(
Abc_ObjId
(
Abc_ObjRegular
(
pObj
)),
Abc_ObjIsComplement
(
pObj
)
);
// perform balance
}
Hop_ManPrintStats
(
pMan
);
// Hop_ManDumpBlif( pMan, "aig_temp.blif" );
Abc_Ntk_t
*
Abc_NtkFromMiniAig
(
Mini_Aig_t
*
p
)
pMan
=
Hop_ManBalance
(
pTemp
=
pMan
,
1
);
{
Hop_ManStop
(
pTemp
);
Abc_Ntk_t
*
pNtk
;
Hop_ManPrintStats
(
pMan
);
Abc_Obj_t
*
pObj
;
// convert from the AIG manager
Vec_Int_t
*
vCopies
;
pNtkAig
=
Abc_NtkFromMini
(
pNtk
,
pMan
);
int
i
,
nNodes
;
if
(
pNtkAig
==
NULL
)
// get the number of nodes
return
NULL
;
nNodes
=
Mini_AigNumNodes
(
p
);
Hop_ManStop
(
pMan
);
// create ABC network
// make sure everything is okay
pNtk
=
Abc_NtkAlloc
(
ABC_NTK_STRASH
,
ABC_FUNC_AIG
,
1
);
if
(
!
Abc_NtkCheck
(
pNtkAig
)
)
// create mapping from MiniAIG into ABC objects
vCopies
=
Vec_IntAlloc
(
nNodes
);
Vec_IntPush
(
vCopies
,
Abc_LitNot
(
Abc_NodeToLit
(
Abc_AigConst1
(
pNtk
)))
);
// iterate through the objects
for
(
i
=
1
;
i
<
nNodes
;
i
++
)
{
{
printf
(
"Abc_NtkStrash: The network check has failed.
\n
"
);
if
(
Mini_AigNodeIsPi
(
p
,
i
)
)
Abc_NtkDelete
(
pNtkAig
);
pObj
=
Abc_NtkCreatePi
(
pNtk
);
return
NULL
;
else
if
(
Mini_AigNodeIsPo
(
p
,
i
)
)
Abc_ObjAddFanin
(
(
pObj
=
Abc_NtkCreatePo
(
pNtk
)),
Abc_NodeFanin0Copy
(
pNtk
,
vCopies
,
p
,
i
)
);
else
if
(
Mini_AigNodeIsAnd
(
p
,
i
)
)
pObj
=
Abc_AigAnd
((
Abc_Aig_t
*
)
pNtk
->
pManFunc
,
Abc_NodeFanin0Copy
(
pNtk
,
vCopies
,
p
,
i
),
Abc_NodeFanin1Copy
(
pNtk
,
vCopies
,
p
,
i
));
else
assert
(
0
);
Vec_IntPush
(
vCopies
,
Abc_NodeToLit
(
pObj
)
);
}
}
return
pNtkAig
;
Abc_AigCleanup
(
(
Abc_Aig_t
*
)
pNtk
->
pManFunc
);
Vec_IntFree
(
vCopies
);
Abc_NtkAddDummyPiNames
(
pNtk
);
Abc_NtkAddDummyPoNames
(
pNtk
);
if
(
!
Abc_NtkCheck
(
pNtk
)
)
fprintf
(
stdout
,
"Abc_NtkFromMini(): Network check has failed.
\n
"
);
return
pNtk
;
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -92,30 +109,32 @@ Abc_Ntk_t * Abc_NtkMiniBalance( Abc_Ntk_t * pNtk )
...
@@ -92,30 +109,32 @@ Abc_Ntk_t * Abc_NtkMiniBalance( Abc_Ntk_t * pNtk )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Hop_Man_t
*
Abc_NtkToMini
(
Abc_Ntk_t
*
pNtk
)
Mini_Aig_t
*
Abc_NtkToMiniAig
(
Abc_Ntk_t
*
pNtk
)
{
{
Hop_Man_t
*
pMan
;
Mini_Aig_t
*
p
=
NULL
;
/*
Abc_Obj_t * pObj;
Abc_Obj_t * pObj;
int i;
int i;
// create the manager
// create the manager
p
Man
=
Hop_ManStart
();
p = Hop_ManStart();
// transfer the pointers to the basic nodes
// transfer the pointers to the basic nodes
Abc_AigConst1
(
pNtk
)
->
pCopy
=
(
Abc_Obj_t
*
)
Hop_ManConst1
(
p
Man
);
Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)Hop_ManConst1(p);
Abc_NtkForEachCi( pNtk, pObj, i )
Abc_NtkForEachCi( pNtk, pObj, i )
pObj
->
pCopy
=
(
Abc_Obj_t
*
)
Hop_ObjCreatePi
(
p
Man
);
pObj->pCopy = (Abc_Obj_t *)Hop_ObjCreatePi(p);
// perform the conversion of the internal nodes (assumes DFS ordering)
// perform the conversion of the internal nodes (assumes DFS ordering)
Abc_NtkForEachNode( pNtk, pObj, i )
Abc_NtkForEachNode( pNtk, pObj, i )
pObj
->
pCopy
=
(
Abc_Obj_t
*
)
Hop_And
(
p
Man
,
(
Hop_Obj_t
*
)
Abc_ObjChild0Copy
(
pObj
),
(
Hop_Obj_t
*
)
Abc_ObjChild1Copy
(
pObj
)
);
pObj->pCopy = (Abc_Obj_t *)Hop_And( p, (Hop_Obj_t *)Abc_ObjChild0Copy(pObj), (Hop_Obj_t *)Abc_ObjChild1Copy(pObj) );
// create the POs
// create the POs
Abc_NtkForEachCo( pNtk, pObj, i )
Abc_NtkForEachCo( pNtk, pObj, i )
Hop_ObjCreatePo
(
pMan
,
(
Hop_Obj_t
*
)
Abc_ObjChild0Copy
(
pObj
)
);
Hop_ObjCreatePo( p, (Hop_Obj_t *)Abc_ObjChild0Copy(pObj) );
Hop_ManCleanup
(
pMan
);
Hop_ManCleanup( p );
return
pMan
;
*/
return
p
;
}
}
/**Function*************************************************************
/**Function*************************************************************
Synopsis [
Converts the network from the AIG manager into ABC.
]
Synopsis []
Description []
Description []
...
@@ -124,31 +143,18 @@ Hop_Man_t * Abc_NtkToMini( Abc_Ntk_t * pNtk )
...
@@ -124,31 +143,18 @@ Hop_Man_t * Abc_NtkToMini( Abc_Ntk_t * pNtk )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkFromMini
(
Abc_Ntk_t
*
pNtk
,
Hop_Man_t
*
pMan
)
void
Abc_NtkInputMiniAig
(
Mini_Aig_t
*
p
)
{
{
Vec_Ptr_t
*
vNodes
;
Abc_Ntk_t
*
pNtk
;
Abc_Ntk_t
*
pNtkNew
;
Abc_Frame_t
*
pAbc
=
Abc_FrameReadGlobalFrame
();
Hop_Obj_t
*
pObj
;
if
(
pAbc
==
NULL
)
int
i
;
printf
(
"ABC framework is not initialized by calling Abc_Start()
\n
"
);
// perform strashing
pNtk
=
Abc_NtkFromMiniAig
(
p
);
pNtkNew
=
Abc_NtkStartFrom
(
pNtk
,
ABC_NTK_STRASH
,
ABC_FUNC_AIG
);
Abc_FrameReplaceCurrentNetwork
(
pAbc
,
pNtk
);
// transfer the pointers to the basic nodes
// Abc_NtkDelete( pNtk );
Hop_ManConst1
(
pMan
)
->
pData
=
Abc_AigConst1
(
pNtkNew
);
Hop_ManForEachPi
(
pMan
,
pObj
,
i
)
pObj
->
pData
=
Abc_NtkCi
(
pNtkNew
,
i
);
// rebuild the AIG
vNodes
=
Hop_ManDfs
(
pMan
);
Vec_PtrForEachEntry
(
Hop_Obj_t
*
,
vNodes
,
pObj
,
i
)
pObj
->
pData
=
Abc_AigAnd
(
(
Abc_Aig_t
*
)
pNtkNew
->
pManFunc
,
(
Abc_Obj_t
*
)
Hop_ObjChild0Copy
(
pObj
),
(
Abc_Obj_t
*
)
Hop_ObjChild1Copy
(
pObj
)
);
Vec_PtrFree
(
vNodes
);
// connect the PO nodes
Hop_ManForEachPo
(
pMan
,
pObj
,
i
)
Abc_ObjAddFanin
(
Abc_NtkCo
(
pNtkNew
,
i
),
(
Abc_Obj_t
*
)
Hop_ObjChild0Copy
(
pObj
)
);
if
(
!
Abc_NtkCheck
(
pNtkNew
)
)
fprintf
(
stdout
,
"Abc_NtkFromMini(): Network check has failed.
\n
"
);
return
pNtkNew
;
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
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