Update chip Graphics API

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-06-13 12:48:58 +02:00
parent 145c849596
commit 1e314cc0ce
4 changed files with 37 additions and 25 deletions

View File

@ -175,6 +175,12 @@ float Chip::estimateDelay(PosInfo src, PosInfo dst) const
// ---------------------------------------------------------------
std::vector<GraphicElement> Chip::getFrameGraphics() const
{
static std::vector<GraphicElement> ret;
return ret;
}
std::vector<GraphicElement> Chip::getBelGraphics(BelId bel) const
{
static std::vector<GraphicElement> ret;
@ -193,10 +199,4 @@ std::vector<GraphicElement> Chip::getPipGraphics(PipId pip) const
return ret;
}
std::vector<GraphicElement> Chip::getFrameGraphics() const
{
static std::vector<GraphicElement> ret;
return ret;
}
NEXTPNR_NAMESPACE_END

View File

@ -118,10 +118,16 @@ struct Chip
PosInfo getPipPosition(PipId pip) const;
float estimateDelay(PosInfo src, PosInfo dst) const;
std::vector<GraphicElement> getFrameGraphics() const;
std::vector<GraphicElement> getBelGraphics(BelId bel) const;
std::vector<GraphicElement> getWireGraphics(WireId wire) const;
std::vector<GraphicElement> getPipGraphics(PipId pip) const;
std::vector<GraphicElement> getFrameGraphics() const;
bool allGraphicsReload = false;
bool frameGraphicsReload = false;
std::unordered_set<BelId> belGraphicsReload;
std::unordered_set<WireId> wireGraphicsReload;
std::unordered_set<PipId> pipGraphicsReload;
};
NEXTPNR_NAMESPACE_END

View File

@ -289,6 +289,23 @@ float Chip::estimateDelay(PosInfo src, PosInfo dst) const
// -----------------------------------------------------------------------
std::vector<GraphicElement> Chip::getFrameGraphics() const
{
std::vector<GraphicElement> ret;
for (int x = 0; x <= chip_info.width; x++)
for (int y = 0; y <= chip_info.height; y++) {
GraphicElement el;
el.type = GraphicElement::G_LINE;
el.x1 = x - 0.05, el.x2 = x + 0.05, el.y1 = y, el.y2 = y, el.z = 0;
ret.push_back(el);
el.x1 = x, el.x2 = x, el.y1 = y - 0.05, el.y2 = y + 0.05, el.z = 0;
ret.push_back(el);
}
return ret;
}
std::vector<GraphicElement> Chip::getBelGraphics(BelId bel) const
{
std::vector<GraphicElement> ret;
@ -369,21 +386,4 @@ std::vector<GraphicElement> Chip::getPipGraphics(PipId pip) const
return ret;
}
std::vector<GraphicElement> Chip::getFrameGraphics() const
{
std::vector<GraphicElement> ret;
for (int x = 0; x <= chip_info.width; x++)
for (int y = 0; y <= chip_info.height; y++) {
GraphicElement el;
el.type = GraphicElement::G_LINE;
el.x1 = x - 0.05, el.x2 = x + 0.05, el.y1 = y, el.y2 = y, el.z = 0;
ret.push_back(el);
el.x1 = x, el.x2 = x, el.y1 = y - 0.05, el.y2 = y + 0.05, el.z = 0;
ret.push_back(el);
}
return ret;
}
NEXTPNR_NAMESPACE_END

View File

@ -709,10 +709,16 @@ struct Chip
// -------------------------------------------------
std::vector<GraphicElement> getFrameGraphics() const;
std::vector<GraphicElement> getBelGraphics(BelId bel) const;
std::vector<GraphicElement> getWireGraphics(WireId wire) const;
std::vector<GraphicElement> getPipGraphics(PipId pip) const;
std::vector<GraphicElement> getFrameGraphics() const;
bool allGraphicsReload = false;
bool frameGraphicsReload = false;
std::unordered_set<BelId> belGraphicsReload;
std::unordered_set<WireId> wireGraphicsReload;
std::unordered_set<PipId> pipGraphicsReload;
};
NEXTPNR_NAMESPACE_END