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
12578e62
Commit
12578e62
authored
Jan 27, 2007
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version abc70127
parent
1c26e2d2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
158 additions
and
16 deletions
+158
-16
abc.dsp
+8
-0
src/base/abc/abc.h
+2
-1
src/base/abc/abcUtil.c
+94
-0
src/base/abci/abc.c
+32
-7
src/base/abci/abcOdc.c
+0
-0
src/base/abci/abcPrint.c
+1
-0
src/base/abci/abcResub.c
+0
-0
src/base/abci/module.make
+1
-0
src/opt/res/resCore.c
+7
-3
src/opt/res/resDivs.c
+2
-0
src/opt/res/resInt.h
+1
-0
src/opt/res/resSim.c
+8
-5
src/opt/res/resWin.c
+2
-0
No files found.
abc.dsp
View file @
12578e62
...
...
@@ -278,6 +278,10 @@ SOURCE=.\src\base\abci\abcNtbdd.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abci\abcOdc.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abci\abcOrder.c
# End Source File
# Begin Source File
...
...
@@ -1670,6 +1674,10 @@ SOURCE=.\src\opt\res\resFilter.c
# End Source File
# Begin Source File
SOURCE=.\src\opt\res\resInt.h
# End Source File
# Begin Source File
SOURCE=.\src\opt\res\resSat.c
# End Source File
# Begin Source File
...
...
src/base/abc/abc.h
View file @
12578e62
...
...
@@ -237,7 +237,8 @@ static inline int Abc_TruthWordNum( int nVars ) { return nV
static
inline
int
Abc_InfoHasBit
(
unsigned
*
p
,
int
i
)
{
return
(
p
[(
i
)
>>
5
]
&
(
1
<<
((
i
)
&
31
)))
>
0
;
}
static
inline
void
Abc_InfoSetBit
(
unsigned
*
p
,
int
i
)
{
p
[(
i
)
>>
5
]
|=
(
1
<<
((
i
)
&
31
));
}
static
inline
void
Abc_InfoXorBit
(
unsigned
*
p
,
int
i
)
{
p
[(
i
)
>>
5
]
^=
(
1
<<
((
i
)
&
31
));
}
static
inline
unsigned
Abc_InfoRandom
()
{
return
((((
unsigned
)
rand
())
<<
24
)
^
(((
unsigned
)
rand
())
<<
12
)
^
((
unsigned
)
rand
()));
}
// #define RAND_MAX 0x7fff
static
inline
unsigned
Abc_InfoRandomWord
()
{
return
((((
unsigned
)
rand
())
<<
24
)
^
(((
unsigned
)
rand
())
<<
12
)
^
((
unsigned
)
rand
()));
}
// #define RAND_MAX 0x7fff
static
inline
void
Abc_InfoRandom
(
unsigned
*
p
,
int
nWords
)
{
int
i
;
for
(
i
=
nWords
-
1
;
i
>=
0
;
i
--
)
p
[
i
]
=
Abc_InfoRandomWord
();
}
static
inline
void
Abc_InfoClear
(
unsigned
*
p
,
int
nWords
)
{
memset
(
p
,
0
,
sizeof
(
unsigned
)
*
nWords
);
}
static
inline
void
Abc_InfoFill
(
unsigned
*
p
,
int
nWords
)
{
memset
(
p
,
0xff
,
sizeof
(
unsigned
)
*
nWords
);}
static
inline
void
Abc_InfoNot
(
unsigned
*
p
,
int
nWords
)
{
int
i
;
for
(
i
=
nWords
-
1
;
i
>=
0
;
i
--
)
p
[
i
]
=
~
p
[
i
];
}
...
...
src/base/abc/abcUtil.c
View file @
12578e62
...
...
@@ -1450,6 +1450,100 @@ void Abc_NtkTransferCopy( Abc_Ntk_t * pNtk )
pObj
->
pCopy
=
pObj
->
pCopy
?
Abc_ObjEquiv
(
pObj
->
pCopy
)
:
NULL
;
}
/**Function*************************************************************
Synopsis [Increaments the cut counter.]
Description [Returns 1 if it becomes equal to the ref counter.]
SideEffects []
SeeAlso []
***********************************************************************/
static
inline
int
Abc_ObjCrossCutInc
(
Abc_Obj_t
*
pObj
)
{
pObj
->
pCopy
=
(
void
*
)(((
int
)
pObj
->
pCopy
)
++
);
return
(
int
)
pObj
->
pCopy
==
Abc_ObjFanoutNum
(
pObj
);
}
/**Function*************************************************************
Synopsis [Computes cross-cut of the circuit.]
Description [Returns 1 if it is the last visit to the node.]
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_NtkCrossCut_rec
(
Abc_Obj_t
*
pObj
,
int
*
pnCutSize
,
int
*
pnCutSizeMax
)
{
Abc_Obj_t
*
pFanin
;
int
i
,
nDecrem
=
0
;
int
fReverse
=
0
;
if
(
Abc_ObjIsCi
(
pObj
)
)
return
0
;
// if visited, increment visit counter
if
(
Abc_NodeIsTravIdCurrent
(
pObj
)
)
return
Abc_ObjCrossCutInc
(
pObj
);
Abc_NodeSetTravIdCurrent
(
pObj
);
// visit the fanins
if
(
!
Abc_ObjIsCi
(
pObj
)
)
{
if
(
fReverse
)
{
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
i
)
{
pFanin
=
Abc_ObjFanin
(
pObj
,
Abc_ObjFaninNum
(
pObj
)
-
1
-
i
);
nDecrem
+=
Abc_NtkCrossCut_rec
(
pFanin
,
pnCutSize
,
pnCutSizeMax
);
}
}
else
{
Abc_ObjForEachFanin
(
pObj
,
pFanin
,
i
)
nDecrem
+=
Abc_NtkCrossCut_rec
(
pFanin
,
pnCutSize
,
pnCutSizeMax
);
}
}
// count the node
(
*
pnCutSize
)
++
;
if
(
*
pnCutSizeMax
<
*
pnCutSize
)
*
pnCutSizeMax
=
*
pnCutSize
;
(
*
pnCutSize
)
-=
nDecrem
;
return
Abc_ObjCrossCutInc
(
pObj
);
}
/**Function*************************************************************
Synopsis [Computes cross-cut of the circuit.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int
Abc_NtkCrossCut
(
Abc_Ntk_t
*
pNtk
)
{
Abc_Obj_t
*
pObj
;
int
nCutSize
=
0
,
nCutSizeMax
=
0
;
int
i
;
Abc_NtkCleanCopy
(
pNtk
);
Abc_NtkIncrementTravId
(
pNtk
);
Abc_NtkForEachCo
(
pNtk
,
pObj
,
i
)
{
Abc_NtkCrossCut_rec
(
pObj
,
&
nCutSize
,
&
nCutSizeMax
);
nCutSize
--
;
}
assert
(
nCutSize
==
0
);
printf
(
"Max cross cut size = %6d. Ratio = %6.2f %%
\n
"
,
nCutSizeMax
,
100
.
0
*
nCutSizeMax
/
Abc_NtkObjNum
(
pNtk
)
);
return
nCutSizeMax
;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
...
...
src/base/abci/abc.c
View file @
12578e62
...
...
@@ -2999,23 +2999,27 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
int
c
;
int
nCutsMax
;
int
nNodesMax
;
int
nLevelsOdc
;
bool
fUpdateLevel
;
bool
fUseZeros
;
bool
fVerbose
;
extern
int
Abc_NtkResubstitute
(
Abc_Ntk_t
*
pNtk
,
int
nCutsMax
,
int
nNodesMax
,
bool
fUpdateLevel
,
bool
fVerbose
);
bool
fVeryVerbose
;
extern
int
Abc_NtkResubstitute
(
Abc_Ntk_t
*
pNtk
,
int
nCutsMax
,
int
nNodesMax
,
int
nLevelsOdc
,
bool
fUpdateLevel
,
bool
fVerbose
,
bool
fVeryVerbose
);
pNtk
=
Abc_FrameReadNtk
(
pAbc
);
pOut
=
Abc_FrameReadOut
(
pAbc
);
pErr
=
Abc_FrameReadErr
(
pAbc
);
// set defaults
nCutsMax
=
8
;
nCutsMax
=
8
;
nNodesMax
=
1
;
nLevelsOdc
=
0
;
fUpdateLevel
=
1
;
fUseZeros
=
0
;
fVerbose
=
0
;
fVeryVerbose
=
0
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KN
lzv
h"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"KN
Flzvw
h"
)
)
!=
EOF
)
{
switch
(
c
)
{
...
...
@@ -3041,6 +3045,17 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
nNodesMax
<
0
)
goto
usage
;
break
;
case
'F'
:
if
(
globalUtilOptind
>=
argc
)
{
fprintf
(
pErr
,
"Command line switch
\"
-F
\"
should be followed by an integer.
\n
"
);
goto
usage
;
}
nLevelsOdc
=
atoi
(
argv
[
globalUtilOptind
]);
globalUtilOptind
++
;
if
(
nLevelsOdc
<
0
)
goto
usage
;
break
;
case
'l'
:
fUpdateLevel
^=
1
;
break
;
...
...
@@ -3050,6 +3065,9 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'v'
:
fVerbose
^=
1
;
break
;
case
'w'
:
fVeryVerbose
^=
1
;
break
;
case
'h'
:
goto
usage
;
default:
...
...
@@ -3064,7 +3082,12 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
}
if
(
nCutsMax
<
RS_CUT_MIN
||
nCutsMax
>
RS_CUT_MAX
)
{
fprintf
(
pErr
,
"Can only compute the cuts for %d <= K <= %d.
\n
"
,
RS_CUT_MIN
,
RS_CUT_MAX
);
fprintf
(
pErr
,
"Can only compute cuts for %d <= K <= %d.
\n
"
,
RS_CUT_MIN
,
RS_CUT_MAX
);
return
1
;
}
if
(
nNodesMax
<
0
||
nNodesMax
>
3
)
{
fprintf
(
pErr
,
"Can only resubstitute at most 3 nodes.
\n
"
);
return
1
;
}
if
(
!
Abc_NtkIsStrash
(
pNtk
)
)
...
...
@@ -3079,7 +3102,7 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// modify the current network
if
(
!
Abc_NtkResubstitute
(
pNtk
,
nCutsMax
,
nNodesMax
,
fUpdateLevel
,
f
Verbose
)
)
if
(
!
Abc_NtkResubstitute
(
pNtk
,
nCutsMax
,
nNodesMax
,
nLevelsOdc
,
fUpdateLevel
,
fVerbose
,
fVery
Verbose
)
)
{
fprintf
(
pErr
,
"Refactoring has failed.
\n
"
);
return
1
;
...
...
@@ -3087,13 +3110,15 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
usage:
fprintf
(
pErr
,
"usage: resub [-K num] [-N num] [-
lzv
h]
\n
"
);
fprintf
(
pErr
,
"usage: resub [-K num] [-N num] [-
F num] [-lzvw
h]
\n
"
);
fprintf
(
pErr
,
"
\t
performs technology-independent restructuring of the AIG
\n
"
);
fprintf
(
pErr
,
"
\t
-K num : the max cut size (%d <= num <= %d) [default = %d]
\n
"
,
RS_CUT_MIN
,
RS_CUT_MAX
,
nCutsMax
);
fprintf
(
pErr
,
"
\t
-N num : the max number of nodes to add [default = %d]
\n
"
,
nNodesMax
);
fprintf
(
pErr
,
"
\t
-N num : the max number of nodes to add (0 <= num <= 3) [default = %d]
\n
"
,
nNodesMax
);
fprintf
(
pErr
,
"
\t
-F num : the number of fanout levels for ODC computation [default = %d]
\n
"
,
nLevelsOdc
);
fprintf
(
pErr
,
"
\t
-l : toggle preserving the number of levels [default = %s]
\n
"
,
fUpdateLevel
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-z : toggle using zero-cost replacements [default = %s]
\n
"
,
fUseZeros
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-v : toggle verbose printout [default = %s]
\n
"
,
fVerbose
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-w : toggle verbose printout of ODC computation [default = %s]
\n
"
,
fVeryVerbose
?
"yes"
:
"no"
);
fprintf
(
pErr
,
"
\t
-h : print the command usage
\n
"
);
return
1
;
}
...
...
src/base/abci/abcOdc.c
0 → 100644
View file @
12578e62
This diff is collapsed.
Click to expand it.
src/base/abci/abcPrint.c
View file @
12578e62
...
...
@@ -111,6 +111,7 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored )
fprintf
(
pFile
,
"
\n
"
);
// Abc_NtkCrossCut( pNtk );
// print the statistic into a file
/*
...
...
src/base/abci/abcResub.c
View file @
12578e62
This diff is collapsed.
Click to expand it.
src/base/abci/module.make
View file @
12578e62
...
...
@@ -24,6 +24,7 @@ SRC += src/base/abci/abc.c \
src/base/abci/abcMiter.c
\
src/base/abci/abcMulti.c
\
src/base/abci/abcNtbdd.c
\
src/base/abci/abcOdc.c
\
src/base/abci/abcOrder.c
\
src/base/abci/abcPrint.c
\
src/base/abci/abcProve.c
\
...
...
src/opt/res/resCore.c
View file @
12578e62
...
...
@@ -200,8 +200,11 @@ p->timeAig += clock() - clk;
if
(
p
->
pPars
->
fVeryVerbose
)
{
printf
(
"%5d : "
,
pObj
->
Id
);
printf
(
"Win = %3d/%4d/%3d "
,
Vec_PtrSize
(
p
->
pWin
->
vLeaves
),
Vec_VecSizeSize
(
p
->
pWin
->
vLevels
),
Vec_PtrSize
(
p
->
pWin
->
vRoots
)
);
printf
(
"%5d (lev=%2d) : "
,
pObj
->
Id
,
pObj
->
Level
);
printf
(
"Win = %3d/%3d/%4d/%3d "
,
Vec_PtrSize
(
p
->
pWin
->
vLeaves
)
-
p
->
pWin
->
nLeavesPlus
,
p
->
pWin
->
nLeavesPlus
,
Vec_VecSizeSize
(
p
->
pWin
->
vLevels
),
Vec_PtrSize
(
p
->
pWin
->
vRoots
)
);
printf
(
"D = %3d "
,
Vec_PtrSize
(
p
->
pWin
->
vDivs
)
);
printf
(
"D+ = %3d "
,
p
->
pWin
->
nDivsPlus
);
printf
(
"AIG = %4d "
,
Abc_NtkNodeNum
(
p
->
pAig
)
);
...
...
@@ -242,12 +245,13 @@ p->timeSat += clock() - clk;
// printf( " Sat\n" );
continue
;
}
p
->
nProvedSets
++
;
// printf( " Unsat\n" );
continue
;
// write it into a file
// Sto_ManDumpClauses( p->pCnf, "trace.cnf" );
p
->
nProvedSets
++
;
// interplate the problem if it was UNSAT
clk
=
clock
();
...
...
src/opt/res/resDivs.c
View file @
12578e62
...
...
@@ -60,6 +60,8 @@ void Res_WinDivisors( Res_Win_t * p, int nLevDivMax )
// mark the MFFC of the node (does not increment trav ID)
Res_WinVisitMffc
(
p
);
// what about the fanouts of the leaves!!!
// go through all the legal levels and check if their fanouts can be divisors
p
->
nDivsPlus
=
0
;
Vec_VecForEachEntryStartStop
(
p
->
vLevels
,
pObj
,
i
,
k
,
0
,
p
->
nLevDivMax
-
1
)
...
...
src/opt/res/resInt.h
View file @
12578e62
...
...
@@ -48,6 +48,7 @@ struct Res_Win_t_
int
nLevLeaves
;
// the level where leaves begin
int
nLevDivMax
;
// the maximum divisor level
int
nDivsPlus
;
// the number of additional divisors
int
nLeavesPlus
;
// the number of additional leaves
Abc_Obj_t
*
pNode
;
// the node in the center
// the window data
Vec_Vec_t
*
vLevels
;
// nodes by level
...
...
src/opt/res/resSim.c
View file @
12578e62
...
...
@@ -141,12 +141,11 @@ void Res_SimSetRandom( Res_Sim_t * p )
{
Abc_Obj_t
*
pObj
;
unsigned
*
pInfo
;
int
i
,
w
;
int
i
;
Abc_NtkForEachPi
(
p
->
pAig
,
pObj
,
i
)
{
pInfo
=
Vec_PtrEntry
(
p
->
vPats
,
pObj
->
Id
);
for
(
w
=
0
;
w
<
p
->
nWords
;
w
++
)
pInfo
[
w
]
=
Abc_InfoRandom
();
Abc_InfoRandom
(
pInfo
,
p
->
nWords
);
}
}
...
...
@@ -478,7 +477,7 @@ int Res_SimPrepare( Res_Sim_t * p, Abc_Ntk_t * pAig )
// prepare the manager
Res_SimAdjust
(
p
,
pAig
);
// collect 0/1 simulation info
for
(
Limit
=
0
;
Limit
<
10
0
;
Limit
++
)
for
(
Limit
=
0
;
Limit
<
10
;
Limit
++
)
{
Res_SimSetRandom
(
p
);
Res_SimPerformRound
(
p
);
...
...
@@ -489,10 +488,14 @@ int Res_SimPrepare( Res_Sim_t * p, Abc_Ntk_t * pAig )
}
// printf( "%d ", Limit );
// report the last set of patterns
// Res_SimReportOne( p );
Res_SimReportOne
(
p
);
printf
(
"
\n
"
);
// quit if there is not enough
if
(
p
->
nPats0
<
4
||
p
->
nPats1
<
4
)
{
// Res_SimReportOne( p );
return
0
;
}
// create bit-matrix info
if
(
p
->
nPats0
<
p
->
nPats
)
Res_SimPadSimInfo
(
p
->
vPats0
,
p
->
nPats0
,
p
->
nWords
);
...
...
src/opt/res/resWin.c
View file @
12578e62
...
...
@@ -243,6 +243,7 @@ void Res_WinAddMissing_rec( Res_Win_t * p, Abc_Obj_t * pObj )
return
;
if
(
!
Abc_NodeIsTravIdCurrent
(
pObj
)
||
(
int
)
pObj
->
Level
<=
p
->
nLevLeaves
)
{
p
->
nLeavesPlus
++
;
Vec_PtrPush
(
p
->
vLeaves
,
pObj
);
pObj
->
fMarkA
=
1
;
return
;
...
...
@@ -349,6 +350,7 @@ int Res_WinCompute( Abc_Obj_t * pNode, int nWinTfiMax, int nWinTfoMax, Res_Win_t
p
->
pNode
=
pNode
;
p
->
nWinTfiMax
=
nWinTfiMax
;
p
->
nWinTfoMax
=
nWinTfoMax
;
p
->
nLeavesPlus
=
0
;
p
->
nLevLeaves
=
ABC_MAX
(
0
,
((
int
)
p
->
pNode
->
Level
)
-
p
->
nWinTfiMax
-
1
);
// collect the nodes in TFI cone of pNode above the level of leaves (p->nLevLeaves)
Res_WinCollectNodeTfi
(
p
);
...
...
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