aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecp5/arch.cc271
-rw-r--r--ecp5/gfx.cc276
-rw-r--r--ecp5/gfx.h25
3 files changed, 304 insertions, 268 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index 9e5c4a14..e6b43d0b 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -597,28 +597,6 @@ bool Arch::route()
// -----------------------------------------------------------------------
-const float switchbox_x1 = 0.51;
-const float switchbox_x2 = 0.90;
-const float switchbox_y1 = 0.51;
-const float switchbox_y2 = 0.90;
-
-const float slice_x1 = 0.92;
-const float slice_x2 = 0.94;
-const float slice_y1 = 0.71;
-const float slice_y2 = 0.745 + 0.0068;
-const float slice_pitch = 0.0374 +0.0068;
-
-const float io_cell_v_x1 = 0.76;
-const float io_cell_v_x2 = 0.95;
-const float io_cell_v_y1 = 0.05;
-const float io_cell_v_y2 = 0.15;
-const float io_cell_v_pitch = 0.125;
-
-const float io_cell_h_x1 = 0.05;
-const float io_cell_h_x2 = 0.14;
-const float io_cell_h_y1 = 0.05;
-const float io_cell_h_y2 = 0.24;
-const float io_cell_h_pitch = 0.125;
std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
{
@@ -648,254 +626,11 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
auto wire_type = getWireType(wire);
int x = decal.location.x;
int y = chip_info->height - 1 - decal.location.y;
+ GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
GfxTileWireId tilewire = GfxTileWireId(locInfo(wire)->wire_data[wire.index].tile_wire);
- if (wire_type == id_WIRE_TYPE_SLICE && tilewire != GfxTileWireId::TILE_WIRE_NONE) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- if (tilewire >= TILE_WIRE_FCO_SLICE && tilewire <=TILE_WIRE_FCI_SLICE)
- {
- int gap = (tilewire - TILE_WIRE_FCO_SLICE) / 24;
- int item = (tilewire - TILE_WIRE_FCO_SLICE) % 24;
- el.x1 = x + slice_x1 - 0.005f;
- el.x2 = x + slice_x1;
- el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap*2) + 3*slice_pitch;
- el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap*2) + 3*slice_pitch;
- ret.push_back(el);
- // FX to F connection - top
- if (item == (TILE_WIRE_FXD_SLICE-TILE_WIRE_FCO_SLICE))
- {
- el.x2 = el.x1;
- el.y2 = el.y1 - 0.0017f;
- ret.push_back(el);
- }
- // F5 to F connection - bottom
- if (item == (TILE_WIRE_F5D_SLICE-TILE_WIRE_FCO_SLICE))
- {
- el.x2 = el.x1;
- el.y2 = el.y1 + 0.0017f;
- ret.push_back(el);
- }
- // connection between slices
- if (item == (TILE_WIRE_FCID_SLICE-TILE_WIRE_FCO_SLICE) && tilewire!=TILE_WIRE_FCI_SLICE)
- {
- el.x2 = el.x1;
- el.y2 = el.y1 - 0.0017f * 3;
- ret.push_back(el);
- }
- }
- if (tilewire >= TILE_WIRE_DUMMY_D2 && tilewire <=TILE_WIRE_WAD0A_SLICE)
- {
- int gap = (tilewire - TILE_WIRE_DUMMY_D2) / 12;
- el.x1 = x + slice_x2 + 0.005f;
- el.x2 = x + slice_x2;
- el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap*14) + 3*slice_pitch;
- el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap*14) + 3*slice_pitch;
- ret.push_back(el);
- }
- }
- if (wire_type == id_WIRE_TYPE_V01) {
- if (tilewire >= TILE_WIRE_V01N0001 && tilewire <=TILE_WIRE_V01S0100)
- {
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (tilewire - TILE_WIRE_V01N0001);
- el.x2 = el.x1;
- el.y1 = y + switchbox_y1;
- el.y2 = y + switchbox_y2 - 1;
- ret.push_back(el);
- }
- }
- if (wire_type == id_WIRE_TYPE_H01) {
- if (tilewire >= TILE_WIRE_H01E0001 && tilewire <=TILE_WIRE_HL7W0001)
- {
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + switchbox_x1;
- el.x2 = x + switchbox_x2 - 1;
- el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (tilewire - TILE_WIRE_H01E0001);
- el.y2 = el.y1;
- ret.push_back(el);
- }
- }
- if (wire_type == id_WIRE_TYPE_V00) {
- int group = (tilewire - TILE_WIRE_V00T0000) / 2;
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + switchbox_x2 - 0.0017f*(8 - ((tilewire - TILE_WIRE_V00T0000) % 2)*4);
- el.x2 = el.x1;
- if (group) {
- el.y1 = y + switchbox_y1;
- el.y2 = y + switchbox_y1 - 0.0017f*4;
- } else {
- el.y1 = y + switchbox_y2;
- el.y2 = y + switchbox_y2 + 0.0017f*4;
- }
- ret.push_back(el);
- }
- if (wire_type == id_WIRE_TYPE_H00) {
- int group = (tilewire - TILE_WIRE_H00L0000) / 2;
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.y1 = y + switchbox_y1 + 0.0017f*(8 - ((tilewire - TILE_WIRE_H00L0000) % 2)*4);
- el.y2 = el.y1;
-
- if (group) {
- el.x1 = x + switchbox_x2 + 0.0017f*4;
- el.x2 = x + switchbox_x2;
- } else {
- el.x1 = x + switchbox_x1 - 0.0017f*4;
- el.x2 = x + switchbox_x1;
- }
- ret.push_back(el);
- }
- if (wire_type == id_WIRE_TYPE_NONE) {
- if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE)
- {
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + switchbox_x2 - 0.0017f*4;
- el.x2 = x + switchbox_x2 - 0.0017f*8;
- if (tilewire == TILE_WIRE_NBOUNCE) {
- el.y1 = y + switchbox_y2 + 0.0017f*4;
- el.y2 = el.y1;
- } else {
- el.y1 = y + switchbox_y1 - 0.0017f*4;
- el.y2 = el.y1;
- }
- ret.push_back(el);
- }
- if (tilewire >= TILE_WIRE_WBOUNCE && tilewire <=TILE_WIRE_EBOUNCE)
- {
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.y1 = y + switchbox_y1 + 0.0017f*4;
- el.y2 = y + switchbox_y1 + 0.0017f*8;
- if (tilewire == TILE_WIRE_WBOUNCE) {
- el.x1 = x + switchbox_x1 - 0.0017f*4;
- el.x2 = el.x1;
- } else {
- el.x1 = x + switchbox_x2 + 0.0017f*4;
- el.x2 = el.x1;
- }
- ret.push_back(el);
- }
- if (tilewire >= TILE_WIRE_CLK0 && tilewire <=TILE_WIRE_LSR1)
- {
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + switchbox_x2;
- el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f;
- el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLK0 - 5) + 3*slice_pitch;
- el.y2 = el.y1;
- ret.push_back(el);
- el.x1 = el.x2;
- el.y2 = y + slice_y2 - 0.0017f * (3 + (tilewire - TILE_WIRE_CLK0));
- ret.push_back(el);
- for (int i=0;i<4;i++)
- {
- el.x1 = x + slice_x2 + 0.0255f + 0.0017f;
- el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f;
- el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + tilewire - TILE_WIRE_CLK0)+ i*slice_pitch;
- el.y2 = el.y1;
- ret.push_back(el);
- }
- if (tilewire==TILE_WIRE_CLK1 || tilewire==TILE_WIRE_LSR1) {
- for (int i=0;i<2;i++)
- {
- el.x1 = x + slice_x2 + 0.0051f;
- el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f;
- el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 - 1 + (tilewire - TILE_WIRE_CLK0)/2)+ i*slice_pitch;
- el.y2 = el.y1;
- ret.push_back(el);
- }
- }
- }
-
- if (tilewire >= TILE_WIRE_FCO && tilewire <=TILE_WIRE_FCI)
- {
- int gap = (tilewire - TILE_WIRE_FCO) / 24;
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + switchbox_x2;
- el.x2 = x + slice_x1 - 0.005f;
- el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch;
- el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch;
- ret.push_back(el);
- }
-
- if (tilewire >= TILE_WIRE_MUXCLK3 && tilewire <=TILE_WIRE_MUXLSR0)
- {
- int gap = (tilewire - TILE_WIRE_MUXCLK3) / 2;
- int part = (tilewire - TILE_WIRE_MUXCLK3) % 2;
- GraphicElement el;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x2 + 0.0051f;
- el.x2 = x + slice_x2 + 0.0255f;
- el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + gap*26) + 3*slice_pitch;
- el.y2 = el.y1;
- ret.push_back(el);
- }
-
- if (tilewire >= TILE_WIRE_WD3 && tilewire <=TILE_WIRE_WD0)
- {
- GraphicElement el;
- int part = (tilewire - TILE_WIRE_WD3) % 4;
- int group = (tilewire - TILE_WIRE_WD3) / 2;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x2 + 0.005f;
- el.x2 = x + slice_x2 + 0.005f + 0.0017f *(4 - part);
- el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_WDO3C_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + 14) + 3*slice_pitch;
- el.y2 = el.y1;
- ret.push_back(el);
-
- el.x1 = el.x2;
- el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WD1B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + (part & 1) + 14*2) + (3-group)*slice_pitch;
- ret.push_back(el);
-
- el.x1 = x + slice_x2 + 0.005f;
- el.y1 = el.y2;
- ret.push_back(el);
- }
- if (tilewire >= TILE_WIRE_WAD3 && tilewire <=TILE_WIRE_WAD0)
- {
- GraphicElement el;
- int part = (tilewire - TILE_WIRE_WAD3) % 4;
- el.type = GraphicElement::TYPE_LINE;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x2 + 0.005f;
- el.x2 = x + slice_x2 + 0.005f + 0.0017f *(8 - part);
- el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_WADO3C_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14) + 3*slice_pitch;
- el.y2 = el.y1;
- ret.push_back(el);
-
- el.x1 = el.x2;
- el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WAD3B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14*2) + 2*slice_pitch;
- ret.push_back(el);
-
- el.x1 = x + slice_x2 + 0.005f;
- el.y1 = el.y2;
- ret.push_back(el);
-
- // middle line
- el.x1 = x + slice_x2 + 0.005f;
- el.x2 = x + slice_x2 + 0.005f + 0.0017f *(8 - part);
- el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WAD3B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14*2) + 3*slice_pitch;
- el.y1 = el.y2;
- ret.push_back(el);
- }
- }
+
+ gfxTileWire(ret, x, y, wire_type, tilewire, style);
}
if (decal.type == DecalId::TYPE_BEL) {
BelId bel;
diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc
new file mode 100644
index 00000000..c749bad7
--- /dev/null
+++ b/ecp5/gfx.cc
@@ -0,0 +1,276 @@
+/*
+ * nextpnr -- Next Generation Place and Route
+ *
+ * Copyright (C) 2018 Clifford Wolf <clifford@symbioticeda.com>
+ * Copyright (C) 2019 Miodrag Milanovic <miodrag@symbioticeda.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "gfx.h"
+
+NEXTPNR_NAMESPACE_BEGIN
+
+void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style)
+{
+ if (wire_type == id_WIRE_TYPE_SLICE && tilewire != GfxTileWireId::TILE_WIRE_NONE) {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ if (tilewire >= TILE_WIRE_FCO_SLICE && tilewire <=TILE_WIRE_FCI_SLICE)
+ {
+ int gap = (tilewire - TILE_WIRE_FCO_SLICE) / 24;
+ int item = (tilewire - TILE_WIRE_FCO_SLICE) % 24;
+ el.x1 = x + slice_x1 - 0.005f;
+ el.x2 = x + slice_x1;
+ el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap*2) + 3*slice_pitch;
+ el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap*2) + 3*slice_pitch;
+ g.push_back(el);
+ // FX to F connection - top
+ if (item == (TILE_WIRE_FXD_SLICE-TILE_WIRE_FCO_SLICE))
+ {
+ el.x2 = el.x1;
+ el.y2 = el.y1 - 0.0017f;
+ g.push_back(el);
+ }
+ // F5 to F connection - bottom
+ if (item == (TILE_WIRE_F5D_SLICE-TILE_WIRE_FCO_SLICE))
+ {
+ el.x2 = el.x1;
+ el.y2 = el.y1 + 0.0017f;
+ g.push_back(el);
+ }
+ // connection between slices
+ if (item == (TILE_WIRE_FCID_SLICE-TILE_WIRE_FCO_SLICE) && tilewire!=TILE_WIRE_FCI_SLICE)
+ {
+ el.x2 = el.x1;
+ el.y2 = el.y1 - 0.0017f * 3;
+ g.push_back(el);
+ }
+ }
+ if (tilewire >= TILE_WIRE_DUMMY_D2 && tilewire <=TILE_WIRE_WAD0A_SLICE)
+ {
+ int gap = (tilewire - TILE_WIRE_DUMMY_D2) / 12;
+ el.x1 = x + slice_x2 + 0.005f;
+ el.x2 = x + slice_x2;
+ el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap*14) + 3*slice_pitch;
+ el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap*14) + 3*slice_pitch;
+ g.push_back(el);
+ }
+ }
+ if (wire_type == id_WIRE_TYPE_V01) {
+ if (tilewire >= TILE_WIRE_V01N0001 && tilewire <=TILE_WIRE_V01S0100)
+ {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (tilewire - TILE_WIRE_V01N0001);
+ el.x2 = el.x1;
+ el.y1 = y + switchbox_y1;
+ el.y2 = y + switchbox_y2 - 1;
+ g.push_back(el);
+ }
+ }
+ if (wire_type == id_WIRE_TYPE_H01) {
+ if (tilewire >= TILE_WIRE_H01E0001 && tilewire <=TILE_WIRE_HL7W0001)
+ {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + switchbox_x1;
+ el.x2 = x + switchbox_x2 - 1;
+ el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (tilewire - TILE_WIRE_H01E0001);
+ el.y2 = el.y1;
+ g.push_back(el);
+ }
+ }
+ if (wire_type == id_WIRE_TYPE_V00) {
+ int group = (tilewire - TILE_WIRE_V00T0000) / 2;
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + switchbox_x2 - 0.0017f*(8 - ((tilewire - TILE_WIRE_V00T0000) % 2)*4);
+ el.x2 = el.x1;
+ if (group) {
+ el.y1 = y + switchbox_y1;
+ el.y2 = y + switchbox_y1 - 0.0017f*4;
+ } else {
+ el.y1 = y + switchbox_y2;
+ el.y2 = y + switchbox_y2 + 0.0017f*4;
+ }
+ g.push_back(el);
+ }
+ if (wire_type == id_WIRE_TYPE_H00) {
+ int group = (tilewire - TILE_WIRE_H00L0000) / 2;
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.y1 = y + switchbox_y1 + 0.0017f*(8 - ((tilewire - TILE_WIRE_H00L0000) % 2)*4);
+ el.y2 = el.y1;
+
+ if (group) {
+ el.x1 = x + switchbox_x2 + 0.0017f*4;
+ el.x2 = x + switchbox_x2;
+ } else {
+ el.x1 = x + switchbox_x1 - 0.0017f*4;
+ el.x2 = x + switchbox_x1;
+ }
+ g.push_back(el);
+ }
+ if (wire_type == id_WIRE_TYPE_NONE) {
+ if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE)
+ {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + switchbox_x2 - 0.0017f*4;
+ el.x2 = x + switchbox_x2 - 0.0017f*8;
+ if (tilewire == TILE_WIRE_NBOUNCE) {
+ el.y1 = y + switchbox_y2 + 0.0017f*4;
+ el.y2 = el.y1;
+ } else {
+ el.y1 = y + switchbox_y1 - 0.0017f*4;
+ el.y2 = el.y1;
+ }
+ g.push_back(el);
+ }
+ if (tilewire >= TILE_WIRE_WBOUNCE && tilewire <=TILE_WIRE_EBOUNCE)
+ {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.y1 = y + switchbox_y1 + 0.0017f*4;
+ el.y2 = y + switchbox_y1 + 0.0017f*8;
+ if (tilewire == TILE_WIRE_WBOUNCE) {
+ el.x1 = x + switchbox_x1 - 0.0017f*4;
+ el.x2 = el.x1;
+ } else {
+ el.x1 = x + switchbox_x2 + 0.0017f*4;
+ el.x2 = el.x1;
+ }
+ g.push_back(el);
+ }
+ if (tilewire >= TILE_WIRE_CLK0 && tilewire <=TILE_WIRE_LSR1)
+ {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + switchbox_x2;
+ el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f;
+ el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLK0 - 5) + 3*slice_pitch;
+ el.y2 = el.y1;
+ g.push_back(el);
+ el.x1 = el.x2;
+ el.y2 = y + slice_y2 - 0.0017f * (3 + (tilewire - TILE_WIRE_CLK0));
+ g.push_back(el);
+ for (int i=0;i<4;i++)
+ {
+ el.x1 = x + slice_x2 + 0.0255f + 0.0017f;
+ el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f;
+ el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + tilewire - TILE_WIRE_CLK0)+ i*slice_pitch;
+ el.y2 = el.y1;
+ g.push_back(el);
+ }
+ if (tilewire==TILE_WIRE_CLK1 || tilewire==TILE_WIRE_LSR1) {
+ for (int i=0;i<2;i++)
+ {
+ el.x1 = x + slice_x2 + 0.0051f;
+ el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f;
+ el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 - 1 + (tilewire - TILE_WIRE_CLK0)/2)+ i*slice_pitch;
+ el.y2 = el.y1;
+ g.push_back(el);
+ }
+ }
+ }
+
+ if (tilewire >= TILE_WIRE_FCO && tilewire <=TILE_WIRE_FCI)
+ {
+ int gap = (tilewire - TILE_WIRE_FCO) / 24;
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + switchbox_x2;
+ el.x2 = x + slice_x1 - 0.005f;
+ el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch;
+ el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch;
+ g.push_back(el);
+ }
+
+ if (tilewire >= TILE_WIRE_MUXCLK3 && tilewire <=TILE_WIRE_MUXLSR0)
+ {
+ int gap = (tilewire - TILE_WIRE_MUXCLK3) / 2;
+ int part = (tilewire - TILE_WIRE_MUXCLK3) % 2;
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + slice_x2 + 0.0051f;
+ el.x2 = x + slice_x2 + 0.0255f;
+ el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + gap*26) + 3*slice_pitch;
+ el.y2 = el.y1;
+ g.push_back(el);
+ }
+
+ if (tilewire >= TILE_WIRE_WD3 && tilewire <=TILE_WIRE_WD0)
+ {
+ GraphicElement el;
+ int part = (tilewire - TILE_WIRE_WD3) % 4;
+ int group = (tilewire - TILE_WIRE_WD3) / 2;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + slice_x2 + 0.005f;
+ el.x2 = x + slice_x2 + 0.005f + 0.0017f *(4 - part);
+ el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_WDO3C_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + 14) + 3*slice_pitch;
+ el.y2 = el.y1;
+ g.push_back(el);
+
+ el.x1 = el.x2;
+ el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WD1B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + (part & 1) + 14*2) + (3-group)*slice_pitch;
+ g.push_back(el);
+
+ el.x1 = x + slice_x2 + 0.005f;
+ el.y1 = el.y2;
+ g.push_back(el);
+ }
+ if (tilewire >= TILE_WIRE_WAD3 && tilewire <=TILE_WIRE_WAD0)
+ {
+ GraphicElement el;
+ int part = (tilewire - TILE_WIRE_WAD3) % 4;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = style;
+ el.x1 = x + slice_x2 + 0.005f;
+ el.x2 = x + slice_x2 + 0.005f + 0.0017f *(8 - part);
+ el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_WADO3C_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14) + 3*slice_pitch;
+ el.y2 = el.y1;
+ g.push_back(el);
+
+ el.x1 = el.x2;
+ el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WAD3B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14*2) + 2*slice_pitch;
+ g.push_back(el);
+
+ el.x1 = x + slice_x2 + 0.005f;
+ el.y1 = el.y2;
+ g.push_back(el);
+
+ // middle line
+ el.x1 = x + slice_x2 + 0.005f;
+ el.x2 = x + slice_x2 + 0.005f + 0.0017f *(8 - part);
+ el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WAD3B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14*2) + 3*slice_pitch;
+ el.y1 = el.y2;
+ g.push_back(el);
+ }
+ }
+
+}
+
+NEXTPNR_NAMESPACE_END
diff --git a/ecp5/gfx.h b/ecp5/gfx.h
index 1ba4fec2..6a6d7ad2 100644
--- a/ecp5/gfx.h
+++ b/ecp5/gfx.h
@@ -24,6 +24,29 @@
NEXTPNR_NAMESPACE_BEGIN
+const float switchbox_x1 = 0.51;
+const float switchbox_x2 = 0.90;
+const float switchbox_y1 = 0.51;
+const float switchbox_y2 = 0.90;
+
+const float slice_x1 = 0.92;
+const float slice_x2 = 0.94;
+const float slice_y1 = 0.71;
+const float slice_y2 = 0.745 + 0.0068;
+const float slice_pitch = 0.0374 +0.0068;
+
+const float io_cell_v_x1 = 0.76;
+const float io_cell_v_x2 = 0.95;
+const float io_cell_v_y1 = 0.05;
+const float io_cell_v_y2 = 0.15;
+const float io_cell_v_pitch = 0.125;
+
+const float io_cell_h_x1 = 0.05;
+const float io_cell_h_x2 = 0.14;
+const float io_cell_h_y1 = 0.05;
+const float io_cell_h_y2 = 0.24;
+const float io_cell_h_pitch = 0.125;
+
enum GfxTileWireId
{
TILE_WIRE_NONE,
@@ -344,6 +367,8 @@ enum GfxTileWireId
};
+void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style);
+
NEXTPNR_NAMESPACE_END
#endif