machxo2: Implement 2 Bel API functions.
This commit is contained in:
parent
3e6be4bbfd
commit
682de724a8
@ -135,10 +135,25 @@ BelId Arch::getBelByName(IdString name) const
|
||||
return BelId();
|
||||
}
|
||||
|
||||
IdString Arch::getBelName(BelId bel) const { return IdString(); }
|
||||
|
||||
BelId Arch::getBelByLocation(Loc loc) const
|
||||
{
|
||||
BelId ret;
|
||||
|
||||
if(loc.x >= chip_info->width || loc.y >= chip_info->height)
|
||||
return BelId();
|
||||
|
||||
ret.location.x = loc.x;
|
||||
ret.location.y = loc.y;
|
||||
|
||||
const TileTypePOD *tilei = tileInfo(ret);
|
||||
for(int i = 0; i < tilei->num_bels; i++) {
|
||||
if(tilei->bel_data[i].z == loc.z)
|
||||
{
|
||||
ret.index = i;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return BelId();
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,14 @@ struct Arch : BaseCtx
|
||||
int getTilePipDimZ(int x, int y) const { return 2; }
|
||||
|
||||
BelId getBelByName(IdString name) const;
|
||||
IdString getBelName(BelId bel) const;
|
||||
IdString getBelName(BelId bel) const
|
||||
{
|
||||
NPNR_ASSERT(bel != BelId());
|
||||
std::stringstream name;
|
||||
name << "X" << bel.location.x << "/Y" << bel.location.y << "/" << tileInfo(bel)->bel_data[bel.index].name.get();
|
||||
return id(name.str());
|
||||
}
|
||||
|
||||
Loc getBelLocation(BelId bel) const
|
||||
{
|
||||
NPNR_ASSERT(bel != BelId());
|
||||
|
Loading…
Reference in New Issue
Block a user