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
efb8ad0a
Commit
efb8ad0a
authored
Nov 08, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extending and improving timing manager.
parent
7f65f0d7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
436 deletions
+30
-436
src/map/mio/mio.h
+2
-0
src/map/scl/sclCon.h
+7
-4
src/opt/sfm/sfmDec.c
+5
-3
src/opt/sfm/sfmInt.h
+2
-1
src/opt/sfm/sfmMit.c
+14
-428
No files found.
src/map/mio/mio.h
View file @
efb8ad0a
...
@@ -151,9 +151,11 @@ extern char * Mio_GateReadSop ( Mio_Gate_t * pGate );
...
@@ -151,9 +151,11 @@ extern char * Mio_GateReadSop ( Mio_Gate_t * pGate );
extern
Vec_Int_t
*
Mio_GateReadExpr
(
Mio_Gate_t
*
pGate
);
extern
Vec_Int_t
*
Mio_GateReadExpr
(
Mio_Gate_t
*
pGate
);
extern
word
Mio_GateReadTruth
(
Mio_Gate_t
*
pGate
);
extern
word
Mio_GateReadTruth
(
Mio_Gate_t
*
pGate
);
extern
int
Mio_GateReadValue
(
Mio_Gate_t
*
pGate
);
extern
int
Mio_GateReadValue
(
Mio_Gate_t
*
pGate
);
extern
int
Mio_GateReadCell
(
Mio_Gate_t
*
pGate
);
extern
char
*
Mio_GateReadPinName
(
Mio_Gate_t
*
pGate
,
int
iPin
);
extern
char
*
Mio_GateReadPinName
(
Mio_Gate_t
*
pGate
,
int
iPin
);
extern
float
Mio_GateReadPinDelay
(
Mio_Gate_t
*
pGate
,
int
iPin
);
extern
float
Mio_GateReadPinDelay
(
Mio_Gate_t
*
pGate
,
int
iPin
);
extern
void
Mio_GateSetValue
(
Mio_Gate_t
*
pGate
,
int
Value
);
extern
void
Mio_GateSetValue
(
Mio_Gate_t
*
pGate
,
int
Value
);
extern
void
Mio_GateSetCell
(
Mio_Gate_t
*
pGate
,
int
Cell
);
extern
int
Mio_GateIsInv
(
Mio_Gate_t
*
pGate
);
extern
int
Mio_GateIsInv
(
Mio_Gate_t
*
pGate
);
extern
char
*
Mio_PinReadName
(
Mio_Pin_t
*
pPin
);
extern
char
*
Mio_PinReadName
(
Mio_Pin_t
*
pPin
);
extern
Mio_PinPhase_t
Mio_PinReadPhase
(
Mio_Pin_t
*
pPin
);
extern
Mio_PinPhase_t
Mio_PinReadPhase
(
Mio_Pin_t
*
pPin
);
...
...
src/map/scl/sclCon.h
View file @
efb8ad0a
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
Revision [$Id: sclCon.h,v 1.0 2012/08/24 00:00:00 alanmi Exp $]
Revision [$Id: sclCon.h,v 1.0 2012/08/24 00:00:00 alanmi Exp $]
***********************************************************************/
***********************************************************************/
#ifndef ABC__scl_Con__h
#define ABC__scl_Con__h
ABC_NAMESPACE_HEADER_START
ABC_NAMESPACE_HEADER_START
...
@@ -279,11 +282,11 @@ static inline float Scl_ConGetOutReqFloat( int i ) { return Scl_Wrd2Flt( Scl_
...
@@ -279,11 +282,11 @@ static inline float Scl_ConGetOutReqFloat( int i ) { return Scl_Wrd2Flt( Scl_
static
inline
float
Scl_ConGetOutLoadFloat
(
int
i
)
{
return
Scl_Wrd2Flt
(
Scl_ConGetOutLoad
(
i
)
);
}
static
inline
float
Scl_ConGetOutLoadFloat
(
int
i
)
{
return
Scl_Wrd2Flt
(
Scl_ConGetOutLoad
(
i
)
);
}
ABC_NAMESPACE_HEADER_END
#endif
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_END
src/opt/sfm/sfmDec.c
View file @
efb8ad0a
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
#include "misc/util/utilTruth.h"
#include "misc/util/utilTruth.h"
#include "opt/dau/dau.h"
#include "opt/dau/dau.h"
#include "map/mio/exp.h"
#include "map/mio/exp.h"
#include "map/scl/sclCon.h"
#include "base/main/main.h"
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
...
@@ -212,10 +214,10 @@ p->timeLib = Abc_Clock();
...
@@ -212,10 +214,10 @@ p->timeLib = Abc_Clock();
p
->
timeLib
=
Abc_Clock
()
-
p
->
timeLib
;
p
->
timeLib
=
Abc_Clock
()
-
p
->
timeLib
;
if
(
!
pPars
->
fArea
)
if
(
!
pPars
->
fArea
)
{
{
if
(
p
->
pMit
)
if
(
Abc_FrameReadLibScl
()
)
p
->
pMit
=
Sfm_MitStart
(
pLib
,
NULL
,
pNtk
,
p
->
DeltaCrit
);
p
->
pMit
=
Sfm_MitStart
(
pLib
,
(
SC_Lib
*
)
Abc_FrameReadLibScl
(),
Scl_ConReadMan
()
,
pNtk
,
p
->
DeltaCrit
);
else
else
p
->
pTim
=
Sfm_TimStart
(
pLib
,
NULL
,
pNtk
,
p
->
DeltaCrit
);
p
->
pTim
=
Sfm_TimStart
(
pLib
,
Scl_ConReadMan
()
,
pNtk
,
p
->
DeltaCrit
);
}
}
if
(
pPars
->
fVeryVerbose
)
if
(
pPars
->
fVeryVerbose
)
// if ( pPars->fVerbose )
// if ( pPars->fVerbose )
...
...
src/opt/sfm/sfmInt.h
View file @
efb8ad0a
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "misc/vec/vec.h"
#include "misc/vec/vec.h"
#include "sat/bsat/satSolver.h"
#include "sat/bsat/satSolver.h"
#include "misc/util/utilNam.h"
#include "misc/util/utilNam.h"
#include "map/scl/sclLib.h"
#include "map/scl/sclCon.h"
#include "map/scl/sclCon.h"
#include "misc/st/st.h"
#include "misc/st/st.h"
#include "map/mio/mio.h"
#include "map/mio/mio.h"
...
@@ -226,7 +227,7 @@ extern int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands, int
...
@@ -226,7 +227,7 @@ extern int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands, int
extern
int
Sfm_TimNodeIsNonCritical
(
Sfm_Tim_t
*
p
,
Abc_Obj_t
*
pPivot
,
Abc_Obj_t
*
pNode
);
extern
int
Sfm_TimNodeIsNonCritical
(
Sfm_Tim_t
*
p
,
Abc_Obj_t
*
pPivot
,
Abc_Obj_t
*
pNode
);
extern
int
Sfm_TimEvalRemapping
(
Sfm_Tim_t
*
p
,
Vec_Int_t
*
vFanins
,
Vec_Int_t
*
vMap
,
Mio_Gate_t
*
pGate1
,
char
*
pFans1
,
Mio_Gate_t
*
pGate2
,
char
*
pFans2
);
extern
int
Sfm_TimEvalRemapping
(
Sfm_Tim_t
*
p
,
Vec_Int_t
*
vFanins
,
Vec_Int_t
*
vMap
,
Mio_Gate_t
*
pGate1
,
char
*
pFans1
,
Mio_Gate_t
*
pGate2
,
char
*
pFans2
);
/*=== sfmMit.c ==========================================================*/
/*=== sfmMit.c ==========================================================*/
extern
Sfm_Mit_t
*
Sfm_MitStart
(
Mio_Library_t
*
pLib
,
Scl_Con_t
*
pExt
,
Abc_Ntk_t
*
pNtk
,
int
DeltaCrit
);
extern
Sfm_Mit_t
*
Sfm_MitStart
(
Mio_Library_t
*
pLib
,
S
C_Lib
*
pScl
,
S
cl_Con_t
*
pExt
,
Abc_Ntk_t
*
pNtk
,
int
DeltaCrit
);
extern
void
Sfm_MitStop
(
Sfm_Mit_t
*
p
);
extern
void
Sfm_MitStop
(
Sfm_Mit_t
*
p
);
extern
int
Sfm_MitReadNtkDelay
(
Sfm_Mit_t
*
p
);
extern
int
Sfm_MitReadNtkDelay
(
Sfm_Mit_t
*
p
);
extern
int
Sfm_MitReadObjDelay
(
Sfm_Mit_t
*
p
,
int
iObj
);
extern
int
Sfm_MitReadObjDelay
(
Sfm_Mit_t
*
p
,
int
iObj
);
...
...
src/opt/sfm/sfmMit.c
View file @
efb8ad0a
...
@@ -22,410 +22,25 @@
...
@@ -22,410 +22,25 @@
ABC_NAMESPACE_IMPL_START
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
struct
Sfm_Mit_t_
struct
Sfm_Mit_t_
{
{
// external
int
Value1
;
Mio_Library_t
*
pLib
;
// library
int
Value2
;
Scl_Con_t
*
pExt
;
// external timing
int
Value3
;
Abc_Ntk_t
*
pNtk
;
// mapped network
int
Value4
;
int
Delay
;
// the largest delay
int
DeltaCrit
;
// critical delay delta
// timing info
Vec_Int_t
vTimArrs
;
// arrivals (rise/fall)
Vec_Int_t
vTimReqs
;
// required (rise/fall)
Vec_Int_t
vTimSlews
;
// slews (rise/fall)
Vec_Int_t
vTimLoads
;
// loads (rise/fall)
// timing edges
Vec_Int_t
vObjOffs
;
// object offsets
Vec_Int_t
vTimEdges
;
// edge timings (rise/fall)
// incremental timing
Vec_Wec_t
vLevels
;
// levels
// critical path
Vec_Int_t
vPath
;
// critical path
Vec_Wrd_t
vSortData
;
// node priority order
};
};
static
inline
int
*
Sfm_MitArrId
(
Sfm_Mit_t
*
p
,
int
Id
)
{
return
Vec_IntEntryP
(
&
p
->
vTimArrs
,
Abc_Var2Lit
(
Id
,
0
)
);
}
static
inline
int
*
Sfm_MitReqId
(
Sfm_Mit_t
*
p
,
int
Id
)
{
return
Vec_IntEntryP
(
&
p
->
vTimReqs
,
Abc_Var2Lit
(
Id
,
0
)
);
}
static
inline
int
*
Sfm_MitSlewId
(
Sfm_Mit_t
*
p
,
int
Id
)
{
return
Vec_IntEntryP
(
&
p
->
vTimSlews
,
Abc_Var2Lit
(
Id
,
0
)
);
}
static
inline
int
*
Sfm_MitLoadId
(
Sfm_Mit_t
*
p
,
int
Id
)
{
return
Vec_IntEntryP
(
&
p
->
vTimLoads
,
Abc_Var2Lit
(
Id
,
0
)
);
}
static
inline
int
*
Sfm_MitArr
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
return
Vec_IntEntryP
(
&
p
->
vTimArrs
,
Abc_Var2Lit
(
Abc_ObjId
(
pNode
),
0
)
);
}
static
inline
int
*
Sfm_MitReq
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
return
Vec_IntEntryP
(
&
p
->
vTimReqs
,
Abc_Var2Lit
(
Abc_ObjId
(
pNode
),
0
)
);
}
static
inline
int
*
Sfm_MitSlew
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
return
Vec_IntEntryP
(
&
p
->
vTimSlews
,
Abc_Var2Lit
(
Abc_ObjId
(
pNode
),
0
)
);
}
static
inline
int
*
Sfm_MitLoad
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
return
Vec_IntEntryP
(
&
p
->
vTimLoads
,
Abc_Var2Lit
(
Abc_ObjId
(
pNode
),
0
)
);
}
static
inline
int
Sfm_MitArrMaxId
(
Sfm_Mit_t
*
p
,
int
Id
)
{
int
*
a
=
Sfm_MitArrId
(
p
,
Id
);
return
Abc_MaxInt
(
a
[
0
],
a
[
1
]);
}
static
inline
int
Sfm_MitArrMax
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
int
*
a
=
Sfm_MitArr
(
p
,
pNode
);
return
Abc_MaxInt
(
a
[
0
],
a
[
1
]);
}
static
inline
void
Sfm_MitSetReq
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
,
int
t
)
{
int
*
r
=
Sfm_MitReq
(
p
,
pNode
);
r
[
0
]
=
r
[
1
]
=
t
;
}
static
inline
int
Sfm_MitSlack
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
int
*
r
=
Sfm_MitReq
(
p
,
pNode
),
*
a
=
Sfm_MitArr
(
p
,
pNode
);
return
Abc_MinInt
(
r
[
0
]
-
a
[
0
],
r
[
1
]
-
a
[
1
]);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
/**Function*************************************************************
Synopsis []
Synopsis [Temporary place holders.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
void
Sfm_MitEdgeArrival
(
Sfm_Mit_t
*
p
,
Mio_Pin_t
*
pPin
,
int
*
pTimeIn
,
int
*
pTimeOut
)
{
Mio_PinPhase_t
PinPhase
=
Mio_PinReadPhase
(
pPin
);
int
tDelayBlockRise
=
(
int
)(
MIO_NUM
*
Mio_PinReadDelayBlockRise
(
pPin
));
int
tDelayBlockFall
=
(
int
)(
MIO_NUM
*
Mio_PinReadDelayBlockFall
(
pPin
));
if
(
PinPhase
!=
MIO_PHASE_INV
)
// NONINV phase is present
{
pTimeOut
[
0
]
=
Abc_MaxInt
(
pTimeOut
[
0
],
pTimeIn
[
0
]
+
tDelayBlockRise
);
pTimeOut
[
1
]
=
Abc_MaxInt
(
pTimeOut
[
1
],
pTimeIn
[
1
]
+
tDelayBlockFall
);
}
if
(
PinPhase
!=
MIO_PHASE_NONINV
)
// INV phase is present
{
pTimeOut
[
0
]
=
Abc_MaxInt
(
pTimeOut
[
0
],
pTimeIn
[
1
]
+
tDelayBlockRise
);
pTimeOut
[
1
]
=
Abc_MaxInt
(
pTimeOut
[
1
],
pTimeIn
[
0
]
+
tDelayBlockFall
);
}
}
static
inline
void
Sfm_MitGateArrival
(
Sfm_Mit_t
*
p
,
Mio_Gate_t
*
pGate
,
int
**
pTimesIn
,
int
*
pTimeOut
)
{
Mio_Pin_t
*
pPin
;
int
i
=
0
;
pTimeOut
[
0
]
=
pTimeOut
[
1
]
=
0
;
Mio_GateForEachPin
(
pGate
,
pPin
)
Sfm_MitEdgeArrival
(
p
,
pPin
,
pTimesIn
[
i
++
],
pTimeOut
);
assert
(
i
==
Mio_GateReadPinNum
(
pGate
)
);
}
static
inline
void
Sfm_MitNodeArrival
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
int
i
,
iFanin
,
*
pTimesIn
[
6
];
int
*
pTimeOut
=
Sfm_MitArr
(
p
,
pNode
);
assert
(
Abc_ObjFaninNum
(
pNode
)
<=
6
);
Abc_ObjForEachFaninId
(
pNode
,
iFanin
,
i
)
pTimesIn
[
i
]
=
Sfm_MitArrId
(
p
,
iFanin
);
Sfm_MitGateArrival
(
p
,
(
Mio_Gate_t
*
)
pNode
->
pData
,
pTimesIn
,
pTimeOut
);
}
static
inline
void
Sfm_MitEdgeRequired
(
Sfm_Mit_t
*
p
,
Mio_Pin_t
*
pPin
,
int
*
pTimeIn
,
int
*
pTimeOut
)
{
Mio_PinPhase_t
PinPhase
=
Mio_PinReadPhase
(
pPin
);
int
tDelayBlockRise
=
(
int
)(
MIO_NUM
*
Mio_PinReadDelayBlockRise
(
pPin
));
int
tDelayBlockFall
=
(
int
)(
MIO_NUM
*
Mio_PinReadDelayBlockFall
(
pPin
));
if
(
PinPhase
!=
MIO_PHASE_INV
)
// NONINV phase is present
{
pTimeIn
[
0
]
=
Abc_MinInt
(
pTimeIn
[
0
],
pTimeOut
[
0
]
-
tDelayBlockRise
);
pTimeIn
[
1
]
=
Abc_MinInt
(
pTimeIn
[
1
],
pTimeOut
[
1
]
-
tDelayBlockFall
);
}
if
(
PinPhase
!=
MIO_PHASE_NONINV
)
// INV phase is present
{
pTimeIn
[
0
]
=
Abc_MinInt
(
pTimeIn
[
0
],
pTimeOut
[
1
]
-
tDelayBlockRise
);
pTimeIn
[
1
]
=
Abc_MinInt
(
pTimeIn
[
1
],
pTimeOut
[
0
]
-
tDelayBlockFall
);
}
}
static
inline
void
Sfm_MitGateRequired
(
Sfm_Mit_t
*
p
,
Mio_Gate_t
*
pGate
,
int
**
pTimesIn
,
int
*
pTimeOut
)
{
Mio_Pin_t
*
pPin
;
int
i
=
0
;
Mio_GateForEachPin
(
pGate
,
pPin
)
Sfm_MitEdgeRequired
(
p
,
pPin
,
pTimesIn
[
i
++
],
pTimeOut
);
assert
(
i
==
Mio_GateReadPinNum
(
pGate
)
);
}
void
Sfm_MitNodeRequired
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pNode
)
{
int
i
,
iFanin
,
*
pTimesIn
[
6
];
int
*
pTimeOut
=
Sfm_MitReq
(
p
,
pNode
);
assert
(
Abc_ObjFaninNum
(
pNode
)
<=
6
);
Abc_ObjForEachFaninId
(
pNode
,
iFanin
,
i
)
pTimesIn
[
i
]
=
Sfm_MitReqId
(
p
,
iFanin
);
Sfm_MitGateRequired
(
p
,
(
Mio_Gate_t
*
)
pNode
->
pData
,
pTimesIn
,
pTimeOut
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Sfm_MitCriticalPath_int
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pObj
,
Vec_Int_t
*
vPath
,
int
SlackMax
)
{
Abc_Obj_t
*
pNext
;
int
i
;
if
(
Abc_NodeIsTravIdCurrent
(
pObj
)
)
return
;
Abc_NodeSetTravIdCurrent
(
pObj
);
assert
(
Abc_ObjIsNode
(
pObj
)
);
Abc_ObjForEachFanin
(
pObj
,
pNext
,
i
)
{
if
(
Abc_ObjIsCi
(
pNext
)
||
Abc_ObjFaninNum
(
pNext
)
==
0
)
continue
;
assert
(
Abc_ObjIsNode
(
pNext
)
);
if
(
Sfm_MitSlack
(
p
,
pNext
)
<=
SlackMax
)
Sfm_MitCriticalPath_int
(
p
,
pNext
,
vPath
,
SlackMax
);
}
if
(
Abc_ObjFaninNum
(
pObj
)
>
0
)
Vec_IntPush
(
vPath
,
Abc_ObjId
(
pObj
)
);
}
int
Sfm_MitCriticalPath
(
Sfm_Mit_t
*
p
,
int
Window
)
{
int
i
,
SlackMax
=
p
->
Delay
*
Window
/
100
;
Abc_Obj_t
*
pObj
,
*
pNext
;
Vec_IntClear
(
&
p
->
vPath
);
Abc_NtkIncrementTravId
(
p
->
pNtk
);
Abc_NtkForEachCo
(
p
->
pNtk
,
pObj
,
i
)
{
pNext
=
Abc_ObjFanin0
(
pObj
);
if
(
Abc_ObjIsCi
(
pNext
)
||
Abc_ObjFaninNum
(
pNext
)
==
0
)
continue
;
assert
(
Abc_ObjIsNode
(
pNext
)
);
if
(
Sfm_MitSlack
(
p
,
pNext
)
<=
SlackMax
)
Sfm_MitCriticalPath_int
(
p
,
pNext
,
&
p
->
vPath
,
SlackMax
);
}
return
Vec_IntSize
(
&
p
->
vPath
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Sfm_MitTrace
(
Sfm_Mit_t
*
p
)
{
Abc_Obj_t
*
pObj
;
int
i
,
Delay
=
0
;
Vec_Ptr_t
*
vNodes
=
Abc_NtkDfs
(
p
->
pNtk
,
1
);
Vec_PtrForEachEntry
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
Sfm_MitNodeArrival
(
p
,
pObj
);
Abc_NtkForEachCo
(
p
->
pNtk
,
pObj
,
i
)
Delay
=
Abc_MaxInt
(
Delay
,
Sfm_MitArrMax
(
p
,
Abc_ObjFanin0
(
pObj
))
);
Vec_IntFill
(
&
p
->
vTimReqs
,
2
*
Abc_NtkObjNumMax
(
p
->
pNtk
),
ABC_INFINITY
);
Abc_NtkForEachCo
(
p
->
pNtk
,
pObj
,
i
)
Sfm_MitSetReq
(
p
,
Abc_ObjFanin0
(
pObj
),
Delay
);
Vec_PtrForEachEntryReverse
(
Abc_Obj_t
*
,
vNodes
,
pObj
,
i
)
Sfm_MitNodeRequired
(
p
,
pObj
);
Vec_PtrFree
(
vNodes
);
return
Delay
;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Sfm_Mit_t
*
Sfm_MitStart
(
Mio_Library_t
*
pLib
,
Scl_Con_t
*
pExt
,
Abc_Ntk_t
*
pNtk
,
int
DeltaCrit
)
{
// Abc_Obj_t * pObj; int i;
Sfm_Mit_t
*
p
=
ABC_CALLOC
(
Sfm_Mit_t
,
1
);
p
->
pLib
=
pLib
;
p
->
pExt
=
pExt
;
p
->
pNtk
=
pNtk
;
Vec_IntFill
(
&
p
->
vTimArrs
,
3
*
Abc_NtkObjNumMax
(
pNtk
),
0
);
Vec_IntFill
(
&
p
->
vTimReqs
,
3
*
Abc_NtkObjNumMax
(
pNtk
),
0
);
// Vec_IntFill( &p->vTimSlews, 3*Abc_NtkObjNumMax(pNtk), 0 );
// Vec_IntFill( &p->vTimLoads, 3*Abc_NtkObjNumMax(pNtk), 0 );
// Vec_IntFill( &p->vObjOffs, 2*Abc_NtkObjNumMax(pNtk), 0 );
// Abc_NtkForEachNode( pNtk, pObj, i )
// {
// Vec_IntWriteEntry( &p->vObjOffs, i, Vec_IntSize(Vec_IntSize(&p->vTimEdges)) );
// Vec_IntFillExtra( &p->vTimEdges, Vec_IntSize(Vec_IntSize(&p->vTimEdges)) + Abc_ObjFaninNum(pObj), 0 );
// }
p
->
Delay
=
Sfm_MitTrace
(
p
);
assert
(
DeltaCrit
>
0
&&
DeltaCrit
<
MIO_NUM
*
1000
);
p
->
DeltaCrit
=
DeltaCrit
;
return
p
;
}
void
Sfm_MitStop
(
Sfm_Mit_t
*
p
)
{
Vec_IntErase
(
&
p
->
vTimArrs
);
Vec_IntErase
(
&
p
->
vTimReqs
);
Vec_IntErase
(
&
p
->
vTimSlews
);
Vec_IntErase
(
&
p
->
vTimLoads
);
Vec_IntErase
(
&
p
->
vObjOffs
);
Vec_IntErase
(
&
p
->
vTimEdges
);
Vec_WecErase
(
&
p
->
vLevels
);
Vec_IntErase
(
&
p
->
vPath
);
Vec_WrdErase
(
&
p
->
vSortData
);
ABC_FREE
(
p
);
}
int
Sfm_MitReadNtkDelay
(
Sfm_Mit_t
*
p
)
{
return
p
->
Delay
;
}
int
Sfm_MitReadObjDelay
(
Sfm_Mit_t
*
p
,
int
iObj
)
{
return
Sfm_MitArrMaxId
(
p
,
iObj
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Sfm_MitTest
(
Abc_Ntk_t
*
pNtk
)
{
Mio_Library_t
*
pLib
=
(
Mio_Library_t
*
)
pNtk
->
pManFunc
;
Sfm_Mit_t
*
p
=
Sfm_MitStart
(
pLib
,
NULL
,
pNtk
,
100
);
printf
(
"Max delay = %.2f. Path = %d (%d).
\n
"
,
MIO_NUMINV
*
p
->
Delay
,
Sfm_MitCriticalPath
(
p
,
1
),
Abc_NtkNodeNum
(
p
->
pNtk
)
);
Sfm_MitStop
(
p
);
}
/**Function*************************************************************
Synopsis [Levelized structure.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
void
Sfm_MitUpdateClean
(
Sfm_Mit_t
*
p
)
{
Vec_Int_t
*
vLevel
;
Abc_Obj_t
*
pObj
;
int
i
,
k
;
Vec_WecForEachLevel
(
&
p
->
vLevels
,
vLevel
,
i
)
{
Abc_NtkForEachObjVec
(
vLevel
,
p
->
pNtk
,
pObj
,
k
)
{
assert
(
pObj
->
fMarkC
==
1
);
pObj
->
fMarkC
=
0
;
}
Vec_IntClear
(
vLevel
);
}
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Sfm_MitUpdateTiming
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vTimeNodes
)
{
assert
(
Vec_IntSize
(
vTimeNodes
)
>
0
&&
Vec_IntSize
(
vTimeNodes
)
<=
2
);
Vec_IntFillExtra
(
&
p
->
vTimArrs
,
2
*
Abc_NtkObjNumMax
(
p
->
pNtk
),
0
);
Vec_IntFillExtra
(
&
p
->
vTimReqs
,
2
*
Abc_NtkObjNumMax
(
p
->
pNtk
),
0
);
p
->
Delay
=
Sfm_MitTrace
(
p
);
}
/**Function*************************************************************
Synopsis [Sort an array of nodes using their max arrival times.]
Description [Returns the number of new divisor nodes.]
SideEffects []
SeeAlso []
***********************************************************************/
int
Sfm_MitSortArrayByArrival
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vNodes
,
int
iPivot
)
{
word
Entry
;
int
i
,
Id
,
nDivNew
=
-
1
;
int
MaxDelay
=
Sfm_MitArrMaxId
(
p
,
iPivot
);
assert
(
p
->
DeltaCrit
>
0
);
// collect nodes
Vec_WrdClear
(
&
p
->
vSortData
);
Vec_IntForEachEntry
(
vNodes
,
Id
,
i
)
Vec_WrdPush
(
&
p
->
vSortData
,
((
word
)
Id
<<
32
)
|
Sfm_MitArrMaxId
(
p
,
Id
)
);
// sort nodes by delay
Abc_QuickSort3
(
Vec_WrdArray
(
&
p
->
vSortData
),
Vec_WrdSize
(
&
p
->
vSortData
),
0
);
// collect sorted nodes and find place where divisors end
Vec_IntClear
(
vNodes
);
Vec_WrdForEachEntry
(
&
p
->
vSortData
,
Entry
,
i
)
{
Vec_IntPush
(
vNodes
,
(
int
)(
Entry
>>
32
)
);
if
(
nDivNew
==
-
1
&&
((
int
)
Entry
)
+
p
->
DeltaCrit
>
MaxDelay
)
nDivNew
=
i
;
}
return
nDivNew
;
}
/**Function*************************************************************
Synopsis [Priority of nodes to try remapping for delay.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Sfm_MitPriorityNodes
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vCands
,
int
Window
)
{
Vec_Int_t
*
vLevel
;
Abc_Obj_t
*
pObj
;
int
i
,
k
;
assert
(
Window
>=
0
&&
Window
<=
100
);
// collect critical path
Sfm_MitCriticalPath
(
p
,
Window
);
// add nodes to the levelized structure
Sfm_MitUpdateClean
(
p
);
Abc_NtkForEachObjVec
(
&
p
->
vPath
,
p
->
pNtk
,
pObj
,
i
)
{
assert
(
pObj
->
fMarkC
==
0
);
pObj
->
fMarkC
=
1
;
Vec_WecPush
(
&
p
->
vLevels
,
Abc_ObjLevel
(
pObj
),
Abc_ObjId
(
pObj
)
);
}
// prioritize nodes by expected gain
Vec_WecSort
(
&
p
->
vLevels
,
0
);
Vec_IntClear
(
vCands
);
Vec_WecForEachLevel
(
&
p
->
vLevels
,
vLevel
,
i
)
{
// printf( "%d ", Vec_IntSize(vLevel) );
Abc_NtkForEachObjVec
(
vLevel
,
p
->
pNtk
,
pObj
,
k
)
if
(
!
pObj
->
fMarkA
)
Vec_IntPush
(
vCands
,
Abc_ObjId
(
pObj
)
);
// if ( Vec_IntSize(vCands) > 10 )
// break;
}
// printf( "\n" );
// printf( "Path = %5d ", Vec_IntSize(&p->vPath) );
// printf( "Cand = %5d ", Vec_IntSize(vCands) );
return
Vec_IntSize
(
vCands
)
>
0
;
}
/**Function*************************************************************
Synopsis [Returns 1 if node is relatively non-critical compared to the pivot.]
Description []
Description []
...
@@ -434,44 +49,15 @@ int Sfm_MitPriorityNodes( Sfm_Mit_t * p, Vec_Int_t * vCands, int Window )
...
@@ -434,44 +49,15 @@ int Sfm_MitPriorityNodes( Sfm_Mit_t * p, Vec_Int_t * vCands, int Window )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Sfm_MitNodeIsNonCritical
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pPivot
,
Abc_Obj_t
*
pNode
)
Sfm_Mit_t
*
Sfm_MitStart
(
Mio_Library_t
*
pLib
,
SC_Lib
*
pScl
,
Scl_Con_t
*
pExt
,
Abc_Ntk_t
*
pNtk
,
int
DeltaCrit
)
{
return
NULL
;
}
{
void
Sfm_MitStop
(
Sfm_Mit_t
*
p
)
{}
return
Sfm_MitArrMax
(
p
,
pNode
)
+
p
->
DeltaCrit
<=
Sfm_MitArrMax
(
p
,
pPivot
);
int
Sfm_MitReadNtkDelay
(
Sfm_Mit_t
*
p
)
{
return
0
;}
}
int
Sfm_MitReadObjDelay
(
Sfm_Mit_t
*
p
,
int
iObj
)
{
return
0
;}
void
Sfm_MitUpdateTiming
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vTimeNodes
)
{}
/**Function*************************************************************
int
Sfm_MitSortArrayByArrival
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vNodes
,
int
iPivot
)
{
return
0
;}
int
Sfm_MitPriorityNodes
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vCands
,
int
Window
)
{
return
0
;}
Synopsis []
int
Sfm_MitNodeIsNonCritical
(
Sfm_Mit_t
*
p
,
Abc_Obj_t
*
pPivot
,
Abc_Obj_t
*
pNode
)
{
return
0
;}
int
Sfm_MitEvalRemapping
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vFanins
,
Vec_Int_t
*
vMap
,
Mio_Gate_t
*
pGate1
,
char
*
pFans1
,
Mio_Gate_t
*
pGate2
,
char
*
pFans2
)
{
return
0
;}
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Sfm_MitEvalRemapping
(
Sfm_Mit_t
*
p
,
Vec_Int_t
*
vFanins
,
Vec_Int_t
*
vMap
,
Mio_Gate_t
*
pGate1
,
char
*
pFans1
,
Mio_Gate_t
*
pGate2
,
char
*
pFans2
)
{
int
TimeOut
[
2
][
2
];
int
*
pTimesIn1
[
6
],
*
pTimesIn2
[
6
];
int
i
,
nFanins1
,
nFanins2
;
// process the first gate
nFanins1
=
Mio_GateReadPinNum
(
pGate1
);
for
(
i
=
0
;
i
<
nFanins1
;
i
++
)
pTimesIn1
[
i
]
=
Sfm_MitArrId
(
p
,
Vec_IntEntry
(
vMap
,
Vec_IntEntry
(
vFanins
,
(
int
)
pFans1
[
i
]))
);
Sfm_MitGateArrival
(
p
,
pGate1
,
pTimesIn1
,
TimeOut
[
0
]
);
if
(
pGate2
==
NULL
)
return
Abc_MaxInt
(
TimeOut
[
0
][
0
],
TimeOut
[
0
][
1
]);
// process the second gate
nFanins2
=
Mio_GateReadPinNum
(
pGate2
);
for
(
i
=
0
;
i
<
nFanins2
;
i
++
)
if
(
(
int
)
pFans2
[
i
]
==
16
)
pTimesIn2
[
i
]
=
TimeOut
[
0
];
else
pTimesIn2
[
i
]
=
Sfm_MitArrId
(
p
,
Vec_IntEntry
(
vMap
,
Vec_IntEntry
(
vFanins
,
(
int
)
pFans2
[
i
]))
);
Sfm_MitGateArrival
(
p
,
pGate2
,
pTimesIn2
,
TimeOut
[
1
]
);
return
Abc_MaxInt
(
TimeOut
[
1
][
0
],
TimeOut
[
1
][
1
]);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
...
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