From f6d74cb7a91db81410d4990f94b133447081f902 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 9 Nov 2019 13:12:20 +0100 Subject: Draw some pips, fixed H6 and V6 --- ecp5/arch.cc | 23 ++++++++++++++++++++- ecp5/gfx.cc | 65 ++++++++++++++++++++++++++++++++---------------------------- ecp5/gfx.h | 1 + 3 files changed, 58 insertions(+), 31 deletions(-) (limited to 'ecp5') 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 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 &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 &g, int x, int y, int w, int h, IdS } +void gfxTilePip(std::vector &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 &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style); +void gfxTilePip(std::vector &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 -- cgit v1.2.3