Skip to content

Commit cb971e0

Browse files
committed
Recent experiments.
1 parent 474e7fb commit cb971e0

File tree

6 files changed

+1469
-20
lines changed

6 files changed

+1469
-20
lines changed

src/aig/gia/giaMulFind.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -661,15 +661,15 @@ Vec_Wec_t * Gia_ManMulFindBInputs( Gia_Man_t * p, Vec_Wec_t * vCuts4, Vec_Wec_t
661661
SeeAlso []
662662
663663
***********************************************************************/
664-
Vec_Int_t * Gia_ManMulFindTfo( Gia_Man_t * p, Vec_Int_t * vIn0, Vec_Int_t * vIn1 )
664+
Vec_Int_t * Gia_ManMulFindTfo( Gia_Man_t * p, Vec_Int_t * vIn0, Vec_Int_t * vIn1, int fLits )
665665
{
666666
Vec_Int_t * vTfo = Vec_IntAlloc( 100 );
667667
Gia_Obj_t * pObj; int i, Obj;
668668
Gia_ManIncrementTravId( p );
669669
Vec_IntForEachEntry( vIn0, Obj, i )
670-
Gia_ObjSetTravIdCurrentId( p, Obj );
670+
Gia_ObjSetTravIdCurrentId( p, fLits ? Abc_Lit2Var(Obj) : Obj );
671671
Vec_IntForEachEntry( vIn1, Obj, i )
672-
Gia_ObjSetTravIdCurrentId( p, Obj );
672+
Gia_ObjSetTravIdCurrentId( p, fLits ? Abc_Lit2Var(Obj) : Obj );
673673
Gia_ManForEachAnd( p, pObj, i ) {
674674
if ( Gia_ObjIsTravIdCurrentId(p, i) )
675675
continue;
@@ -678,15 +678,15 @@ Vec_Int_t * Gia_ManMulFindTfo( Gia_Man_t * p, Vec_Int_t * vIn0, Vec_Int_t * vIn1
678678
}
679679
return vTfo;
680680
}
681-
Vec_Wrd_t * Gia_ManMulFindSimCone( Gia_Man_t * p, Vec_Int_t * vIn0, Vec_Int_t * vIn1, Vec_Wrd_t * vSim0, Vec_Wrd_t * vSim1, Vec_Int_t * vTfo )
681+
Vec_Wrd_t * Gia_ManMulFindSimCone( Gia_Man_t * p, Vec_Int_t * vIn0, Vec_Int_t * vIn1, Vec_Wrd_t * vSim0, Vec_Wrd_t * vSim1, Vec_Int_t * vTfo, int fLits )
682682
{
683683
Vec_Wrd_t * vRes = Vec_WrdAlloc( Vec_IntSize(vTfo) );
684684
Vec_Wrd_t * vSims = Vec_WrdStart( Gia_ManObjNum(p) );
685685
Gia_Obj_t * pObj; int i, Obj;
686686
Vec_IntForEachEntry( vIn0, Obj, i )
687-
Vec_WrdWriteEntry( vSims, Obj, Vec_WrdEntry(vSim0, i) );
687+
Vec_WrdWriteEntry( vSims, fLits ? Abc_Lit2Var(Obj) : Obj, (fLits && Abc_LitIsCompl(Obj)) ? ~Vec_WrdEntry(vSim0, i) : Vec_WrdEntry(vSim0, i) );
688688
Vec_IntForEachEntry( vIn1, Obj, i )
689-
Vec_WrdWriteEntry( vSims, Obj, Vec_WrdEntry(vSim1, i) );
689+
Vec_WrdWriteEntry( vSims, fLits ? Abc_Lit2Var(Obj) : Obj, (fLits && Abc_LitIsCompl(Obj)) ? ~Vec_WrdEntry(vSim1, i) : Vec_WrdEntry(vSim1, i) );
690690
Gia_ManForEachObjVec( vTfo, p, pObj, i ) {
691691
word Sim0 = Vec_WrdEntry(vSims, Gia_ObjFaninId0p(p, pObj) );
692692
word Sim1 = Vec_WrdEntry(vSims, Gia_ObjFaninId1p(p, pObj) );
@@ -697,17 +697,17 @@ Vec_Wrd_t * Gia_ManMulFindSimCone( Gia_Man_t * p, Vec_Int_t * vIn0, Vec_Int_t *
697697
Vec_WrdFree( vSims );
698698
return vRes;
699699
}
700-
int Gia_ManMulFindGetArg( Vec_Wrd_t * vSim, int i, int fSigned )
700+
iword Gia_ManMulFindGetArg( Vec_Wrd_t * vSim, int i, int fSigned )
701701
{
702-
int w, Res = 0; word Word = 0;
702+
int w; iword Res = 0; word Word = 0;
703703
Vec_WrdForEachEntry( vSim, Word, w )
704704
if ( (Word >> i) & 1 )
705-
Res |= (1 << w);
705+
Res |= ((iword)1 << w);
706706
if ( fSigned && ((Word >> i) & 1) )
707-
Res |= ~0 << Vec_WrdSize(vSim);
707+
Res |= ~(iword)0 << Vec_WrdSize(vSim);
708708
return Res;
709709
}
710-
void Gia_ManMulFindSetArg( Vec_Wrd_t * vSim, int i, int iNum )
710+
void Gia_ManMulFindSetArg( Vec_Wrd_t * vSim, int i, iword iNum )
711711
{
712712
int w; word * pWords = Vec_WrdArray(vSim);
713713
for ( w = 0; w < Vec_WrdSize(vSim); w++ )
@@ -716,17 +716,17 @@ void Gia_ManMulFindSetArg( Vec_Wrd_t * vSim, int i, int iNum )
716716
}
717717
Vec_Wrd_t * Gia_ManMulFindSim( Vec_Wrd_t * vSim0, Vec_Wrd_t * vSim1, int fSigned )
718718
{
719-
assert( Vec_WrdSize(vSim0) + Vec_WrdSize(vSim1) <= 30 );
719+
assert( Vec_WrdSize(vSim0) + Vec_WrdSize(vSim1) <= 62 );
720720
Vec_Wrd_t * vRes = Vec_WrdStart( Vec_WrdSize(vSim0) + Vec_WrdSize(vSim1) );
721721
for ( int i = 0; i < 64; i++ )
722722
{
723-
int a = Gia_ManMulFindGetArg( vSim0, i, fSigned );
724-
int b = Gia_ManMulFindGetArg( vSim1, i, fSigned );
723+
iword a = Gia_ManMulFindGetArg( vSim0, i, fSigned );
724+
iword b = Gia_ManMulFindGetArg( vSim1, i, fSigned );
725725
Gia_ManMulFindSetArg( vRes, i, a * b );
726726
}
727727
return vRes;
728728
}
729-
void Gia_ManMulFindOutputs( Gia_Man_t * p, Vec_Wec_t * vTerms, int fVerbose )
729+
void Gia_ManMulFindOutputs( Gia_Man_t * p, Vec_Wec_t * vTerms, int fLits, int fVerbose )
730730
{
731731
Abc_Random(1);
732732
for ( int m = 0; m < Vec_WecSize(vTerms)/3; m++ ) {
@@ -737,8 +737,8 @@ void Gia_ManMulFindOutputs( Gia_Man_t * p, Vec_Wec_t * vTerms, int fVerbose )
737737
Vec_Wrd_t * vSim1 = Vec_WrdStartRandom( Vec_IntSize(vIn1) );
738738
Vec_Wrd_t * vSimU = Gia_ManMulFindSim( vSim0, vSim1, 0 );
739739
Vec_Wrd_t * vSimS = Gia_ManMulFindSim( vSim0, vSim1, 1 );
740-
Vec_Int_t * vTfo = Gia_ManMulFindTfo( p, vIn0, vIn1 );
741-
Vec_Wrd_t * vSims = Gia_ManMulFindSimCone( p, vIn0, vIn1, vSim0, vSim1, vTfo );
740+
Vec_Int_t * vTfo = Gia_ManMulFindTfo( p, vIn0, vIn1, fLits );
741+
Vec_Wrd_t * vSims = Gia_ManMulFindSimCone( p, vIn0, vIn1, vSim0, vSim1, vTfo, fLits );
742742
Vec_Int_t * vOutU = Vec_IntAlloc( 100 );
743743
Vec_Int_t * vOutS = Vec_IntAlloc( 100 );
744744
word Word; int w, iPlace;
@@ -814,7 +814,7 @@ Vec_Wec_t * Gia_ManMulFindA( Gia_Man_t * p, Vec_Wec_t * vCuts3, int fVerbose )
814814
Vec_Wec_t * vXors = Gia_ManMulFindXors( p, vCuts3, fVerbose );
815815
Vec_Wec_t * vTerms = Gia_ManMulFindAInputs2( p, fVerbose );
816816
if ( Vec_WecSize(vTerms) )
817-
Gia_ManMulFindOutputs( p, vTerms, fVerbose );
817+
Gia_ManMulFindOutputs( p, vTerms, 0, fVerbose );
818818
Vec_WecFree( vXors );
819819
return vTerms;
820820
}
@@ -824,7 +824,7 @@ Vec_Wec_t * Gia_ManMulFindB( Gia_Man_t * p, Vec_Wec_t * vCuts4, Vec_Wec_t * vCut
824824
if ( Vec_WecSize(vCuts4) && Vec_WecSize(vCuts5) )
825825
vTerms = Gia_ManMulFindBInputs2( p, vCuts4, vCuts5, fVerbose );
826826
if ( Vec_WecSize(vTerms) )
827-
Gia_ManMulFindOutputs( p, vTerms, fVerbose );
827+
Gia_ManMulFindOutputs( p, vTerms, 0, fVerbose );
828828
return vTerms;
829829
}
830830
void Gia_ManMulFindPrintSet( Vec_Int_t * vSet, int fLit, int fSkipLast )

src/aig/gia/giaMulFind3.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**CFile****************************************************************
2+
3+
FileName [giaMulFind3.c]
4+
5+
SystemName [ABC: Logic synthesis and verification system.]
6+
7+
PackageName [Scalable AIG package.]
8+
9+
Synopsis [Multiplier detection.]
10+
11+
Author [Alan Mishchenko]
12+
13+
Affiliation [UC Berkeley]
14+
15+
Date [Ver. 1.0. Started - June 20, 2005.]
16+
17+
Revision [$Id: giaMulFind3.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18+
19+
***********************************************************************/
20+
21+
#include <math.h>
22+
23+
#include "gia.h"
24+
#include "misc/vec/vecHsh.h"
25+
#include "misc/util/utilTruth.h"
26+
27+
ABC_NAMESPACE_IMPL_START
28+
29+
30+
////////////////////////////////////////////////////////////////////////
31+
/// DECLARATIONS ///
32+
////////////////////////////////////////////////////////////////////////
33+
34+
////////////////////////////////////////////////////////////////////////
35+
/// FUNCTION DEFINITIONS ///
36+
////////////////////////////////////////////////////////////////////////
37+
38+
void Gia_ManMulFindNew( Gia_Man_t * p, int nABits, int nFanLim, int fLits, int fVerbose )
39+
{
40+
}
41+
42+
43+
////////////////////////////////////////////////////////////////////////
44+
/// END OF FILE ///
45+
////////////////////////////////////////////////////////////////////////
46+
47+
ABC_NAMESPACE_IMPL_END
48+

src/aig/gia/module.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ SRC += src/aig/gia/giaAig.c \
5858
src/aig/gia/giaMinLut.c \
5959
src/aig/gia/giaMinLut2.c \
6060
src/aig/gia/giaMulFind.c \
61+
src/aig/gia/giaMulFind3.c \
6162
src/aig/gia/giaMuxes.c \
6263
src/aig/gia/giaNf.c \
6364
src/aig/gia/giaOf.c \

src/base/abci/abc.c

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ static int Abc_CommandAbc9FunAbs ( Abc_Frame_t * pAbc, int argc, cha
643643
static int Abc_CommandAbc9DsdInfo ( Abc_Frame_t * pAbc, int argc, char ** argv );
644644
static int Abc_CommandAbc9FunTrace ( Abc_Frame_t * pAbc, int argc, char ** argv );
645645
static int Abc_CommandAbc9MulFind ( Abc_Frame_t * pAbc, int argc, char ** argv );
646+
static int Abc_CommandAbc9MulFind3 ( Abc_Frame_t * pAbc, int argc, char ** argv );
646647
static int Abc_CommandAbc9BsFind ( Abc_Frame_t * pAbc, int argc, char ** argv );
647648
static int Abc_CommandAbc9AndCare ( Abc_Frame_t * pAbc, int argc, char ** argv );
648649

@@ -1469,7 +1470,8 @@ void Abc_Init( Abc_Frame_t * pAbc )
14691470
Cmd_CommandAdd( pAbc, "ABC9", "&funabs", Abc_CommandAbc9FunAbs, 0 );
14701471
Cmd_CommandAdd( pAbc, "ABC9", "&dsdinfo", Abc_CommandAbc9DsdInfo, 0 );
14711472
Cmd_CommandAdd( pAbc, "ABC9", "&funtrace", Abc_CommandAbc9FunTrace, 0 );
1472-
Cmd_CommandAdd( pAbc, "ABC9", "&mulfind", Abc_CommandAbc9MulFind, 0 );
1473+
Cmd_CommandAdd( pAbc, "ABC9", "&mulfind", Abc_CommandAbc9MulFind, 0 );
1474+
Cmd_CommandAdd( pAbc, "ABC9", "&mulfind3", Abc_CommandAbc9MulFind3, 0 );
14731475
Cmd_CommandAdd( pAbc, "ABC9", "&bsfind", Abc_CommandAbc9BsFind, 0 );
14741476
Cmd_CommandAdd( pAbc, "ABC9", "&andcare", Abc_CommandAbc9AndCare, 0 );
14751477

@@ -57579,6 +57581,79 @@ int Abc_CommandAbc9MulFind( Abc_Frame_t * pAbc, int argc, char ** argv )
5757957581
return 1;
5758057582
}
5758157583

57584+
/**Function*************************************************************
57585+
57586+
Synopsis []
57587+
57588+
Description []
57589+
57590+
SideEffects []
57591+
57592+
SeeAlso []
57593+
57594+
***********************************************************************/
57595+
int Abc_CommandAbc9MulFind3( Abc_Frame_t * pAbc, int argc, char ** argv )
57596+
{
57597+
extern void Gia_ManMulFindNew( Gia_Man_t * p, int nABits, int nFanLim, int fLits, int fVerbose );
57598+
int c, nABits = 0, nFanLim = 4, fLits = 0, fVerbose = 0;
57599+
Extra_UtilGetoptReset();
57600+
while ( ( c = Extra_UtilGetopt( argc, argv, "IFlvh" ) ) != EOF )
57601+
{
57602+
switch ( c )
57603+
{
57604+
case 'I':
57605+
if ( globalUtilOptind >= argc )
57606+
{
57607+
Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" );
57608+
goto usage;
57609+
}
57610+
nABits = atoi(argv[globalUtilOptind]);
57611+
globalUtilOptind++;
57612+
if ( nABits < 0 )
57613+
goto usage;
57614+
break;
57615+
case 'F':
57616+
if ( globalUtilOptind >= argc )
57617+
{
57618+
Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" );
57619+
goto usage;
57620+
}
57621+
nFanLim = atoi(argv[globalUtilOptind]);
57622+
globalUtilOptind++;
57623+
if ( nFanLim < 0 )
57624+
goto usage;
57625+
break;
57626+
case 'l':
57627+
fLits ^= 1;
57628+
break;
57629+
case 'v':
57630+
fVerbose ^= 1;
57631+
break;
57632+
case 'h':
57633+
goto usage;
57634+
default:
57635+
goto usage;
57636+
}
57637+
}
57638+
if ( pAbc->pGia == NULL )
57639+
{
57640+
Abc_Print( -1, "Abc_CommandAbc9MulFind(): There is no AIG.\n" );
57641+
return 0;
57642+
}
57643+
Gia_ManMulFindNew( pAbc->pGia, nABits, nFanLim, fLits, fVerbose );
57644+
return 0;
57645+
57646+
usage:
57647+
Abc_Print( -2, "usage: &mulfind3 [-IF num] [-lvh]\n" );
57648+
Abc_Print( -2, "\t detects multipliers in the given AIG\n" );
57649+
Abc_Print( -2, "\t-I num : the bit-width of the first input if known [default = %d]\n", nABits );
57650+
Abc_Print( -2, "\t-F num : the fanout limit [default = %d]\n", nFanLim );
57651+
Abc_Print( -2, "\t-l : toggles using literals instead of nodes [default = %s]\n", fLits ? "yes": "no" );
57652+
Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose ? "yes": "no" );
57653+
Abc_Print( -2, "\t-h : print the command usage\n");
57654+
return 1;
57655+
}
57656+
5758257657
/**Function*************************************************************
5758357658

5758457659
Synopsis []

src/misc/util/module.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
SRC += src/misc/util/utilBridge.c \
2+
src/misc/util/utilBipart.c \
23
src/misc/util/utilBSet.c \
34
src/misc/util/utilCex.c \
45
src/misc/util/utilColor.c \

0 commit comments

Comments
 (0)