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
e2e9aed1
Commit
e2e9aed1
authored
Apr 22, 2008
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version abc80422
parent
7ec48bc2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
341 additions
and
22 deletions
+341
-22
src/aig/aig/aig.h
+3
-0
src/aig/aig/aigMan.c
+22
-0
src/aig/aig/aigObj.c
+75
-0
src/aig/aig/aigUtil.c
+42
-0
src/aig/cnf/cnf.h
+1
-0
src/aig/cnf/cnfWrite.c
+102
-0
src/aig/nwk/nwkFlow.c
+18
-10
src/aig/nwk/nwkFlow_depth.c
+0
-0
src/aig/saig/saigPhase.c
+60
-2
src/aig/saig/saigRetMin.c
+0
-0
src/base/abci/abc.c
+13
-7
src/base/abci/abcDar.c
+5
-3
No files found.
src/aig/aig/aig.h
View file @
e2e9aed1
...
...
@@ -273,6 +273,7 @@ static inline Aig_Obj_t * Aig_ManLi( Aig_Man_t * p, int i ) { return (Aig_
static
inline
Aig_Obj_t
*
Aig_ManObj
(
Aig_Man_t
*
p
,
int
i
)
{
return
p
->
vObjs
?
(
Aig_Obj_t
*
)
Vec_PtrEntry
(
p
->
vObjs
,
i
)
:
NULL
;
}
static
inline
Aig_Type_t
Aig_ObjType
(
Aig_Obj_t
*
pObj
)
{
return
(
Aig_Type_t
)
pObj
->
Type
;
}
static
inline
int
Aig_ObjId
(
Aig_Obj_t
*
pObj
)
{
return
pObj
->
Id
;
}
static
inline
int
Aig_ObjIsNone
(
Aig_Obj_t
*
pObj
)
{
return
pObj
->
Type
==
AIG_OBJ_NONE
;
}
static
inline
int
Aig_ObjIsConst1
(
Aig_Obj_t
*
pObj
)
{
assert
(
!
Aig_IsComplement
(
pObj
));
return
pObj
->
Type
==
AIG_OBJ_CONST1
;
}
static
inline
int
Aig_ObjIsPi
(
Aig_Obj_t
*
pObj
)
{
return
pObj
->
Type
==
AIG_OBJ_PI
;
}
...
...
@@ -493,6 +494,7 @@ extern void Aig_ManStop( Aig_Man_t * p );
extern
int
Aig_ManCleanup
(
Aig_Man_t
*
p
);
extern
int
Aig_ManPiCleanup
(
Aig_Man_t
*
p
);
extern
void
Aig_ManPrintStats
(
Aig_Man_t
*
p
);
extern
void
Aig_ManReportImprovement
(
Aig_Man_t
*
p
,
Aig_Man_t
*
pNew
);
/*=== aigMem.c ==========================================================*/
extern
void
Aig_ManStartMemory
(
Aig_Man_t
*
p
);
extern
void
Aig_ManStopMemory
(
Aig_Man_t
*
p
);
...
...
@@ -513,6 +515,7 @@ extern void Aig_ObjDelete( Aig_Man_t * p, Aig_Obj_t * pObj );
extern
void
Aig_ObjDelete_rec
(
Aig_Man_t
*
p
,
Aig_Obj_t
*
pObj
,
int
fFreeTop
);
extern
void
Aig_ObjPatchFanin0
(
Aig_Man_t
*
p
,
Aig_Obj_t
*
pObj
,
Aig_Obj_t
*
pFaninNew
);
extern
void
Aig_ObjReplace
(
Aig_Man_t
*
p
,
Aig_Obj_t
*
pObjOld
,
Aig_Obj_t
*
pObjNew
,
int
fNodesOnly
,
int
fUpdateLevel
);
extern
void
Aig_ObjPrint
(
Aig_Man_t
*
p
,
Aig_Obj_t
*
pObj
);
/*=== aigOper.c =========================================================*/
extern
Aig_Obj_t
*
Aig_IthVar
(
Aig_Man_t
*
p
,
int
i
);
extern
Aig_Obj_t
*
Aig_Oper
(
Aig_Man_t
*
p
,
Aig_Obj_t
*
p0
,
Aig_Obj_t
*
p1
,
Aig_Type_t
Type
);
...
...
src/aig/aig/aigMan.c
View file @
e2e9aed1
...
...
@@ -337,6 +337,28 @@ void Aig_ManPrintStats( Aig_Man_t * p )
fflush
(
stdout
);
}
/**Function*************************************************************
Synopsis [Reports the reduction of the AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Aig_ManReportImprovement
(
Aig_Man_t
*
p
,
Aig_Man_t
*
pNew
)
{
printf
(
"REGs: Beg = %d. End = %d. (R = %6.2f %%). "
,
Aig_ManRegNum
(
p
),
Aig_ManRegNum
(
pNew
),
Aig_ManRegNum
(
p
)
?
100
.
0
*
(
Aig_ManRegNum
(
p
)
-
Aig_ManRegNum
(
pNew
))
/
Aig_ManRegNum
(
p
)
:
0
.
0
);
printf
(
"ANDs: Beg = %d. End = %d. (R = %6.2f %%)."
,
Aig_ManNodeNum
(
p
),
Aig_ManNodeNum
(
pNew
),
Aig_ManNodeNum
(
p
)
?
100
.
0
*
(
Aig_ManNodeNum
(
p
)
-
Aig_ManNodeNum
(
pNew
))
/
Aig_ManNodeNum
(
p
)
:
0
.
0
);
printf
(
"
\n
"
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/aig/aig/aigObj.c
View file @
e2e9aed1
...
...
@@ -416,6 +416,81 @@ void Aig_ObjReplace( Aig_Man_t * p, Aig_Obj_t * pObjOld, Aig_Obj_t * pObjNew, in
pObjOld
->
pHaig
=
pHaig
;
}
/**Function*************************************************************
Synopsis [Verbose printing of the AIG node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Aig_ObjPrint
(
Aig_Man_t
*
p
,
Aig_Obj_t
*
pObj
)
{
int
fHaig
=
0
;
int
fShowFanouts
=
0
;
Aig_Obj_t
*
pTemp
;
assert
(
!
Aig_IsComplement
(
pObj
)
);
printf
(
"Node %4d : "
,
Aig_ObjId
(
pObj
)
);
if
(
Aig_ObjIsConst1
(
pObj
)
)
printf
(
"constant 1"
);
else
if
(
Aig_ObjIsPi
(
pObj
)
)
printf
(
"PI"
);
else
if
(
Aig_ObjIsPo
(
pObj
)
)
printf
(
"PO( %4d%s )"
,
Aig_ObjFanin0
(
pObj
)
->
Id
,
(
Aig_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
)
);
else
if
(
Aig_ObjIsBuf
(
pObj
)
)
printf
(
"BUF( %d%s )"
,
Aig_ObjFanin0
(
pObj
)
->
Id
,
(
Aig_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
)
);
else
printf
(
"AND( %4d%s, %4d%s )"
,
Aig_ObjFanin0
(
pObj
)
->
Id
,
(
Aig_ObjFaninC0
(
pObj
)
?
"
\'
"
:
" "
),
Aig_ObjFanin1
(
pObj
)
->
Id
,
(
Aig_ObjFaninC1
(
pObj
)
?
"
\'
"
:
" "
)
);
printf
(
" (refs = %3d)"
,
Aig_ObjRefs
(
pObj
)
);
if
(
fShowFanouts
&&
p
->
pFanData
)
{
Aig_Obj_t
*
pFanout
;
int
i
,
iFan
;
printf
(
"
\n
Fanouts:
\n
"
);
Aig_ObjForEachFanout
(
p
,
pObj
,
pFanout
,
iFan
,
i
)
{
printf
(
" "
);
printf
(
"Node %4d : "
,
Aig_ObjId
(
pFanout
)
);
if
(
Aig_ObjIsPo
(
pFanout
)
)
printf
(
"PO( %4d%s )"
,
Aig_ObjFanin0
(
pFanout
)
->
Id
,
(
Aig_ObjFaninC0
(
pFanout
)
?
"
\'
"
:
" "
)
);
else
if
(
Aig_ObjIsBuf
(
pFanout
)
)
printf
(
"BUF( %d%s )"
,
Aig_ObjFanin0
(
pFanout
)
->
Id
,
(
Aig_ObjFaninC0
(
pFanout
)
?
"
\'
"
:
" "
)
);
else
printf
(
"AND( %4d%s, %4d%s )"
,
Aig_ObjFanin0
(
pFanout
)
->
Id
,
(
Aig_ObjFaninC0
(
pFanout
)
?
"
\'
"
:
" "
),
Aig_ObjFanin1
(
pFanout
)
->
Id
,
(
Aig_ObjFaninC1
(
pFanout
)
?
"
\'
"
:
" "
)
);
printf
(
"
\n
"
);
}
return
;
}
if
(
fHaig
)
{
if
(
pObj
->
pHaig
==
NULL
)
printf
(
" HAIG node not given"
);
else
printf
(
" HAIG node = %d%s"
,
Aig_Regular
(
pObj
->
pHaig
)
->
Id
,
(
Aig_IsComplement
(
pObj
->
pHaig
)
?
"
\'
"
:
" "
)
);
return
;
}
// there are choices
if
(
p
->
pEquivs
&&
p
->
pEquivs
[
pObj
->
Id
]
)
{
// print equivalence class
printf
(
" { %4d "
,
pObj
->
Id
);
for
(
pTemp
=
p
->
pEquivs
[
pObj
->
Id
];
pTemp
;
pTemp
=
p
->
pEquivs
[
pTemp
->
Id
]
)
printf
(
" %4d%s"
,
pTemp
->
Id
,
(
pTemp
->
fPhase
!=
pObj
->
fPhase
)
?
"
\'
"
:
" "
);
printf
(
" }"
);
return
;
}
// this is a secondary node
if
(
p
->
pReprs
&&
p
->
pReprs
[
pObj
->
Id
]
)
printf
(
" class of %d"
,
pObj
->
Id
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/aig/aig/aigUtil.c
View file @
e2e9aed1
...
...
@@ -947,6 +947,48 @@ int Aig_ManCountChoices( Aig_Man_t * p )
return
Counter
;
}
/**Function*************************************************************
Synopsis [Prints the fanouts of the control register.]
Description [Useful only for Intel MC benchmarks.]
SideEffects []
SeeAlso []
***********************************************************************/
void
Aig_ManPrintControlFanouts
(
Aig_Man_t
*
p
)
{
Aig_Obj_t
*
pObj
,
*
pFanin0
,
*
pFanin1
,
*
pCtrl
;
int
i
,
Counter
=
0
;
pCtrl
=
Aig_ManPi
(
p
,
Aig_ManPiNum
(
p
)
-
1
);
printf
(
"Control signal:
\n
"
);
Aig_ObjPrint
(
p
,
pCtrl
);
printf
(
"
\n\n
"
);
Aig_ManForEachObj
(
p
,
pObj
,
i
)
{
if
(
!
Aig_ObjIsNode
(
pObj
)
)
continue
;
assert
(
pObj
!=
pCtrl
);
pFanin0
=
Aig_ObjFanin0
(
pObj
);
pFanin1
=
Aig_ObjFanin1
(
pObj
);
if
(
pFanin0
==
pCtrl
&&
Aig_ObjIsPi
(
pFanin1
)
)
{
Aig_ObjPrint
(
p
,
pObj
);
printf
(
"
\n
"
);
Aig_ObjPrint
(
p
,
pFanin1
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
if
(
pFanin1
==
pCtrl
&&
Aig_ObjIsPi
(
pFanin0
)
)
{
Aig_ObjPrint
(
p
,
pObj
);
printf
(
"
\n
"
);
Aig_ObjPrint
(
p
,
pFanin0
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
}
////////////////////////////////////////////////////////////////////////
...
...
src/aig/cnf/cnf.h
View file @
e2e9aed1
...
...
@@ -152,6 +152,7 @@ extern Vec_Ptr_t * Cnf_ManScanMapping( Cnf_Man_t * p, int fCollect, int fPre
extern
void
Cnf_SopConvertToVector
(
char
*
pSop
,
int
nCubes
,
Vec_Int_t
*
vCover
);
extern
Cnf_Dat_t
*
Cnf_ManWriteCnf
(
Cnf_Man_t
*
p
,
Vec_Ptr_t
*
vMapped
,
int
nOutputs
);
extern
Cnf_Dat_t
*
Cnf_DeriveSimple
(
Aig_Man_t
*
p
,
int
nOutputs
);
extern
Cnf_Dat_t
*
Cnf_DeriveSimpleForRetiming
(
Aig_Man_t
*
p
);
#ifdef __cplusplus
}
...
...
src/aig/cnf/cnfWrite.c
View file @
e2e9aed1
...
...
@@ -440,6 +440,108 @@ Cnf_Dat_t * Cnf_DeriveSimple( Aig_Man_t * p, int nOutputs )
return
pCnf
;
}
/**Function*************************************************************
Synopsis [Derives a simple CNF for backward retiming computation.]
Description [The last argument shows the number of last outputs
of the manager, which will not be converted into clauses.
New variables will be introduced for these outputs.]
SideEffects []
SeeAlso []
***********************************************************************/
Cnf_Dat_t
*
Cnf_DeriveSimpleForRetiming
(
Aig_Man_t
*
p
)
{
Aig_Obj_t
*
pObj
;
Cnf_Dat_t
*
pCnf
;
int
OutVar
,
PoVar
,
pVars
[
32
],
*
pLits
,
**
pClas
;
int
i
,
nLiterals
,
nClauses
,
Number
;
// count the number of literals and clauses
nLiterals
=
1
+
7
*
Aig_ManNodeNum
(
p
)
+
5
*
Aig_ManPoNum
(
p
);
nClauses
=
1
+
3
*
Aig_ManNodeNum
(
p
)
+
3
*
Aig_ManPoNum
(
p
);
// allocate CNF
pCnf
=
ALLOC
(
Cnf_Dat_t
,
1
);
memset
(
pCnf
,
0
,
sizeof
(
Cnf_Dat_t
)
);
pCnf
->
pMan
=
p
;
pCnf
->
nLiterals
=
nLiterals
;
pCnf
->
nClauses
=
nClauses
;
pCnf
->
pClauses
=
ALLOC
(
int
*
,
nClauses
+
1
);
pCnf
->
pClauses
[
0
]
=
ALLOC
(
int
,
nLiterals
);
pCnf
->
pClauses
[
nClauses
]
=
pCnf
->
pClauses
[
0
]
+
nLiterals
;
// create room for variable numbers
pCnf
->
pVarNums
=
ALLOC
(
int
,
Aig_ManObjNumMax
(
p
)
);
memset
(
pCnf
->
pVarNums
,
0xff
,
sizeof
(
int
)
*
Aig_ManObjNumMax
(
p
)
);
// assign variables to the last (nOutputs) POs
Number
=
1
;
Aig_ManForEachPo
(
p
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
// assign variables to the internal nodes
Aig_ManForEachNode
(
p
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
// assign variables to the PIs and constant node
Aig_ManForEachPi
(
p
,
pObj
,
i
)
pCnf
->
pVarNums
[
pObj
->
Id
]
=
Number
++
;
pCnf
->
pVarNums
[
Aig_ManConst1
(
p
)
->
Id
]
=
Number
++
;
pCnf
->
nVars
=
Number
;
// assign the clauses
pLits
=
pCnf
->
pClauses
[
0
];
pClas
=
pCnf
->
pClauses
;
Aig_ManForEachNode
(
p
,
pObj
,
i
)
{
OutVar
=
pCnf
->
pVarNums
[
pObj
->
Id
];
pVars
[
0
]
=
pCnf
->
pVarNums
[
Aig_ObjFanin0
(
pObj
)
->
Id
];
pVars
[
1
]
=
pCnf
->
pVarNums
[
Aig_ObjFanin1
(
pObj
)
->
Id
];
// positive phase
*
pClas
++
=
pLits
;
*
pLits
++
=
2
*
OutVar
;
*
pLits
++
=
2
*
pVars
[
0
]
+
!
Aig_ObjFaninC0
(
pObj
);
*
pLits
++
=
2
*
pVars
[
1
]
+
!
Aig_ObjFaninC1
(
pObj
);
// negative phase
*
pClas
++
=
pLits
;
*
pLits
++
=
2
*
OutVar
+
1
;
*
pLits
++
=
2
*
pVars
[
0
]
+
Aig_ObjFaninC0
(
pObj
);
*
pClas
++
=
pLits
;
*
pLits
++
=
2
*
OutVar
+
1
;
*
pLits
++
=
2
*
pVars
[
1
]
+
Aig_ObjFaninC1
(
pObj
);
}
// write the constant literal
OutVar
=
pCnf
->
pVarNums
[
Aig_ManConst1
(
p
)
->
Id
];
assert
(
OutVar
<=
Aig_ManObjNumMax
(
p
)
);
*
pClas
++
=
pLits
;
*
pLits
++
=
2
*
OutVar
;
// write the output literals
Aig_ManForEachPo
(
p
,
pObj
,
i
)
{
OutVar
=
pCnf
->
pVarNums
[
Aig_ObjFanin0
(
pObj
)
->
Id
];
PoVar
=
pCnf
->
pVarNums
[
pObj
->
Id
];
// first clause
*
pClas
++
=
pLits
;
*
pLits
++
=
2
*
PoVar
;
*
pLits
++
=
2
*
OutVar
+
!
Aig_ObjFaninC0
(
pObj
);
// second clause
*
pClas
++
=
pLits
;
*
pLits
++
=
2
*
PoVar
+
1
;
*
pLits
++
=
2
*
OutVar
+
Aig_ObjFaninC0
(
pObj
);
// final clause (init-state is always 0 -> set the output to 0)
*
pClas
++
=
pLits
;
*
pLits
++
=
2
*
PoVar
+
1
;
}
// verify that the correct number of literals and clauses was written
assert
(
pLits
-
pCnf
->
pClauses
[
0
]
==
nLiterals
);
assert
(
pClas
-
pCnf
->
pClauses
==
nClauses
);
return
pCnf
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/aig/nwk/nwkFlow.c
View file @
e2e9aed1
...
...
@@ -20,6 +20,14 @@
#include "nwk.h"
/*
This code is based on the papers:
A. Hurst, A. Mishchenko, and R. Brayton, "Fast minimum-register retiming
via binary maximum-flow", Proc. FMCAD '07, pp. 181-187.
A. Hurst, A. Mishchenko, and R. Brayton, "Scalable min-area retiming
under simultaneous delay and initial state constraints". Proc. DAC'08.
*/
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
...
...
@@ -368,7 +376,7 @@ int Nwk_ManVerifyCut_rec( Nwk_Obj_t * pObj )
return
0
;
return
1
;
}
/**Function*************************************************************
Synopsis [Verifies the forward cut.]
...
...
@@ -453,7 +461,7 @@ Vec_Ptr_t * Nwk_ManRetimeCutForward( Nwk_Man_t * pMan, int nLatches, int fVerbos
Counter
++
;
}
if
(
fVerbose
)
printf
(
"Forward:
Max-flow1 = %5d.
"
,
Counter
);
printf
(
"Forward:
Max-flow = %4d ->
"
,
Counter
);
// continue flow computation from each LO
Nwk_ManIncrementTravIdFlow
(
pMan
);
Nwk_ManForEachLoSeq
(
pMan
,
pObj
,
i
)
...
...
@@ -464,7 +472,7 @@ Vec_Ptr_t * Nwk_ManRetimeCutForward( Nwk_Man_t * pMan, int nLatches, int fVerbos
Counter2
++
;
}
if
(
fVerbose
)
printf
(
"
Max-flow2 = %5
d. "
,
Counter
+
Counter2
);
printf
(
"
%4
d. "
,
Counter
+
Counter2
);
// repeat flow computation from each LO
if
(
Counter2
>
0
)
{
...
...
@@ -489,10 +497,10 @@ Vec_Ptr_t * Nwk_ManRetimeCutForward( Nwk_Man_t * pMan, int nLatches, int fVerbos
}
}
Nwk_ManCleanMarks
(
pMan
);
assert
(
Nwk_ManRetimeVerifyCutForward
(
pMan
,
vNodes
)
);
//
assert( Nwk_ManRetimeVerifyCutForward(pMan, vNodes) );
if
(
fVerbose
)
{
printf
(
"Min-cut = %
5d. Unmoved regs = %5
d. "
,
Vec_PtrSize
(
vNodes
),
Counter
);
printf
(
"Min-cut = %
4d. Unmoved = %4
d. "
,
Vec_PtrSize
(
vNodes
),
Counter
);
PRT
(
"Time"
,
clock
()
-
clk
);
}
return
vNodes
;
...
...
@@ -536,8 +544,8 @@ Vec_Ptr_t * Nwk_ManRetimeCutBackward( Nwk_Man_t * pMan, int nLatches, int fVerbo
Nwk_ManIncrementTravIdFlow
(
pMan
);
Counter
++
;
}
if
(
fVerbose
)
printf
(
"Backward: Max-flow
1 = %5d.
"
,
Counter
);
if
(
fVerbose
)
printf
(
"Backward: Max-flow
= %4d ->
"
,
Counter
);
// continue flow computation from each LI driver
Nwk_ManIncrementTravIdFlow
(
pMan
);
Nwk_ManForEachLiSeq
(
pMan
,
pObj
,
i
)
...
...
@@ -548,7 +556,7 @@ Vec_Ptr_t * Nwk_ManRetimeCutBackward( Nwk_Man_t * pMan, int nLatches, int fVerbo
Counter2
++
;
}
if
(
fVerbose
)
printf
(
"
Max-flow2 = %5
d. "
,
Counter
+
Counter2
);
printf
(
"
%4
d. "
,
Counter
+
Counter2
);
// repeat flow computation from each LI driver
if
(
Counter2
>
0
)
{
...
...
@@ -576,10 +584,10 @@ Vec_Ptr_t * Nwk_ManRetimeCutBackward( Nwk_Man_t * pMan, int nLatches, int fVerbo
if
(
Nwk_ObjVisitedBotOnly
(
Nwk_ObjFanin0
(
pObj
)
)
)
Counter
++
;
Nwk_ManCleanMarks
(
pMan
);
assert
(
Nwk_ManRetimeVerifyCutBackward
(
pMan
,
vNodes
)
);
//
assert( Nwk_ManRetimeVerifyCutBackward(pMan, vNodes) );
if
(
fVerbose
)
{
printf
(
"Min-cut = %
5d. Unmoved regs = %5
d. "
,
Vec_PtrSize
(
vNodes
),
Counter
);
printf
(
"Min-cut = %
4d. Unmoved = %4
d. "
,
Vec_PtrSize
(
vNodes
),
Counter
);
PRT
(
"Time"
,
clock
()
-
clk
);
}
return
vNodes
;
...
...
src/aig/nwk/nwkFlow_depth.c
0 → 100644
View file @
e2e9aed1
This diff is collapsed.
Click to expand it.
src/aig/saig/saigPhase.c
View file @
e2e9aed1
...
...
@@ -272,7 +272,7 @@ void Saig_TsiPrintTraces( Saig_Tsim_t * p, int nWords, int nPrefix )
else
continue
;
// print trace
printf
(
"%5d : %5d
"
,
Counter
,
i
);
printf
(
"%5d : %5d
%5d "
,
Counter
,
i
,
Saig_ManLo
(
p
->
pAig
,
i
)
->
Id
);
Vec_PtrForEachEntryStop
(
p
->
vStates
,
pState
,
k
,
Vec_PtrSize
(
p
->
vStates
)
-
1
)
{
Value
=
(
Aig_InfoHasBit
(
pState
,
2
*
i
+
1
)
<<
1
)
|
Aig_InfoHasBit
(
pState
,
2
*
i
);
...
...
@@ -536,6 +536,60 @@ Saig_Tsim_t * Saig_ManReachableTernary( Aig_Man_t * p, Vec_Int_t * vInits )
/**Function*************************************************************
Synopsis [Analize initial value of the selected register.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Saig_ManAnalizeControl
(
Aig_Man_t
*
p
,
int
Reg
)
{
Aig_Obj_t
*
pObj
,
*
pReg
,
*
pCtrl
,
*
pAnd
;
int
i
;
pReg
=
Saig_ManLo
(
p
,
Reg
);
pCtrl
=
Saig_ManLo
(
p
,
Saig_ManRegNum
(
p
)
-
1
);
assert
(
pReg
->
Id
<
pCtrl
->
Id
);
// find a node pointing to both
pAnd
=
NULL
;
Aig_ManForEachNode
(
p
,
pObj
,
i
)
{
if
(
Aig_ObjFanin0
(
pObj
)
==
pReg
&&
Aig_ObjFanin1
(
pObj
)
==
pCtrl
)
{
pAnd
=
pObj
;
break
;
}
}
if
(
pAnd
==
NULL
)
{
printf
(
"Register is not found.
\n
"
);
return
;
}
printf
(
"Clock-like register:
\n
"
);
Aig_ObjPrint
(
p
,
pReg
);
printf
(
"
\n
"
);
printf
(
"Control register:
\n
"
);
Aig_ObjPrint
(
p
,
pCtrl
);
printf
(
"
\n
"
);
printf
(
"Their fanout:
\n
"
);
Aig_ObjPrint
(
p
,
pAnd
);
printf
(
"
\n
"
);
// find the fanouts of pAnd
printf
(
"Fanouts of the fanout:
\n
"
);
Aig_ManForEachObj
(
p
,
pObj
,
i
)
if
(
Aig_ObjFanin0
(
pObj
)
==
pAnd
||
Aig_ObjFanin1
(
pObj
)
==
pAnd
)
{
Aig_ObjPrint
(
p
,
pObj
);
printf
(
"
\n
"
);
}
printf
(
"
\n
"
);
}
/**Function*************************************************************
Synopsis [Finds the registers to phase-abstract.]
Description []
...
...
@@ -587,6 +641,9 @@ int Saig_ManFindRegisters( Saig_Tsim_t * pTsi, int nFrames, int fIgnore, int fVe
for
(
k
=
0
;
k
<
nFrames
;
k
++
)
Saig_XsimPrint
(
stdout
,
Values
[
k
]
);
printf
(
"]
\n
"
);
if
(
fVerbose
)
Saig_ManAnalizeControl
(
pTsi
->
pAig
,
Reg
);
}
}
Vec_IntShrink
(
pTsi
->
vNonXRegs
,
r
);
...
...
@@ -595,6 +652,7 @@ int Saig_ManFindRegisters( Saig_Tsim_t * pTsi, int nFrames, int fIgnore, int fVe
return
Vec_IntSize
(
pTsi
->
vNonXRegs
);
}
/**Function*************************************************************
Synopsis [Mapping of AIG nodes into frames nodes.]
...
...
@@ -662,7 +720,7 @@ Aig_Man_t * Saig_ManPerformAbstraction( Saig_Tsim_t * pTsi, int nFrames, int fVe
pState
=
Vec_PtrEntry
(
pTsi
->
vStates
,
f
);
Value
=
(
Aig_InfoHasBit
(
pState
,
2
*
Reg
+
1
)
<<
1
)
|
Aig_InfoHasBit
(
pState
,
2
*
Reg
);
assert
(
Value
==
SAIG_XVS0
||
Value
==
SAIG_XVS1
);
pObjNew
=
Value
?
Aig_ManConst1
(
pFrames
)
:
Aig_ManConst0
(
pFrames
);
pObjNew
=
(
Value
==
SAIG_XVS1
)
?
Aig_ManConst1
(
pFrames
)
:
Aig_ManConst0
(
pFrames
);
Saig_ObjSetFrames
(
pObjMap
,
nFrames
,
pObj
,
f
,
pObjNew
);
}
// add internal nodes of this frame
...
...
src/aig/saig/saigRetMin.c
View file @
e2e9aed1
This diff is collapsed.
Click to expand it.
src/base/abci/abc.c
View file @
e2e9aed1
...
...
@@ -11921,13 +11921,14 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
int
fMinArea
;
int
fForwardOnly
;
int
fBackwardOnly
;
int
fInitial
;
int
nStepsMax
;
int
fFastAlgo
;
int
fVerbose
;
int
c
;
extern
Abc_Ntk_t
*
Abc_NtkDarRetime
(
Abc_Ntk_t
*
pNtk
,
int
nStepsMax
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_NtkDarRetimeF
(
Abc_Ntk_t
*
pNtk
,
int
nStepsMax
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_NtkDarRetimeMinArea
(
Abc_Ntk_t
*
pNtk
,
int
fForwardOnly
,
int
fBackwardOnly
,
int
fVerbose
);
extern
Abc_Ntk_t
*
Abc_NtkDarRetimeMinArea
(
Abc_Ntk_t
*
pNtk
,
int
fForwardOnly
,
int
fBackwardOnly
,
int
f
Initial
,
int
f
Verbose
);
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
pOut
=
Abc_FrameReadOut
(
pAbc
);
...
...
@@ -11936,12 +11937,13 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
// set defaults
fMinArea
=
1
;
fForwardOnly
=
0
;
fBackwardOnly
=
1
;
fBackwardOnly
=
0
;
fInitial
=
1
;
nStepsMax
=
100000
;
fFastAlgo
=
1
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Smfbavh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Smfb
i
avh"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -11965,6 +11967,9 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'b'
:
fBackwardOnly
^=
1
;
break
;
case
'i'
:
fInitial
^=
1
;
break
;
case
'a'
:
fFastAlgo
^=
1
;
break
;
...
...
@@ -11998,7 +12003,7 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
// perform the retiming
if
(
fMinArea
)
pNtkRes
=
Abc_NtkDarRetimeMinArea
(
pNtk
,
fForwardOnly
,
fBackwardOnly
,
fVerbose
);
pNtkRes
=
Abc_NtkDarRetimeMinArea
(
pNtk
,
fForwardOnly
,
fBackwardOnly
,
f
Initial
,
f
Verbose
);
else
if
(
fFastAlgo
)
pNtkRes
=
Abc_NtkDarRetime
(
pNtk
,
nStepsMax
,
fVerbose
);
else
...
...
@@ -12013,11 +12018,12 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
fprintf
(
pErr
,
"usage: dretime [-S num] [-mfbavh]
\n
"
);
fprintf
(
pErr
,
"
\t
retimes the current network forward
\n
"
);
fprintf
(
pErr
,
"usage: dretime [-S num] [-mfb
i
avh]
\n
"
);
fprintf
(
pErr
,
"
\t
new implementation of min-area retiming
\n
"
);
fprintf
(
pErr
,
"
\t
-m : toggle min-area and most-forward retiming [default = %s]
\n
"
,
fMinArea
?
"min-area"
:
"most-fwd"
);
fprintf
(
pErr
,
"
\t
-f : enables forward-only retiming [default = %s]
\n
"
,
fForwardOnly
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-b : enables backward-only retiming [default = %s]
\n
"
,
fBackwardOnly
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-i : enables init state computation [default = %s]
\n
"
,
fInitial
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-S num : the max number of forward retiming steps to perform [default = %d]
\n
"
,
nStepsMax
);
fprintf
(
pErr
,
"
\t
-a : enables a fast most-forward algorithm [default = %s]
\n
"
,
fFastAlgo
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-v : enables verbose output [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
...
...
@@ -13127,7 +13133,7 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv )
nFrames
=
0
;
fIgnore
=
0
;
fPrint
=
0
;
fVerbose
=
1
;
fVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Fipvh"
)
)
!=
EOF
)
{
...
...
src/base/abci/abcDar.c
View file @
e2e9aed1
...
...
@@ -1364,6 +1364,7 @@ int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nFrames, int fRetim
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkDarLatchSweep
(
Abc_Ntk_t
*
pNtk
,
int
fLatchConst
,
int
fLatchEqual
,
int
fVerbose
)
{
extern
void
Aig_ManPrintControlFanouts
(
Aig_Man_t
*
p
);
Abc_Ntk_t
*
pNtkAig
;
Aig_Man_t
*
pMan
,
*
pTemp
;
pMan
=
Abc_NtkToDar
(
pNtk
,
0
,
1
);
...
...
@@ -1380,6 +1381,7 @@ Abc_Ntk_t * Abc_NtkDarLatchSweep( Abc_Ntk_t * pNtk, int fLatchConst, int fLatchE
pMan
=
Aig_ManScl
(
pTemp
=
pMan
,
fLatchConst
,
fLatchEqual
,
fVerbose
);
Aig_ManStop
(
pTemp
);
pNtkAig
=
Abc_NtkFromDarSeqSweep
(
pNtk
,
pMan
);
//Aig_ManPrintControlFanouts( pMan );
Aig_ManStop
(
pMan
);
return
pNtkAig
;
}
...
...
@@ -1429,9 +1431,9 @@ Abc_Ntk_t * Abc_NtkDarRetime( Abc_Ntk_t * pNtk, int nStepsMax, int fVerbose )
SeeAlso []
***********************************************************************/
Abc_Ntk_t
*
Abc_NtkDarRetimeMinArea
(
Abc_Ntk_t
*
pNtk
,
int
fForwardOnly
,
int
fBackwardOnly
,
int
fVerbose
)
Abc_Ntk_t
*
Abc_NtkDarRetimeMinArea
(
Abc_Ntk_t
*
pNtk
,
int
fForwardOnly
,
int
fBackwardOnly
,
int
f
Initial
,
int
f
Verbose
)
{
extern
Aig_Man_t
*
Saig_ManRetimeMinArea
(
Aig_Man_t
*
p
,
int
fForwardOnly
,
int
fBackwardOnly
,
int
fVerbose
);
extern
Aig_Man_t
*
Saig_ManRetimeMinArea
(
Aig_Man_t
*
p
,
int
fForwardOnly
,
int
fBackwardOnly
,
int
f
Initial
,
int
f
Verbose
);
Abc_Ntk_t
*
pNtkAig
;
Aig_Man_t
*
pMan
,
*
pTemp
;
pMan
=
Abc_NtkToDar
(
pNtk
,
0
,
1
);
...
...
@@ -1444,7 +1446,7 @@ Abc_Ntk_t * Abc_NtkDarRetimeMinArea( Abc_Ntk_t * pNtk, int fForwardOnly, int fBa
pMan
->
nTruePis
=
Aig_ManPiNum
(
pMan
)
-
Aig_ManRegNum
(
pMan
);
pMan
->
nTruePos
=
Aig_ManPoNum
(
pMan
)
-
Aig_ManRegNum
(
pMan
);
pMan
=
Saig_ManRetimeMinArea
(
pTemp
=
pMan
,
fForwardOnly
,
fBackwardOnly
,
fVerbose
);
pMan
=
Saig_ManRetimeMinArea
(
pTemp
=
pMan
,
fForwardOnly
,
fBackwardOnly
,
f
Initial
,
f
Verbose
);
Aig_ManStop
(
pTemp
);
pNtkAig
=
Abc_NtkFromDarSeqSweep
(
pNtk
,
pMan
);
...
...
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