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
6ed334d4
Commit
6ed334d4
authored
Nov 24, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to handling boxes and flops.
parent
8feac565
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
159 additions
and
58 deletions
+159
-58
src/aig/gia/gia.h
+1
-1
src/aig/gia/giaMan.c
+7
-5
src/aig/gia/giaMfs.c
+1
-1
src/aig/gia/giaSweep.c
+101
-38
src/aig/gia/giaTim.c
+2
-2
src/misc/tim/tim.h
+3
-1
src/misc/tim/timBox.c
+32
-0
src/misc/tim/timMan.c
+12
-10
No files found.
src/aig/gia/gia.h
View file @
6ed334d4
...
...
@@ -1359,7 +1359,7 @@ extern Gia_Man_t * Gia_ManDupUnshuffleInputs( Gia_Man_t * p );
extern
int
Gia_ManLevelWithBoxes
(
Gia_Man_t
*
p
);
extern
int
Gia_ManLutLevelWithBoxes
(
Gia_Man_t
*
p
);
extern
void
*
Gia_ManUpdateTimMan
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vBoxPres
);
extern
void
*
Gia_ManUpdateTimMan2
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
);
extern
void
*
Gia_ManUpdateTimMan2
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
,
int
nTermsDiff
);
extern
Gia_Man_t
*
Gia_ManUpdateExtraAig
(
void
*
pTime
,
Gia_Man_t
*
pAig
,
Vec_Int_t
*
vBoxPres
);
extern
Gia_Man_t
*
Gia_ManUpdateExtraAig2
(
void
*
pTime
,
Gia_Man_t
*
pAig
,
Vec_Int_t
*
vBoxesLeft
);
extern
Gia_Man_t
*
Gia_ManDupCollapse
(
Gia_Man_t
*
p
,
Gia_Man_t
*
pBoxes
,
Vec_Int_t
*
vBoxPres
,
int
fSeq
);
...
...
src/aig/gia/giaMan.c
View file @
6ed334d4
...
...
@@ -408,6 +408,8 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
Abc_Print
(
1
,
"(c=%d)"
,
Gia_ManConstrNum
(
p
)
);
if
(
Gia_ManRegNum
(
p
)
)
Abc_Print
(
1
,
" ff =%7d"
,
Gia_ManRegNum
(
p
)
);
if
(
p
->
vRegClasses
)
Abc_Print
(
1
,
" boxff =%d(%d)"
,
Vec_IntSize
(
p
->
vRegClasses
),
Vec_IntFindMax
(
p
->
vRegClasses
)
);
#ifdef WIN32
{
...
...
@@ -466,11 +468,11 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
Gia_ManPrintFlopClasses
(
p
);
Gia_ManPrintGateClasses
(
p
);
Gia_ManPrintObjClasses
(
p
);
if
(
p
->
vRegClasses
)
{
printf
(
"The design has %d flops with the following class info: "
,
Vec_IntSize
(
p
->
vRegClasses
)
);
Vec_IntPrint
(
p
->
vRegClasses
);
}
//
if ( p->vRegClasses )
//
{
//
printf( "The design has %d flops with the following class info: ", Vec_IntSize(p->vRegClasses) );
//
Vec_IntPrint( p->vRegClasses );
//
}
if
(
p
->
vInitClasses
)
Gia_ManPrintInitClasses
(
p
->
vInitClasses
);
if
(
pPars
&&
pPars
->
fTents
)
...
...
src/aig/gia/giaMfs.c
View file @
6ed334d4
...
...
@@ -341,7 +341,7 @@ Gia_Man_t * Gia_ManInsertMfs( Gia_Man_t * p, Sfm_Ntk_t * pNtk )
// create new timing manager and extra AIG
if
(
pManTime
)
pNew
->
pManTime
=
Gia_ManUpdateTimMan2
(
p
,
vBoxesLeft
);
pNew
->
pManTime
=
Gia_ManUpdateTimMan2
(
p
,
vBoxesLeft
,
0
);
// update extra STG
if
(
p
->
pAigExtra
)
pNew
->
pAigExtra
=
Gia_ManUpdateExtraAig2
(
p
->
pManTime
,
p
->
pAigExtra
,
vBoxesLeft
);
...
...
src/aig/gia/giaSweep.c
View file @
6ed334d4
...
...
@@ -65,7 +65,7 @@ void Gia_ManMarkSeqGiaWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t
int
nRegs
=
Gia_ManRegBoxNum
(
p
);
int
iFlop
=
Gia_ObjCioId
(
pObj
)
-
(
nRealCis
-
nRegs
);
assert
(
iFlop
>=
0
&&
iFlop
<
nRegs
);
pObj
=
Gia_ManCo
(
p
,
Tim_ManPoNum
(
pManTime
)
-
nRegs
+
iFlop
);
pObj
=
Gia_ManCo
(
p
,
Gia_ManPoNum
(
p
)
-
nRegs
+
iFlop
);
Vec_IntPush
(
vRoots
,
Gia_ObjId
(
p
,
pObj
)
);
return
;
}
...
...
@@ -104,14 +104,21 @@ void Gia_ManMarkSeqGiaWithBoxes( Gia_Man_t * p, int fSeq )
// collect flops reachable from the POs
vRoots
=
Vec_IntAlloc
(
Gia_ManRegBoxNum
(
p
)
);
for
(
i
=
Gia_ManPoNum
(
p
)
-
nRealCos
;
i
<
Gia_ManPoNum
(
p
)
-
nRegs
;
i
++
)
{
Gia_ObjSetTravIdCurrent
(
p
,
Gia_ManPo
(
p
,
i
)
);
Gia_ManMarkSeqGiaWithBoxes_rec
(
p
,
Gia_ObjFanin0
(
Gia_ManPo
(
p
,
i
)),
vRoots
);
}
// collect flops reachable from roots
if
(
fSeq
)
{
Gia_ManForEachObjVec
(
vRoots
,
p
,
pObj
,
i
)
{
assert
(
Gia_ObjIsCo
(
pObj
)
);
Gia_ObjSetTravIdCurrent
(
p
,
pObj
);
Gia_ManMarkSeqGiaWithBoxes_rec
(
p
,
Gia_ObjFanin0
(
pObj
),
vRoots
);
}
//printf( "Explored %d flops\n", Vec_IntSize(vRoots) );
}
Vec_IntFree
(
vRoots
);
}
Gia_Man_t
*
Gia_ManDupWithBoxes
(
Gia_Man_t
*
p
,
int
fSeq
)
...
...
@@ -122,6 +129,7 @@ Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, int fSeq )
Vec_Int_t
*
vBoxesLeft
;
int
curCi
,
curCo
,
nBoxIns
,
nBoxOuts
;
int
i
,
k
,
iShift
,
nMarked
;
int
CiLeft
=
0
,
CoLeft
=
0
;
assert
(
Gia_ManBoxNum
(
p
)
>
0
);
assert
(
Gia_ManRegBoxNum
(
p
)
>
0
);
// mark useful boxes
...
...
@@ -143,7 +151,7 @@ Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, int fSeq )
pObj
->
Value
=
Gia_ManAppendCo
(
pNew
,
Gia_ObjFanin0Copy
(
pObj
)
);
else
assert
(
0
);
}
assert
(
!
Gia_ManHasDangling
(
p
)
);
assert
(
!
Gia_ManHasDangling
(
p
New
)
);
// collect remaining flops
if
(
fSeq
)
{
...
...
@@ -173,17 +181,29 @@ Gia_Man_t * Gia_ManDupWithBoxes( Gia_Man_t * p, int fSeq )
// check presence
assert
(
nMarked
==
0
||
nMarked
==
nBoxIns
+
nBoxOuts
);
if
(
nMarked
)
{
Vec_IntPush
(
vBoxesLeft
,
i
);
CoLeft
+=
nBoxIns
;
CiLeft
+=
nBoxOuts
;
}
}
curCo
+=
Tim_ManPoNum
(
pManTime
);
assert
(
curCi
==
Gia_ManCiNum
(
p
)
);
assert
(
curCo
==
Gia_ManCoNum
(
p
)
);
// update timing manager
pNew
->
pManTime
=
Gia_ManUpdateTimMan2
(
p
,
vBoxesLeft
);
pNew
->
pManTime
=
Gia_ManUpdateTimMan2
(
p
,
vBoxesLeft
,
Vec_IntSize
(
p
->
vRegClasses
)
-
Vec_IntSize
(
pNew
->
vRegClasses
)
);
// update extra STG
assert
(
p
->
pAigExtra
!=
NULL
);
assert
(
pNew
->
pAigExtra
==
NULL
);
pNew
->
pAigExtra
=
Gia_ManUpdateExtraAig2
(
p
->
pManTime
,
p
->
pAigExtra
,
vBoxesLeft
);
{
int
a
=
Gia_ManCiNum
(
pNew
);
int
b
=
Tim_ManPiNum
(
pNew
->
pManTime
);
int
c
=
Gia_ManCoNum
(
pNew
->
pAigExtra
);
int
d
=
b
+
c
;
assert
(
Gia_ManCiNum
(
pNew
)
==
Tim_ManPiNum
(
pNew
->
pManTime
)
+
Gia_ManCoNum
(
pNew
->
pAigExtra
)
);
}
Vec_IntFree
(
vBoxesLeft
);
return
pNew
;
}
...
...
@@ -363,19 +383,62 @@ Gia_Man_t * Gia_ManFraigReduceGia( Gia_Man_t * p, int * pReprs )
SeeAlso []
***********************************************************************/
int
*
Gia_ManFraigSelectReprs
(
Gia_Man_t
*
p
,
Gia_Man_t
*
p
Gia
,
int
fVerbose
)
int
*
Gia_ManFraigSelectReprs
(
Gia_Man_t
*
p
,
Gia_Man_t
*
p
Clp
,
int
fVerbose
)
{
Gia_Obj_t
*
pObj
;
Tim_Man_t
*
pManTime
=
(
Tim_Man_t
*
)
p
->
pManTime
;
int
*
pReprs
=
ABC_FALLOC
(
int
,
Gia_ManObjNum
(
p
)
);
int
*
pGia2Abc
=
ABC_FALLOC
(
int
,
Gia_ManObjNum
(
pGia
)
);
int
i
,
iLitGia
,
iLitGia2
,
iReprGia
,
fCompl
;
int
nConsts
=
0
,
nReprs
=
0
;
pGia2Abc
[
0
]
=
0
;
int
*
pClp2Gia
=
ABC_FALLOC
(
int
,
Gia_ManObjNum
(
pClp
)
);
int
i
,
nBoxes
,
iLast
,
iBox
,
iLitClp
,
iLitClp2
,
iReprClp
,
fCompl
;
int
nConsts
=
0
,
nReprs
=
0
,
Count1
=
0
,
Count2
=
0
;
assert
(
pManTime
!=
NULL
);
// count the number of equivalent objects
Gia_ManForEachObj1
(
pClp
,
pObj
,
i
)
{
if
(
Gia_ObjIsCo
(
pObj
)
)
continue
;
if
(
i
==
Gia_ObjReprSelf
(
pClp
,
i
)
)
continue
;
if
(
Gia_ObjReprSelf
(
pClp
,
i
)
==
0
)
nConsts
++
;
else
nReprs
++
;
}
if
(
fVerbose
)
printf
(
"Computed %d const objects and %d other objects.
\n
"
,
nConsts
,
nReprs
);
nConsts
=
nReprs
=
0
;
// mark flop input boxes
Gia_ManCleanMark0
(
p
);
Gia_ManForEachCo
(
p
,
pObj
,
i
)
if
(
Gia_ObjIsCi
(
Gia_ObjFanin0
(
pObj
))
)
// this CI is pointed by CO
Gia_ObjFanin0
(
pObj
)
->
fMark0
=
1
;
Gia_ManSetPhase
(
pGia
);
for
(
i
=
Gia_ManPoNum
(
p
)
-
Gia_ManRegBoxNum
(
p
);
i
<
Gia_ManPoNum
(
p
);
i
++
)
{
pObj
=
Gia_ObjFanin0
(
Gia_ManPo
(
p
,
i
)
);
assert
(
Gia_ObjIsCi
(
pObj
)
);
pObj
->
fMark0
=
1
;
Count1
++
;
}
// mark connects between last box inputs and first box outputs
nBoxes
=
Tim_ManBoxNum
(
pManTime
);
for
(
i
=
0
;
i
<
nBoxes
;
i
++
)
{
iLast
=
Tim_ManBoxInputLast
(
pManTime
,
i
);
pObj
=
Gia_ObjFanin0
(
Gia_ManCo
(
p
,
iLast
)
);
if
(
!
Gia_ObjIsCi
(
pObj
)
)
continue
;
iBox
=
Tim_ManBoxForCi
(
pManTime
,
Gia_ObjCioId
(
pObj
)
);
if
(
iBox
==
-
1
)
continue
;
assert
(
Gia_ObjIsCi
(
pObj
)
);
if
(
Gia_ObjCioId
(
pObj
)
==
Tim_ManBoxOutputLast
(
pManTime
,
iBox
)
)
pObj
->
fMark0
=
1
,
Count2
++
;
}
if
(
fVerbose
)
printf
(
"Fixed %d flop inputs and %d box/box connections (out of %d boxes).
\n
"
,
Count1
,
Count2
,
nBoxes
-
Gia_ManRegBoxNum
(
p
)
);
// compute representatives
pClp2Gia
[
0
]
=
0
;
Gia_ManSetPhase
(
pClp
);
Gia_ManForEachObj1
(
p
,
pObj
,
i
)
{
if
(
Gia_ObjIsCo
(
pObj
)
)
...
...
@@ -383,32 +446,32 @@ int * Gia_ManFraigSelectReprs( Gia_Man_t * p, Gia_Man_t * pGia, int fVerbose )
if
(
Gia_ObjIsCi
(
pObj
)
&&
pObj
->
fMark0
)
// skip CI pointed by CO
continue
;
assert
(
Gia_ObjIsCi
(
pObj
)
||
Gia_ObjIsAnd
(
pObj
)
);
iLit
Gia
=
Gia_ObjValue
(
pObj
);
if
(
iLit
Gia
==
-
1
)
iLit
Clp
=
Gia_ObjValue
(
pObj
);
if
(
iLit
Clp
==
-
1
)
continue
;
iRepr
Gia
=
Gia_ObjReprSelf
(
pGia
,
Abc_Lit2Var
(
iLitGia
)
);
if
(
p
Gia2Abc
[
iReprGia
]
==
-
1
)
p
Gia2Abc
[
iReprGia
]
=
i
;
iRepr
Clp
=
Gia_ObjReprSelf
(
pClp
,
Abc_Lit2Var
(
iLitClp
)
);
if
(
p
Clp2Gia
[
iReprClp
]
==
-
1
)
p
Clp2Gia
[
iReprClp
]
=
i
;
else
{
iLit
Gia2
=
Gia_ObjValue
(
Gia_ManObj
(
p
,
pGia2Abc
[
iReprGia
])
);
assert
(
Gia_ObjReprSelf
(
p
Gia
,
Abc_Lit2Var
(
iLitGia
))
==
Gia_ObjReprSelf
(
pGia
,
Abc_Lit2Var
(
iLitGia
2
))
);
fCompl
=
Abc_LitIsCompl
(
iLit
Gia
)
^
Abc_LitIsCompl
(
iLitGia
2
);
fCompl
^=
Gia_ManObj
(
p
Gia
,
Abc_Lit2Var
(
iLitGia
))
->
fPhase
;
fCompl
^=
Gia_ManObj
(
p
Gia
,
Abc_Lit2Var
(
iLitGia
2
))
->
fPhase
;
pReprs
[
i
]
=
Abc_Var2Lit
(
p
Gia2Abc
[
iReprGia
],
fCompl
);
iLit
Clp2
=
Gia_ObjValue
(
Gia_ManObj
(
p
,
pClp2Gia
[
iReprClp
])
);
assert
(
Gia_ObjReprSelf
(
p
Clp
,
Abc_Lit2Var
(
iLitClp
))
==
Gia_ObjReprSelf
(
pClp
,
Abc_Lit2Var
(
iLitClp
2
))
);
fCompl
=
Abc_LitIsCompl
(
iLit
Clp
)
^
Abc_LitIsCompl
(
iLitClp
2
);
fCompl
^=
Gia_ManObj
(
p
Clp
,
Abc_Lit2Var
(
iLitClp
))
->
fPhase
;
fCompl
^=
Gia_ManObj
(
p
Clp
,
Abc_Lit2Var
(
iLitClp
2
))
->
fPhase
;
pReprs
[
i
]
=
Abc_Var2Lit
(
p
Clp2Gia
[
iReprClp
],
fCompl
);
assert
(
Abc_Lit2Var
(
pReprs
[
i
])
<
i
);
if
(
p
Gia2Abc
[
iReprGia
]
==
0
)
if
(
p
Clp2Gia
[
iReprClp
]
==
0
)
nConsts
++
;
else
nReprs
++
;
}
}
ABC_FREE
(
p
Gia2Abc
);
Gia_ManForEachC
o
(
p
,
pObj
,
i
)
Gia_ObjFanin0
(
pObj
)
->
fMark0
=
0
;
ABC_FREE
(
p
Clp2Gia
);
Gia_ManForEachC
i
(
p
,
pObj
,
i
)
pObj
->
fMark0
=
0
;
if
(
fVerbose
)
printf
(
"Found %d const
reprs and %d other repr
s.
\n
"
,
nConsts
,
nReprs
);
printf
(
"Found %d const
objects and %d other object
s.
\n
"
,
nConsts
,
nReprs
);
return
pReprs
;
}
...
...
@@ -469,7 +532,7 @@ Gia_Man_t * Gia_ManFraigSweepSimple( Gia_Man_t * p, void * pPars )
***********************************************************************/
Gia_Man_t
*
Gia_ManSweepWithBoxes
(
Gia_Man_t
*
p
,
void
*
pParsC
,
void
*
pParsS
,
int
fConst
,
int
fEquiv
,
int
fVerbose
)
{
Gia_Man_t
*
p
Gia
,
*
pNew
,
*
pTemp
;
Gia_Man_t
*
p
Clp
,
*
pNew
,
*
pTemp
;
int
*
pReprs
;
assert
(
Gia_ManRegNum
(
p
)
==
0
);
assert
(
p
->
pAigExtra
!=
NULL
);
...
...
@@ -477,23 +540,23 @@ Gia_Man_t * Gia_ManSweepWithBoxes( Gia_Man_t * p, void * pParsC, void * pParsS,
pNew
=
Gia_ManDupUnnormalize
(
p
);
if
(
pNew
==
NULL
)
return
NULL
;
Gia_ManTransferTiming
(
pNew
,
p
);
// find global equivalences
pGia
=
Gia_ManDupCollapse
(
pNew
,
p
->
pAigExtra
,
NULL
,
pParsC
?
0
:
1
);
Gia_ManTransferTiming
(
pGia
,
pNew
);
Gia_ManTransferTiming
(
pNew
,
p
);
pClp
=
Gia_ManDupCollapse
(
pNew
,
pNew
->
pAigExtra
,
NULL
,
pParsC
?
0
:
1
);
// compute equivalences
if
(
pParsC
)
Gia_ManFraigSweepPerform
(
p
Gia
,
pParsC
);
Gia_ManFraigSweepPerform
(
p
Clp
,
pParsC
);
else
if
(
pParsS
)
Cec_ManLSCorrespondenceClasses
(
p
Gia
,
(
Cec_ParCor_t
*
)
pParsS
);
Cec_ManLSCorrespondenceClasses
(
p
Clp
,
(
Cec_ParCor_t
*
)
pParsS
);
else
Gia_ManSeqCleanupClasses
(
p
Gia
,
fConst
,
fEquiv
,
fVerbose
);
Gia_ManSeqCleanupClasses
(
p
Clp
,
fConst
,
fEquiv
,
fVerbose
);
// transfer equivalences
pReprs
=
Gia_ManFraigSelectReprs
(
pNew
,
p
Gia
,
fVerbose
);
Gia_ManStop
(
p
Gia
);
pReprs
=
Gia_ManFraigSelectReprs
(
pNew
,
p
Clp
,
fVerbose
);
Gia_ManStop
(
p
Clp
);
// reduce AIG
Gia_ManTransferTiming
(
p
,
pNew
);
pNew
=
Gia_ManFraigReduceGia
(
pTemp
=
pNew
,
pReprs
);
Gia_ManTransferTiming
(
pNew
,
p
Temp
);
Gia_ManTransferTiming
(
pNew
,
p
);
Gia_ManStop
(
pTemp
);
ABC_FREE
(
pReprs
);
// derive new AIG
...
...
src/aig/gia/giaTim.c
View file @
6ed334d4
...
...
@@ -623,12 +623,12 @@ void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres )
assert
(
Vec_IntSize
(
vBoxPres
)
==
Tim_ManBoxNum
(
pManTime
)
);
return
Tim_ManTrim
(
pManTime
,
vBoxPres
);
}
void
*
Gia_ManUpdateTimMan2
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
)
void
*
Gia_ManUpdateTimMan2
(
Gia_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
,
int
nTermsDiff
)
{
Tim_Man_t
*
pManTime
=
(
Tim_Man_t
*
)
p
->
pManTime
;
assert
(
pManTime
!=
NULL
);
assert
(
Vec_IntSize
(
vBoxesLeft
)
<=
Tim_ManBoxNum
(
pManTime
)
);
return
Tim_ManReduce
(
pManTime
,
vBoxesLeft
);
return
Tim_ManReduce
(
pManTime
,
vBoxesLeft
,
nTermsDiff
);
}
/**Function*************************************************************
...
...
src/misc/tim/tim.h
View file @
6ed334d4
...
...
@@ -114,7 +114,9 @@ extern void Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, i
extern
int
Tim_ManBoxForCi
(
Tim_Man_t
*
p
,
int
iCo
);
extern
int
Tim_ManBoxForCo
(
Tim_Man_t
*
p
,
int
iCi
);
extern
int
Tim_ManBoxInputFirst
(
Tim_Man_t
*
p
,
int
iBox
);
extern
int
Tim_ManBoxInputLast
(
Tim_Man_t
*
p
,
int
iBox
);
extern
int
Tim_ManBoxOutputFirst
(
Tim_Man_t
*
p
,
int
iBox
);
extern
int
Tim_ManBoxOutputLast
(
Tim_Man_t
*
p
,
int
iBox
);
extern
int
Tim_ManBoxInputNum
(
Tim_Man_t
*
p
,
int
iBox
);
extern
int
Tim_ManBoxOutputNum
(
Tim_Man_t
*
p
,
int
iBox
);
extern
int
Tim_ManBoxDelayTableId
(
Tim_Man_t
*
p
,
int
iBox
);
...
...
@@ -130,7 +132,7 @@ extern Tim_Man_t * Tim_ManLoad( Vec_Str_t * p, int fHieOnly );
extern
Tim_Man_t
*
Tim_ManStart
(
int
nCis
,
int
nCos
);
extern
Tim_Man_t
*
Tim_ManDup
(
Tim_Man_t
*
p
,
int
fUnitDelay
);
extern
Tim_Man_t
*
Tim_ManTrim
(
Tim_Man_t
*
p
,
Vec_Int_t
*
vBoxPres
);
extern
Tim_Man_t
*
Tim_ManReduce
(
Tim_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
);
extern
Tim_Man_t
*
Tim_ManReduce
(
Tim_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
,
int
nTermsDiff
);
extern
Vec_Int_t
*
Tim_ManAlignTwo
(
Tim_Man_t
*
pSpec
,
Tim_Man_t
*
pImpl
);
extern
void
Tim_ManCreate
(
Tim_Man_t
*
p
,
void
*
pLib
,
Vec_Flt_t
*
vInArrs
,
Vec_Flt_t
*
vOutReqs
);
extern
float
*
Tim_ManGetArrTimes
(
Tim_Man_t
*
p
);
...
...
src/misc/tim/timBox.c
View file @
6ed334d4
...
...
@@ -126,6 +126,22 @@ int Tim_ManBoxInputFirst( Tim_Man_t * p, int iBox )
/**Function*************************************************************
Synopsis [Returns the last input of the box.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Tim_ManBoxInputLast
(
Tim_Man_t
*
p
,
int
iBox
)
{
return
Tim_ManBox
(
p
,
iBox
)
->
Inouts
[
0
]
+
Tim_ManBoxInputNum
(
p
,
iBox
)
-
1
;
}
/**Function*************************************************************
Synopsis [Returns the first output of the box.]
Description []
...
...
@@ -142,6 +158,22 @@ int Tim_ManBoxOutputFirst( Tim_Man_t * p, int iBox )
/**Function*************************************************************
Synopsis [Returns the last output of the box.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Tim_ManBoxOutputLast
(
Tim_Man_t
*
p
,
int
iBox
)
{
return
Tim_ManBox
(
p
,
iBox
)
->
Inouts
[
Tim_ManBox
(
p
,
iBox
)
->
nInputs
]
+
Tim_ManBoxOutputNum
(
p
,
iBox
)
-
1
;
}
/**Function*************************************************************
Synopsis [Returns the number of box inputs.]
Description []
...
...
src/misc/tim/timMan.c
View file @
6ed334d4
...
...
@@ -248,25 +248,27 @@ Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres )
SeeAlso []
***********************************************************************/
Tim_Man_t
*
Tim_ManReduce
(
Tim_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
)
Tim_Man_t
*
Tim_ManReduce
(
Tim_Man_t
*
p
,
Vec_Int_t
*
vBoxesLeft
,
int
nTermsDiff
)
{
Tim_Man_t
*
pNew
;
Tim_Box_t
*
pBox
;
Tim_Obj_t
*
pObj
;
float
*
pDelayTable
,
*
pDelayTableNew
;
int
i
,
k
,
iBox
,
nNewCis
,
nNewCos
,
nInputs
,
nOutputs
;
int
nNewPiNum
=
Tim_ManPiNum
(
p
)
-
nTermsDiff
;
int
nNewPoNum
=
Tim_ManPoNum
(
p
)
-
nTermsDiff
;
assert
(
Vec_IntSize
(
vBoxesLeft
)
<=
Tim_ManBoxNum
(
p
)
);
// count the number of CIs and COs in the trimmed manager
nNewCis
=
Tim_ManPiNum
(
p
)
;
nNewCos
=
Tim_ManPoNum
(
p
)
;
nNewCis
=
nNewPiNum
;
nNewCos
=
nNewPoNum
;
Vec_IntForEachEntry
(
vBoxesLeft
,
iBox
,
i
)
{
pBox
=
Tim_ManBox
(
p
,
iBox
);
nNewCis
+=
pBox
->
nOutputs
;
nNewCos
+=
pBox
->
nInputs
;
}
assert
(
nNewCis
<=
Tim_ManCiNum
(
p
)
);
assert
(
nNewCos
<=
Tim_ManCoNum
(
p
)
);
assert
(
nNewCis
<=
Tim_ManCiNum
(
p
)
-
nTermsDiff
);
assert
(
nNewCos
<=
Tim_ManCoNum
(
p
)
-
nTermsDiff
);
// clear traversal IDs
Tim_ManForEachCi
(
p
,
pObj
,
i
)
pObj
->
TravId
=
0
;
...
...
@@ -275,10 +277,10 @@ Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft )
// create new manager
pNew
=
Tim_ManStart
(
nNewCis
,
nNewCos
);
// copy box connectivity information
memcpy
(
pNew
->
pCis
,
p
->
pCis
,
sizeof
(
Tim_Obj_t
)
*
Tim_ManPiNum
(
p
)
);
memcpy
(
pNew
->
pCos
+
nNewCos
-
Tim_ManPoNum
(
p
)
,
memcpy
(
pNew
->
pCis
,
p
->
pCis
,
sizeof
(
Tim_Obj_t
)
*
nNewPiNum
);
memcpy
(
pNew
->
pCos
+
nNewCos
-
nNewPoNum
,
p
->
pCos
+
Tim_ManCoNum
(
p
)
-
Tim_ManPoNum
(
p
),
sizeof
(
Tim_Obj_t
)
*
Tim_ManPoNum
(
p
)
);
sizeof
(
Tim_Obj_t
)
*
nNewPoNum
);
// duplicate delay tables
if
(
Tim_ManDelayTableNum
(
p
)
>
0
)
{
...
...
@@ -304,7 +306,7 @@ Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft )
// duplicate boxes
if
(
Tim_ManBoxNum
(
p
)
>
0
)
{
int
curPi
=
Tim_ManPiNum
(
p
)
;
int
curPi
=
nNewPiNum
;
int
curPo
=
0
;
pNew
->
vBoxes
=
Vec_PtrAlloc
(
Tim_ManBoxNum
(
p
)
);
Vec_IntForEachEntry
(
vBoxesLeft
,
iBox
,
i
)
...
...
@@ -315,7 +317,7 @@ Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft )
curPi
+=
pBox
->
nOutputs
;
curPo
+=
pBox
->
nInputs
;
}
curPo
+=
Tim_ManPoNum
(
p
)
;
curPo
+=
nNewPoNum
;
assert
(
curPi
==
Tim_ManCiNum
(
pNew
)
);
assert
(
curPo
==
Tim_ManCoNum
(
pNew
)
);
}
...
...
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