aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2019-11-09 13:12:20 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2019-11-09 13:12:20 +0100
commitf6d74cb7a91db81410d4990f94b133447081f902 (patch)
tree1e36c8ba2531cd78ecc11dcdfe39e37d3c438040 /ecp5
parent49760a9ea81180024783a06ee9ac052035de98ea (diff)
downloadnextpnr-f6d74cb7a91db81410d4990f94b133447081f902.tar.gz
nextpnr-f6d74cb7a91db81410d4990f94b133447081f902.tar.bz2
nextpnr-f6d74cb7a91db81410d4990f94b133447081f902.zip
Draw some pips, fixed H6 and V6
Diffstat (limited to 'ecp5')
-rw-r--r--ecp5/arch.cc23
-rw-r--r--ecp5/gfx.cc65
-rw-r--r--ecp5/gfx.h1
3 files changed, 58 insertions, 31 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index 7027fdfc..fd9879b9 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -632,6 +632,19 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
gfxTileWire(ret, x, y, chip_info->width, chip_info->height, wire_type, tilewire, style);
}
+ if (decal.type == DecalId::TYPE_PIP) {
+ PipId pip;
+ pip.index = decal.z;
+ pip.location = decal.location;
+ WireId src_wire = getPipSrcWire(pip);
+ WireId dst_wire = getPipDstWire(pip);
+ int x = decal.location.x;
+ int y = chip_info->height - 1 - decal.location.y;
+ GfxTileWireId src_id = GfxTileWireId(locInfo(src_wire)->wire_data[src_wire.index].tile_wire);
+ GfxTileWireId dst_id = GfxTileWireId(locInfo(dst_wire)->wire_data[dst_wire.index].tile_wire);
+ GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_HIDDEN;
+ gfxTilePip(ret, x, y, chip_info->width, chip_info->height, src_wire, getWireType(src_wire), src_id, dst_wire, getWireType(dst_wire), dst_id, style);
+ }
if (decal.type == DecalId::TYPE_BEL) {
BelId bel;
bel.index = decal.z;
@@ -702,7 +715,15 @@ DecalXY Arch::getWireDecal(WireId wire) const
return decalxy;
}
-DecalXY Arch::getPipDecal(PipId pip) const { return {}; };
+DecalXY Arch::getPipDecal(PipId pip) const
+{
+ DecalXY decalxy;
+ decalxy.decal.type = DecalId::TYPE_PIP;
+ decalxy.decal.location = pip.location;
+ decalxy.decal.z = pip.index;
+ decalxy.decal.active = getBoundPipNet(pip) != nullptr;
+ return decalxy;
+};
DecalXY Arch::getGroupDecal(GroupId group) const
{
diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc
index 5828965f..f13a6ab7 100644
--- a/ecp5/gfx.cc
+++ b/ecp5/gfx.cc
@@ -168,70 +168,50 @@ void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, int w, int h, IdS
GraphicElement el;
el.type = GraphicElement::TYPE_LINE;
el.style = style;
+
el.y1 = y + switchbox_y1 + 0.0017f*(16 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3));
el.y2 = el.y1;
el.x1 = x + switchbox_x1;
el.x2 = x + switchbox_x1 - 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3));
g.push_back(el);
- int y1 = y + 1;
- if (y1> h - 1) y1 = h - 1;
-
- el.y2 = y1 + switchbox_y1 + 0.0017f*(16 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3));
- el.x1 = el.x2;
- g.push_back(el);
+ int y2 = y - 3;
+ if (y2<0) y2 = 0;
- el.y1 = el.y2;
- el.x1 = x + switchbox_x1;
+ el.y1 = y2 + switchbox_y1 + 0.0017f*(16 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3));
+ el.y2 = el.y1;
g.push_back(el);
- int y2 = y - 1;
- if (y2<0) y2 = 0;
-
el.y1 = y + switchbox_y1 + 0.0017f*(16 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3));
el.y2 = y2 + switchbox_y1 + 0.0017f*(16 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3));
el.x2 = x + switchbox_x1 - 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3));
el.x1 = el.x2;
g.push_back(el);
-
- el.y1 = el.y2;
- el.x1 = x + switchbox_x1;
- g.push_back(el);
}
if (wire_type == id_WIRE_TYPE_H06) {
GraphicElement el;
el.type = GraphicElement::TYPE_LINE;
el.style = style;
+
el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3));
el.x2 = el.x1;
el.y1 = y + switchbox_y1;
el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3));
g.push_back(el);
- int x1 = x + 3;
- if (x1> w - 1) x1 = w - 1;
-
- el.x2 = x1 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3));
- el.y1 = el.y2;
- g.push_back(el);
-
- el.x1 = el.x2;
- el.y1 = y + switchbox_y1;
- g.push_back(el);
-
int x2 = x - 3;
if (x2<0) x2 = 0;
+ el.x1 = x2 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3));
+ el.x2 = el.x1;
+ g.push_back(el);
+
el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3));
el.x2 = x2 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3));
el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3));
el.y1 = el.y2;
g.push_back(el);
-
- el.x1 = el.x2;
- el.y1 = y + switchbox_y1;
- g.push_back(el);
}
if (wire_type == id_WIRE_TYPE_V06) {
@@ -414,4 +394,29 @@ void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, int w, int h, IdS
}
+void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, int w, int h, WireId src, IdString src_type, GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style)
+{
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+
+ if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V06) {
+ el.x1 = x + switchbox_x1 + 0.0017f*(96 + (src_id - TILE_WIRE_H06W0303)+ 20 *(x%3));
+ el.y1 = y + switchbox_y1;
+
+ el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3));
+ el.x2 = x + switchbox_x1;
+ g.push_back(el);
+ }
+ if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) {
+ el.x1 = x + switchbox_x2;
+ el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (src_id - TILE_WIRE_H01E0001);
+
+ el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3));
+ el.x2 = x + switchbox_x1;
+ g.push_back(el);
+ }
+
+}
+
NEXTPNR_NAMESPACE_END
diff --git a/ecp5/gfx.h b/ecp5/gfx.h
index e9ec6133..f3fa6a4c 100644
--- a/ecp5/gfx.h
+++ b/ecp5/gfx.h
@@ -436,6 +436,7 @@ enum GfxTileWireId
};
void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style);
+void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, int w, int h, WireId src, IdString src_type, GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style);
NEXTPNR_NAMESPACE_END