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
10478a9c
Commit
10478a9c
authored
Jan 15, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Variable timeframe abstraction.
parent
bb4897ab
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
211 additions
and
16 deletions
+211
-16
src/aig/gia/gia.h
+3
-0
src/aig/gia/giaAbsVta.c
+0
-0
src/aig/gia/giaAiger.c
+39
-2
src/aig/gia/giaFrames.c
+75
-8
src/aig/gia/giaMan.c
+67
-0
src/base/abci/abc.c
+4
-6
src/misc/vec/vecVec.h
+23
-0
No files found.
src/aig/gia/gia.h
View file @
10478a9c
...
...
@@ -134,6 +134,7 @@ struct Gia_Man_t_
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
Vec_Int_t
*
vObjClasses
;
// classes of objects for abstraction
unsigned
char
*
pSwitching
;
// switching activity for each object
Gia_Plc_t
*
pPlacement
;
// placement of the objects
int
*
pTravIds
;
// separate traversal ID representation
...
...
@@ -703,6 +704,8 @@ extern void Gia_ManFanoutStop( Gia_Man_t * p );
/*=== giaForce.c =========================================================*/
extern
void
For_ManExperiment
(
Gia_Man_t
*
pGia
,
int
nIters
,
int
fClustered
,
int
fVerbose
);
/*=== giaFrames.c =========================================================*/
extern
Gia_Man_t
*
Gia_ManUnrollDup
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vLimit
);
extern
Vec_Ptr_t
*
Gia_ManUnrollAbs
(
Gia_Man_t
*
p
,
int
nFrames
);
extern
void
*
Gia_ManUnrollStart
(
Gia_Man_t
*
pAig
,
Gia_ParFra_t
*
pPars
);
extern
void
*
Gia_ManUnrollAdd
(
void
*
pMan
,
int
fMax
);
extern
void
Gia_ManUnrollStop
(
void
*
pMan
);
...
...
src/aig/gia/giaAbsVta.c
View file @
10478a9c
This diff is collapsed.
Click to expand it.
src/aig/gia/giaAiger.c
View file @
10478a9c
...
...
@@ -567,6 +567,14 @@ Gia_Man_t * Gia_ReadAiger2( char * pFileName, int fCheck )
pNew
->
vGateClasses
=
Vec_IntStart
(
Gia_ManObjNum
(
pNew
)
);
Gia_ReadFlopClasses
(
&
pCur
,
pNew
->
vGateClasses
,
Gia_ManObjNum
(
pNew
)
);
}
if
(
*
pCur
==
'v'
)
{
pCur
++
;
// read object classes
pNew
->
vObjClasses
=
Vec_IntStart
(
Gia_ReadInt
(
pCur
)
/
4
);
pCur
+=
4
;
memcpy
(
Vec_IntArray
(
pNew
->
vObjClasses
),
pCur
,
4
*
Vec_IntSize
(
pNew
->
vObjClasses
)
);
pCur
+=
4
*
Vec_IntSize
(
pNew
->
vObjClasses
);
}
if
(
*
pCur
==
'm'
)
{
pCur
++
;
...
...
@@ -618,7 +626,6 @@ Gia_Man_t * Gia_ReadAiger2( char * pFileName, int fCheck )
return
pNew
;
}
/**Function*************************************************************
Synopsis [Reads the AIG in the binary AIGER format.]
...
...
@@ -833,6 +840,14 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
pNew
->
vGateClasses
=
Vec_IntStart
(
Gia_ManObjNum
(
pNew
)
);
Gia_ReadFlopClasses
(
&
pCur
,
pNew
->
vGateClasses
,
Gia_ManObjNum
(
pNew
)
);
}
if
(
*
pCur
==
'v'
)
{
pCur
++
;
// read object classes
pNew
->
vObjClasses
=
Vec_IntStart
(
Gia_ReadInt
(
pCur
)
/
4
);
pCur
+=
4
;
memcpy
(
Vec_IntArray
(
pNew
->
vObjClasses
),
pCur
,
4
*
Vec_IntSize
(
pNew
->
vObjClasses
)
);
pCur
+=
4
*
Vec_IntSize
(
pNew
->
vObjClasses
);
}
if
(
*
pCur
==
'm'
)
{
pCur
++
;
...
...
@@ -1024,14 +1039,26 @@ Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck
}
{
Vec_Int_t
*
vFlopMap
,
*
vGateMap
;
Vec_Int_t
*
vFlopMap
,
*
vGateMap
,
*
vObjMap
;
vFlopMap
=
pNew
->
vFlopClasses
;
pNew
->
vFlopClasses
=
NULL
;
vGateMap
=
pNew
->
vGateClasses
;
pNew
->
vGateClasses
=
NULL
;
vObjMap
=
pNew
->
vObjClasses
;
pNew
->
vObjClasses
=
NULL
;
pNew
=
Gia_ManCleanup
(
pTemp
=
pNew
);
Gia_ManStop
(
pTemp
);
pNew
->
vFlopClasses
=
vFlopMap
;
pNew
->
vGateClasses
=
vGateMap
;
pNew
->
vObjClasses
=
vObjMap
;
}
/*
{
extern Vec_Int_t * Vta_ManFramesToAbs( Vec_Vec_t * vFrames );
extern Vec_Ptr_t * Vta_ManAbsToFrames( Vec_Int_t * vAbs );
Vec_Vec_t * vAbs = (Vec_Vec_t *)Gia_ManUnrollAbs( pNew );
assert( pNew->vObjClasses == NULL );
pNew->vObjClasses = Vta_ManFramesToAbs( vAbs );
Vec_VecFree( vAbs );
}
*/
return
pNew
;
}
...
...
@@ -1461,6 +1488,16 @@ void Gia_WriteAiger( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
fwrite
(
Buffer
,
1
,
4
,
pFile
);
fwrite
(
Vec_IntArray
(
p
->
vGateClasses
),
1
,
nSize
,
pFile
);
}
// write object classes
if
(
p
->
vObjClasses
)
{
unsigned
char
Buffer
[
10
];
int
nSize
=
4
*
Vec_IntSize
(
p
->
vObjClasses
);
Gia_WriteInt
(
Buffer
,
nSize
);
fprintf
(
pFile
,
"v"
);
fwrite
(
Buffer
,
1
,
4
,
pFile
);
fwrite
(
Vec_IntArray
(
p
->
vObjClasses
),
1
,
nSize
,
pFile
);
}
// write mapping
if
(
p
->
pMapping
)
{
...
...
src/aig/gia/giaFrames.c
View file @
10478a9c
...
...
@@ -72,7 +72,7 @@ struct Gia_ManUnr_t_
SeeAlso []
***********************************************************************/
void
Gia_ManUnrDup_rec
(
Gia_Man_t
*
pNew
,
Gia_Obj_t
*
pObj
,
int
Id
)
void
Gia_ManUnr
oll
Dup_rec
(
Gia_Man_t
*
pNew
,
Gia_Obj_t
*
pObj
,
int
Id
)
{
if
(
~
pObj
->
Value
)
return
;
...
...
@@ -80,13 +80,13 @@ void Gia_ManUnrDup_rec( Gia_Man_t * pNew, Gia_Obj_t * pObj, int Id )
pObj
->
Value
=
Gia_ManAppendCi
(
pNew
);
else
if
(
Gia_ObjIsCo
(
pObj
)
)
{
Gia_ManUnrDup_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
),
Gia_ObjFaninId0
(
pObj
,
Id
)
);
Gia_ManUnr
oll
Dup_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
),
Gia_ObjFaninId0
(
pObj
,
Id
)
);
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
}
else
if
(
Gia_ObjIsAnd
(
pObj
)
)
{
Gia_ManUnrDup_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
),
Gia_ObjFaninId0
(
pObj
,
Id
)
);
Gia_ManUnrDup_rec
(
pNew
,
Gia_ObjFanin1
(
pObj
),
Gia_ObjFaninId1
(
pObj
,
Id
)
);
Gia_ManUnr
oll
Dup_rec
(
pNew
,
Gia_ObjFanin0
(
pObj
),
Gia_ObjFaninId0
(
pObj
,
Id
)
);
Gia_ManUnr
oll
Dup_rec
(
pNew
,
Gia_ObjFanin1
(
pObj
),
Gia_ObjFaninId1
(
pObj
,
Id
)
);
pObj
->
Value
=
Gia_ManAppendAnd
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
),
Gia_ObjFanin1Copy
(
pObj
)
);
}
else
assert
(
0
);
...
...
@@ -104,7 +104,7 @@ void Gia_ManUnrDup_rec( Gia_Man_t * pNew, Gia_Obj_t * pObj, int Id )
SeeAlso []
***********************************************************************/
Gia_Man_t
*
Gia_ManUnrDup
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vLimit
)
Gia_Man_t
*
Gia_ManUnr
oll
Dup
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vLimit
)
{
Gia_Man_t
*
pNew
;
Gia_Obj_t
*
pObj
;
...
...
@@ -120,7 +120,7 @@ Gia_Man_t * Gia_ManUnrDup( Gia_Man_t * p, Vec_Int_t * vLimit )
// create first class
Gia_ManForEachPo
(
p
,
pObj
,
i
)
Gia_ManUnrDup_rec
(
pNew
,
pObj
,
Gia_ObjId
(
p
,
pObj
)
);
Gia_ManUnr
oll
Dup_rec
(
pNew
,
pObj
,
Gia_ObjId
(
p
,
pObj
)
);
Vec_IntPush
(
vLimit
,
Gia_ManObjNum
(
pNew
)
);
// create next classes
...
...
@@ -133,7 +133,7 @@ Gia_Man_t * Gia_ManUnrDup( Gia_Man_t * p, Vec_Int_t * vLimit )
{
pObj
=
Gia_ObjRoToRi
(
p
,
pObj
);
assert
(
!~
pObj
->
Value
);
Gia_ManUnrDup_rec
(
pNew
,
pObj
,
Gia_ObjId
(
p
,
pObj
)
);
Gia_ManUnr
oll
Dup_rec
(
pNew
,
pObj
,
Gia_ObjId
(
p
,
pObj
)
);
}
}
Gia_ManSetRegNum
(
pNew
,
0
);
...
...
@@ -142,6 +142,73 @@ Gia_Man_t * Gia_ManUnrDup( Gia_Man_t * p, Vec_Int_t * vLimit )
/**Function*************************************************************
Synopsis [Duplicates AIG for unrolling.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Ptr_t
*
Gia_ManUnrollAbs
(
Gia_Man_t
*
p
,
int
nFrames
)
{
int
fVerbose
=
0
;
Vec_Ptr_t
*
vFrames
;
Vec_Int_t
*
vLimit
,
*
vOne
;
Gia_Man_t
*
pNew
;
Gia_Obj_t
*
pObj
;
int
nObjBits
,
nObjMask
;
int
f
,
fMax
,
k
,
Entry
,
Prev
,
iStart
,
iStop
,
Size
;
// get the bitmasks
nObjBits
=
Gia_Base2Log
(
Gia_ManObjNum
(
p
)
);
nObjMask
=
(
1
<<
nObjBits
)
-
1
;
assert
(
Gia_ManObjNum
(
p
)
<=
nObjMask
);
// derive the tents
vLimit
=
Vec_IntAlloc
(
1000
);
pNew
=
Gia_ManUnrollDup
(
p
,
vLimit
);
// debug printout
if
(
fVerbose
)
{
Prev
=
1
;
printf
(
"Tents: "
);
Vec_IntForEachEntryStart
(
vLimit
,
Entry
,
k
,
1
)
printf
(
"%d=%d "
,
k
,
Entry
-
Prev
),
Prev
=
Entry
;
printf
(
" Unused=%d"
,
Gia_ManObjNum
(
p
)
-
Gia_ManObjNum
(
pNew
)
);
printf
(
"
\n
"
);
}
// create abstraction
vFrames
=
Vec_PtrAlloc
(
Vec_IntSize
(
vLimit
)
);
for
(
fMax
=
0
;
fMax
<
nFrames
;
fMax
++
)
{
Size
=
(
fMax
+
1
<
Vec_IntSize
(
vLimit
))
?
Vec_IntEntry
(
vLimit
,
fMax
+
1
)
:
Gia_ManObjNum
(
pNew
);
vOne
=
Vec_IntAlloc
(
Size
);
for
(
f
=
0
;
f
<=
fMax
;
f
++
)
{
iStart
=
(
f
<
Vec_IntSize
(
vLimit
))
?
Vec_IntEntry
(
vLimit
,
f
)
:
0
;
iStop
=
(
f
+
1
<
Vec_IntSize
(
vLimit
))
?
Vec_IntEntry
(
vLimit
,
f
+
1
)
:
0
;
for
(
k
=
iStop
-
1
;
k
>=
iStart
;
k
--
)
{
pObj
=
Gia_ManObj
(
pNew
,
k
);
if
(
Gia_ObjIsCo
(
pObj
)
)
continue
;
assert
(
Gia_ObjIsCi
(
pObj
)
||
Gia_ObjIsAnd
(
pObj
)
);
Entry
=
((
fMax
-
f
)
<<
nObjBits
)
|
pObj
->
Value
;
Vec_IntPush
(
vOne
,
Entry
);
// printf( "%d ", Gia_ManObj(pNew, k)->Value );
}
// printf( "\n" );
}
Vec_PtrPush
(
vFrames
,
vOne
);
assert
(
Vec_IntSize
(
vOne
)
<=
Size
-
1
);
}
Vec_IntFree
(
vLimit
);
Gia_ManStop
(
pNew
);
return
vFrames
;
}
/**Function*************************************************************
Synopsis [Creates manager.]
Description []
...
...
@@ -163,7 +230,7 @@ Gia_ManUnr_t * Gia_ManUnrStart( Gia_Man_t * pAig, Gia_ParFra_t * pPars )
p
->
pPars
=
pPars
;
// create order
p
->
vLimit
=
Vec_IntAlloc
(
0
);
p
->
pOrder
=
Gia_ManUnrDup
(
pAig
,
p
->
vLimit
);
p
->
pOrder
=
Gia_ManUnr
oll
Dup
(
pAig
,
p
->
vLimit
);
/*
Vec_IntForEachEntryStart( p->vLimit, Shift, i, 1 )
printf( "%d=%d ", i, Shift-Vec_IntEntry(p->vLimit, i-1) );
...
...
src/aig/gia/giaMan.c
View file @
10478a9c
...
...
@@ -83,6 +83,7 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_IntFreeP
(
&
p
->
vUserFfIds
);
Vec_IntFreeP
(
&
p
->
vFlopClasses
);
Vec_IntFreeP
(
&
p
->
vGateClasses
);
Vec_IntFreeP
(
&
p
->
vObjClasses
);
Vec_IntFreeP
(
&
p
->
vLevels
);
Vec_IntFreeP
(
&
p
->
vTruths
);
Vec_IntFree
(
p
->
vCis
);
...
...
@@ -256,6 +257,71 @@ void Gia_ManPrintGateClasses( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
void
Gia_ManPrintObjClasses
(
Gia_Man_t
*
p
)
{
Vec_Int_t
*
vSeens
;
// objects seen so far
Vec_Int_t
*
vAbs
=
p
->
vObjClasses
;
int
i
,
k
,
Entry
,
iStart
,
iStop
,
nFrames
;
int
nObjBits
,
nObjMask
,
iObj
,
iFrame
,
nWords
;
unsigned
*
pInfo
,
*
pCountAll
,
*
pCountUni
;
if
(
vAbs
==
NULL
)
return
;
nFrames
=
Vec_IntEntry
(
vAbs
,
0
);
assert
(
Vec_IntEntry
(
vAbs
,
nFrames
+
1
)
==
Vec_IntSize
(
vAbs
)
);
pCountAll
=
ABC_ALLOC
(
int
,
nFrames
+
1
);
pCountUni
=
ABC_ALLOC
(
int
,
nFrames
+
1
);
// start storage for seen objects
nWords
=
Gia_BitWordNum
(
nFrames
);
vSeens
=
Vec_IntStart
(
Gia_ManObjNum
(
p
)
*
nWords
);
// get the bitmasks
nObjBits
=
Gia_Base2Log
(
Gia_ManObjNum
(
p
)
);
nObjMask
=
(
1
<<
nObjBits
)
-
1
;
assert
(
Gia_ManObjNum
(
p
)
<=
nObjMask
);
// print info about frames
for
(
i
=
0
;
i
<
nFrames
;
i
++
)
{
iStart
=
Vec_IntEntry
(
vAbs
,
i
+
1
);
iStop
=
Vec_IntEntry
(
vAbs
,
i
+
2
);
memset
(
pCountAll
,
0
,
sizeof
(
int
)
*
(
nFrames
+
1
)
);
memset
(
pCountUni
,
0
,
sizeof
(
int
)
*
(
nFrames
+
1
)
);
Vec_IntForEachEntryStartStop
(
vAbs
,
Entry
,
k
,
iStart
,
iStop
)
{
iObj
=
(
Entry
&
nObjMask
);
iFrame
=
(
Entry
>>
nObjBits
);
pInfo
=
(
unsigned
*
)
Vec_IntEntryP
(
vSeens
,
nWords
*
iObj
);
if
(
Gia_InfoHasBit
(
pInfo
,
iFrame
)
==
0
)
{
Gia_InfoSetBit
(
pInfo
,
iFrame
);
pCountUni
[
iFrame
+
1
]
++
;
pCountUni
[
0
]
++
;
}
pCountAll
[
iFrame
+
1
]
++
;
pCountAll
[
0
]
++
;
}
assert
(
pCountAll
[
0
]
==
(
unsigned
)(
iStop
-
iStart
)
);
printf
(
"%5d%5d "
,
pCountAll
[
0
],
pCountUni
[
0
]
);
for
(
k
=
0
;
k
<
nFrames
;
k
++
)
if
(
k
<=
i
)
printf
(
"%5d%5d "
,
pCountAll
[
k
+
1
],
pCountUni
[
k
+
1
]
);
printf
(
"
\n
"
);
}
assert
(
iStop
==
Vec_IntSize
(
vAbs
)
);
Vec_IntFree
(
vSeens
);
ABC_FREE
(
pCountAll
);
ABC_FREE
(
pCountUni
);
}
/**Function*************************************************************
Synopsis [Prints stats for the AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Gia_ManPrintPlacement
(
Gia_Man_t
*
p
)
{
int
i
,
nFixed
=
0
,
nUndef
=
0
;
...
...
@@ -315,6 +381,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, int fSwitch )
// print register classes
Gia_ManPrintFlopClasses
(
p
);
Gia_ManPrintGateClasses
(
p
);
Gia_ManPrintObjClasses
(
p
);
}
/**Function*************************************************************
...
...
src/base/abci/abc.c
View file @
10478a9c
...
...
@@ -30329,8 +30329,8 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
int
c
,
fVerbose
=
0
;
int
fSwitch
=
0
;
// extern Gia_Man_t * Gia_VtaTest( Gia_Man_t * p );
extern
void
Gia_VtaTest
(
Gia_Man_t
*
p
,
int
nFramesMax
,
int
nConfMax
,
int
nTimeMax
,
int
fVerbose
);
extern
int
Gia_ManSuppSizeTest
(
Gia_Man_t
*
p
);
// extern int Gia_ManSuppSizeTest( Gia_Man_t * p
);
extern
void
Gia_VtaTest
(
Gia_Man_t
*
p
,
int
nFramesStart
,
int
nFramesMax
,
int
nConfMax
,
int
nTimeMax
,
int
fVerbose
);
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"svh"
)
)
!=
EOF
)
...
...
@@ -30364,14 +30364,12 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
// pAbc->pGia = Gia_ManDupSelf( pTemp = pAbc->pGia );
// pAbc->pGia = Gia_ManRemoveEnables( pTemp = pAbc->pGia );
// Cbs_ManSolveTest( pAbc->pGia );
// pAbc->pGia = Gia_VtaTest( pTemp = pAbc->pGia );
// Gia_ManStopP( &pTemp );
// Gia_VtaTest( pAbc->pGia, 100000, 0, 0, 1 );
Gia_ManSuppSizeTest
(
pAbc
->
pGia
);
// Gia_ManSuppSizeTest( pAbc->pGia );
Gia_VtaTest
(
pAbc
->
pGia
,
10
,
100000
,
0
,
0
,
1
);
return
0
;
usage:
Abc_Print
(
-
2
,
"usage: &test [-svh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
testing various procedures
\n
"
);
...
...
src/misc/vec/vecVec.h
View file @
10478a9c
...
...
@@ -586,6 +586,29 @@ static inline void Vec_VecSort( Vec_Vec_t * p, int fReverse )
(
int
(
*
)(
const
void
*
,
const
void
*
))
Vec_VecSortCompare1
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
void
Vec_VecPrintInt
(
Vec_Vec_t
*
p
)
{
int
i
,
k
,
Entry
;
printf
(
"Integers by level"
);
Vec_VecForEachEntryInt
(
p
,
Entry
,
i
,
k
)
{
if
(
k
==
0
)
printf
(
"
\n
%3d : "
,
i
);
printf
(
"%6d "
,
Entry
);
}
printf
(
"
\n
"
);
}
ABC_NAMESPACE_HEADER_END
...
...
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