From 4576fc7c20c7a211556b9b160a9eb35b5f8bb5b7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 9 Jul 2018 16:12:41 +0200 Subject: [PATCH] Vertical wires and span-12 wires Signed-off-by: Clifford Wolf --- ice40/gfx.cc | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ ice40/gfx.h | 2 - 2 files changed, 158 insertions(+), 2 deletions(-) diff --git a/ice40/gfx.cc b/ice40/gfx.cc index 5a30c79d..613f1a31 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -23,6 +23,8 @@ NEXTPNR_NAMESPACE_BEGIN void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) { + // Horizontal Span-4 Wires + if (id >= TILE_WIRE_SP4_H_L_36 && id <= TILE_WIRE_SP4_H_L_47) { int idx = (id - TILE_WIRE_SP4_H_L_36) + 48; GraphicElement el; @@ -72,6 +74,162 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.y2 = y3; g.push_back(el); } + + // Vertical Span-4 Wires + + if (id >= TILE_WIRE_SP4_V_T_36 && id <= TILE_WIRE_SP4_V_T_47) { + int idx = (id - TILE_WIRE_SP4_V_T_36) + 48; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (60 - idx); + + el.y1 = y + 0.0; + el.y2 = y + 0.9; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + } + + if (id >= TILE_WIRE_SP4_V_B_0 && id <= TILE_WIRE_SP4_V_B_47) { + int idx = id - TILE_WIRE_SP4_V_B_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (60 - idx); + float x2 = x + 0.03 + 0.0025 * (60 - (idx ^ 1)); + float x3 = x + 0.03 + 0.0025 * (60 - (idx ^ 1) - 12); + + if (idx >= 12) { + el.y1 = y; + el.y2 = y + 0.01; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + + el.y1 = y + 0.01; + el.y2 = y + 0.02; + el.x1 = x1; + el.x2 = x2; + g.push_back(el); + } + + el.y1 = y + 0.02; + el.y2 = y + 0.9; + el.x1 = x2; + el.x2 = x2; + g.push_back(el); + + el.y1 = y + 0.9; + el.y2 = y + 1.0; + el.x1 = x2; + el.x2 = x3; + g.push_back(el); + } + + // Horizontal Span-12 Wires + + if (id >= TILE_WIRE_SP12_H_L_22 && id <= TILE_WIRE_SP12_H_L_23) { + int idx = (id - TILE_WIRE_SP12_H_L_22) + 24; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float y1 = y + 0.03 + 0.0025 * (90 - idx); + + el.x1 = x + 0.0; + el.x2 = x + 0.98333; + el.y1 = y1; + el.y2 = y1; + g.push_back(el); + } + + if (id >= TILE_WIRE_SP12_H_R_0 && id <= TILE_WIRE_SP12_H_R_23) { + int idx = id - TILE_WIRE_SP12_H_R_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float y1 = y + 0.03 + 0.0025 * (90 - idx); + float y2 = y + 0.03 + 0.0025 * (90 - (idx ^ 1)); + float y3 = y + 0.03 + 0.0025 * (90 - (idx ^ 1) - 2); + + if (idx >= 2) { + el.x1 = x; + el.x2 = x + 0.01; + el.y1 = y1; + el.y2 = y1; + g.push_back(el); + + el.x1 = x + 0.01; + el.x2 = x + 0.02; + el.y1 = y1; + el.y2 = y2; + g.push_back(el); + } + + el.x1 = x + 0.02; + el.x2 = x + 0.98333; + el.y1 = y2; + el.y2 = y2; + g.push_back(el); + + el.x1 = x + 0.98333; + el.x2 = x + 1.0; + el.y1 = y2; + el.y2 = y3; + g.push_back(el); + } + + // Vertical Span-12 Wires + + if (id >= TILE_WIRE_SP12_V_T_22 && id <= TILE_WIRE_SP12_V_T_23) { + int idx = (id - TILE_WIRE_SP12_V_T_22) + 24; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (90 - idx); + + el.y1 = y + 0.0; + el.y2 = y + 0.98333; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + } + + if (id >= TILE_WIRE_SP12_V_B_0 && id <= TILE_WIRE_SP12_V_B_23) { + int idx = id - TILE_WIRE_SP12_V_B_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (90 - idx); + float x2 = x + 0.03 + 0.0025 * (90 - (idx ^ 1)); + float x3 = x + 0.03 + 0.0025 * (90 - (idx ^ 1) - 2); + + if (idx >= 2) { + el.y1 = y; + el.y2 = y + 0.01; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + + el.y1 = y + 0.01; + el.y2 = y + 0.02; + el.x1 = x1; + el.x2 = x2; + g.push_back(el); + } + + el.y1 = y + 0.02; + el.y2 = y + 0.98333; + el.x1 = x2; + el.x2 = x2; + g.push_back(el); + + el.y1 = y + 0.98333; + el.y2 = y + 1.0; + el.x1 = x2; + el.x2 = x3; + g.push_back(el); + } } NEXTPNR_NAMESPACE_END diff --git a/ice40/gfx.h b/ice40/gfx.h index e9cc0e16..fa8d51eb 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -428,7 +428,6 @@ enum GfxTileWireId { TILE_WIRE_SP12_H_R_7, TILE_WIRE_SP12_H_R_8, TILE_WIRE_SP12_H_R_9, - TILE_WIRE_SP12_H_R_10, TILE_WIRE_SP12_H_R_11, TILE_WIRE_SP12_H_R_12, @@ -439,7 +438,6 @@ enum GfxTileWireId { TILE_WIRE_SP12_H_R_17, TILE_WIRE_SP12_H_R_18, TILE_WIRE_SP12_H_R_19, - TILE_WIRE_SP12_H_R_20, TILE_WIRE_SP12_H_R_21, TILE_WIRE_SP12_H_R_22,