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
78e09e91
Commit
78e09e91
authored
Jun 05, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correcting switching activity computation.
parent
c5b620b9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
56 deletions
+46
-56
src/aig/gia/giaIf.c
+1
-9
src/aig/gia/giaSwitch.c
+10
-6
src/base/abci/abcIf.c
+33
-41
src/base/abci/abcPrint.c
+1
-0
src/map/if/if.h
+1
-0
No files found.
src/aig/gia/giaIf.c
View file @
78e09e91
...
...
@@ -1618,15 +1618,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized )
}
// compute switching for the IF objects
if
(
pPars
->
fPower
)
{
Gia_Obj_t
*
pObj
;
int
i
;
assert
(
pIfMan
->
vSwitching
==
NULL
);
pIfMan
->
vSwitching
=
Vec_IntStart
(
If_ManObjNum
(
pIfMan
)
);
Gia_ManForEachObj
(
p
,
pObj
,
i
)
if
(
~
Gia_ObjValue
(
pObj
)
)
Vec_IntWriteEntry
(
pIfMan
->
vSwitching
,
Gia_ObjValue
(
pObj
),
Vec_IntEntry
(
p
->
vSwitching
,
i
)
);
// Vec_IntFreeP( &p->vSwitching );
}
If_ManComputeSwitching
(
pIfMan
);
if
(
p
->
pManTime
)
pIfMan
->
pManTim
=
Tim_ManDup
(
(
Tim_Man_t
*
)
p
->
pManTime
,
0
);
if
(
!
If_ManPerformMapping
(
pIfMan
)
)
...
...
src/aig/gia/giaSwitch.c
View file @
78e09e91
...
...
@@ -745,10 +745,13 @@ float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbO
Gia_Man_t
*
pDfs
;
Gia_Obj_t
*
pObj
,
*
pObjDfs
;
Vec_Int_t
*
vSwitching
;
float
*
pSwitching
,
Switch
,
SwitchTotal
=
0
.
0
;
//, SwitchTotal2 = 0.0;
float
*
pSwitching
,
Switch
,
SwitchTotal
=
0
.
0
;
int
i
;
// derives the DFS ordered AIG
Gia_ManCreateRefs
(
p
);
if
(
Gia_ManHasMapping
(
p
)
)
Gia_ManSetRefsMapped
(
p
);
else
Gia_ManCreateRefs
(
p
);
// pDfs = Gia_ManDupOrderDfs( p );
pDfs
=
Gia_ManDup
(
p
);
assert
(
Gia_ManObjNum
(
pDfs
)
==
Gia_ManObjNum
(
p
)
);
...
...
@@ -762,11 +765,12 @@ float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbO
pObjDfs
=
Gia_ObjFromLit
(
pDfs
,
pObj
->
Value
);
Switch
=
pSwitching
[
Gia_ObjId
(
pDfs
,
pObjDfs
)
];
p
->
pSwitching
[
i
]
=
(
char
)((
Switch
>=
1
.
0
)
?
255
:
(
int
)((
0
.
002
+
Switch
)
*
255
));
// 0.00196 = (1/255)/2
SwitchTotal
+=
(
float
)
Gia_ObjRefNum
(
p
,
pObj
)
*
p
->
pSwitching
[
i
]
/
255
;
// SwitchTotal2 += Gia_ObjRefNum(p, pObj) * Switch;
// printf( "%d = %.2f\n", i, Gia_ObjRefNum(p, pObj) * Switch );
if
(
Gia_ObjIsCi
(
pObj
)
||
(
Gia_ObjIsAnd
(
pObj
)
&&
(
!
Gia_ManHasMapping
(
p
)
||
Gia_ObjIsLut
(
p
,
i
)))
)
{
SwitchTotal
+=
(
float
)
Gia_ObjRefNum
(
p
,
pObj
)
*
p
->
pSwitching
[
i
]
/
255
;
// printf( "%d = %.2f\n", i, (float)Gia_ObjRefNum(p, pObj) * p->pSwitching[i] / 255 );
}
}
// printf( "\nSwitch float = %f. Switch char = %f.\n", SwitchTotal2, SwitchTotal );
Vec_IntFree
(
vSwitching
);
Gia_ManStop
(
pDfs
);
return
SwitchTotal
;
...
...
src/base/abci/abcIf.c
View file @
78e09e91
...
...
@@ -55,49 +55,41 @@ extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose );
SeeAlso []
***********************************************************************/
void
Abc_NtkIfComputeSwitching
(
Abc_Ntk_t
*
pNtk
,
If_Man_t
*
pIfMan
)
void
If_ManComputeSwitching
(
If_Man_t
*
pIfMan
)
{
extern
Aig_Man_t
*
Abc_NtkToDar
(
Abc_Ntk_t
*
pNtk
,
int
fExors
,
int
fRegisters
);
extern
Vec_Int_t
*
Saig_ManComputeSwitchProbs
(
Aig_Man_t
*
p
,
int
nFrames
,
int
nPref
,
int
fProbOne
);
Vec_Int_t
*
vSwitching
;
float
*
pSwitching
;
Abc_Obj_t
*
pObjAbc
;
Aig_Obj_t
*
pObjAig
;
Aig_Man_t
*
pAig
;
If_Obj_t
*
pObjIf
;
int
i
;
abctime
clk
=
Abc_Clock
();
// map IF objects into old network
Abc_NtkForEachObj
(
pNtk
,
pObjAbc
,
i
)
if
(
(
pObjIf
=
(
If_Obj_t
*
)
pObjAbc
->
pTemp
)
)
pObjIf
->
pCopy
=
pObjAbc
;
// map network into an AIG
pAig
=
Abc_NtkToDar
(
pNtk
,
0
,
0
);
vSwitching
=
Saig_ManComputeSwitchProbs
(
pAig
,
48
,
16
,
0
);
pSwitching
=
(
float
*
)
vSwitching
->
pArray
;
Abc_NtkForEachObj
(
pNtk
,
pObjAbc
,
i
)
if
(
!
Abc_ObjIsCo
(
pObjAbc
)
&&
(
pObjAig
=
(
Aig_Obj_t
*
)
pObjAbc
->
pTemp
)
)
{
pObjAbc
->
dTemp
=
pSwitching
[
pObjAig
->
Id
];
// J. Anderson and F. N. Najm, Power-Aware Technology Mapping for LUT-Based FPGAs,
// IEEE Intl. Conf. on Field-Programmable Technology, 2002.
// pObjAbc->dTemp = (1.55 + 1.05 / (float) Abc_ObjFanoutNum(pObjAbc)) * pSwitching[pObjAig->Id];
}
else
pObjAbc
->
dTemp
=
0
;
Vec_IntFree
(
vSwitching
);
Aig_ManStop
(
pAig
);
// compute switching for the IF objects
Gia_Man_t
*
pNew
;
Vec_Int_t
*
vCopy
;
If_Obj_t
*
pIfObj
;
int
i
;
assert
(
pIfMan
->
vSwitching
==
NULL
);
pIfMan
->
vSwitching
=
Vec_IntStart
(
If_ManObjNum
(
pIfMan
)
);
pSwitching
=
(
float
*
)
pIfMan
->
vSwitching
->
pArray
;
If_ManForEachObj
(
pIfMan
,
pObjIf
,
i
)
if
(
(
pObjAbc
=
(
Abc_Obj_t
*
)
pObjIf
->
pCopy
)
)
pSwitching
[
i
]
=
pObjAbc
->
dTemp
;
if
(
pIfMan
->
pPars
->
fVerbose
)
{
ABC_PRT
(
"Computing switching activity"
,
Abc_Clock
()
-
clk
);
}
// create the new manager
pNew
=
Gia_ManStart
(
If_ManObjNum
(
pIfMan
)
);
vCopy
=
Vec_IntAlloc
(
If_ManObjNum
(
pIfMan
)
);
// constant and inputs
Vec_IntPush
(
vCopy
,
1
);
If_ManForEachCi
(
pIfMan
,
pIfObj
,
i
)
Vec_IntPush
(
vCopy
,
Gia_ManAppendCi
(
pNew
)
);
// internal nodes
If_ManForEachNode
(
pIfMan
,
pIfObj
,
i
)
{
int
iLit0
=
Abc_LitNotCond
(
Vec_IntEntry
(
vCopy
,
If_ObjFanin0
(
pIfObj
)
->
Id
),
If_ObjFaninC0
(
pIfObj
)
);
int
iLit1
=
Abc_LitNotCond
(
Vec_IntEntry
(
vCopy
,
If_ObjFanin1
(
pIfObj
)
->
Id
),
If_ObjFaninC1
(
pIfObj
)
);
Vec_IntPush
(
vCopy
,
Gia_ManAppendAnd
(
pNew
,
iLit0
,
iLit1
)
);
}
// outputs
If_ManForEachCo
(
pIfMan
,
pIfObj
,
i
)
{
int
iLit0
=
Abc_LitNotCond
(
Vec_IntEntry
(
vCopy
,
If_ObjFanin0
(
pIfObj
)
->
Id
),
If_ObjFaninC0
(
pIfObj
)
);
Vec_IntPush
(
vCopy
,
Gia_ManAppendCo
(
pNew
,
iLit0
)
);
}
assert
(
Vec_IntSize
(
vCopy
)
==
If_ManObjNum
(
pIfMan
)
);
Vec_IntFree
(
vCopy
);
// compute switching activity
pIfMan
->
vSwitching
=
Gia_ManComputeSwitchProbs
(
pNew
,
48
,
16
,
0
);
Gia_ManStop
(
pNew
);
if
(
pIfMan
->
pPars
->
fVerbose
)
Abc_PrintTime
(
1
,
"Computing switching activity"
,
Abc_Clock
()
-
clk
);
}
/**Function*************************************************************
...
...
@@ -135,7 +127,7 @@ Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
if
(
pIfMan
==
NULL
)
return
NULL
;
if
(
pPars
->
fPower
)
Abc_NtkIfComputeSwitching
(
pNtk
,
pIfMan
);
If_ManComputeSwitching
(
pIfMan
);
// create DSD manager
if
(
pPars
->
fUseDsd
)
...
...
src/base/abci/abcPrint.c
View file @
78e09e91
...
...
@@ -155,6 +155,7 @@ float Abc_NtkMfsTotalSwitching( Abc_Ntk_t * pNtk )
if
(
(
pObjAbc2
=
Abc_ObjRegular
((
Abc_Obj_t
*
)
pObjAbc
->
pTemp
))
&&
(
pObjAig
=
Aig_Regular
((
Aig_Obj_t
*
)
pObjAbc2
->
pTemp
))
)
{
Result
+=
Abc_ObjFanoutNum
(
pObjAbc
)
*
pSwitching
[
pObjAig
->
Id
];
// Abc_ObjPrint( stdout, pObjAbc );
// printf( "%d = %.2f\n", i, Abc_ObjFanoutNum(pObjAbc) * pSwitching[pObjAig->Id] );
}
}
...
...
src/map/if/if.h
View file @
78e09e91
...
...
@@ -482,6 +482,7 @@ static inline float If_CutLutDelay( If_LibLut_t * p, int Size, int iPin )
/*=== ifCore.c ===========================================================*/
extern
int
If_ManPerformMapping
(
If_Man_t
*
p
);
extern
int
If_ManPerformMappingComb
(
If_Man_t
*
p
);
extern
void
If_ManComputeSwitching
(
If_Man_t
*
p
);
/*=== ifCut.c ============================================================*/
extern
int
If_CutVerifyCuts
(
If_Set_t
*
pCutSet
,
int
fOrdered
);
extern
int
If_CutFilter
(
If_Set_t
*
pCutSet
,
If_Cut_t
*
pCut
,
int
fSaveCut0
);
...
...
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