Commit 3b946e76 by MyskYko

options

parent 920f4dbb
......@@ -41,13 +41,13 @@ Gia_Man_t *Gia_ManTransductionBdd(Gia_Man_t *pGia, int nType, int fMspf, int nRa
break;
case 6: {
bool fInner = (nParameter / 4) % 2;
count -= t.RepeatResubInner(fMspf, fInner);
count -= t.RepeatInner(fMspf, fInner);
break;
}
case 7: {
bool fInner = (nParameter / 4) % 2;
bool fOuter = (nParameter / 8) % 2;
count -= t.RepeatResubOuter(fMspf, fInner, fOuter);
count -= t.RepeatOuter(fMspf, fInner, fOuter);
break;
}
case 8: {
......@@ -55,12 +55,11 @@ Gia_Man_t *Gia_ManTransductionBdd(Gia_Man_t *pGia, int nType, int fMspf, int nRa
bool fMspfMerge = fMspf? (nParameter / 2) % 2: false;
bool fInner = (nParameter / 4) % 2;
bool fOuter = (nParameter / 8) % 2;
count -= t.Optimize(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
count -= t.RepeatAll(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
break;
}
default:
std::cout << "Invalid transduction type" << std::endl;
assert(0);
std::cout << "Unknown transduction type " << nType << std::endl;
}
assert(t.Verify());
assert(count == t.CountWires());
......@@ -98,13 +97,13 @@ Gia_Man_t *Gia_ManTransductionTt(Gia_Man_t *pGia, int nType, int fMspf, int nRan
break;
case 6: {
bool fInner = (nParameter / 4) % 2;
count -= t.RepeatResubInner(fMspf, fInner);
count -= t.RepeatInner(fMspf, fInner);
break;
}
case 7: {
bool fInner = (nParameter / 4) % 2;
bool fOuter = (nParameter / 8) % 2;
count -= t.RepeatResubOuter(fMspf, fInner, fOuter);
count -= t.RepeatOuter(fMspf, fInner, fOuter);
break;
}
case 8: {
......@@ -112,12 +111,11 @@ Gia_Man_t *Gia_ManTransductionTt(Gia_Man_t *pGia, int nType, int fMspf, int nRan
bool fMspfMerge = fMspf? (nParameter / 2) % 2: false;
bool fInner = (nParameter / 4) % 2;
bool fOuter = (nParameter / 8) % 2;
count -= t.Optimize(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
count -= t.RepeatAll(fFirstMerge, fMspfMerge, fMspf, fInner, fOuter);
break;
}
default:
std::cout << "Invalid transduction type" << std::endl;
assert(0);
std::cout << "Unknown transduction type " << nType << std::endl;
}
assert(t.Verify());
assert(count == t.CountWires());
......
......@@ -1386,7 +1386,7 @@ public: // Optimization scripts
count += diff;
return count;
}
int RepeatResubInner(bool fMspf, bool fInner) {
int RepeatInner(bool fMspf, bool fInner) {
int count = 0;
while(int diff = RepeatResub(true, fMspf) + RepeatResub(false, fMspf)) {
count += diff;
......@@ -1395,30 +1395,30 @@ public: // Optimization scripts
}
return count;
}
int RepeatResubOuter(bool fMspf, bool fInner, bool fOuter) {
int RepeatOuter(bool fMspf, bool fInner, bool fOuter) {
int count = 0;
while(int diff = fMspf? RepeatResubInner(false, fInner) + RepeatResubInner(true, fInner): RepeatResubInner(false, fInner)) {
while(int diff = fMspf? RepeatInner(false, fInner) + RepeatInner(true, fInner): RepeatInner(false, fInner)) {
count += diff;
if(!fOuter)
break;
}
return count;
}
int Optimize(bool fFirstMerge, bool fMspfMerge, bool fMspfResub, bool fInner, bool fOuter) {
int RepeatAll(bool fFirstMerge, bool fMspfMerge, bool fMspfResub, bool fInner, bool fOuter) {
TransductionBackup<Man, lit, LitMax> b;
Save(b);
int count = 0;
int diff = 0;
if(fFirstMerge)
diff = ResubShared(fMspfMerge);
diff += RepeatResubOuter(fMspfResub, fInner, fOuter);
diff += RepeatOuter(fMspfResub, fInner, fOuter);
if(diff > 0) {
count = diff;
Save(b);
diff = 0;
}
while(true) {
diff += ResubShared(fMspfMerge) + RepeatResubOuter(fMspfResub, fInner, fOuter);
diff += ResubShared(fMspfMerge) + RepeatOuter(fMspfResub, fInner, fOuter);
if(diff > 0) {
count += diff;
Save(b);
......@@ -1591,7 +1591,7 @@ public: // Constructor
startclk = Abc_Clock();
p.nGbc = 1;
p.nReo = 4000;
if(nSortType)
if(nSortType && nSortType < 4)
p.fCountOnes = true;
this->man = new Man(Gia_ManCiNum(pGia), p);
ImportAig(pGia);
......
......@@ -42586,7 +42586,7 @@ usage:
int Abc_CommandAbc9Transduction( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Gia_Man_t * pTemp, * pExdc = NULL;
int c, nType = 8, fMspf = 1, nRandom = 0, nSortType = 0, nPiShuffle = 0, nParameter = 0, fLevel = 0, fTruth = 0, fNewLine = 0, nVerbose = 0;
int c, nType = 1, fMspf = 0, nRandom = 0, nSortType = 0, nPiShuffle = 0, nParameter = 0, fLevel = 0, fTruth = 0, fNewLine = 0, nVerbose = 2;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "TSIPRVtmnl" ) ) != EOF )
{
......@@ -42692,7 +42692,7 @@ int Abc_CommandAbc9Transduction( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( fLevel && (nType == 3 || nType == 8) )
{
Abc_Print( -1, "Level preserving optimization does not work with type 3 and 8.\n" );
Abc_Print( -1, "Level preserving optimization does not work with transduction type 3 and 8.\n" );
return 1;
}
......@@ -42715,12 +42715,17 @@ usage:
Abc_Print( -2, "\t 3: ResubShared\n" );
Abc_Print( -2, "\t 4: repeat Resub\n" );
Abc_Print( -2, "\t 5: repeat ResubMono\n" );
Abc_Print( -2, "\t 6: RepeatResubInner\n" );
Abc_Print( -2, "\t 7: RepeatResubOuter\n" );
Abc_Print( -2, "\t 8: Optimize\n" );
Abc_Print( -2, "\t 6: script RepeatInner\n" );
Abc_Print( -2, "\t 7: script RepeatOuter\n" );
Abc_Print( -2, "\t 8: script RepeatAll\n" );
Abc_Print( -2, "\t-S num : fanin sort type [default = %d]\n", nSortType );
Abc_Print( -2, "\t-I num : random seed to shuffle pis (0 = no shuffle) [default = %d]\n", nPiShuffle );
Abc_Print( -2, "\t-P num : internal parameter [default = %d]\n", nParameter );
Abc_Print( -2, "\t 0: topological order\n" );
Abc_Print( -2, "\t 1: number of ones\n" );
Abc_Print( -2, "\t 2: number of ones before complemented edges\n" );
Abc_Print( -2, "\t 3: pseudo random\n" );
Abc_Print( -2, "\t 4: no sorting\n" );
Abc_Print( -2, "\t-I num : random seed to shuffle PIs (0 = no shuffle) [default = %d]\n", nPiShuffle );
Abc_Print( -2, "\t-P num : parameters for scripts [default = %d]\n", nParameter );
Abc_Print( -2, "\t-R num : random seed to set all parameters (0 = no random) ([default = %d]\n", nRandom );
Abc_Print( -2, "\t-V num : verbosity level [default = %d]\n", nVerbose);
Abc_Print( -2, "\t-t : toggles using truth table instead of BDD [default = %s]\n", fTruth? "yes": "no" );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment