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
8f74276e
Commit
8f74276e
authored
Sep 22, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial changes to enable gate-level abstraction.
parent
81b040e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
141 additions
and
57 deletions
+141
-57
src/aig/gia/gia.h
+4
-2
src/aig/gia/giaAbs.c
+2
-28
src/aig/gia/giaAiger.c
+27
-1
src/aig/gia/giaDup.c
+66
-6
src/aig/gia/giaMan.c
+39
-17
src/aig/gia/giaReparam.c
+1
-1
src/base/abci/abc.c
+0
-0
src/misc/vec/vecInt.h
+2
-2
No files found.
src/aig/gia/gia.h
View file @
8f74276e
...
...
@@ -133,6 +133,7 @@ struct Gia_Man_t_
int
*
pCopies
;
// intermediate copies
Vec_Int_t
*
vTruths
;
// used for truth table computation
Vec_Int_t
*
vFlopClasses
;
// classes of flops for retiming/merging/etc
Vec_Int_t
*
vGateClasses
;
// classes of gates for abstraction
unsigned
char
*
pSwitching
;
// switching activity for each object
Gia_Plc_t
*
pPlacement
;
// placement of the objects
int
*
pTravIds
;
// separate traversal ID representation
...
...
@@ -656,7 +657,8 @@ extern Gia_Man_t * Gia_ManMiter( Gia_Man_t * pAig0, Gia_Man_t * pAig1, i
extern
Gia_Man_t
*
Gia_ManTransformMiter
(
Gia_Man_t
*
p
);
extern
Gia_Man_t
*
Gia_ManChoiceMiter
(
Vec_Ptr_t
*
vGias
);
extern
Gia_Man_t
*
Gia_ManDupWithConstraints
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vPoTypes
);
extern
Gia_Man_t
*
Gia_ManDupAbstraction
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vFlopClasses
);
extern
Gia_Man_t
*
Gia_ManDupAbsFlops
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vFlopClasses
);
extern
Gia_Man_t
*
Gia_ManDupAbsGates
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vGateClasses
);
/*=== giaEnable.c ==========================================================*/
extern
void
Gia_ManDetectSeqSignals
(
Gia_Man_t
*
p
,
int
fSetReset
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManUnrollAndCofactor
(
Gia_Man_t
*
p
,
int
nFrames
,
int
nFanMax
,
int
fVerbose
);
...
...
@@ -750,7 +752,7 @@ extern int Gia_MmStepReadMemUsage( Gia_MmStep_t * p );
/*=== giaPat.c ===========================================================*/
extern
void
Gia_SatVerifyPattern
(
Gia_Man_t
*
p
,
Gia_Obj_t
*
pRoot
,
Vec_Int_t
*
vCex
,
Vec_Int_t
*
vVisit
);
/*=== giaReparam.c ===========================================================*/
extern
Gia_Man_t
*
Gia_ManReparm
(
Gia_Man_t
*
p
,
int
fVerbose
);
extern
Gia_Man_t
*
Gia_ManRepar
a
m
(
Gia_Man_t
*
p
,
int
fVerbose
);
/*=== giaRetime.c ===========================================================*/
extern
Gia_Man_t
*
Gia_ManRetimeForward
(
Gia_Man_t
*
p
,
int
nMaxIters
,
int
fVerbose
);
/*=== giaSat.c ============================================================*/
...
...
src/aig/gia/giaAbs.c
View file @
8f74276e
...
...
@@ -111,32 +111,6 @@ Vec_Int_t * Gia_ManClasses2Flops( Vec_Int_t * vFlopClasses )
/**Function*************************************************************
Synopsis [Performs abstraction on the AIG manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupAbstractionAig
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vFlops
)
{
Gia_Man_t
*
pGia
;
Aig_Man_t
*
pNew
,
*
pTemp
;
pNew
=
Gia_ManToAig
(
p
,
0
);
pNew
=
Saig_ManDupAbstraction
(
pTemp
=
pNew
,
vFlops
);
Aig_ManStop
(
pTemp
);
pGia
=
Gia_ManFromAig
(
pNew
);
// pGia->vCiNumsOrig = pNew->vCiNumsOrig;
// pNew->vCiNumsOrig = NULL;
Aig_ManStop
(
pNew
);
return
pGia
;
}
/**Function*************************************************************
Synopsis [Starts abstraction by computing latch map.]
Description []
...
...
@@ -281,7 +255,7 @@ int Gia_ManCbaPerform( Gia_Man_t * pGia, void * pPars )
pGia
->
vFlopClasses
=
Vec_IntStart
(
Gia_ManRegNum
(
pGia
)
);
}
// derive abstraction
pAbs
=
Gia_ManDupAbs
traction
(
pGia
,
pGia
->
vFlopClasses
);
pAbs
=
Gia_ManDupAbs
Flops
(
pGia
,
pGia
->
vFlopClasses
);
pAig
=
Gia_ManToAigSimple
(
pAbs
);
Gia_ManStop
(
pAbs
);
// refine abstraction using CBA
...
...
@@ -343,7 +317,7 @@ int Gia_ManPbaPerform( Gia_Man_t * pGia, int nStart, int nFrames, int nConfLimit
return
0
;
}
// derive abstraction
pAbs
=
Gia_ManDupAbs
traction
(
pGia
,
pGia
->
vFlopClasses
);
pAbs
=
Gia_ManDupAbs
Flops
(
pGia
,
pGia
->
vFlopClasses
);
// refine abstraction using PBA
pAig
=
Gia_ManToAigSimple
(
pAbs
);
Gia_ManStop
(
pAbs
);
...
...
src/aig/gia/giaAiger.c
View file @
8f74276e
...
...
@@ -507,6 +507,13 @@ Gia_Man_t * Gia_ReadAiger2( char * pFileName, int fCheck )
pNew
->
vFlopClasses
=
Vec_IntStart
(
Gia_ManRegNum
(
pNew
)
);
Gia_ReadFlopClasses
(
&
pCur
,
pNew
->
vFlopClasses
,
Gia_ManRegNum
(
pNew
)
);
}
if
(
*
pCur
==
'g'
)
{
pCur
++
;
// read gate classes
pNew
->
vGateClasses
=
Vec_IntStart
(
Gia_ManObjNum
(
pNew
)
);
Gia_ReadFlopClasses
(
&
pCur
,
pNew
->
vGateClasses
,
Gia_ManObjNum
(
pNew
)
);
}
if
(
*
pCur
==
'm'
)
{
pCur
++
;
...
...
@@ -712,6 +719,13 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
pNew
->
vFlopClasses
=
Vec_IntStart
(
Gia_ManRegNum
(
pNew
)
);
Gia_ReadFlopClasses
(
&
pCur
,
pNew
->
vFlopClasses
,
Gia_ManRegNum
(
pNew
)
);
}
if
(
*
pCur
==
'g'
)
{
pCur
++
;
// read gate classes
pNew
->
vGateClasses
=
Vec_IntStart
(
Gia_ManObjNum
(
pNew
)
);
Gia_ReadFlopClasses
(
&
pCur
,
pNew
->
vGateClasses
,
Gia_ManObjNum
(
pNew
)
);
}
if
(
*
pCur
==
'm'
)
{
pCur
++
;
...
...
@@ -898,11 +912,13 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
}
{
Vec_Int_t
*
vFlopMap
;
Vec_Int_t
*
vFlopMap
,
*
vGateMap
;
vFlopMap
=
pNew
->
vFlopClasses
;
pNew
->
vFlopClasses
=
NULL
;
vGateMap
=
pNew
->
vGateClasses
;
pNew
->
vGateClasses
=
NULL
;
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
pNew
->
vFlopClasses
=
vFlopMap
;
pNew
->
vGateClasses
=
vGateMap
;
}
return
pNew
;
}
...
...
@@ -1317,6 +1333,16 @@ void Gia_WriteAiger( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
fwrite
(
Buffer
,
1
,
4
,
pFile
);
fwrite
(
Vec_IntArray
(
p
->
vFlopClasses
),
1
,
nSize
,
pFile
);
}
// write gate classes
if
(
p
->
vGateClasses
)
{
unsigned
char
Buffer
[
10
];
int
nSize
=
4
*
Gia_ManObjNum
(
p
);
Gia_WriteInt
(
Buffer
,
nSize
);
fprintf
(
pFile
,
"g"
);
fwrite
(
Buffer
,
1
,
4
,
pFile
);
fwrite
(
Vec_IntArray
(
p
->
vGateClasses
),
1
,
nSize
,
pFile
);
}
// write mapping
if
(
p
->
pMapping
)
{
...
...
src/aig/gia/giaDup.c
View file @
8f74276e
...
...
@@ -1517,12 +1517,13 @@ Gia_Man_t * Gia_ManDupWithConstraints( Gia_Man_t * p, Vec_Int_t * vPoTypes )
SeeAlso []
***********************************************************************/
void
Gia_ManDupAbs
traction
_rec
(
Gia_Man_t
*
pNew
,
Gia_Obj_t
*
pObj
)
void
Gia_ManDupAbs
Flops
_rec
(
Gia_Man_t
*
pNew
,
Gia_Obj_t
*
pObj
)
{
if
(
~
pObj
->
Value
)
return
;
Gia_ManDupAbstraction_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManDupAbstraction_rec
(
pNew
,
Gia_ObjFanin1
(
pObj
)
);
assert
(
Gia_ObjIsAnd
(
pObj
)
);
Gia_ManDupAbsFlops_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManDupAbsFlops_rec
(
pNew
,
Gia_ObjFanin1
(
pObj
)
);
pObj
->
Value
=
Gia_ManHashAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
}
...
...
@@ -1537,7 +1538,7 @@ void Gia_ManDupAbstraction_rec( Gia_Man_t * pNew, Gia_Obj_t * pObj )
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupAbs
traction
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vFlopClasses
)
Gia_Man_t
*
Gia_ManDupAbs
Flops
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vFlopClasses
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
...
...
@@ -1562,14 +1563,73 @@ Gia_Man_t * Gia_ManDupAbstraction( Gia_Man_t * p, Vec_Int_t * vFlopClasses )
Gia_ManHashAlloc
(
pNew
);
Gia_ManForEachPo
(
p
,
pObj
,
i
)
{
Gia_ManDupAbs
traction
_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManDupAbs
Flops
_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
}
// create RIs
Gia_ManForEachRi
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vFlopClasses
,
i
)
)
{
Gia_ManDupAbstraction_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManDupAbsFlops_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
nFlops
++
;
}
Gia_ManHashStop
(
pNew
);
Gia_ManSetRegNum
(
pNew
,
nFlops
);
// clean up
pNew
=
Gia_ManSeqCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
return
pNew
;
}
/**Function*************************************************************
Synopsis [Performs abstraction of the AIG to preserve the included gates.]
Description [The array contains PIs, LOs, and internal nodes included.
0=unsed, 1=PI, 2=PPI, 3=FF, 4=AND.]
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManDupAbsGates
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vGateClasses
)
{
Gia_Man_t
*
pNew
,
*
pTemp
;
Gia_Obj_t
*
pObj
;
int
i
,
nFlops
=
0
;
assert
(
Gia_ManPoNum
(
p
)
==
1
);
Gia_ManFillValue
(
p
);
// start the new manager
pNew
=
Gia_ManStart
(
5000
);
pNew
->
pName
=
Gia_UtilStrsav
(
p
->
pName
);
// create PIs
Gia_ManConst0
(
p
)
->
Value
=
0
;
Gia_ManForEachPi
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
1
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create additional PIs
Gia_ManForEachPi
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
2
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create ROs
Gia_ManForEachRo
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
3
)
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
// create POs
Gia_ManHashAlloc
(
pNew
);
Gia_ManForEachPo
(
p
,
pObj
,
i
)
{
Gia_ManDupAbsFlops_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
}
// create RIs
Gia_ManForEachRo
(
p
,
pObj
,
i
)
if
(
Vec_IntEntry
(
vGateClasses
,
Gia_ObjId
(
p
,
pObj
))
==
3
)
{
pObj
=
Gia_ObjRoToRi
(
p
,
pObj
);
Gia_ManDupAbsFlops_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
)
);
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
nFlops
++
;
}
...
...
src/aig/gia/giaMan.c
View file @
8f74276e
...
...
@@ -81,6 +81,7 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_IntFreeP
(
&
p
->
vUserPoIds
);
Vec_IntFreeP
(
&
p
->
vUserFfIds
);
Vec_IntFreeP
(
&
p
->
vFlopClasses
);
Vec_IntFreeP
(
&
p
->
vGateClasses
);
Vec_IntFreeP
(
&
p
->
vLevels
);
Vec_IntFreeP
(
&
p
->
vTruths
);
Vec_IntFree
(
p
->
vCis
);
...
...
@@ -166,30 +167,21 @@ void Gia_ManPrintClasses_old( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
void
Gia_ManPrintClasses
(
Gia_Man_t
*
p
)
void
Gia_ManPrint
Flop
Classes
(
Gia_Man_t
*
p
)
{
int
i
,
Class
,
Counter0
,
Counter1
;
int
Counter0
,
Counter1
;
if
(
p
->
vFlopClasses
==
NULL
)
return
;
if
(
Vec_IntSize
(
p
->
vFlopClasses
)
!=
Gia_ManRegNum
(
p
)
)
{
printf
(
"Gia_ManPrintClasses(): The number of flop map entries differs from the number of flops.
\n
"
);
printf
(
"Gia_ManPrint
Flop
Classes(): The number of flop map entries differs from the number of flops.
\n
"
);
return
;
}
printf
(
"Register classes: "
);
// count zero entries
Counter0
=
0
;
Vec_IntForEachEntry
(
p
->
vFlopClasses
,
Class
,
i
)
Counter0
+=
(
Class
==
0
);
printf
(
"0=%d "
,
Counter0
);
// count one entries
Counter1
=
0
;
Vec_IntForEachEntry
(
p
->
vFlopClasses
,
Class
,
i
)
Counter1
+=
(
Class
==
1
);
printf
(
"1=%d "
,
Counter1
);
// add comment
Counter0
=
Vec_IntCountEntry
(
p
->
vFlopClasses
,
0
);
Counter1
=
Vec_IntCountEntry
(
p
->
vFlopClasses
,
1
);
printf
(
"Flop-level abstraction: Excluded FFs = %d Included FFs = %d "
,
Counter0
,
Counter1
);
if
(
Counter0
+
Counter1
<
Gia_ManRegNum
(
p
)
)
printf
(
"
there are other
classes..."
);
printf
(
"
and there are other FF
classes..."
);
printf
(
"
\n
"
);
}
...
...
@@ -204,6 +196,35 @@ void Gia_ManPrintClasses( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
void
Gia_ManPrintGateClasses
(
Gia_Man_t
*
p
)
{
int
i
,
Counter
[
5
];
if
(
p
->
vGateClasses
==
NULL
)
return
;
if
(
Vec_IntSize
(
p
->
vGateClasses
)
!=
Gia_ManObjNum
(
p
)
)
{
printf
(
"Gia_ManPrintGateClasses(): The number of flop map entries differs from the number of flops.
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
5
;
i
++
)
Counter
[
i
]
=
Vec_IntCountEntry
(
p
->
vGateClasses
,
i
);
printf
(
"Gate-level abstraction: PI = %d PPI = %d FF = %d AND = %d Unused = %d
\n
"
,
Counter
[
1
],
Counter
[
2
],
Counter
[
3
],
Counter
[
4
],
Counter
[
0
]
);
if
(
Counter
[
0
]
+
Counter
[
1
]
+
Counter
[
2
]
+
Counter
[
3
]
+
Counter
[
4
]
!=
Gia_ManObjNum
(
p
)
)
printf
(
"Gia_ManPrintGateClasses(): Mismatch in the object count.
\n
"
);
}
/**Function*************************************************************
Synopsis [Prints stats for the AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Gia_ManPrintPlacement
(
Gia_Man_t
*
p
)
{
int
i
,
nFixed
=
0
,
nUndef
=
0
;
...
...
@@ -261,7 +282,8 @@ void Gia_ManPrintStats( Gia_Man_t * p, int fSwitch )
if
(
p
->
pPlacement
)
Gia_ManPrintPlacement
(
p
);
// print register classes
Gia_ManPrintClasses
(
p
);
Gia_ManPrintFlopClasses
(
p
);
Gia_ManPrintGateClasses
(
p
);
}
/**Function*************************************************************
...
...
src/aig/gia/giaReparam.c
View file @
8f74276e
...
...
@@ -138,7 +138,7 @@ Gia_Man_t * Gia_ManDupFf2In( Gia_Man_t * p, int nFlopsOld )
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManReparm
(
Gia_Man_t
*
p
,
int
fVerbose
)
Gia_Man_t
*
Gia_ManRepar
a
m
(
Gia_Man_t
*
p
,
int
fVerbose
)
{
// extern Aig_Man_t * Saig_ManRetimeMinArea( Aig_Man_t * p, int nMaxIters, int fForwardOnly, int fBackwardOnly, int fInitial, int fVerbose );
Aig_Man_t
*
pMan
,
*
pTemp
;
...
...
src/base/abci/abc.c
View file @
8f74276e
This diff is collapsed.
Click to expand it.
src/misc/vec/vecInt.h
View file @
8f74276e
...
...
@@ -917,11 +917,11 @@ static inline int Vec_IntSum( Vec_Int_t * p )
SeeAlso []
***********************************************************************/
static
inline
int
Vec_IntCount
Zero
(
Vec_Int_t
*
p
)
static
inline
int
Vec_IntCount
Entry
(
Vec_Int_t
*
p
,
int
Entry
)
{
int
i
,
Counter
=
0
;
for
(
i
=
0
;
i
<
p
->
nSize
;
i
++
)
Counter
+=
(
p
->
pArray
[
i
]
==
0
);
Counter
+=
(
p
->
pArray
[
i
]
==
Entry
);
return
Counter
;
}
...
...
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