Fixed Gray calculation in KV_PiEleLoc
This commit is contained in:
parent
ed1b206cff
commit
ac7e6ff233
2 changed files with 5 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "Tools.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -20,9 +21,9 @@ public:
|
||||||
this->i = i;
|
this->i = i;
|
||||||
|
|
||||||
this->w = i & ((0x1 << (numVarX)) - 1); // get x coord
|
this->w = i & ((0x1 << (numVarX)) - 1); // get x coord
|
||||||
this->w ^= w/2; // make it gray
|
this->w = Tools::GrayToBinary(w);
|
||||||
|
|
||||||
this->h = i >> numVarX; // get y coord
|
this->h = i >> numVarX; // get y coord
|
||||||
this->h ^= h/2; // make it gray
|
this->h = Tools::GrayToBinary(h);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "Tools.h"
|
||||||
#include "PrimImplikant.h"
|
#include "PrimImplikant.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -53,11 +54,7 @@ void PrimImplikant::sort()
|
||||||
|
|
||||||
bool PrimImplikant::compareGray(uint a, uint b)
|
bool PrimImplikant::compareGray(uint a, uint b)
|
||||||
{
|
{
|
||||||
for (uint i = 1; i < dimension; i++)
|
return Tools::GrayToBinary(a) < Tools::GrayToBinary(b);
|
||||||
a ^= a / 2; // convert a from gray to binary
|
|
||||||
for (uint i = 1; i < dimension; i++)
|
|
||||||
b ^= b / 2; // convert b from gray to binary
|
|
||||||
return a < b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrimImplikant::makeLocations()
|
void PrimImplikant::makeLocations()
|
||||||
|
|
Loading…
Reference in a new issue