machxo2: Finish implementing Pip API functions.

This commit is contained in:
William D. Jones 2021-01-28 03:16:57 -05:00 committed by gatecat
parent 0adde4aede
commit 861c12e6eb
2 changed files with 67 additions and 27 deletions

View File

@ -351,24 +351,6 @@ IdString Arch::getPipName(PipId pip) const
return id("X" + std::to_string(x) + "/Y" + std::to_string(y) + "/" + src_name + ".->." + dst_name);
}
NetInfo *Arch::getBoundPipNet(PipId pip) const { return nullptr; }
NetInfo *Arch::getConflictingPipNet(PipId pip) const { return nullptr; }
WireId Arch::getConflictingPipWire(PipId pip) const { return WireId(); }
const std::vector<PipId> &Arch::getPips() const { return pip_id_dummy; }
Loc Arch::getPipLocation(PipId pip) const { return Loc(); }
DelayInfo Arch::getPipDelay(PipId pip) const { return DelayInfo(); }
const std::vector<PipId> &Arch::getPipsDownhill(WireId wire) const { return pip_id_dummy; }
const std::vector<PipId> &Arch::getPipsUphill(WireId wire) const { return pip_id_dummy; }
const std::vector<PipId> &Arch::getWireAliases(WireId wire) const { return pip_id_dummy; }
// ---------------------------------------------------------------
GroupId Arch::getGroupByName(IdString name) const { return GroupId(); }

View File

@ -748,11 +748,50 @@ struct Arch : BaseCtx
return pip_to_net.find(pip) == pip_to_net.end() || pip_to_net.at(pip) == nullptr;
}
NetInfo *getBoundPipNet(PipId pip) const;
WireId getConflictingPipWire(PipId pip) const;
NetInfo *getConflictingPipNet(PipId pip) const;
const std::vector<PipId> &getPips() const;
Loc getPipLocation(PipId pip) const;
NetInfo *getBoundPipNet(PipId pip) const
{
NPNR_ASSERT(pip != PipId());
if (pip_to_net.find(pip) == pip_to_net.end())
return nullptr;
else
return pip_to_net.at(pip);
}
WireId getConflictingPipWire(PipId pip) const { return WireId(); }
NetInfo *getConflictingPipNet(PipId pip) const
{
NPNR_ASSERT(pip != PipId());
if (pip_to_net.find(pip) == pip_to_net.end())
return nullptr;
else
return pip_to_net.at(pip);
}
AllPipRange getPips() const
{
AllPipRange range;
range.b.cursor_tile = 0;
range.b.cursor_index = -1;
range.b.chip = chip_info;
++range.b; //-1 and then ++ deals with the case of no Bels in the first tile
range.e.cursor_tile = chip_info->width * chip_info->height;
range.e.cursor_index = 0;
range.e.chip = chip_info;
return range;
}
Loc getPipLocation(PipId pip) const
{
Loc loc;
loc.x = pip.location.x;
loc.y = pip.location.y;
// FIXME: Some Pip's config bits span across tiles. Will Z
// be affected by this?
loc.z = 0;
return loc;
}
WireId getPipSrcWire(PipId pip) const
{
@ -772,10 +811,29 @@ struct Arch : BaseCtx
return wire;
}
DelayInfo getPipDelay(PipId pip) const;
const std::vector<PipId> &getPipsDownhill(WireId wire) const;
const std::vector<PipId> &getPipsUphill(WireId wire) const;
const std::vector<PipId> &getWireAliases(WireId wire) const;
DelayInfo getPipDelay(PipId pip) const { return DelayInfo(); }
PipRange getPipsDownhill(WireId wire) const
{
PipRange range;
NPNR_ASSERT(wire != WireId());
range.b.cursor = tileInfo(wire)->wire_data[wire.index].pips_downhill.get();
range.b.wire_loc = wire.location;
range.e.cursor = range.b.cursor + tileInfo(wire)->wire_data[wire.index].num_downhill;
range.e.wire_loc = wire.location;
return range;
}
PipRange getPipsUphill(WireId wire) const
{
PipRange range;
NPNR_ASSERT(wire != WireId());
range.b.cursor = tileInfo(wire)->wire_data[wire.index].pips_uphill.get();
range.b.wire_loc = wire.location;
range.e.cursor = range.b.cursor + tileInfo(wire)->wire_data[wire.index].num_uphill;
range.e.wire_loc = wire.location;
return range;
}
// Group
GroupId getGroupByName(IdString name) const;