Add Loc constructors
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
f438fc615b
commit
30e2f0e1e8
@ -164,6 +164,9 @@ struct Loc
|
|||||||
{
|
{
|
||||||
int x = -1, y = -1, z = -1;
|
int x = -1, y = -1, z = -1;
|
||||||
|
|
||||||
|
Loc() {}
|
||||||
|
Loc(int x, int y, int z) : x(x), y(y), z(z) {}
|
||||||
|
|
||||||
bool operator==(const Loc &other) const { return (x == other.x) && (y == other.y) && (z == other.z); }
|
bool operator==(const Loc &other) const { return (x == other.x) && (y == other.y) && (z == other.z); }
|
||||||
bool operator!=(const Loc &other) const { return (x != other.x) || (y != other.y) || (z == other.z); }
|
bool operator!=(const Loc &other) const { return (x != other.x) || (y != other.y) || (z == other.z); }
|
||||||
};
|
};
|
||||||
|
@ -62,28 +62,23 @@ void Arch::addAlias(IdString name, IdString srcWire, IdString dstWire, DelayInfo
|
|||||||
pip_ids.push_back(name);
|
pip_ids.push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arch::addBel(IdString name, IdString type, int x, int y, int z, bool gb)
|
void Arch::addBel(IdString name, IdString type, Loc loc, bool gb)
|
||||||
{
|
{
|
||||||
Loc loc;
|
|
||||||
loc.x = x;
|
|
||||||
loc.y = y;
|
|
||||||
loc.z = z;
|
|
||||||
|
|
||||||
NPNR_ASSERT(bels.count(name) == 0);
|
NPNR_ASSERT(bels.count(name) == 0);
|
||||||
NPNR_ASSERT(bel_by_loc.count(loc) == 0);
|
NPNR_ASSERT(bel_by_loc.count(loc) == 0);
|
||||||
BelInfo &bi = bels[name];
|
BelInfo &bi = bels[name];
|
||||||
bi.name = name;
|
bi.name = name;
|
||||||
bi.type = type;
|
bi.type = type;
|
||||||
bi.x = x;
|
bi.x = loc.x;
|
||||||
bi.y = y;
|
bi.y = loc.y;
|
||||||
bi.z = z;
|
bi.z = loc.z;
|
||||||
bi.gb = gb;
|
bi.gb = gb;
|
||||||
|
|
||||||
bel_ids.push_back(name);
|
bel_ids.push_back(name);
|
||||||
bel_ids_by_type[type].push_back(name);
|
bel_ids_by_type[type].push_back(name);
|
||||||
|
|
||||||
bel_by_loc[loc] = name;
|
bel_by_loc[loc] = name;
|
||||||
bels_by_tile[x][y].push_back(name);
|
bels_by_tile[loc.x][loc.y].push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arch::addBelInput(IdString bel, IdString name, IdString wire)
|
void Arch::addBelInput(IdString bel, IdString name, IdString wire)
|
||||||
|
@ -97,7 +97,7 @@ struct Arch : BaseCtx
|
|||||||
void addPip(IdString name, IdString srcWire, IdString dstWire, DelayInfo delay);
|
void addPip(IdString name, IdString srcWire, IdString dstWire, DelayInfo delay);
|
||||||
void addAlias(IdString name, IdString srcWire, IdString dstWire, DelayInfo delay);
|
void addAlias(IdString name, IdString srcWire, IdString dstWire, DelayInfo delay);
|
||||||
|
|
||||||
void addBel(IdString name, IdString type, int x, int y, int z, bool gb);
|
void addBel(IdString name, IdString type, Loc loc, bool gb);
|
||||||
void addBelInput(IdString bel, IdString name, IdString wire);
|
void addBelInput(IdString bel, IdString name, IdString wire);
|
||||||
void addBelOutput(IdString bel, IdString name, IdString wire);
|
void addBelOutput(IdString bel, IdString name, IdString wire);
|
||||||
void addBelInout(IdString bel, IdString name, IdString wire);
|
void addBelInout(IdString bel, IdString name, IdString wire);
|
||||||
|
@ -279,12 +279,7 @@ BelRange Arch::getBelsByTile(int x, int y) const
|
|||||||
// In iCE40 chipdb bels at the same tile are consecutive and dense z ordinates are used
|
// In iCE40 chipdb bels at the same tile are consecutive and dense z ordinates are used
|
||||||
BelRange br;
|
BelRange br;
|
||||||
|
|
||||||
Loc loc;
|
br.b.cursor = Arch::getBelByLocation(Loc(x, y, 0)).index;
|
||||||
loc.x = x;
|
|
||||||
loc.y = y;
|
|
||||||
loc.z = 0;
|
|
||||||
|
|
||||||
br.b.cursor = Arch::getBelByLocation(loc).index;
|
|
||||||
br.e.cursor = br.b.cursor;
|
br.e.cursor = br.b.cursor;
|
||||||
|
|
||||||
if (br.e.cursor != -1) {
|
if (br.e.cursor != -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user