From 0d2ae5cc9dc3667f12e0f6d8ff3881191ee10930 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 20 Oct 2019 11:12:26 +0200 Subject: Split graphics calls for wires into gfx.cc --- ecp5/gfx.cc | 276 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 276 insertions(+) create mode 100644 ecp5/gfx.cc (limited to 'ecp5/gfx.cc') 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 + * Copyright (C) 2019 Miodrag Milanovic + * + * 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 &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 -- cgit v1.2.3 From d1feb2aa2d9865807083888c5d24cdbbd98a942a Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 23 Oct 2019 18:17:08 +0200 Subject: display horizontal wires, add some globals to list --- ecp5/gfx.cc | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index c749bad7..950ccc3c 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -127,7 +127,56 @@ void gfxTileWire(std::vector &g, int x, int y, IdString wire_typ el.x2 = x + switchbox_x1; } g.push_back(el); - } + } + if (wire_type == id_WIRE_TYPE_H02) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.x2 = el.x1; + el.y1 = y + switchbox_y1; + el.y2 = y + switchbox_y1 - 0.0017f*(20 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + g.push_back(el); + + el.x2 = (x+2) + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.y1 = el.y2; + g.push_back(el); + + el.x2 = (x+1) + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.x1 = el.x2; + el.y1 = y + switchbox_y1; + g.push_back(el); + + el.x2 = (x+2) + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.x1 = el.x2; + el.y1 = y + switchbox_y1; + 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); + + el.x2 = (x+6) + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.y1 = el.y2; + g.push_back(el); + + el.x2 = (x+3) + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.x1 = el.x2; + el.y1 = y + switchbox_y1; + g.push_back(el); + + el.x2 = (x+6) + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.x1 = el.x2; + el.y1 = y + switchbox_y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_NONE) { if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE) { -- cgit v1.2.3 From 49760a9ea81180024783a06ee9ac052035de98ea Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 25 Oct 2019 09:28:08 +0200 Subject: Show V02/V06/H02/H06 --- ecp5/gfx.cc | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 103 insertions(+), 11 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 950ccc3c..5828965f 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -22,7 +22,7 @@ NEXTPNR_NAMESPACE_BEGIN -void gfxTileWire(std::vector &g, int x, int y, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style) +void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style) { if (wire_type == id_WIRE_TYPE_SLICE && tilewire != GfxTileWireId::TILE_WIRE_NONE) { GraphicElement el; @@ -128,7 +128,8 @@ void gfxTileWire(std::vector &g, int x, int y, IdString wire_typ } g.push_back(el); } - if (wire_type == id_WIRE_TYPE_H02) { + + if (wire_type == id_WIRE_TYPE_H02) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; @@ -138,21 +139,67 @@ void gfxTileWire(std::vector &g, int x, int y, IdString wire_typ el.y2 = y + switchbox_y1 - 0.0017f*(20 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); g.push_back(el); - el.x2 = (x+2) + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + int x1 = x + 1; + if (x1> w - 1) x1 = w - 1; + + el.x2 = x1 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); el.y1 = el.y2; g.push_back(el); - el.x2 = (x+1) + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); el.x1 = el.x2; el.y1 = y + switchbox_y1; g.push_back(el); - el.x2 = (x+2) + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + int x2 = x - 1; + if (x2<0) x2 = 0; + + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.x2 = x2 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.y2 = y + switchbox_y1 - 0.0017f*(20 + (tilewire - TILE_WIRE_H02W0701)+ 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_H06) { + } + + if (wire_type == id_WIRE_TYPE_V02) { + 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); + + el.y1 = el.y2; + el.x1 = x + switchbox_x1; + 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; @@ -162,20 +209,65 @@ void gfxTileWire(std::vector &g, int x, int y, IdString wire_typ el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); g.push_back(el); - el.x2 = (x+6) + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); + 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.x2 = (x+3) + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); el.x1 = el.x2; el.y1 = y + switchbox_y1; g.push_back(el); - el.x2 = (x+6) + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); + int x2 = x - 3; + if (x2<0) x2 = 0; + + 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) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y2 = el.y1; + el.x1 = x + switchbox_x1; + el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + g.push_back(el); + + int y1 = y + 3; + if (y1> h - 1) y1 = h - 1; + + el.y2 = y1 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.x1 = el.x2; + g.push_back(el); + + el.y1 = el.y2; + el.x1 = x + switchbox_x1; + g.push_back(el); + + int y2 = y - 3; + if (y2<0) y2 = 0; + + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y2 = y2 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 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_NONE) { if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE) -- cgit v1.2.3 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/gfx.cc | 65 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'ecp5/gfx.cc') 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 -- cgit v1.2.3 From 9a9265f4d2c5d1c4f1a5bb90aece2647990e8b56 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 10 Nov 2019 10:08:02 +0100 Subject: more pips --- ecp5/gfx.cc | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index f13a6ab7..77572437 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -409,14 +409,55 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire 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); + if (src_id <= TILE_WIRE_H01E0101) { + el.x1 = x + switchbox_x1; + el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (src_id - TILE_WIRE_H01E0001); + + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; + el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + g.push_back(el); + + el.x1 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + 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); + } else { + 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); + } + } + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { + el.x1 = x + switchbox_x1; + el.y1 = y + switchbox_y1 + 0.0017f*(16 + (src_id - TILE_WIRE_V02N0701)+ 20 *(y%3)); + + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; + el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + g.push_back(el); + + el.x1 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); 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_H02 && dst_type == id_WIRE_TYPE_V02) { + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (src_id - TILE_WIRE_H02W0701)+ 20 *(src.location.x%3)); + el.y1 = y + switchbox_y1; + + el.x2 = x + switchbox_x1; + el.y2 = y + switchbox_y1 + 0.0017f*(16 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(y%3)); + + g.push_back(el); + } + + } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 43c7b4fa2113c2eaca0053fe9395dc4fd0635be3 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 10 Nov 2019 11:10:13 +0100 Subject: Fixed V2, some more pips --- ecp5/gfx.cc | 55 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 77572437..373112a7 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -163,31 +163,41 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y1 = y + switchbox_y1; g.push_back(el); } - + if (wire_type == id_WIRE_TYPE_V02) { 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.y1 = y + switchbox_y1 + 0.0017f*(20 + (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 y2 = y - 3; - if (y2<0) y2 = 0; + int y1 = y + 1; + if (y1> h - 1) y1 = h - 1; - el.y1 = y2 + switchbox_y1 + 0.0017f*(16 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); - el.y2 = el.y1; + el.y2 = y1 + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + el.x1 = el.x2; g.push_back(el); - 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.y1 = el.y2; + el.x1 = x + switchbox_x1; + g.push_back(el); + + int y2 = y - 1; + if (y2<0) y2 = 0; + + el.y1 = y + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + el.y2 = y2 + switchbox_y1 + 0.0017f*(20 + (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; @@ -434,7 +444,7 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f*(16 + (src_id - TILE_WIRE_V02N0701)+ 20 *(y%3)); + el.y1 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); @@ -452,10 +462,31 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire el.y1 = y + switchbox_y1; el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f*(16 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(y%3)); + el.y2 = y + switchbox_y1 + 0.0017f*(20 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(dst.location.y%3)); g.push_back(el); } + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { + + el.x1 = x + switchbox_x1; + el.y1 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); + + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 - 0.0017f*(src_id - TILE_WIRE_V02N0701); + el.y2 = el.y1; + + g.push_back(el); + + el.y2 = y + switchbox_y1 + 0.0017f*(20 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(dst.location.y%3)); + el.x1 = el.x2; + + g.push_back(el); + + el.y1 = el.y2; + el.x1 = x + switchbox_x1; + + g.push_back(el); + + } } -- cgit v1.2.3 From 74f2c4a73b56910b5b42013a89484e1060a1f736 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 10 Nov 2019 15:24:06 +0100 Subject: more pips, and valid mapping --- ecp5/gfx.cc | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 373112a7..6b07861b 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -455,8 +455,7 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire 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_H02 && dst_type == id_WIRE_TYPE_V02) { el.x1 = x + switchbox_x1 + 0.0017f*(16 + (src_id - TILE_WIRE_H02W0701)+ 20 *(src.location.x%3)); el.y1 = y + switchbox_y1; @@ -466,6 +465,15 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire g.push_back(el); } + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H02) { + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (dst_id - TILE_WIRE_H02W0701)+ 20 *(dst.location.x%3)); + el.y1 = y + switchbox_y1; + + el.x2 = x + switchbox_x1; + el.y2 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); + + g.push_back(el); + } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { el.x1 = x + switchbox_x1; @@ -485,10 +493,15 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire el.x1 = x + switchbox_x1; g.push_back(el); - - } - - + } + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (dst_id - TILE_WIRE_H02W0701)+ 20 *(dst.location.x%3)); + el.y1 = y + switchbox_y1; + + el.x2 = x + switchbox_x1; + el.y2 = y + switchbox_y1 + 0.0017f*(96 + (src_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + g.push_back(el); + } } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From afea345cc74d75f9b0b1f578b301681f73e09434 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 10 Nov 2019 17:02:18 +0100 Subject: More pips added --- ecp5/gfx.cc | 241 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 200 insertions(+), 41 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 6b07861b..ac6ac21b 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -404,6 +404,46 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } +void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, GfxTileWireId src_id) +{ + if (src_type == id_WIRE_TYPE_H02) { + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (src_id - TILE_WIRE_H02W0701)+ 20 *(src.location.x%3)); + el.y1 = y + switchbox_y1; + } + if (src_type == id_WIRE_TYPE_H06) { + el.x1 = x + switchbox_x1 + 0.0017f*(96 + (src_id - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.y1 = y + switchbox_y1; + } + if (src_type == id_WIRE_TYPE_V02) { + el.x1 = x + switchbox_x1; + el.y1 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); + } + if (src_type == id_WIRE_TYPE_V06) { + el.x1 = x + switchbox_x1; + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (src_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + } +} + +void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_type, GfxTileWireId dst_id) +{ + if (dst_type == id_WIRE_TYPE_H02) { + el.x2 = x + switchbox_x1 + 0.0017f*(16 + (dst_id - TILE_WIRE_H02W0701)+ 20 *(dst.location.x%3)); + el.y2 = y + switchbox_y1; + } + if (dst_type == id_WIRE_TYPE_H06) { + el.x2 = x + switchbox_x1 + 0.0017f*(96 + (dst_id - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.y2 = y + switchbox_y1; + } + if (dst_type == id_WIRE_TYPE_V02) { + el.x2 = x + switchbox_x1; + el.y2 = y + switchbox_y1 + 0.0017f*(20 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(dst.location.y%3)); + } + if (dst_type == id_WIRE_TYPE_V06) { + el.x2 = x + switchbox_x1; + el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + } +} + 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; @@ -411,13 +451,10 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire 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; + setSource(el,x,y,src,src_type,src_id); + setDestination(el,x,y,dst,dst_type,dst_id); g.push_back(el); - } + } if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) { if (src_id <= TILE_WIRE_H01E0101) { @@ -441,67 +478,189 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire el.x2 = x + switchbox_x1; g.push_back(el); } - } + } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { - el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); + setSource(el,x,y,src,src_type,src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + 0.0017f*(src_id - TILE_WIRE_V02N0701); + el.y2 = el.y1; + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el.x2; + el.y1 = el2.y2; g.push_back(el); - el.x1 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); - el.x2 = x + switchbox_x1; + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); + } + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V02) { + setSource(el,x,y,src,src_type,src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + 0.0017f*(src_id - TILE_WIRE_V06N0303); + el.y2 = el.y1; + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el.x2; + el.y1 = el2.y2; g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); } - if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V02) { - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (src_id - TILE_WIRE_H02W0701)+ 20 *(src.location.x%3)); - el.y1 = y + switchbox_y1; + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { + setSource(el,x,y,src,src_type,src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 - 0.0017f*(src_id - TILE_WIRE_V02N0701); + el.y2 = el.y1; + g.push_back(el); - el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f*(20 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(dst.location.y%3)); + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el.x2; + el.y1 = el2.y2; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); + } + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { + setSource(el,x,y,src,src_type,src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + 0.0017f*(src_id - TILE_WIRE_V06N0303); + el.y2 = el.y1; + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el.x2; + el.y1 = el2.y2; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); + } + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V02) { + setSource(el,x,y,src,src_type,src_id); + setDestination(el,x,y,dst,dst_type,dst_id); g.push_back(el); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H02) { - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (dst_id - TILE_WIRE_H02W0701)+ 20 *(dst.location.x%3)); - el.y1 = y + switchbox_y1; - - el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); + setSource(el,x,y,src,src_type,src_id); + setDestination(el,x,y,dst,dst_type,dst_id); g.push_back(el); } - if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { - - el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { + setSource(el,x,y,src,src_type,src_id); + setDestination(el,x,y,dst,dst_type,dst_id); + g.push_back(el); + } - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 - 0.0017f*(src_id - TILE_WIRE_V02N0701); - el.y2 = el.y1; + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { + setSource(el,x,y,src,src_type,src_id); + el.x2 = el.x1; + el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 + 0.0017f*(src_id - TILE_WIRE_H02W0701); + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el2.x2; + el.y1 = el.y2; g.push_back(el); - el.y2 = y + switchbox_y1 + 0.0017f*(20 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(dst.location.y%3)); - el.x1 = el.x2; + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); + } + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H06) { + setSource(el,x,y,src,src_type,src_id); + el.x2 = el.x1; + el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 + 0.0017f*(src_id - TILE_WIRE_H02W0701); g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el2.x2; el.y1 = el.y2; - el.x1 = x + switchbox_x1; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); + } + + if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H06) { + setSource(el,x,y,src,src_type,src_id); + el.x2 = el.x1; + el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 - 0.0017f*(src_id - TILE_WIRE_H06W0303); + g.push_back(el); + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el2.x2; + el.y1 = el.y2; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); + } + + if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H02) { + setSource(el,x,y,src,src_type,src_id); + el.x2 = el.x1; + el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 - 0.0017f*(src_id - TILE_WIRE_H06W0303); g.push_back(el); - } - if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (dst_id - TILE_WIRE_H02W0701)+ 20 *(dst.location.x%3)); - el.y1 = y + switchbox_y1; - el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (src_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + GraphicElement el2; + el2.type = GraphicElement::TYPE_LINE; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el2.x2; + el.y1 = el.y2; g.push_back(el); - } + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); + } + } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 6e349db55b5bc01e0d6719a8e24f96fc04c47b86 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 11 Nov 2019 08:58:46 +0100 Subject: proper h06 and v06 --- ecp5/gfx.cc | 73 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 34 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index ac6ac21b..23053b39 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -197,47 +197,55 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); el.x2 = el.x1; el.y1 = y + switchbox_y1; - el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); g.push_back(el); - int x2 = x - 3; - if (x2<0) x2 = 0; + int x1 = x + 3; + if (x1> w - 1) x1 = w - 1; - el.x1 = x2 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 20 *(x%3)); - el.x2 = el.x1; + el.x2 = x1 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + el.y1 = el.y2; 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; + el.x1 = el.x2; + el.y1 = y + switchbox_y1; g.push_back(el); - } + int x2 = x - 3; + if (x2<0) x2 = 0; + + el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + el.x2 = x2 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + 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) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); el.y2 = el.y1; el.x1 = x + switchbox_x1; - el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); g.push_back(el); int y1 = y + 3; if (y1> h - 1) y1 = h - 1; - el.y2 = y1 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y2 = y1 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); el.x1 = el.x2; g.push_back(el); @@ -248,17 +256,16 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS int y2 = y - 3; if (y2<0) y2 = 0; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); - el.y2 = y2 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); - el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + el.y2 = y2 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); 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_NONE) { if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE) { @@ -411,7 +418,7 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_H06) { - el.x1 = x + switchbox_x1 + 0.0017f*(96 + (src_id - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.x1 = x + switchbox_x1 + 0.0017f*(96 + (src_id - TILE_WIRE_H06W0303)+ 10 *(src.location.x%9)); el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_V02) { @@ -420,7 +427,7 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, } if (src_type == id_WIRE_TYPE_V06) { el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (src_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (src_id - TILE_WIRE_V06N0303)+ 10 *(src.location.y%9)); } } @@ -431,7 +438,7 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_H06) { - el.x2 = x + switchbox_x1 + 0.0017f*(96 + (dst_id - TILE_WIRE_H06W0303)+ 20 *(x%3)); + el.x2 = x + switchbox_x1 + 0.0017f*(96 + (dst_id - TILE_WIRE_H06W0303)+ 10 *(dst.location.x%9)); el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_V02) { @@ -440,7 +447,7 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t } if (dst_type == id_WIRE_TYPE_V06) { el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); } } @@ -462,19 +469,19 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (src_id - TILE_WIRE_H01E0001); el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); g.push_back(el); el.x1 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 20 *(y%3)); + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); + el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); el.x2 = x + switchbox_x1; g.push_back(el); } else { 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.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); el.x2 = x + switchbox_x1; g.push_back(el); } @@ -538,7 +545,7 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire el2.x1 = el.x1; el2.y1 = el.y1; g.push_back(el2); - } + } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { setSource(el,x,y,src,src_type,src_id); el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + 0.0017f*(src_id - TILE_WIRE_V06N0303); @@ -570,13 +577,12 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire setDestination(el,x,y,dst,dst_type,dst_id); g.push_back(el); - } + } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { setSource(el,x,y,src,src_type,src_id); setDestination(el,x,y,dst,dst_type,dst_id); g.push_back(el); } - if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { setSource(el,x,y,src,src_type,src_id); el.x2 = el.x1; @@ -597,7 +603,6 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire el2.y1 = el.y1; g.push_back(el2); } - if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H06) { setSource(el,x,y,src,src_type,src_id); el.x2 = el.x1; -- cgit v1.2.3 From 522bbbc1f2a33ee19e027ffa1aeab57bfe3d9e19 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 11 Nov 2019 09:32:28 +0100 Subject: cleanup --- ecp5/gfx.cc | 252 +++++++++++++++++++----------------------------------------- 1 file changed, 78 insertions(+), 174 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 23053b39..a06cbefe 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -451,17 +451,68 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t } } +void straightLine(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id) +{ + setSource(el,x,y,src,src_type,src_id); + setDestination(el,x,y,dst,dst_type,dst_id); + g.push_back(el); +} + +void toSameSideHor(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +{ + int sign = (src_type==dst_type) ? 1 : -1; + setSource(el,x,y,src,src_type,src_id); + el.x2 = el.x1; + el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 + sign * 0.0017f*idx; + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_ARROW; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el2.x2; + el.y1 = el.y2; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); +} + +void toSameSideVer(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +{ + int sign = (src_type==dst_type) ? 1 : -1; + setSource(el,x,y,src,src_type,src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + sign * 0.0017f*idx; + el.y2 = el.y1; + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_ARROW; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el.x2; + el.y1 = el2.y2; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); +} + 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.type = GraphicElement::TYPE_ARROW; el.style = style; if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V06) { - setSource(el,x,y,src,src_type,src_id); - setDestination(el,x,y,dst,dst_type,dst_id); - g.push_back(el); - } + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) { if (src_id <= TILE_WIRE_H01E0101) { @@ -487,185 +538,38 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire } } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + 0.0017f*(src_id - TILE_WIRE_V02N0701); - el.y2 = el.y1; - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el.x2; - el.y1 = el2.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); + } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V02) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + 0.0017f*(src_id - TILE_WIRE_V06N0303); - el.y2 = el.y1; - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el.x2; - el.y1 = el2.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); + } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 - 0.0017f*(src_id - TILE_WIRE_V02N0701); - el.y2 = el.y1; - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el.x2; - el.y1 = el2.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); + } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + 0.0017f*(src_id - TILE_WIRE_V06N0303); - el.y2 = el.y1; - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el.x2; - el.y1 = el2.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); + } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V02) { - setSource(el,x,y,src,src_type,src_id); - setDestination(el,x,y,dst,dst_type,dst_id); - - g.push_back(el); - } + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H02) { - setSource(el,x,y,src,src_type,src_id); - setDestination(el,x,y,dst,dst_type,dst_id); - - g.push_back(el); - } + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { - setSource(el,x,y,src,src_type,src_id); - setDestination(el,x,y,dst,dst_type,dst_id); - g.push_back(el); - } + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 + 0.0017f*(src_id - TILE_WIRE_H02W0701); - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el2.x2; - el.y1 = el.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } + toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H02W0701); + } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H06) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 + 0.0017f*(src_id - TILE_WIRE_H02W0701); - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el2.x2; - el.y1 = el.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } - + toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H02W0701); + } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H06) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 - 0.0017f*(src_id - TILE_WIRE_H06W0303); - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el2.x2; - el.y1 = el.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } - + toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H06W0303); + } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H02) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 - 0.0017f*(src_id - TILE_WIRE_H06W0303); - g.push_back(el); - - GraphicElement el2; - el2.type = GraphicElement::TYPE_LINE; - el2.style = style; - - setDestination(el2,x,y,dst,dst_type,dst_id); - - el.x1 = el2.x2; - el.y1 = el.y2; - g.push_back(el); - - el2.x1 = el.x1; - el2.y1 = el.y1; - g.push_back(el2); - } - + toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H06W0303); + } } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 2827731210e9a6075a5ad38c3738d4ae284ec0e6 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 11 Nov 2019 12:49:26 +0100 Subject: More pips and fix for V01 --- ecp5/gfx.cc | 212 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 170 insertions(+), 42 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index a06cbefe..409e8dec 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -77,8 +77,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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; + el.y1 = y + switchbox_y1 + 1; + el.y2 = y + switchbox_y2; g.push_back(el); } } @@ -413,6 +413,13 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, GfxTileWireId src_id) { + if (src_type == id_WIRE_TYPE_H01) { + if (x == src.location.x) + el.x1 = x + switchbox_x1; + else + el.x1 = x + switchbox_x2; + el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (src_id - TILE_WIRE_H01E0001); + } if (src_type == id_WIRE_TYPE_H02) { el.x1 = x + switchbox_x1 + 0.0017f*(16 + (src_id - TILE_WIRE_H02W0701)+ 20 *(src.location.x%3)); el.y1 = y + switchbox_y1; @@ -421,6 +428,13 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, el.x1 = x + switchbox_x1 + 0.0017f*(96 + (src_id - TILE_WIRE_H06W0303)+ 10 *(src.location.x%9)); el.y1 = y + switchbox_y1; } + if (src_type == id_WIRE_TYPE_V01) { + el.x1 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (src_id - TILE_WIRE_V01N0001); + if (y == src.location.y) + el.y1 = y + switchbox_y2; + else + el.y1 = y + switchbox_y1; + } if (src_type == id_WIRE_TYPE_V02) { el.x1 = x + switchbox_x1; el.y1 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); @@ -433,6 +447,13 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_type, GfxTileWireId dst_id) { + if (dst_type == id_WIRE_TYPE_H01) { + if (x == dst.location.x) + el.x2 = x + switchbox_x1; + else + el.x2 = x + switchbox_x2; + el.y2 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (dst_id - TILE_WIRE_H01E0001); + } if (dst_type == id_WIRE_TYPE_H02) { el.x2 = x + switchbox_x1 + 0.0017f*(16 + (dst_id - TILE_WIRE_H02W0701)+ 20 *(dst.location.x%3)); el.y2 = y + switchbox_y1; @@ -441,6 +462,13 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t el.x2 = x + switchbox_x1 + 0.0017f*(96 + (dst_id - TILE_WIRE_H06W0303)+ 10 *(dst.location.x%9)); el.y2 = y + switchbox_y1; } + if (dst_type == id_WIRE_TYPE_V01) { + el.x2 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (dst_id - TILE_WIRE_V01N0001); + if (y == dst.location.y) + el.y2 = y + switchbox_y2; + else + el.y2 = y + switchbox_y1; + } if (dst_type == id_WIRE_TYPE_V02) { el.x2 = x + switchbox_x1; el.y2 = y + switchbox_y1 + 0.0017f*(20 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(dst.location.y%3)); @@ -504,53 +532,102 @@ void toSameSideVer(std::vector &g, GraphicElement &el,int x, int g.push_back(el2); } +void toSameSideH1Ver(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +{ + setSource(el,x,y,src,src_type,src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 - 0.0017f*idx; + el.y2 = el.y1; + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_ARROW; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el.x2; + el.y1 = el2.y2; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); +} + +void toSameSideH1Hor(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +{ + setSource(el,x,y,src,src_type,src_id); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_ARROW; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + if (dst_type == id_WIRE_TYPE_H01 || src_type == id_WIRE_TYPE_V01) { + el.x2 = el.x1; + el.y2 = el2.y2; + g.push_back(el); + } else { + el.x2 = el2.x2; + el.y2 = el.y1; + g.push_back(el); + } + + el2.x1 = el.x2; + el2.y1 = el.y2; + g.push_back(el2); +} + +void toSameSideV1Ver(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +{ + setSource(el,x,y,src,src_type,src_id); + el.x2 = el.x1; + el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 - 0.0017f*idx; + g.push_back(el); + + GraphicElement el2; + el2.type = GraphicElement::TYPE_ARROW; + el2.style = style; + + setDestination(el2,x,y,dst,dst_type,dst_id); + + el.x1 = el2.x2; + el.y1 = el.y2; + g.push_back(el); + + el2.x1 = el.x1; + el2.y1 = el.y1; + g.push_back(el2); +} 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_ARROW; el.style = style; - if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V06) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H01) { + toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H01E0001); + } + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V01) { + toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V01N0001); } - if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) { - if (src_id <= TILE_WIRE_H01E0101) { - - el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (src_id - TILE_WIRE_H01E0001); - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); - g.push_back(el); - el.x1 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); - el.x2 = x + switchbox_x1; - g.push_back(el); - } else { - 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)+ 10 *(dst.location.y%9)); - el.x2 = x + switchbox_x1; - g.push_back(el); - } - } - if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); + if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H02) { + toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H02W0701); } - if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); - } - if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); - } - if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { + toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H02W0701); } - if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V02) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H02) { + toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H06W0303); + } + if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H02) { + if (y == src.location.y) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } else { + toSameSideV1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H02W0701); + } } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H02) { straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); @@ -558,8 +635,9 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); } - if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H02W0701); + + if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H06) { + toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H06) { toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H02W0701); @@ -567,8 +645,58 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H06) { toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H06W0303); } - if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H06W0303); + if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H06) { + if (y == src.location.y) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } else { + toSameSideV1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H06W0303); + } + } + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H06) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + + if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V02) { + if (x == src.location.x) { + toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V02N0701); + } else { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + } + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V02) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V02) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V02) { + toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V02N0701); + } + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); + } + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V02) { + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); + } + + if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) { + if (x == src.location.x) { + toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V06N0303); + } else { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + } + if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V06) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V06) { + toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V06N0303); + } + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); + } + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { + toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); } } -- cgit v1.2.3 From da8b5758cd743441999a43c29fa1498c57fd047d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 11 Nov 2019 13:30:11 +0100 Subject: Handle H00 and V00 --- ecp5/gfx.cc | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 409e8dec..1a774884 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -447,6 +447,16 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_type, GfxTileWireId dst_id) { + if (dst_type == id_WIRE_TYPE_H00) { + int group = (dst_id - TILE_WIRE_H00L0000) / 2; + el.y2 = y + switchbox_y1 + 0.0017f*(8 - ((dst_id - TILE_WIRE_H00L0000) % 2)*4); + + if (group) { + el.x2 = x + switchbox_x2; + } else { + el.x2 = x + switchbox_x1; + } + } if (dst_type == id_WIRE_TYPE_H01) { if (x == dst.location.x) el.x2 = x + switchbox_x1; @@ -462,6 +472,15 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t el.x2 = x + switchbox_x1 + 0.0017f*(96 + (dst_id - TILE_WIRE_H06W0303)+ 10 *(dst.location.x%9)); el.y2 = y + switchbox_y1; } + if (dst_type == id_WIRE_TYPE_V00) { + int group = (dst_id - TILE_WIRE_V00T0000) / 2; + el.x2 = x + switchbox_x2 - 0.0017f*(8 - ((dst_id - TILE_WIRE_V00T0000) % 2)*4); + if (group) { + el.y2 = y + switchbox_y1; + } else { + el.y2 = y + switchbox_y2; + } + } if (dst_type == id_WIRE_TYPE_V01) { el.x2 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (dst_id - TILE_WIRE_V01N0001); if (y == dst.location.y) @@ -563,7 +582,7 @@ void toSameSideH1Hor(std::vector &g, GraphicElement &el,int x, i el2.style = style; setDestination(el2,x,y,dst,dst_type,dst_id); - if (dst_type == id_WIRE_TYPE_H01 || src_type == id_WIRE_TYPE_V01) { + if (dst_type == id_WIRE_TYPE_H01 || src_type == id_WIRE_TYPE_V01 || dst_type == id_WIRE_TYPE_H00) { el.x2 = el.x1; el.y2 = el2.y2; g.push_back(el); @@ -605,14 +624,21 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire el.type = GraphicElement::TYPE_ARROW; el.style = style; + // To H00 + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H00) { + toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H00L0000 + 30); + } + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H00) { + //toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H00L0000); + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + + // To H01 if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H01) { toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H01E0001); } - if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V01) { - toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V01N0001); - } - - + + // To H02 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H02) { toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H02W0701); } @@ -636,6 +662,7 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); } + // To H06 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H06) { toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H06W0303); } @@ -656,6 +683,21 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); } + // To V00 + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V00) { + //toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V00T0000); + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V00) { + toSameSideV1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, src_id - TILE_WIRE_H02W0701 + 20); + } + + // To V01 + if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V01) { + toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V01N0001); + } + + // To V02 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V02) { if (x == src.location.x) { toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V02N0701); @@ -679,6 +721,7 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); } + // To V06 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) { if (x == src.location.x) { toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V06N0303); -- cgit v1.2.3 From 0c77eed07dfa40b7a2564db652c52be74b4fe441 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 1 Dec 2019 11:00:24 +0100 Subject: add more pips --- ecp5/gfx.cc | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 1a774884..5adf591d 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -413,6 +413,16 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, GfxTileWireId src_id) { + if (src_type == id_WIRE_TYPE_H00) { + int group = (src_id - TILE_WIRE_H00L0000) / 2; + el.y1 = y + switchbox_y1 + 0.0017f*(8 - ((src_id - TILE_WIRE_H00L0000) % 2)*4); + + if (group) { + el.x1 = x + switchbox_x2; + } else { + el.x1 = x + switchbox_x1; + } + } if (src_type == id_WIRE_TYPE_H01) { if (x == src.location.x) el.x1 = x + switchbox_x1; @@ -428,6 +438,15 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, el.x1 = x + switchbox_x1 + 0.0017f*(96 + (src_id - TILE_WIRE_H06W0303)+ 10 *(src.location.x%9)); el.y1 = y + switchbox_y1; } + if (src_type == id_WIRE_TYPE_V00) { + int group = (src_id - TILE_WIRE_V00T0000) / 2; + el.x1 = x + switchbox_x2 - 0.0017f*(8 - ((src_id - TILE_WIRE_V00T0000) % 2)*4); + if (group) { + el.y1 = y + switchbox_y1; + } else { + el.y1 = y + switchbox_y2; + } + } if (src_type == id_WIRE_TYPE_V01) { el.x1 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (src_id - TILE_WIRE_V01N0001); if (y == src.location.y) @@ -496,6 +515,15 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t el.x2 = x + switchbox_x1; el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); } + + if (dst_type == id_WIRE_TYPE_NONE) { + if (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI) + { + int gap = (dst_id - TILE_WIRE_FCO) / 24; + el.x2 = x + switchbox_x2; + el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch; + } + } } void straightLine(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id) @@ -741,6 +769,27 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); } + + if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { + toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_FCO); + } + if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { + toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_FCO); + } + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + + if (src_type == id_WIRE_TYPE_V00 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { + straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + } + } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From b764f9b13a6bdc00ee3965448786c3e060430516 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 7 Dec 2019 17:21:59 +0100 Subject: Fix edge wires --- ecp5/gfx.cc | 177 ++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 108 insertions(+), 69 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 5adf591d..e78d7c5a 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -77,8 +77,16 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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 + 1; - el.y2 = y + switchbox_y2; + if (y==h-2) + el.y1 = y + 1.1; + else + el.y1 = y + switchbox_y1 + 1; + + if (y==0) + el.y2 = y + 0.9; + else + el.y2 = y + switchbox_y2; + g.push_back(el); } } @@ -88,8 +96,14 @@ 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.x1 = x + switchbox_x1; - el.x2 = x + switchbox_x2 - 1; + if (x==w-1) + el.x1 = x + 0.1; + else + el.x1 = x + switchbox_x1; + if (x==1) + el.x2 = x - 0.1; + else + 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); @@ -129,143 +143,168 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } - if (wire_type == id_WIRE_TYPE_H02) { + if (wire_type == id_WIRE_TYPE_H02) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + if (x==0) + el.x1 = 0.9; + else + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); el.x2 = el.x1; el.y1 = y + switchbox_y1; el.y2 = y + switchbox_y1 - 0.0017f*(20 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); - g.push_back(el); - - int x1 = x + 1; - if (x1> w - 1) x1 = w - 1; + if (x!=0 && x!=w-1) g.push_back(el); - el.x2 = x1 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + if (x==w-2) + el.x2 = x + 1 + 0.1; + else + el.x2 = x + 1 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); el.y1 = el.y2; - g.push_back(el); + if (x!=w-1) g.push_back(el); el.x1 = el.x2; el.y1 = y + switchbox_y1; - g.push_back(el); + if (x!=w-1 && x!=w-2) g.push_back(el); - int x2 = x - 1; - if (x2<0) x2 = 0; - - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); - el.x2 = x2 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + if (x==w-1) + el.x1 = x + 0.1; + else + el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + if (x==1) + el.x2 = x - 1 + 0.9; + else + el.x2 = x - 1 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); el.y2 = y + switchbox_y1 - 0.0017f*(20 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); el.y1 = el.y2; - g.push_back(el); + if (x!=0) g.push_back(el); el.x1 = el.x2; el.y1 = y + switchbox_y1; - g.push_back(el); + if (x!=0 && x!=1) g.push_back(el); } - if (wire_type == id_WIRE_TYPE_V02) { + if (wire_type == id_WIRE_TYPE_V02) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - el.y1 = y + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + if (y==0) + el.y1 = 0.9; + else + el.y1 = y + switchbox_y1 + 0.0017f*(20 + (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); + if (y!=0 && y!=h-1) g.push_back(el); - int y1 = y + 1; - if (y1> h - 1) y1 = h - 1; - - el.y2 = y1 + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + if (y==h-2) + el.y2 = y + 1 + 0.1; + else + el.y2 = y + 1 + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); el.x1 = el.x2; - g.push_back(el); + if (y!=h-1) g.push_back(el); el.y1 = el.y2; el.x1 = x + switchbox_x1; - g.push_back(el); - - int y2 = y - 1; - if (y2<0) y2 = 0; + if (y!=h-1 && y!=h-2) g.push_back(el); - el.y1 = y + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); - el.y2 = y2 + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + if (y==h-1) + el.y1 = y + 0.1; + else + el.y1 = y + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + if (y==1) + el.y2 = y - 1 + 0.9; + else + el.y2 = y - 1 + switchbox_y1 + 0.0017f*(20 + (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); + if (y!=0) g.push_back(el); el.y1 = el.y2; el.x1 = x + switchbox_x1; - g.push_back(el); - } + if (y!=0 && y!=1) 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)+ 10 *(x%9)); + if (x==0) + el.x1 = 0.9; + else + el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); el.x2 = el.x1; el.y1 = y + switchbox_y1; el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); - g.push_back(el); + if (x!=0 && x!=w-1) 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)+ 10 *(x%9)); + if (x==w-2 || x==w-3 || x==w-4) + el.x2 = w - 1 + 0.1; + else + el.x2 = x + 3 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); el.y1 = el.y2; - g.push_back(el); + if (x!=w-1) 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; + if (x!=w-1 && x!=w-2 && x!=w-3 && x!=w-4) g.push_back(el); - el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); - el.x2 = x2 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + if (x==w-1) + el.x1 = x + 0.1; + else + el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + if (x==1 || x==2 || x==3) + el.x2 = 0.9; + else + el.x2 = x - 3 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); el.y1 = el.y2; - g.push_back(el); + if (x!=0) g.push_back(el); el.x1 = el.x2; el.y1 = y + switchbox_y1; - g.push_back(el); - } + if (x!=0 && x!=1 && x!=2 && x!=3) g.push_back(el); + } if (wire_type == id_WIRE_TYPE_V06) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + if (y==0) + el.y1 = 0.9; + else + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); el.y2 = el.y1; el.x1 = x + switchbox_x1; el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); - g.push_back(el); + if (y!=0 && y!=h-1) g.push_back(el); - int y1 = y + 3; - if (y1> h - 1) y1 = h - 1; - - el.y2 = y1 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + if (y==h-2 || y==h-3 || y==h-4) + el.y2 = h - 1 + 0.1; + else + el.y2 = y + 3 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); el.x1 = el.x2; - g.push_back(el); + if (y!=h-1) g.push_back(el); el.y1 = el.y2; el.x1 = x + switchbox_x1; - g.push_back(el); - - int y2 = y - 3; - if (y2<0) y2 = 0; + if (y!=h-1 && y!=h-2 && y!=h-3 && y!=h-4) g.push_back(el); - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); - el.y2 = y2 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + if (y==h-1) + el.y1 = y + 0.1; + else + el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + if (y==1 || y==2 || y==3) + el.y2 = 0.9; + else + el.y2 = y - 3 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); el.x1 = el.x2; - g.push_back(el); + if (y!=0) g.push_back(el); el.y1 = el.y2; el.x1 = x + switchbox_x1; - g.push_back(el); - } + if (y!=0 && y!=1 && y!=2 && y!=3) g.push_back(el); + } if (wire_type == id_WIRE_TYPE_NONE) { if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE) { -- cgit v1.2.3 From 7fd856b866f1ddd2f81fdeaf981c15fde51b847d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 8 Dec 2019 09:33:06 +0100 Subject: clangformat run --- ecp5/gfx.cc | 596 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 317 insertions(+), 279 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index e78d7c5a..5c357dda 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -22,106 +22,100 @@ NEXTPNR_NAMESPACE_BEGIN -void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style) +void gfxTileWire(std::vector &g, int x, int y, int w, int h, 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) - { + 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; + 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)) - { + 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)) - { + 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) - { + 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) - { + 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; + 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) - { + 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.x1 = x + switchbox_x2 - 0.0017f * 16 + 0.0017f * (tilewire - TILE_WIRE_V01N0001); el.x2 = el.x1; - if (y==h-2) + if (y == h - 2) el.y1 = y + 1.1; else el.y1 = y + switchbox_y1 + 1; - if (y==0) + if (y == 0) el.y2 = y + 0.9; else el.y2 = y + switchbox_y2; g.push_back(el); - } - } + } + } if (wire_type == id_WIRE_TYPE_H01) { - if (tilewire >= TILE_WIRE_H01E0001 && tilewire <=TILE_WIRE_HL7W0001) - { + if (tilewire >= TILE_WIRE_H01E0001 && tilewire <= TILE_WIRE_HL7W0001) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - if (x==w-1) + if (x == w - 1) el.x1 = x + 0.1; else el.x1 = x + switchbox_x1; - if (x==1) + if (x == 1) el.x2 = x - 0.1; else el.x2 = x + switchbox_x2 - 1; - el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (tilewire - TILE_WIRE_H01E0001); + 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.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; + el.y2 = y + switchbox_y1 - 0.0017f * 4; } else { el.y1 = y + switchbox_y2; - el.y2 = y + switchbox_y2 + 0.0017f*4; + el.y2 = y + switchbox_y2 + 0.0017f * 4; } g.push_back(el); } @@ -130,14 +124,14 @@ 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*(8 - ((tilewire - TILE_WIRE_H00L0000) % 2)*4); + 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.x1 = x + switchbox_x2 + 0.0017f * 4; el.x2 = x + switchbox_x2; } else { - el.x1 = x + switchbox_x1 - 0.0017f*4; + el.x1 = x + switchbox_x1 - 0.0017f * 4; el.x2 = x + switchbox_x1; } g.push_back(el); @@ -147,245 +141,263 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - if (x==0) + if (x == 0) el.x1 = 0.9; else - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.x1 = x + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.x2 = el.x1; el.y1 = y + switchbox_y1; - el.y2 = y + switchbox_y1 - 0.0017f*(20 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); - if (x!=0 && x!=w-1) g.push_back(el); + el.y2 = y + switchbox_y1 - 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + if (x != 0 && x != w - 1) + g.push_back(el); - if (x==w-2) + if (x == w - 2) el.x2 = x + 1 + 0.1; else - el.x2 = x + 1 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.x2 = x + 1 + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.y1 = el.y2; - if (x!=w-1) g.push_back(el); + if (x != w - 1) + g.push_back(el); el.x1 = el.x2; el.y1 = y + switchbox_y1; - if (x!=w-1 && x!=w-2) g.push_back(el); + if (x != w - 1 && x != w - 2) + g.push_back(el); - if (x==w-1) + if (x == w - 1) el.x1 = x + 0.1; else - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); - if (x==1) + el.x1 = x + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + if (x == 1) el.x2 = x - 1 + 0.9; else - el.x2 = x - 1 + switchbox_x1 + 0.0017f*(16 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); - el.y2 = y + switchbox_y1 - 0.0017f*(20 + (tilewire - TILE_WIRE_H02W0701)+ 20 *(x%3)); + el.x2 = x - 1 + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.y2 = y + switchbox_y1 - 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.y1 = el.y2; - if (x!=0) g.push_back(el); - + if (x != 0) + g.push_back(el); + el.x1 = el.x2; el.y1 = y + switchbox_y1; - if (x!=0 && x!=1) g.push_back(el); - } + if (x != 0 && x != 1) + g.push_back(el); + } if (wire_type == id_WIRE_TYPE_V02) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - if (y==0) + if (y == 0) el.y1 = 0.9; else - el.y1 = y + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + el.y1 = y + switchbox_y1 + 0.0017f * (20 + (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)); - if (y!=0 && y!=h-1) g.push_back(el); + el.x2 = x + switchbox_x1 - 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); + if (y != 0 && y != h - 1) + g.push_back(el); - if (y==h-2) + if (y == h - 2) el.y2 = y + 1 + 0.1; else - el.y2 = y + 1 + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + el.y2 = y + 1 + switchbox_y1 + 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); el.x1 = el.x2; - if (y!=h-1) g.push_back(el); + if (y != h - 1) + g.push_back(el); el.y1 = el.y2; el.x1 = x + switchbox_x1; - if (y!=h-1 && y!=h-2) g.push_back(el); + if (y != h - 1 && y != h - 2) + g.push_back(el); - if (y==h-1) + if (y == h - 1) el.y1 = y + 0.1; else - el.y1 = y + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); - if (y==1) + el.y1 = y + switchbox_y1 + 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); + if (y == 1) el.y2 = y - 1 + 0.9; else - el.y2 = y - 1 + switchbox_y1 + 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); - el.x2 = x + switchbox_x1 - 0.0017f*(20 + (tilewire - TILE_WIRE_V02N0701)+ 20 *(y%3)); + el.y2 = y - 1 + switchbox_y1 + 0.0017f * (20 + (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; - if (y!=0) g.push_back(el); - + if (y != 0) + g.push_back(el); + el.y1 = el.y2; el.x1 = x + switchbox_x1; - if (y!=0 && y!=1) g.push_back(el); - } + if (y != 0 && y != 1) + g.push_back(el); + } - if (wire_type == id_WIRE_TYPE_H06) { + if (wire_type == id_WIRE_TYPE_H06) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - if (x==0) + if (x == 0) el.x1 = 0.9; else - el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + el.x1 = x + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); el.x2 = el.x1; el.y1 = y + switchbox_y1; - el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); - if (x!=0 && x!=w-1) g.push_back(el); + el.y2 = y + switchbox_y1 - 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + if (x != 0 && x != w - 1) + g.push_back(el); - if (x==w-2 || x==w-3 || x==w-4) + if (x == w - 2 || x == w - 3 || x == w - 4) el.x2 = w - 1 + 0.1; else - el.x2 = x + 3 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + el.x2 = x + 3 + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); el.y1 = el.y2; - if (x!=w-1) g.push_back(el); + if (x != w - 1) + g.push_back(el); el.x1 = el.x2; el.y1 = y + switchbox_y1; - if (x!=w-1 && x!=w-2 && x!=w-3 && x!=w-4) g.push_back(el); + if (x != w - 1 && x != w - 2 && x != w - 3 && x != w - 4) + g.push_back(el); - if (x==w-1) + if (x == w - 1) el.x1 = x + 0.1; else - el.x1 = x + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); - if (x==1 || x==2 || x==3) + el.x1 = x + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + if (x == 1 || x == 2 || x == 3) el.x2 = 0.9; else - el.x2 = x - 3 + switchbox_x1 + 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); - el.y2 = y + switchbox_y1 - 0.0017f*(96 + (tilewire - TILE_WIRE_H06W0303)+ 10 *(x%9)); + el.x2 = x - 3 + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + el.y2 = y + switchbox_y1 - 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); el.y1 = el.y2; - if (x!=0) g.push_back(el); - + if (x != 0) + g.push_back(el); + el.x1 = el.x2; el.y1 = y + switchbox_y1; - if (x!=0 && x!=1 && x!=2 && x!=3) g.push_back(el); + if (x != 0 && x != 1 && x != 2 && x != 3) + g.push_back(el); } - if (wire_type == id_WIRE_TYPE_V06) { + if (wire_type == id_WIRE_TYPE_V06) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - if (y==0) + if (y == 0) el.y1 = 0.9; else - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + el.y1 = y + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); el.y2 = el.y1; el.x1 = x + switchbox_x1; - el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); - if (y!=0 && y!=h-1) g.push_back(el); + el.x2 = x + switchbox_x1 - 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + if (y != 0 && y != h - 1) + g.push_back(el); - if (y==h-2 || y==h-3 || y==h-4) + if (y == h - 2 || y == h - 3 || y == h - 4) el.y2 = h - 1 + 0.1; else - el.y2 = y + 3 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + el.y2 = y + 3 + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); el.x1 = el.x2; - if (y!=h-1) g.push_back(el); + if (y != h - 1) + g.push_back(el); el.y1 = el.y2; el.x1 = x + switchbox_x1; - if (y!=h-1 && y!=h-2 && y!=h-3 && y!=h-4) g.push_back(el); + if (y != h - 1 && y != h - 2 && y != h - 3 && y != h - 4) + g.push_back(el); - if (y==h-1) + if (y == h - 1) el.y1 = y + 0.1; else - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); - if (y==1 || y==2 || y==3) + el.y1 = y + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + if (y == 1 || y == 2 || y == 3) el.y2 = 0.9; else - el.y2 = y - 3 + switchbox_y1 + 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); - el.x2 = x + switchbox_x1 - 0.0017f*(96 + (tilewire - TILE_WIRE_V06N0303)+ 10 *(y%9)); + el.y2 = y - 3 + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + el.x2 = x + switchbox_x1 - 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); el.x1 = el.x2; - if (y!=0) g.push_back(el); - + if (y != 0) + g.push_back(el); + el.y1 = el.y2; el.x1 = x + switchbox_x1; - if (y!=0 && y!=1 && y!=2 && y!=3) g.push_back(el); - } + if (y != 0 && y != 1 && y != 2 && y != 3) + g.push_back(el); + } if (wire_type == id_WIRE_TYPE_NONE) { - if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE) - { + 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; + 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.y1 = y + switchbox_y2 + 0.0017f * 4; el.y2 = el.y1; } else { - el.y1 = y + switchbox_y1 - 0.0017f*4; + 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) - { + 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; + 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.x1 = x + switchbox_x1 - 0.0017f * 4; el.x2 = el.x1; } else { - el.x1 = x + switchbox_x2 + 0.0017f*4; + 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; + } + 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.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++) - { + 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.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++) - { + 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.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) - { + if (tilewire >= TILE_WIRE_FCO && tilewire <= TILE_WIRE_FCI) { int gap = (tilewire - TILE_WIRE_FCO) / 24; - GraphicElement el; + 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; + 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) - { + 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; @@ -393,46 +405,49 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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.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) - { + 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; + 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.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; + 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) - { + if (tilewire >= TILE_WIRE_WAD3 && tilewire <= TILE_WIRE_WAD0) { GraphicElement el; - int part = (tilewire - TILE_WIRE_WAD3) % 4; + 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.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; + 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; @@ -441,45 +456,45 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS // 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.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); } } - } void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, GfxTileWireId src_id) { if (src_type == id_WIRE_TYPE_H00) { int group = (src_id - TILE_WIRE_H00L0000) / 2; - el.y1 = y + switchbox_y1 + 0.0017f*(8 - ((src_id - TILE_WIRE_H00L0000) % 2)*4); + el.y1 = y + switchbox_y1 + 0.0017f * (8 - ((src_id - TILE_WIRE_H00L0000) % 2) * 4); if (group) { el.x1 = x + switchbox_x2; } else { el.x1 = x + switchbox_x1; } - } + } if (src_type == id_WIRE_TYPE_H01) { - if (x == src.location.x) + if (x == src.location.x) el.x1 = x + switchbox_x1; else el.x1 = x + switchbox_x2; - el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (src_id - TILE_WIRE_H01E0001); + el.y1 = y + switchbox_y1 + 0.0017f * 16 - 0.0017f * (src_id - TILE_WIRE_H01E0001); } if (src_type == id_WIRE_TYPE_H02) { - el.x1 = x + switchbox_x1 + 0.0017f*(16 + (src_id - TILE_WIRE_H02W0701)+ 20 *(src.location.x%3)); + el.x1 = x + switchbox_x1 + 0.0017f * (16 + (src_id - TILE_WIRE_H02W0701) + 20 * (src.location.x % 3)); el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_H06) { - el.x1 = x + switchbox_x1 + 0.0017f*(96 + (src_id - TILE_WIRE_H06W0303)+ 10 *(src.location.x%9)); + el.x1 = x + switchbox_x1 + 0.0017f * (96 + (src_id - TILE_WIRE_H06W0303) + 10 * (src.location.x % 9)); el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_V00) { int group = (src_id - TILE_WIRE_V00T0000) / 2; - el.x1 = x + switchbox_x2 - 0.0017f*(8 - ((src_id - TILE_WIRE_V00T0000) % 2)*4); + el.x1 = x + switchbox_x2 - 0.0017f * (8 - ((src_id - TILE_WIRE_V00T0000) % 2) * 4); if (group) { el.y1 = y + switchbox_y1; } else { @@ -487,19 +502,19 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, } } if (src_type == id_WIRE_TYPE_V01) { - el.x1 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (src_id - TILE_WIRE_V01N0001); - if (y == src.location.y) + el.x1 = x + switchbox_x2 - 0.0017f * 16 + 0.0017f * (src_id - TILE_WIRE_V01N0001); + if (y == src.location.y) el.y1 = y + switchbox_y2; else el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_V02) { - el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f*(20 + (src_id - TILE_WIRE_V02N0701)+ 20 *(src.location.y%3)); + el.x1 = x + switchbox_x1; + el.y1 = y + switchbox_y1 + 0.0017f * (20 + (src_id - TILE_WIRE_V02N0701) + 20 * (src.location.y % 3)); } if (src_type == id_WIRE_TYPE_V06) { - el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f*(96 + (src_id - TILE_WIRE_V06N0303)+ 10 *(src.location.y%9)); + el.x1 = x + switchbox_x1; + el.y1 = y + switchbox_y1 + 0.0017f * (96 + (src_id - TILE_WIRE_V06N0303) + 10 * (src.location.y % 9)); } } @@ -507,7 +522,7 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t { if (dst_type == id_WIRE_TYPE_H00) { int group = (dst_id - TILE_WIRE_H00L0000) / 2; - el.y2 = y + switchbox_y1 + 0.0017f*(8 - ((dst_id - TILE_WIRE_H00L0000) % 2)*4); + el.y2 = y + switchbox_y1 + 0.0017f * (8 - ((dst_id - TILE_WIRE_H00L0000) % 2) * 4); if (group) { el.x2 = x + switchbox_x2; @@ -516,23 +531,23 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t } } if (dst_type == id_WIRE_TYPE_H01) { - if (x == dst.location.x) + if (x == dst.location.x) el.x2 = x + switchbox_x1; else el.x2 = x + switchbox_x2; - el.y2 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (dst_id - TILE_WIRE_H01E0001); + el.y2 = y + switchbox_y1 + 0.0017f * 16 - 0.0017f * (dst_id - TILE_WIRE_H01E0001); } if (dst_type == id_WIRE_TYPE_H02) { - el.x2 = x + switchbox_x1 + 0.0017f*(16 + (dst_id - TILE_WIRE_H02W0701)+ 20 *(dst.location.x%3)); + el.x2 = x + switchbox_x1 + 0.0017f * (16 + (dst_id - TILE_WIRE_H02W0701) + 20 * (dst.location.x % 3)); el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_H06) { - el.x2 = x + switchbox_x1 + 0.0017f*(96 + (dst_id - TILE_WIRE_H06W0303)+ 10 *(dst.location.x%9)); + el.x2 = x + switchbox_x1 + 0.0017f * (96 + (dst_id - TILE_WIRE_H06W0303) + 10 * (dst.location.x % 9)); el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_V00) { int group = (dst_id - TILE_WIRE_V00T0000) / 2; - el.x2 = x + switchbox_x2 - 0.0017f*(8 - ((dst_id - TILE_WIRE_V00T0000) % 2)*4); + el.x2 = x + switchbox_x2 - 0.0017f * (8 - ((dst_id - TILE_WIRE_V00T0000) % 2) * 4); if (group) { el.y2 = y + switchbox_y1; } else { @@ -540,52 +555,54 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t } } if (dst_type == id_WIRE_TYPE_V01) { - el.x2 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (dst_id - TILE_WIRE_V01N0001); - if (y == dst.location.y) + el.x2 = x + switchbox_x2 - 0.0017f * 16 + 0.0017f * (dst_id - TILE_WIRE_V01N0001); + if (y == dst.location.y) el.y2 = y + switchbox_y2; else el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_V02) { - el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f*(20 + (dst_id - TILE_WIRE_V02N0701)+ 20 *(dst.location.y%3)); + el.x2 = x + switchbox_x1; + el.y2 = y + switchbox_y1 + 0.0017f * (20 + (dst_id - TILE_WIRE_V02N0701) + 20 * (dst.location.y % 3)); } if (dst_type == id_WIRE_TYPE_V06) { el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f*(96 + (dst_id - TILE_WIRE_V06N0303)+ 10 *(dst.location.y%9)); + el.y2 = y + switchbox_y1 + 0.0017f * (96 + (dst_id - TILE_WIRE_V06N0303) + 10 * (dst.location.y % 9)); } if (dst_type == id_WIRE_TYPE_NONE) { - if (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI) - { - int gap = (dst_id - TILE_WIRE_FCO) / 24; + if (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) { + int gap = (dst_id - TILE_WIRE_FCO) / 24; el.x2 = x + switchbox_x2; - el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch; - } + el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; + } } } -void straightLine(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id) +void straightLine(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, + GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id) { - setSource(el,x,y,src,src_type,src_id); - setDestination(el,x,y,dst,dst_type,dst_id); + setSource(el, x, y, src, src_type, src_id); + setDestination(el, x, y, dst, dst_type, dst_id); g.push_back(el); } -void toSameSideHor(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +void toSameSideHor(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, + GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, + GraphicElement::style_t style, int idx) { - int sign = (src_type==dst_type) ? 1 : -1; - setSource(el,x,y,src,src_type,src_id); + int sign = (src_type == dst_type) ? 1 : -1; + setSource(el, x, y, src, src_type, src_id); el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 + sign * 0.0017f*idx; + el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 + sign * 0.0017f * idx; g.push_back(el); - - GraphicElement el2; + + GraphicElement el2; el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2,x,y,dst,dst_type,dst_id); - + setDestination(el2, x, y, dst, dst_type, dst_id); + el.x1 = el2.x2; el.y1 = el.y2; g.push_back(el); @@ -595,20 +612,22 @@ void toSameSideHor(std::vector &g, GraphicElement &el,int x, int g.push_back(el2); } -void toSameSideVer(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +void toSameSideVer(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, + GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, + GraphicElement::style_t style, int idx) { - int sign = (src_type==dst_type) ? 1 : -1; - setSource(el,x,y,src,src_type,src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 + sign * 0.0017f*idx; + int sign = (src_type == dst_type) ? 1 : -1; + setSource(el, x, y, src, src_type, src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 + sign * 0.0017f * idx; el.y2 = el.y1; g.push_back(el); - - GraphicElement el2; + + GraphicElement el2; el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2,x,y,dst,dst_type,dst_id); - + setDestination(el2, x, y, dst, dst_type, dst_id); + el.x1 = el.x2; el.y1 = el2.y2; g.push_back(el); @@ -618,19 +637,21 @@ void toSameSideVer(std::vector &g, GraphicElement &el,int x, int g.push_back(el2); } -void toSameSideH1Ver(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +void toSameSideH1Ver(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, + GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, + GraphicElement::style_t style, int idx) { - setSource(el,x,y,src,src_type,src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2-switchbox_x1)/2 - 0.0017f*idx; + setSource(el, x, y, src, src_type, src_id); + el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 - 0.0017f * idx; el.y2 = el.y1; g.push_back(el); - - GraphicElement el2; + + GraphicElement el2; el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2,x,y,dst,dst_type,dst_id); - + setDestination(el2, x, y, dst, dst_type, dst_id); + el.x1 = el.x2; el.y1 = el2.y2; g.push_back(el); @@ -640,15 +661,17 @@ void toSameSideH1Ver(std::vector &g, GraphicElement &el,int x, i g.push_back(el2); } -void toSameSideH1Hor(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +void toSameSideH1Hor(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, + GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, + GraphicElement::style_t style, int idx) { - setSource(el,x,y,src,src_type,src_id); - - GraphicElement el2; + setSource(el, x, y, src, src_type, src_id); + + GraphicElement el2; el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2,x,y,dst,dst_type,dst_id); + setDestination(el2, x, y, dst, dst_type, dst_id); if (dst_type == id_WIRE_TYPE_H01 || src_type == id_WIRE_TYPE_V01 || dst_type == id_WIRE_TYPE_H00) { el.x2 = el.x1; el.y2 = el2.y2; @@ -664,19 +687,21 @@ void toSameSideH1Hor(std::vector &g, GraphicElement &el,int x, i g.push_back(el2); } -void toSameSideV1Ver(std::vector &g, GraphicElement &el,int x, int y, WireId src, IdString src_type, GfxTileWireId src_id,WireId dst, IdString dst_type, GfxTileWireId dst_id, GraphicElement::style_t style, int idx) +void toSameSideV1Ver(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, + GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, + GraphicElement::style_t style, int idx) { - setSource(el,x,y,src,src_type,src_id); + setSource(el, x, y, src, src_type, src_id); el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2-switchbox_y1)/2 - 0.0017f*idx; + el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 - 0.0017f * idx; g.push_back(el); - - GraphicElement el2; + + GraphicElement el2; el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2,x,y,dst,dst_type,dst_id); - + setDestination(el2, x, y, dst, dst_type, dst_id); + el.x1 = el2.x2; el.y1 = el.y2; g.push_back(el); @@ -685,150 +710,163 @@ void toSameSideV1Ver(std::vector &g, GraphicElement &el,int x, i el2.y1 = el.y1; g.push_back(el2); } -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) -{ +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_ARROW; el.style = style; // To H00 if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H00) { - toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H00L0000 + 30); + toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_H00L0000 + 30); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H00) { - //toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H00L0000); - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + // toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H00L0000); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } - + // To H01 if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H01) { - toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H01E0001); + toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H01E0001); } - + // To H02 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H02) { - toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H02W0701); + toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H02W0701); + toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H06W0303); - } + toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); + } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H02) { if (y == src.location.y) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } else { - toSameSideV1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H02W0701); + toSameSideV1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_H02W0701); } } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H02) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } - + // To H06 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H06) { - toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H06W0303); + toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H06) { - toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H02W0701); + toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H06) { - toSameSideHor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_H06W0303); + toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H06) { if (y == src.location.y) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } else { - toSameSideV1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H06W0303); + toSameSideV1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_H06W0303); } } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H06) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } // To V00 if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V00) { - //toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V00T0000); - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + // toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V00T0000); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V00) { - toSameSideV1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, src_id - TILE_WIRE_H02W0701 + 20); + toSameSideV1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_H02W0701 + 20); } // To V01 if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V01) { - toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V01N0001); + toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V01N0001); } // To V02 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V02) { if (x == src.location.x) { - toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V02N0701); + toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_V02N0701); } else { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V02) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V02) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V02) { - toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V02N0701); + toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); + toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); + toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); } // To V06 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) { if (x == src.location.x) { - toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V06N0303); + toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_V06N0303); } else { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V06) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V06) { - toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V06N0303); + toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V06N0303); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V02N0701); + toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style,src_id - TILE_WIRE_V06N0303); + toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); } - - if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { - toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_FCO); + + if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); } - if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { - toSameSideH1Ver(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_FCO); + if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); } - if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_V00 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); - } - if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + if (src_type == id_WIRE_TYPE_V00 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <=TILE_WIRE_FCI)) { - straightLine(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id); + if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + } + if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } - } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 16f6aaa68c834a66be92b7f21f17eb8cfcafc1f8 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 13 Dec 2019 14:01:28 +0100 Subject: Add many new wires --- ecp5/gfx.cc | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 5c357dda..3d37e2a9 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -65,6 +65,102 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } } + if (wire_type == id_WIRE_TYPE_PIO) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + bool top_bottom = (y == 0 || y == (h - 1)); + int gap = 3-(tilewire - TILE_WIRE_PADDOD_PIO)/5; + int num = (tilewire - TILE_WIRE_PADDOD_PIO)%5; + if (top_bottom) { + el.x1 = x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); + el.x2 = el.x1; + if (y == h - 1) { + el.y1 = y + 1 - io_cell_h_y2; + el.y2 = el.y1 - 0.015f; + } else { + el.y1 = y + io_cell_h_y2; + el.y2 = el.y1 + 0.015f; + } + } else { + if (x == 0) { + el.x1 = x + 1 - io_cell_v_x1; + el.x2 = el.x1 + 0.015f; + } else { + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } + el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y2 = el.y1; + } + g.push_back(el); + } + + if (wire_type == id_WIRE_TYPE_IOLOGIC) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + int gap = 7-(tilewire - TILE_WIRE_JLOADND_IOLOGIC)/42; + int num = (tilewire - TILE_WIRE_JLOADND_IOLOGIC)%42; + if (x == 0) { + el.x1 = x + 1 - io_cell_v_x1; + el.x2 = el.x1 + 0.015f; + } else { + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } + el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y2 = el.y1; + g.push_back(el); + } + + if (wire_type == id_WIRE_TYPE_DQS) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + int num = (tilewire - TILE_WIRE_DDRDEL_DQS); + if (x == 0) { + el.x1 = x + 1 - io_cell_v_x1; + el.x2 = el.x1 + 0.015f; + } else { + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } + el.y1 = y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); + el.y2 = el.y1; + g.push_back(el); + } + + if (wire_type == id_WIRE_TYPE_EBR) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_MULT18) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.y2 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_ALU54) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_ALU54 + 1) + 3 * slice_pitch; + el.y2 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_ALU54 + 1) + 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; @@ -384,6 +480,16 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } } } + if (tilewire >= TILE_WIRE_JCE0 && tilewire <= TILE_WIRE_JQ7) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + switchbox_x2; + el.x2 = x + slice_x1 - 0.0025f; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + g.push_back(el); + } if (tilewire >= TILE_WIRE_FCO && tilewire <= TILE_WIRE_FCI) { int gap = (tilewire - TILE_WIRE_FCO) / 24; -- cgit v1.2.3 From c0585e98eb6234fa1658586b617cf6717bc391d8 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 13 Dec 2019 14:32:27 +0100 Subject: added siologic --- ecp5/gfx.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 3d37e2a9..188e44ab 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -112,8 +112,24 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); el.y2 = el.y1; g.push_back(el); - } - + } + if (wire_type == id_WIRE_TYPE_SIOLOGIC) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + int gap = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC)/20; + int num = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC)%20; + el.x1 = x + io_cell_h_x1 + (5-gap) * 0.10 + 0.0017f * (num + 1); + el.x2 = el.x1; + if (y == h - 1) { + el.y1 = y + 1 - io_cell_h_y2; + el.y2 = el.y1 - 0.015f; + } else { + el.y1 = y + io_cell_h_y2; + el.y2 = el.y1 + 0.015f; + } + g.push_back(el); + } if (wire_type == id_WIRE_TYPE_DQS) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; -- cgit v1.2.3 From 2a5f0bbd28481e9809ffe7c7b972252878420888 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 13 Dec 2019 18:24:49 +0100 Subject: new wires in db --- ecp5/gfx.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 188e44ab..e06bcfa6 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -70,8 +70,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.type = GraphicElement::TYPE_LINE; el.style = style; bool top_bottom = (y == 0 || y == (h - 1)); - int gap = 3-(tilewire - TILE_WIRE_PADDOD_PIO)/5; - int num = (tilewire - TILE_WIRE_PADDOD_PIO)%5; + int gap = 3-(tilewire - TILE_WIRE_PADDOD_PIO)/6; + int num = (tilewire - TILE_WIRE_PADDOD_PIO)%6; if (top_bottom) { el.x1 = x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); el.x2 = el.x1; -- cgit v1.2.3 From 6d005f38b5e771341c67e00db054c9d5010e2a56 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 13 Dec 2019 19:44:49 +0100 Subject: add more --- ecp5/gfx.cc | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index e06bcfa6..232b93d9 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -70,8 +70,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.type = GraphicElement::TYPE_LINE; el.style = style; bool top_bottom = (y == 0 || y == (h - 1)); - int gap = 3-(tilewire - TILE_WIRE_PADDOD_PIO)/6; - int num = (tilewire - TILE_WIRE_PADDOD_PIO)%6; + int gap = 3-(tilewire - TILE_WIRE_PADDOD_PIO)/7; + int num = (tilewire - TILE_WIRE_PADDOD_PIO)%7; if (top_bottom) { el.x1 = x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); el.x2 = el.x1; @@ -95,6 +95,33 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } g.push_back(el); } + if (wire_type == id_WIRE_TYPE_DDRDLL) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + int num = (tilewire - TILE_WIRE_DDRDEL_DDRDLL); + el.x1 = x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); + el.x2 = el.x1; + if (y == h - 1) { + el.y1 = y + 0.2; + el.y2 = el.y1 - 0.015f; + } else { + el.y1 = y + 0.8; + el.y2 = el.y1 + 0.015f; + } + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_CCLK) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + int num = (tilewire - TILE_WIRE_JPADDI_CCLK); + el.x1 = x + slice_x1 + 0.0017f * (num + 1); + el.x2 = el.x1; + el.y1 = y + slice_y2 - 1*slice_pitch; + el.y2 = el.y1 - 0.015f; + g.push_back(el); + } if (wire_type == id_WIRE_TYPE_IOLOGIC) { GraphicElement el; -- cgit v1.2.3 From 19eb16045f58be18df9abf8d5b939cd6015bb77d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 08:21:02 +0100 Subject: ebr, mult and alu nice display --- ecp5/gfx.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 232b93d9..d68ac5fa 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -181,7 +181,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; - el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + el.y2 = el.y1; g.push_back(el); } if (wire_type == id_WIRE_TYPE_MULT18) { @@ -191,17 +191,24 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; - el.y2 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.y2 = el.y1; g.push_back(el); } if (wire_type == id_WIRE_TYPE_ALU54) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_ALU54 + 1) + 3 * slice_pitch; - el.y2 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_ALU54 + 1) + 3 * slice_pitch; + int num = (tilewire - TILE_WIRE_JCLK0_ALU54) % 225; + int group = (tilewire - TILE_WIRE_JCLK0_ALU54) / 225; + if (group==0) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + } else { + el.x1 = x + 0.97 + 0.005f; + el.x2 = x + 0.97; + } + el.y1 = y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; + el.y2 = el.y1; g.push_back(el); } if (wire_type == id_WIRE_TYPE_V01) { @@ -528,7 +535,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.type = GraphicElement::TYPE_LINE; el.style = style; el.x1 = x + switchbox_x2; - el.x2 = x + slice_x1 - 0.0025f; + el.x2 = x + switchbox_x2 + 0.005f; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; g.push_back(el); -- cgit v1.2.3 From ebbfb6375d8be60962922936fc7b7cd9b72a4796 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 09:18:24 +0100 Subject: more new wires added --- ecp5/gfx.cc | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index d68ac5fa..9f69cada 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -211,6 +211,101 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y2 = el.y1; g.push_back(el); } + if (wire_type == id_WIRE_TYPE_PLL) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLKI_PLL + 1); + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_GSR) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCLK_GSR + 1); + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_JTAG) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_OSC) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_SED) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_DTR) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JSTARTPULSE_DTR + 1); + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_EXTREF) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } + + if (wire_type == id_WIRE_TYPE_DCU) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } + + if (wire_type == id_WIRE_TYPE_PCSCLKDIV) { + int num = (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; + int group = 1-(tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_V01) { if (tilewire >= TILE_WIRE_V01N0001 && tilewire <= TILE_WIRE_V01S0100) { GraphicElement el; -- cgit v1.2.3 From e118e418e565078971d3e88cc0dac1d6c4a60253 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 09:39:41 +0100 Subject: pips for other type of connection box --- ecp5/gfx.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 9f69cada..f0dabb6d 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -827,6 +827,10 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t el.x2 = x + switchbox_x2; el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; } + if (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7) { + el.x2 = x + switchbox_x2; + el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + } } } @@ -1097,25 +1101,33 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); } + if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { + toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style , dst_id - TILE_WIRE_JCE0); + } if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); } + if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { + toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id,style, dst_id - TILE_WIRE_JCE0); + } + if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_NONE && - (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_V00 && dst_type == id_WIRE_TYPE_NONE && - (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_NONE && - (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_NONE && - (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); } } -- cgit v1.2.3 From 601360b73a5358ce8e14ac33394d4d6fcead71e3 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 10:56:26 +0100 Subject: propagate w and h --- ecp5/gfx.cc | 156 +++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 96 insertions(+), 60 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index f0dabb6d..d56624ef 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -716,7 +716,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } } -void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, GfxTileWireId src_id) +void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, GfxTileWireId src_id) { if (src_type == id_WIRE_TYPE_H00) { int group = (src_id - TILE_WIRE_H00L0000) / 2; @@ -767,9 +767,15 @@ void setSource(GraphicElement &el, int x, int y, WireId src, IdString src_type, el.x1 = x + switchbox_x1; el.y1 = y + switchbox_y1 + 0.0017f * (96 + (src_id - TILE_WIRE_V06N0303) + 10 * (src.location.y % 9)); } + if (src_type == id_WIRE_TYPE_NONE) { + if (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7) { + el.x1 = src.location.x + switchbox_x2 + 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + } + } } -void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_type, GfxTileWireId dst_id) +void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, IdString dst_type, GfxTileWireId dst_id) { if (dst_type == id_WIRE_TYPE_H00) { int group = (dst_id - TILE_WIRE_H00L0000) / 2; @@ -832,22 +838,44 @@ void setDestination(GraphicElement &el, int x, int y, WireId dst, IdString dst_t el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; } } + + if (dst_type == id_WIRE_TYPE_IOLOGIC) { + int gap = 7-(dst_id - TILE_WIRE_JLOADND_IOLOGIC)/42; + int num = (dst_id - TILE_WIRE_JLOADND_IOLOGIC)%42; + if (dst.location.x == 0) { + el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; + } else { + el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + } + el.y2 = dst.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + } + if (dst_type == id_WIRE_TYPE_SIOLOGIC) { + int gap = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC)/20; + int num = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC)%20; + el.x2 = dst.location.x + io_cell_h_x1 + (5-gap) * 0.10 + 0.0017f * (num + 1); + if (dst.location.y == h - 1) { + el.y2 = dst.location.y + 1 - io_cell_h_y2 - 0.015f; + } else { + el.y2 = dst.location.y + io_cell_h_y2 + 0.015f; + } + } + } -void straightLine(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, +void straightLine(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id) { - setSource(el, x, y, src, src_type, src_id); - setDestination(el, x, y, dst, dst_type, dst_id); + setSource(el, x, y, w, h, src, src_type, src_id); + setDestination(el, x, y, w, h, dst, dst_type, dst_id); g.push_back(el); } -void toSameSideHor(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, +void toSameSideHor(std::vector &g, GraphicElement &el, 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, int idx) { int sign = (src_type == dst_type) ? 1 : -1; - setSource(el, x, y, src, src_type, src_id); + setSource(el, x, y, w, h, src, src_type, src_id); el.x2 = el.x1; el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 + sign * 0.0017f * idx; g.push_back(el); @@ -856,7 +884,7 @@ void toSameSideHor(std::vector &g, GraphicElement &el, int x, in el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2, x, y, dst, dst_type, dst_id); + setDestination(el2, x, y, w, h, dst, dst_type, dst_id); el.x1 = el2.x2; el.y1 = el.y2; @@ -867,12 +895,12 @@ void toSameSideHor(std::vector &g, GraphicElement &el, int x, in g.push_back(el2); } -void toSameSideVer(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, +void toSameSideVer(std::vector &g, GraphicElement &el, 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, int idx) { int sign = (src_type == dst_type) ? 1 : -1; - setSource(el, x, y, src, src_type, src_id); + setSource(el, x, y, w, h, src, src_type, src_id); el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 + sign * 0.0017f * idx; el.y2 = el.y1; g.push_back(el); @@ -881,7 +909,7 @@ void toSameSideVer(std::vector &g, GraphicElement &el, int x, in el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2, x, y, dst, dst_type, dst_id); + setDestination(el2, x, y, w, h, dst, dst_type, dst_id); el.x1 = el.x2; el.y1 = el2.y2; @@ -892,11 +920,11 @@ void toSameSideVer(std::vector &g, GraphicElement &el, int x, in g.push_back(el2); } -void toSameSideH1Ver(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, +void toSameSideH1Ver(std::vector &g, GraphicElement &el, 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, int idx) { - setSource(el, x, y, src, src_type, src_id); + setSource(el, x, y, w, h, src, src_type, src_id); el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 - 0.0017f * idx; el.y2 = el.y1; g.push_back(el); @@ -905,7 +933,7 @@ void toSameSideH1Ver(std::vector &g, GraphicElement &el, int x, el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2, x, y, dst, dst_type, dst_id); + setDestination(el2, x, y, w, h, dst, dst_type, dst_id); el.x1 = el.x2; el.y1 = el2.y2; @@ -916,17 +944,17 @@ void toSameSideH1Ver(std::vector &g, GraphicElement &el, int x, g.push_back(el2); } -void toSameSideH1Hor(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, +void toSameSideH1Hor(std::vector &g, GraphicElement &el, 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, int idx) { - setSource(el, x, y, src, src_type, src_id); + setSource(el, x, y, w, h, src, src_type, src_id); GraphicElement el2; el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2, x, y, dst, dst_type, dst_id); + setDestination(el2, x, y, w, h, dst, dst_type, dst_id); if (dst_type == id_WIRE_TYPE_H01 || src_type == id_WIRE_TYPE_V01 || dst_type == id_WIRE_TYPE_H00) { el.x2 = el.x1; el.y2 = el2.y2; @@ -942,11 +970,11 @@ void toSameSideH1Hor(std::vector &g, GraphicElement &el, int x, g.push_back(el2); } -void toSameSideV1Ver(std::vector &g, GraphicElement &el, int x, int y, WireId src, IdString src_type, +void toSameSideV1Ver(std::vector &g, GraphicElement &el, 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, int idx) { - setSource(el, x, y, src, src_type, src_id); + setSource(el, x, y, w, h, src, src_type, src_id); el.x2 = el.x1; el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 - 0.0017f * idx; g.push_back(el); @@ -955,7 +983,7 @@ void toSameSideV1Ver(std::vector &g, GraphicElement &el, int x, el2.type = GraphicElement::TYPE_ARROW; el2.style = style; - setDestination(el2, x, y, dst, dst_type, dst_id); + setDestination(el2, x, y, w, h, dst, dst_type, dst_id); el.x1 = el2.x2; el.y1 = el.y2; @@ -975,160 +1003,168 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire // To H00 if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H00) { - toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H00L0000 + 30); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H00) { // toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H00L0000); - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } // To H01 if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H01) { - toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H01E0001); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H01E0001); } // To H02 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H02) { - toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H02W0701); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H02) { if (y == src.location.y) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } else { - toSameSideV1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + toSameSideV1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H02W0701); } } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_H02) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H02) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } // To H06 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H06) { - toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H06W0303); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H06) { - toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H06) { - toSameSideHor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H06) { if (y == src.location.y) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } else { - toSameSideV1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + toSameSideV1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H06W0303); } } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_H06) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } // To V00 if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V00) { // toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V00T0000); - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V00) { - toSameSideV1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + toSameSideV1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701 + 20); } // To V01 if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V01) { - toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V01N0001); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V01N0001); } // To V02 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V02) { if (x == src.location.x) { - toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V02N0701); } else { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V02) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V02) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V02) { - toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V02N0701); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); } // To V06 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_V06) { if (x == src.location.x) { - toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V06N0303); } else { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_V06) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V06) { - toSameSideH1Hor(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V06N0303); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V06N0303); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); } if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { - toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); } if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { - toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style , dst_id - TILE_WIRE_JCE0); + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style , dst_id - TILE_WIRE_JCE0); } if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { - toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_FCO); } if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { - toSameSideH1Ver(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id,style, dst_id - TILE_WIRE_JCE0); + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id,style, dst_id - TILE_WIRE_JCE0); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_NONE && ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V00 && dst_type == id_WIRE_TYPE_NONE && ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_NONE && ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_NONE && ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { - straightLine(g, el, x, y, src, src_type, src_id, dst, dst_type, dst_id); + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + if (src_type == id_WIRE_TYPE_NONE && dst_type == id_WIRE_TYPE_IOLOGIC && + ((src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7))) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + if (src_type == id_WIRE_TYPE_NONE && dst_type == id_WIRE_TYPE_SIOLOGIC && + ((src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7))) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } } -- cgit v1.2.3 From 7e7e20742d551da270adde59639eaf23f695591d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 12:30:04 +0100 Subject: pips for ios --- ecp5/gfx.cc | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 111 insertions(+), 6 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index d56624ef..6e78f7f7 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -625,6 +625,22 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } } } + + if (tilewire >= TILE_WIRE_JDIA && tilewire <= TILE_WIRE_ECLKD) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = x + 0.5f; + el.x2 = x + 0.5f + 0.005f; + bool top = (y == (h - 1)); + if (top) + el.y1 = y + 1 - (slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + else + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } + if (tilewire >= TILE_WIRE_JCE0 && tilewire <= TILE_WIRE_JQ7) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; @@ -772,7 +788,55 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr el.x1 = src.location.x + switchbox_x2 + 0.005f; el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; } + if (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD) { + bool top = (src.location.y == (h - 1)); + el.x1 = src.location.x + 0.5f + 0.005f; + if (top) + el.y1 = src.location.y + 1 - (slice_y2 - 0.0017f * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + else + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; + } } + if (src_type == id_WIRE_TYPE_IOLOGIC) { + int gap = 7-(src_id - TILE_WIRE_JLOADND_IOLOGIC)/42; + int num = (src_id - TILE_WIRE_JLOADND_IOLOGIC)%42; + if (src.location.x == 0) { + el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; + } else { + el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + } + el.y1 = src.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + } + if (src_type == id_WIRE_TYPE_SIOLOGIC) { + int gap = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC)/20; + int num = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC)%20; + el.x1 = src.location.x + io_cell_h_x1 + (5-gap) * 0.10 + 0.0017f * (num + 1); + if (src.location.y == h - 1) { + el.y1 = src.location.y + 1 - io_cell_h_y2 - 0.015f; + } else { + el.y1 = src.location.y + io_cell_h_y2 + 0.015f; + } + } + if (src_type == id_WIRE_TYPE_PIO) { + bool top_bottom = (src.location.y == 0 || src.location.y == (h - 1)); + int gap = 3-(src_id - TILE_WIRE_PADDOD_PIO)/7; + int num = (src_id - TILE_WIRE_PADDOD_PIO)%7; + if (top_bottom) { + el.x1 = src.location.x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); + if (src.location.y == h - 1) { + el.y1 = src.location.y + 1 - io_cell_h_y2 - 0.015f; + } else { + el.y1 = src.location.y + 1 - io_cell_h_y2 + 0.015f; + } + } else { + if (x == 0) { + el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; + } else { + el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + } + el.y1 = src.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + } + } } void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, IdString dst_type, GfxTileWireId dst_id) @@ -834,8 +898,16 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; } if (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7) { - el.x2 = x + switchbox_x2; - el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + el.x2 = dst.location.x + switchbox_x2; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + } + if (dst_id >= TILE_WIRE_JDIA && dst_id <= TILE_WIRE_ECLKD) { + bool top = (dst.location.y == (h - 1)); + el.x2 = dst.location.x + 0.5f; + if (top) + el.y2 = dst.location.y + 1 - (slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + else + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; } } @@ -859,6 +931,26 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, el.y2 = dst.location.y + io_cell_h_y2 + 0.015f; } } + if (dst_type == id_WIRE_TYPE_PIO) { + bool top_bottom = (dst.location.y == 0 || dst.location.y == (h - 1)); + int gap = 3-(dst_id - TILE_WIRE_PADDOD_PIO)/7; + int num = (dst_id - TILE_WIRE_PADDOD_PIO)%7; + if (top_bottom) { + el.x2 = dst.location.x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); + if (dst.location.y == h - 1) { + el.y2 = dst.location.y + 1 - io_cell_h_y2 - 0.015f; + } else { + el.y2 = dst.location.y + 1 - io_cell_h_y2 + 0.015f; + } + } else { + if (x == 0) { + el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; + } else { + el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + } + el.y2 = dst.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + } + } } @@ -1158,14 +1250,27 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_NONE && dst_type == id_WIRE_TYPE_IOLOGIC && - ((src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7))) { + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC) && + (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_PIO) && + (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_NONE && dst_type == id_WIRE_TYPE_SIOLOGIC && - ((src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7))) { + if (dst_type == id_WIRE_TYPE_NONE && (src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_PIO) && + (dst_id >= TILE_WIRE_JDIA && dst_id <= TILE_WIRE_ECLKD)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } + if (src_type == id_WIRE_TYPE_NONE && dst_type == id_WIRE_TYPE_NONE && + (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD) && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + if (dst_type == id_WIRE_TYPE_NONE && src_type == id_WIRE_TYPE_NONE && + (dst_id >= TILE_WIRE_JDIA && dst_id <= TILE_WIRE_ECLKD) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From d42ecc081e6ce8316098318cc0072767f445e652 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 13:00:09 +0100 Subject: pips for alu, mult and memory --- ecp5/gfx.cc | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 6e78f7f7..cdeebb91 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -836,7 +836,26 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } el.y1 = src.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); } - } + } + if (src_type == id_WIRE_TYPE_EBR) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + } + if (src_type == id_WIRE_TYPE_MULT18) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.00085f * (src_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + } + if (src_type == id_WIRE_TYPE_ALU54) { + int num = (src_id - TILE_WIRE_JCLK0_ALU54) % 225; + int group = (src_id - TILE_WIRE_JCLK0_ALU54) / 225; + if (group==0) { + el.x1 = src.location.x + slice_x1 - 0.005f; + } else { + el.x1 = src.location.x + 0.97 + 0.005f; + } + el.y1 = src.location.y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; + } + } void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, IdString dst_type, GfxTileWireId dst_id) @@ -951,7 +970,24 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, el.y2 = dst.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); } } - + if (dst_type == id_WIRE_TYPE_EBR) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + } + if (dst_type == id_WIRE_TYPE_MULT18) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.00085f * (dst_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + } + if (dst_type == id_WIRE_TYPE_ALU54) { + int num = (dst_id - TILE_WIRE_JCLK0_ALU54) % 225; + int group = (dst_id - TILE_WIRE_JCLK0_ALU54) / 225; + if (group==0) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + } else { + el.x2 = dst.location.x + 0.97 + 0.005f; + } + el.y2 = dst.location.y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; + } } void straightLine(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, @@ -1250,10 +1286,14 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC) && + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_EBR || dst_type == id_WIRE_TYPE_MULT18 || dst_type == id_WIRE_TYPE_ALU54) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } + if (dst_type == id_WIRE_TYPE_NONE && (src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_EBR || src_type == id_WIRE_TYPE_MULT18 || src_type == id_WIRE_TYPE_ALU54) && + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_PIO) && (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); -- cgit v1.2.3 From abf9bc3bb9565dab54e8b5a772c2e60c9f1317d1 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 16:10:41 +0100 Subject: fixes and more pips --- ecp5/gfx.cc | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index cdeebb91..29c1b31f 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -855,7 +855,44 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } el.y1 = src.location.y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; } - + if (src_type == id_WIRE_TYPE_PLL) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_CLKI_PLL + 1); + } + if (src_type == id_WIRE_TYPE_GSR) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JCLK_GSR + 1); + } + if (src_type == id_WIRE_TYPE_JTAG) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; + } + if (src_type == id_WIRE_TYPE_OSC) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; + } + if (src_type == id_WIRE_TYPE_SED) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; + } + if (src_type == id_WIRE_TYPE_DTR) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JSTARTPULSE_DTR + 1); + } + if (src_type == id_WIRE_TYPE_EXTREF) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; + } + if (src_type == id_WIRE_TYPE_DCU) { + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + } + if (src_type == id_WIRE_TYPE_PCSCLKDIV) { + int num = (src_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; + int group = 1-(src_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; + el.x1 = src.location.x + slice_x1 - 0.005f; + el.y1 = src.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; + } } void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, IdString dst_type, GfxTileWireId dst_id) @@ -988,6 +1025,44 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } el.y2 = dst.location.y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; } + if (dst_type == id_WIRE_TYPE_PLL) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_CLKI_PLL + 1); + } + if (dst_type == id_WIRE_TYPE_GSR) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JCLK_GSR + 1); + } + if (dst_type == id_WIRE_TYPE_JTAG) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; + } + if (dst_type == id_WIRE_TYPE_OSC) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; + } + if (dst_type == id_WIRE_TYPE_SED) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; + } + if (dst_type == id_WIRE_TYPE_DTR) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JSTARTPULSE_DTR + 1); + } + if (dst_type == id_WIRE_TYPE_EXTREF) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; + } + if (dst_type == id_WIRE_TYPE_DCU) { + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + } + if (dst_type == id_WIRE_TYPE_PCSCLKDIV) { + int num = (dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; + int group = 1-(dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; + el.x2 = dst.location.x + slice_x1 - 0.005f; + el.y2 = dst.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; + } } void straightLine(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, @@ -1286,6 +1361,20 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } + + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_PLL || dst_type == id_WIRE_TYPE_GSR || dst_type == id_WIRE_TYPE_JTAG || dst_type == id_WIRE_TYPE_OSC || + dst_type == id_WIRE_TYPE_SED || dst_type == id_WIRE_TYPE_DTR || dst_type == id_WIRE_TYPE_EXTREF || dst_type == id_WIRE_TYPE_DCU || + dst_type == id_WIRE_TYPE_PCSCLKDIV) && + (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + if (dst_type == id_WIRE_TYPE_NONE && (src_type == id_WIRE_TYPE_PLL || src_type == id_WIRE_TYPE_GSR || src_type == id_WIRE_TYPE_JTAG || src_type == id_WIRE_TYPE_OSC || + src_type == id_WIRE_TYPE_SED || src_type == id_WIRE_TYPE_DTR || src_type == id_WIRE_TYPE_EXTREF || src_type == id_WIRE_TYPE_DCU || + src_type == id_WIRE_TYPE_PCSCLKDIV) && + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_EBR || dst_type == id_WIRE_TYPE_MULT18 || dst_type == id_WIRE_TYPE_ALU54) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); -- cgit v1.2.3 From cce27e72f0baf70d3d65c4b7ebd8b0b9c4d177f7 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 16:29:25 +0100 Subject: lot more pips --- ecp5/gfx.cc | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 29c1b31f..625a7d7b 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -893,6 +893,30 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr el.x1 = src.location.x + slice_x1 - 0.005f; el.y1 = src.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; } + if (src_type == id_WIRE_TYPE_DQS) { + int num = (src_id - TILE_WIRE_DDRDEL_DQS); + if (src.location.x == 0) { + el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; + } else { + el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + } + el.y1 = src.location.y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); + } + if (src_type == id_WIRE_TYPE_DDRDLL) { + int num = (src_id - TILE_WIRE_DDRDEL_DDRDLL); + el.x1 = src.location.x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); + if (src.location.y == h - 1) { + el.y1 = src.location.y + 0.2 - 0.015f; + } else { + el.y1 = src.location.y + 0.8 + 0.015f; + } + } + if (src_type == id_WIRE_TYPE_CCLK) { + int num = (src_id - TILE_WIRE_JPADDI_CCLK); + el.x1 = src.location.x + slice_x1 + 0.0017f * (num + 1); + el.y1 = src.location.y + slice_y2 - 1*slice_pitch - 0.015f; + } + } void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, IdString dst_type, GfxTileWireId dst_id) @@ -1062,7 +1086,30 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, int group = 1-(dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; el.x2 = dst.location.x + slice_x1 - 0.005f; el.y2 = dst.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; - } + } + if (dst_type == id_WIRE_TYPE_DQS) { + int num = (dst_id - TILE_WIRE_DDRDEL_DQS); + if (dst.location.x == 0) { + el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; + } else { + el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + } + el.y2 = dst.location.y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); + } + if (dst_type == id_WIRE_TYPE_DDRDLL) { + int num = (dst_id - TILE_WIRE_DDRDEL_DDRDLL); + el.x2 = dst.location.x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); + if (dst.location.y == h - 1) { + el.y2 = dst.location.y + 0.2 - 0.015f; + } else { + el.y2 = dst.location.y + 0.8 + 0.015f; + } + } + if (dst_type == id_WIRE_TYPE_CCLK) { + int num = (dst_id - TILE_WIRE_JPADDI_CCLK); + el.x2 = dst.location.x + slice_x1 + 0.0017f * (num + 1); + el.y2 = dst.location.y + slice_y2 - 1*slice_pitch - 0.015f; + } } void straightLine(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, @@ -1361,16 +1408,16 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_PLL || dst_type == id_WIRE_TYPE_GSR || dst_type == id_WIRE_TYPE_JTAG || dst_type == id_WIRE_TYPE_OSC || dst_type == id_WIRE_TYPE_SED || dst_type == id_WIRE_TYPE_DTR || dst_type == id_WIRE_TYPE_EXTREF || dst_type == id_WIRE_TYPE_DCU || - dst_type == id_WIRE_TYPE_PCSCLKDIV) && + dst_type == id_WIRE_TYPE_PCSCLKDIV || dst_type == id_WIRE_TYPE_DDRDLL || dst_type == id_WIRE_TYPE_CCLK || dst_type == id_WIRE_TYPE_DQS) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (dst_type == id_WIRE_TYPE_NONE && (src_type == id_WIRE_TYPE_PLL || src_type == id_WIRE_TYPE_GSR || src_type == id_WIRE_TYPE_JTAG || src_type == id_WIRE_TYPE_OSC || src_type == id_WIRE_TYPE_SED || src_type == id_WIRE_TYPE_DTR || src_type == id_WIRE_TYPE_EXTREF || src_type == id_WIRE_TYPE_DCU || - src_type == id_WIRE_TYPE_PCSCLKDIV) && + src_type == id_WIRE_TYPE_PCSCLKDIV || src_type == id_WIRE_TYPE_DDRDLL || src_type == id_WIRE_TYPE_CCLK || src_type == id_WIRE_TYPE_DQS) && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } -- cgit v1.2.3 From fb27f1a031f0517158a07694b0495e239072b6ce Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 14 Dec 2019 16:40:27 +0100 Subject: fix formating --- ecp5/gfx.cc | 244 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 137 insertions(+), 107 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 625a7d7b..858ac5fb 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -70,8 +70,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.type = GraphicElement::TYPE_LINE; el.style = style; bool top_bottom = (y == 0 || y == (h - 1)); - int gap = 3-(tilewire - TILE_WIRE_PADDOD_PIO)/7; - int num = (tilewire - TILE_WIRE_PADDOD_PIO)%7; + int gap = 3 - (tilewire - TILE_WIRE_PADDOD_PIO) / 7; + int num = (tilewire - TILE_WIRE_PADDOD_PIO) % 7; if (top_bottom) { el.x1 = x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); el.x2 = el.x1; @@ -87,9 +87,9 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + 1 - io_cell_v_x1; el.x2 = el.x1 + 0.015f; } else { - el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; - } + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); el.y2 = el.y1; } @@ -118,7 +118,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS int num = (tilewire - TILE_WIRE_JPADDI_CCLK); el.x1 = x + slice_x1 + 0.0017f * (num + 1); el.x2 = el.x1; - el.y1 = y + slice_y2 - 1*slice_pitch; + el.y1 = y + slice_y2 - 1 * slice_pitch; el.y2 = el.y1 - 0.015f; g.push_back(el); } @@ -127,15 +127,15 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - int gap = 7-(tilewire - TILE_WIRE_JLOADND_IOLOGIC)/42; - int num = (tilewire - TILE_WIRE_JLOADND_IOLOGIC)%42; + int gap = 7 - (tilewire - TILE_WIRE_JLOADND_IOLOGIC) / 42; + int num = (tilewire - TILE_WIRE_JLOADND_IOLOGIC) % 42; if (x == 0) { el.x1 = x + 1 - io_cell_v_x1; el.x2 = el.x1 + 0.015f; } else { - el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; - } + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); el.y2 = el.y1; g.push_back(el); @@ -144,9 +144,9 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; - int gap = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC)/20; - int num = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC)%20; - el.x1 = x + io_cell_h_x1 + (5-gap) * 0.10 + 0.0017f * (num + 1); + int gap = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; + int num = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; + el.x1 = x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); el.x2 = el.x1; if (y == h - 1) { el.y1 = y + 1 - io_cell_h_y2; @@ -166,13 +166,13 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + 1 - io_cell_v_x1; el.x2 = el.x1 + 0.015f; } else { - el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; - } + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } el.y1 = y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); el.y2 = el.y1; g.push_back(el); - } + } if (wire_type == id_WIRE_TYPE_EBR) { GraphicElement el; @@ -200,7 +200,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.style = style; int num = (tilewire - TILE_WIRE_JCLK0_ALU54) % 225; int group = (tilewire - TILE_WIRE_JCLK0_ALU54) / 225; - if (group==0) { + if (group == 0) { el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; } else { @@ -280,7 +280,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; el.y2 = el.y1; g.push_back(el); - } + } if (wire_type == id_WIRE_TYPE_DCU) { GraphicElement el; @@ -291,11 +291,11 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; el.y2 = el.y1; g.push_back(el); - } + } if (wire_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; - int group = 1-(tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; + int group = 1 - (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; GraphicElement el; el.type = GraphicElement::TYPE_LINE; el.style = style; @@ -798,19 +798,19 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } } if (src_type == id_WIRE_TYPE_IOLOGIC) { - int gap = 7-(src_id - TILE_WIRE_JLOADND_IOLOGIC)/42; - int num = (src_id - TILE_WIRE_JLOADND_IOLOGIC)%42; + int gap = 7 - (src_id - TILE_WIRE_JLOADND_IOLOGIC) / 42; + int num = (src_id - TILE_WIRE_JLOADND_IOLOGIC) % 42; if (src.location.x == 0) { el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; } else { - el.x1 = src.location.x + io_cell_v_x1 - 0.015f; - } + el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + } el.y1 = src.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); } if (src_type == id_WIRE_TYPE_SIOLOGIC) { - int gap = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC)/20; - int num = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC)%20; - el.x1 = src.location.x + io_cell_h_x1 + (5-gap) * 0.10 + 0.0017f * (num + 1); + int gap = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; + int num = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; + el.x1 = src.location.x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); if (src.location.y == h - 1) { el.y1 = src.location.y + 1 - io_cell_h_y2 - 0.015f; } else { @@ -819,8 +819,8 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } if (src_type == id_WIRE_TYPE_PIO) { bool top_bottom = (src.location.y == 0 || src.location.y == (h - 1)); - int gap = 3-(src_id - TILE_WIRE_PADDOD_PIO)/7; - int num = (src_id - TILE_WIRE_PADDOD_PIO)%7; + int gap = 3 - (src_id - TILE_WIRE_PADDOD_PIO) / 7; + int num = (src_id - TILE_WIRE_PADDOD_PIO) % 7; if (top_bottom) { el.x1 = src.location.x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); if (src.location.y == h - 1) { @@ -832,8 +832,8 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr if (x == 0) { el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; } else { - el.x1 = src.location.x + io_cell_v_x1 - 0.015f; - } + el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + } el.y1 = src.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); } } @@ -848,7 +848,7 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr if (src_type == id_WIRE_TYPE_ALU54) { int num = (src_id - TILE_WIRE_JCLK0_ALU54) % 225; int group = (src_id - TILE_WIRE_JCLK0_ALU54) / 225; - if (group==0) { + if (group == 0) { el.x1 = src.location.x + slice_x1 - 0.005f; } else { el.x1 = src.location.x + 0.97 + 0.005f; @@ -882,14 +882,14 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr if (src_type == id_WIRE_TYPE_EXTREF) { el.x1 = src.location.x + slice_x1 - 0.005f; el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; - } + } if (src_type == id_WIRE_TYPE_DCU) { el.x1 = src.location.x + slice_x1 - 0.005f; el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; - } + } if (src_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (src_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; - int group = 1-(src_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; + int group = 1 - (src_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; el.x1 = src.location.x + slice_x1 - 0.005f; el.y1 = src.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; } @@ -898,10 +898,10 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr if (src.location.x == 0) { el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; } else { - el.x1 = src.location.x + io_cell_v_x1 - 0.015f; - } + el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + } el.y1 = src.location.y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); - } + } if (src_type == id_WIRE_TYPE_DDRDLL) { int num = (src_id - TILE_WIRE_DDRDEL_DDRDLL); el.x1 = src.location.x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); @@ -914,9 +914,8 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr if (src_type == id_WIRE_TYPE_CCLK) { int num = (src_id - TILE_WIRE_JPADDI_CCLK); el.x1 = src.location.x + slice_x1 + 0.0017f * (num + 1); - el.y1 = src.location.y + slice_y2 - 1*slice_pitch - 0.015f; + el.y1 = src.location.y + slice_y2 - 1 * slice_pitch - 0.015f; } - } void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, IdString dst_type, GfxTileWireId dst_id) @@ -992,19 +991,19 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } if (dst_type == id_WIRE_TYPE_IOLOGIC) { - int gap = 7-(dst_id - TILE_WIRE_JLOADND_IOLOGIC)/42; - int num = (dst_id - TILE_WIRE_JLOADND_IOLOGIC)%42; + int gap = 7 - (dst_id - TILE_WIRE_JLOADND_IOLOGIC) / 42; + int num = (dst_id - TILE_WIRE_JLOADND_IOLOGIC) % 42; if (dst.location.x == 0) { el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; } else { - el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; - } + el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + } el.y2 = dst.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); } if (dst_type == id_WIRE_TYPE_SIOLOGIC) { - int gap = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC)/20; - int num = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC)%20; - el.x2 = dst.location.x + io_cell_h_x1 + (5-gap) * 0.10 + 0.0017f * (num + 1); + int gap = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; + int num = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; + el.x2 = dst.location.x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); if (dst.location.y == h - 1) { el.y2 = dst.location.y + 1 - io_cell_h_y2 - 0.015f; } else { @@ -1013,8 +1012,8 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } if (dst_type == id_WIRE_TYPE_PIO) { bool top_bottom = (dst.location.y == 0 || dst.location.y == (h - 1)); - int gap = 3-(dst_id - TILE_WIRE_PADDOD_PIO)/7; - int num = (dst_id - TILE_WIRE_PADDOD_PIO)%7; + int gap = 3 - (dst_id - TILE_WIRE_PADDOD_PIO) / 7; + int num = (dst_id - TILE_WIRE_PADDOD_PIO) % 7; if (top_bottom) { el.x2 = dst.location.x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); if (dst.location.y == h - 1) { @@ -1026,8 +1025,8 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, if (x == 0) { el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; } else { - el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; - } + el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + } el.y2 = dst.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); } } @@ -1042,7 +1041,7 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, if (dst_type == id_WIRE_TYPE_ALU54) { int num = (dst_id - TILE_WIRE_JCLK0_ALU54) % 225; int group = (dst_id - TILE_WIRE_JCLK0_ALU54) / 225; - if (group==0) { + if (group == 0) { el.x2 = dst.location.x + slice_x1 - 0.005f; } else { el.x2 = dst.location.x + 0.97 + 0.005f; @@ -1076,14 +1075,14 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, if (dst_type == id_WIRE_TYPE_EXTREF) { el.x2 = dst.location.x + slice_x1 - 0.005f; el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; - } + } if (dst_type == id_WIRE_TYPE_DCU) { el.x2 = dst.location.x + slice_x1 - 0.005f; el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; - } + } if (dst_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; - int group = 1-(dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; + int group = 1 - (dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; el.x2 = dst.location.x + slice_x1 - 0.005f; el.y2 = dst.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; } @@ -1092,10 +1091,10 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, if (dst.location.x == 0) { el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; } else { - el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; - } + el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + } el.y2 = dst.location.y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); - } + } if (dst_type == id_WIRE_TYPE_DDRDLL) { int num = (dst_id - TILE_WIRE_DDRDEL_DDRDLL); el.x2 = dst.location.x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); @@ -1108,20 +1107,20 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, if (dst_type == id_WIRE_TYPE_CCLK) { int num = (dst_id - TILE_WIRE_JPADDI_CCLK); el.x2 = dst.location.x + slice_x1 + 0.0017f * (num + 1); - el.y2 = dst.location.y + slice_y2 - 1*slice_pitch - 0.015f; + el.y2 = dst.location.y + slice_y2 - 1 * slice_pitch - 0.015f; } } -void straightLine(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, - GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id) +void straightLine(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, + IdString src_type, GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id) { setSource(el, x, y, w, h, src, src_type, src_id); setDestination(el, x, y, w, h, dst, dst_type, dst_id); g.push_back(el); } -void toSameSideHor(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, - GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, +void toSameSideHor(std::vector &g, GraphicElement &el, 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, int idx) { int sign = (src_type == dst_type) ? 1 : -1; @@ -1145,8 +1144,8 @@ void toSameSideHor(std::vector &g, GraphicElement &el, int x, in g.push_back(el2); } -void toSameSideVer(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, - GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, +void toSameSideVer(std::vector &g, GraphicElement &el, 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, int idx) { int sign = (src_type == dst_type) ? 1 : -1; @@ -1170,8 +1169,8 @@ void toSameSideVer(std::vector &g, GraphicElement &el, int x, in g.push_back(el2); } -void toSameSideH1Ver(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, - GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, +void toSameSideH1Ver(std::vector &g, GraphicElement &el, 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, int idx) { setSource(el, x, y, w, h, src, src_type, src_id); @@ -1194,8 +1193,8 @@ void toSameSideH1Ver(std::vector &g, GraphicElement &el, int x, g.push_back(el2); } -void toSameSideH1Hor(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, - GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, +void toSameSideH1Hor(std::vector &g, GraphicElement &el, 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, int idx) { setSource(el, x, y, w, h, src, src_type, src_id); @@ -1220,8 +1219,8 @@ void toSameSideH1Hor(std::vector &g, GraphicElement &el, int x, g.push_back(el2); } -void toSameSideV1Ver(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, - GfxTileWireId src_id, WireId dst, IdString dst_type, GfxTileWireId dst_id, +void toSameSideV1Ver(std::vector &g, GraphicElement &el, 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, int idx) { setSource(el, x, y, w, h, src, src_type, src_id); @@ -1263,18 +1262,22 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire // To H01 if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H01) { - toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H01E0001); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_H01E0001); } // To H02 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H02) { - toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H02W0701); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H02) { - toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H02) { if (y == src.location.y) { @@ -1293,13 +1296,16 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire // To H06 if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_H06) { - toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_H06W0303); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H06) { - toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H02W0701); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_H02W0701); } if (src_type == id_WIRE_TYPE_H06 && dst_type == id_WIRE_TYPE_H06) { - toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_H06W0303); + toSameSideHor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_H06W0303); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_H06) { if (y == src.location.y) { @@ -1325,7 +1331,8 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire // To V01 if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V01) { - toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V01N0001); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_V01N0001); } // To V02 @@ -1344,13 +1351,16 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V02) { - toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V02N0701); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V02) { - toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_V06N0303); } // To V06 @@ -1366,13 +1376,16 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_V06) { - toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, dst_id - TILE_WIRE_V06N0303); + toSameSideH1Hor(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_V06N0303); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V02N0701); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_V02N0701); } if (src_type == id_WIRE_TYPE_V06 && dst_type == id_WIRE_TYPE_V06) { - toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_V06N0303); + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + src_id - TILE_WIRE_V06N0303); } if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && @@ -1381,7 +1394,8 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire } if (src_type == id_WIRE_TYPE_H00 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { - toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style , dst_id - TILE_WIRE_JCE0); + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_JCE0); } if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI)) { @@ -1389,64 +1403,80 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire } if (src_type == id_WIRE_TYPE_H01 && dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { - toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id,style, dst_id - TILE_WIRE_JCE0); + toSameSideH1Ver(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, + dst_id - TILE_WIRE_JCE0); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_NONE && - ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V00 && dst_type == id_WIRE_TYPE_NONE && - ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_NONE && - ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_NONE && - ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { + ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - - if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_PLL || dst_type == id_WIRE_TYPE_GSR || dst_type == id_WIRE_TYPE_JTAG || dst_type == id_WIRE_TYPE_OSC || - dst_type == id_WIRE_TYPE_SED || dst_type == id_WIRE_TYPE_DTR || dst_type == id_WIRE_TYPE_EXTREF || dst_type == id_WIRE_TYPE_DCU || - dst_type == id_WIRE_TYPE_PCSCLKDIV || dst_type == id_WIRE_TYPE_DDRDLL || dst_type == id_WIRE_TYPE_CCLK || dst_type == id_WIRE_TYPE_DQS) && + + if (src_type == id_WIRE_TYPE_NONE && + (dst_type == id_WIRE_TYPE_PLL || dst_type == id_WIRE_TYPE_GSR || dst_type == id_WIRE_TYPE_JTAG || + dst_type == id_WIRE_TYPE_OSC || dst_type == id_WIRE_TYPE_SED || dst_type == id_WIRE_TYPE_DTR || + dst_type == id_WIRE_TYPE_EXTREF || dst_type == id_WIRE_TYPE_DCU || dst_type == id_WIRE_TYPE_PCSCLKDIV || + dst_type == id_WIRE_TYPE_DDRDLL || dst_type == id_WIRE_TYPE_CCLK || dst_type == id_WIRE_TYPE_DQS) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (dst_type == id_WIRE_TYPE_NONE && (src_type == id_WIRE_TYPE_PLL || src_type == id_WIRE_TYPE_GSR || src_type == id_WIRE_TYPE_JTAG || src_type == id_WIRE_TYPE_OSC || - src_type == id_WIRE_TYPE_SED || src_type == id_WIRE_TYPE_DTR || src_type == id_WIRE_TYPE_EXTREF || src_type == id_WIRE_TYPE_DCU || - src_type == id_WIRE_TYPE_PCSCLKDIV || src_type == id_WIRE_TYPE_DDRDLL || src_type == id_WIRE_TYPE_CCLK || src_type == id_WIRE_TYPE_DQS) && + if (dst_type == id_WIRE_TYPE_NONE && + (src_type == id_WIRE_TYPE_PLL || src_type == id_WIRE_TYPE_GSR || src_type == id_WIRE_TYPE_JTAG || + src_type == id_WIRE_TYPE_OSC || src_type == id_WIRE_TYPE_SED || src_type == id_WIRE_TYPE_DTR || + src_type == id_WIRE_TYPE_EXTREF || src_type == id_WIRE_TYPE_DCU || src_type == id_WIRE_TYPE_PCSCLKDIV || + src_type == id_WIRE_TYPE_DDRDLL || src_type == id_WIRE_TYPE_CCLK || src_type == id_WIRE_TYPE_DQS) && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_EBR || dst_type == id_WIRE_TYPE_MULT18 || dst_type == id_WIRE_TYPE_ALU54) && + if (src_type == id_WIRE_TYPE_NONE && + (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_EBR || + dst_type == id_WIRE_TYPE_MULT18 || dst_type == id_WIRE_TYPE_ALU54) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (dst_type == id_WIRE_TYPE_NONE && (src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_EBR || src_type == id_WIRE_TYPE_MULT18 || src_type == id_WIRE_TYPE_ALU54) && + if (dst_type == id_WIRE_TYPE_NONE && + (src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_EBR || + src_type == id_WIRE_TYPE_MULT18 || src_type == id_WIRE_TYPE_ALU54) && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_PIO) && + if (src_type == id_WIRE_TYPE_NONE && + (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_PIO) && (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (dst_type == id_WIRE_TYPE_NONE && (src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_PIO) && + if (dst_type == id_WIRE_TYPE_NONE && + (src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_PIO) && (dst_id >= TILE_WIRE_JDIA && dst_id <= TILE_WIRE_ECLKD)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_NONE && dst_type == id_WIRE_TYPE_NONE && - (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD) && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { + (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD) && + (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (dst_type == id_WIRE_TYPE_NONE && src_type == id_WIRE_TYPE_NONE && - (dst_id >= TILE_WIRE_JDIA && dst_id <= TILE_WIRE_ECLKD) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { + (dst_id >= TILE_WIRE_JDIA && dst_id <= TILE_WIRE_ECLKD) && + (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 436260e47ee89879193fb42614b76ac5a5880f3b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 09:21:58 +0100 Subject: move bel creation to gfx.cc --- ecp5/gfx.cc | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 858ac5fb..6245bd24 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -22,6 +22,103 @@ NEXTPNR_NAMESPACE_BEGIN +void gfxTileBel(std::vector &g, int x, int y, int z, int w, int h, IdString bel_type, + GraphicElement::style_t style) +{ + GraphicElement el; + el.type = GraphicElement::TYPE_BOX; + el.style = style; + if (bel_type == id_TRELLIS_SLICE) { + el.x1 = x + slice_x1; + el.x2 = x + slice_x2; + el.y1 = y + slice_y1 + (z)*slice_pitch; + el.y2 = y + slice_y2 + (z)*slice_pitch; + g.push_back(el); + + el.style = GraphicElement::STYLE_FRAME; + el.x1 = x + slice_x2 + 0.0255f; + el.x2 = el.x1 + 0.0017f; + el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + z * 26) + + 3 * slice_pitch - 0.0007f; + el.y2 = el.y1 + 0.0017f * 5; + g.push_back(el); + } else if (bel_type == id_TRELLIS_IO || bel_type == id_IOLOGIC || bel_type == id_SIOLOGIC || + bel_type == id_DQSBUFM) { + bool top_bottom = (y == 0 || y == (h - 1)); + if (top_bottom) { + el.x1 = x + io_cell_h_x1 + (z + 2) * 0.10; + el.x2 = x + io_cell_h_x1 + (z + 2) * 0.10 + 0.08f; + if (y == h - 1) { + el.y1 = y + 1 - io_cell_h_y1; + el.y2 = y + 1 - io_cell_h_y2; + } else { + el.y1 = y + io_cell_h_y1; + el.y2 = y + io_cell_h_y2; + } + } else { + if (x == 0) { + el.x1 = x + 1 - io_cell_v_x1; + el.x2 = x + 1 - io_cell_v_x2; + } else { + el.x1 = x + io_cell_v_x1; + el.x2 = x + io_cell_v_x2; + } + el.y1 = y + io_cell_v_y1 + z * 0.10; + el.y2 = y + io_cell_v_y1 + z * 0.10 + 0.08f; + } + g.push_back(el); + } else if (bel_type == id_DCCA) { + el.x1 = x + switchbox_x1 + (z)*0.025; + el.y1 = y + 0.14; + el.x2 = x + switchbox_x1 + (z)*0.025 + 0.020; + el.y2 = y + 0.18; + g.push_back(el); + } else if (bel_type == id_DP16KD || bel_type == id_MULT18X18D || bel_type == id_ALU54B) { + el.x1 = x + slice_x1; + el.x2 = x + 0.97; + el.y1 = y + slice_y1 - 1 * slice_pitch; + el.y2 = y + slice_y2 + 3 * slice_pitch; + g.push_back(el); + } else if (bel_type == id_EHXPLLL) { + el.x1 = x + slice_x1; + el.x2 = x + 0.97; + el.y1 = y + slice_y1; + el.y2 = y + slice_y2; + g.push_back(el); + } else if (bel_type == id_DCUA) { + el.x1 = x + slice_x1; + el.x2 = x + 0.97; + el.y1 = y + slice_y2; + el.y2 = y + 0.25; + g.push_back(el); + } else if (bel_type == id_EXTREFB || bel_type == id_PCSCLKDIV || bel_type == id_DTR || bel_type == id_USRMCLK) { + el.x1 = x + slice_x1; + el.x2 = x + 0.97; + el.y1 = y + slice_y1 + (z)*slice_pitch; + el.y2 = y + slice_y2 + (z)*slice_pitch; + g.push_back(el); + } else if (bel_type == id_SEDGA || bel_type == id_GSR || bel_type == id_JTAGG || bel_type == id_OSCG) { + el.x1 = x + slice_x1; + el.x2 = x + 0.97; + el.y1 = y + slice_y1 + (z)*slice_pitch; + el.y2 = y + slice_y2 + (z)*slice_pitch; + g.push_back(el); + } else if (bel_type == id_DDRDLL) { + el.x1 = x + 0.2; + el.x2 = x + 0.8; + el.y1 = y + 0.2; + el.y2 = y + 0.8; + g.push_back(el); + } else if (bel_type == id_DLLDELD || bel_type == id_CLKDIVF || bel_type == id_ECLKSYNCB || + bel_type == id_TRELLIS_ECLKBUF || bel_type == id_ECLKBRIDGECS) { + el.x1 = x + 0.1 + z * 0.05; + el.x2 = x + 0.14 + z * 0.05; + el.y1 = y + 0.475; + el.y2 = y + 0.525; + g.push_back(el); + } +} + void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style) { -- cgit v1.2.3 From fa55a826b240d2e5cd6cbfe412cb1f9d5ee82e3e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 09:26:25 +0100 Subject: cleanup wire --- ecp5/gfx.cc | 113 ++---------------------------------------------------------- 1 file changed, 3 insertions(+), 110 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 6245bd24..32b4945d 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -122,10 +122,10 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire, GraphicElement::style_t style) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = 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; @@ -163,9 +163,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } } if (wire_type == id_WIRE_TYPE_PIO) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; bool top_bottom = (y == 0 || y == (h - 1)); int gap = 3 - (tilewire - TILE_WIRE_PADDOD_PIO) / 7; int num = (tilewire - TILE_WIRE_PADDOD_PIO) % 7; @@ -193,9 +190,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_DDRDLL) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; int num = (tilewire - TILE_WIRE_DDRDEL_DDRDLL); el.x1 = x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); el.x2 = el.x1; @@ -209,9 +203,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_CCLK) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; int num = (tilewire - TILE_WIRE_JPADDI_CCLK); el.x1 = x + slice_x1 + 0.0017f * (num + 1); el.x2 = el.x1; @@ -221,9 +212,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (wire_type == id_WIRE_TYPE_IOLOGIC) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; int gap = 7 - (tilewire - TILE_WIRE_JLOADND_IOLOGIC) / 42; int num = (tilewire - TILE_WIRE_JLOADND_IOLOGIC) % 42; if (x == 0) { @@ -238,9 +226,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_SIOLOGIC) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; int gap = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; int num = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; el.x1 = x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); @@ -255,9 +240,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_DQS) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; int num = (tilewire - TILE_WIRE_DDRDEL_DQS); if (x == 0) { el.x1 = x + 1 - io_cell_v_x1; @@ -272,9 +254,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (wire_type == id_WIRE_TYPE_EBR) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; @@ -282,9 +261,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_MULT18) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; @@ -292,9 +268,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_ALU54) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; int num = (tilewire - TILE_WIRE_JCLK0_ALU54) % 225; int group = (tilewire - TILE_WIRE_JCLK0_ALU54) / 225; if (group == 0) { @@ -309,9 +282,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_PLL) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLKI_PLL + 1); @@ -319,9 +289,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_GSR) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCLK_GSR + 1); @@ -329,9 +296,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_JTAG) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; @@ -339,9 +303,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_OSC) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; @@ -349,9 +310,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_SED) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; @@ -359,9 +317,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_DTR) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JSTARTPULSE_DTR + 1); @@ -369,33 +324,22 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_EXTREF) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; el.y2 = el.y1; g.push_back(el); } - if (wire_type == id_WIRE_TYPE_DCU) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; el.y2 = el.y1; g.push_back(el); } - if (wire_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; int group = 1 - (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + slice_x1 - 0.005f; el.x2 = x + slice_x1; el.y1 = y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; @@ -405,9 +349,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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; if (y == h - 2) @@ -425,9 +366,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } 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; if (x == w - 1) el.x1 = x + 0.1; else @@ -443,9 +381,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } 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) { @@ -459,9 +394,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } 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; @@ -476,9 +408,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (wire_type == id_WIRE_TYPE_H02) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; if (x == 0) el.x1 = 0.9; else @@ -522,9 +451,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (wire_type == id_WIRE_TYPE_V02) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; if (y == 0) el.y1 = 0.9; else @@ -568,9 +494,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (wire_type == id_WIRE_TYPE_H06) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; if (x == 0) el.x1 = 0.9; else @@ -613,9 +536,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } if (wire_type == id_WIRE_TYPE_V06) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; if (y == 0) el.y1 = 0.9; else @@ -659,9 +579,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } 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) { @@ -674,9 +591,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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) { @@ -689,9 +603,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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; @@ -724,9 +635,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (tilewire >= TILE_WIRE_JDIA && tilewire <= TILE_WIRE_ECLKD) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + 0.5f; el.x2 = x + 0.5f + 0.005f; bool top = (y == (h - 1)); @@ -739,9 +647,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (tilewire >= TILE_WIRE_JCE0 && tilewire <= TILE_WIRE_JQ7) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = style; el.x1 = x + switchbox_x2; el.x2 = x + switchbox_x2 + 0.005f; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; @@ -751,9 +656,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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; @@ -764,9 +666,6 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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) + @@ -776,11 +675,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } 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) + @@ -798,10 +694,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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) + -- cgit v1.2.3 From 3d42097e9d5ba0d2811a70718c5e9e3a357f8c50 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 09:45:09 +0100 Subject: cleanup --- ecp5/gfx.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 32b4945d..9afca7d6 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -38,7 +38,7 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int el.style = GraphicElement::STYLE_FRAME; el.x1 = x + slice_x2 + 0.0255f; el.x2 = el.x1 + 0.0017f; - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + z * 26) + + el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + (3-z) * 26) + 3 * slice_pitch - 0.0007f; el.y2 = el.y1 + 0.0017f * 5; g.push_back(el); @@ -91,13 +91,8 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int el.y1 = y + slice_y2; el.y2 = y + 0.25; g.push_back(el); - } else if (bel_type == id_EXTREFB || bel_type == id_PCSCLKDIV || bel_type == id_DTR || bel_type == id_USRMCLK) { - el.x1 = x + slice_x1; - el.x2 = x + 0.97; - el.y1 = y + slice_y1 + (z)*slice_pitch; - el.y2 = y + slice_y2 + (z)*slice_pitch; - g.push_back(el); - } else if (bel_type == id_SEDGA || bel_type == id_GSR || bel_type == id_JTAGG || bel_type == id_OSCG) { + } else if (bel_type == id_EXTREFB || bel_type == id_PCSCLKDIV || bel_type == id_DTR || bel_type == id_USRMCLK || + bel_type == id_SEDGA || bel_type == id_GSR || bel_type == id_JTAGG || bel_type == id_OSCG) { el.x1 = x + slice_x1; el.x2 = x + 0.97; el.y1 = y + slice_y1 + (z)*slice_pitch; @@ -132,7 +127,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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; + el.y2 = el.y1; g.push_back(el); // FX to F connection - top if (item == (TILE_WIRE_FXD_SLICE - TILE_WIRE_FCO_SLICE)) { @@ -158,7 +153,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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; + el.y2 = el.y1; g.push_back(el); } } @@ -650,7 +645,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + switchbox_x2; el.x2 = x + switchbox_x2 + 0.005f; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; - el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + el.y2 = el.y1; g.push_back(el); } @@ -659,7 +654,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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; + el.y2 = el.y1; g.push_back(el); } -- cgit v1.2.3 From bbc05f31133a335af39476bed917e0318a1cffcd Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 10:07:55 +0100 Subject: optimize and add some missing pips --- ecp5/gfx.cc | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 9afca7d6..706648d6 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -769,6 +769,11 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr el.y1 = y + switchbox_y1 + 0.0017f * (96 + (src_id - TILE_WIRE_V06N0303) + 10 * (src.location.y % 9)); } if (src_type == id_WIRE_TYPE_NONE) { + if (src_id >= TILE_WIRE_FCO && src_id <= TILE_WIRE_FCI) { + int gap = (src_id - TILE_WIRE_FCO) / 24; + el.x1 = src.location.x + switchbox_x2; + el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; + } if (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7) { el.x1 = src.location.x + switchbox_x2 + 0.005f; el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; @@ -1392,24 +1397,16 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire dst_id - TILE_WIRE_JCE0); } - if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_NONE && - ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || - (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { - straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); - } - if (src_type == id_WIRE_TYPE_V00 && dst_type == id_WIRE_TYPE_NONE && - ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || - (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { - straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); - } - if (src_type == id_WIRE_TYPE_V01 && dst_type == id_WIRE_TYPE_NONE && + if ((src_type == id_WIRE_TYPE_H02 || src_type == id_WIRE_TYPE_V00 || src_type == id_WIRE_TYPE_V01 || src_type == id_WIRE_TYPE_V02) + && dst_type == id_WIRE_TYPE_NONE && ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_NONE && - ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || - (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { + if ((dst_type == id_WIRE_TYPE_H02 || dst_type == id_WIRE_TYPE_V00 || dst_type == id_WIRE_TYPE_V01 || dst_type == id_WIRE_TYPE_V02) + && src_type == id_WIRE_TYPE_NONE && + ((src_id >= TILE_WIRE_FCO && src_id <= TILE_WIRE_FCI) || + (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } @@ -1417,7 +1414,9 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire (dst_type == id_WIRE_TYPE_PLL || dst_type == id_WIRE_TYPE_GSR || dst_type == id_WIRE_TYPE_JTAG || dst_type == id_WIRE_TYPE_OSC || dst_type == id_WIRE_TYPE_SED || dst_type == id_WIRE_TYPE_DTR || dst_type == id_WIRE_TYPE_EXTREF || dst_type == id_WIRE_TYPE_DCU || dst_type == id_WIRE_TYPE_PCSCLKDIV || - dst_type == id_WIRE_TYPE_DDRDLL || dst_type == id_WIRE_TYPE_CCLK || dst_type == id_WIRE_TYPE_DQS) && + dst_type == id_WIRE_TYPE_DDRDLL || dst_type == id_WIRE_TYPE_CCLK || dst_type == id_WIRE_TYPE_DQS || + dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_EBR || + dst_type == id_WIRE_TYPE_MULT18 || dst_type == id_WIRE_TYPE_ALU54) && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } @@ -1425,23 +1424,13 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire (src_type == id_WIRE_TYPE_PLL || src_type == id_WIRE_TYPE_GSR || src_type == id_WIRE_TYPE_JTAG || src_type == id_WIRE_TYPE_OSC || src_type == id_WIRE_TYPE_SED || src_type == id_WIRE_TYPE_DTR || src_type == id_WIRE_TYPE_EXTREF || src_type == id_WIRE_TYPE_DCU || src_type == id_WIRE_TYPE_PCSCLKDIV || - src_type == id_WIRE_TYPE_DDRDLL || src_type == id_WIRE_TYPE_CCLK || src_type == id_WIRE_TYPE_DQS) && - (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { - straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); - } - - if (src_type == id_WIRE_TYPE_NONE && - (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_EBR || - dst_type == id_WIRE_TYPE_MULT18 || dst_type == id_WIRE_TYPE_ALU54) && - (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { - straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); - } - if (dst_type == id_WIRE_TYPE_NONE && - (src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_EBR || + src_type == id_WIRE_TYPE_DDRDLL || src_type == id_WIRE_TYPE_CCLK || src_type == id_WIRE_TYPE_DQS || + src_type == id_WIRE_TYPE_IOLOGIC || src_type == id_WIRE_TYPE_SIOLOGIC || src_type == id_WIRE_TYPE_EBR || src_type == id_WIRE_TYPE_MULT18 || src_type == id_WIRE_TYPE_ALU54) && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_IOLOGIC || dst_type == id_WIRE_TYPE_SIOLOGIC || dst_type == id_WIRE_TYPE_PIO) && (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD)) { -- cgit v1.2.3 From 2872b500e3c4a7c627483a1a83b7c0698b2df8cc Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 10:33:12 +0100 Subject: make it more simetric --- ecp5/gfx.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 706648d6..5f2aead4 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -344,7 +344,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (wire_type == id_WIRE_TYPE_V01) { if (tilewire >= TILE_WIRE_V01N0001 && tilewire <= TILE_WIRE_V01S0100) { - el.x1 = x + switchbox_x2 - 0.0017f * 16 + 0.0017f * (tilewire - TILE_WIRE_V01N0001); + el.x1 = x + switchbox_x1 + 0.0017f * (10 + tilewire - TILE_WIRE_V01N0001); el.x2 = el.x1; if (y == h - 2) el.y1 = y + 1.1; @@ -369,7 +369,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x2 = x - 0.1; else el.x2 = x + switchbox_x2 - 1; - el.y1 = y + switchbox_y1 + 0.0017f * 16 - 0.0017f * (tilewire - TILE_WIRE_H01E0001); + el.y1 = y + switchbox_y1 + 0.0017f * (10 + tilewire - TILE_WIRE_H01E0001); el.y2 = el.y1; g.push_back(el); } @@ -406,7 +406,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (x == 0) el.x1 = 0.9; else - el.x1 = x + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x1 = x + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.x2 = el.x1; el.y1 = y + switchbox_y1; el.y2 = y + switchbox_y1 - 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); @@ -416,7 +416,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (x == w - 2) el.x2 = x + 1 + 0.1; else - el.x2 = x + 1 + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x2 = x + 1 + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.y1 = el.y2; if (x != w - 1) g.push_back(el); @@ -429,11 +429,11 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (x == w - 1) el.x1 = x + 0.1; else - el.x1 = x + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x1 = x + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); if (x == 1) el.x2 = x - 1 + 0.9; else - el.x2 = x - 1 + switchbox_x1 + 0.0017f * (16 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x2 = x - 1 + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.y2 = y + switchbox_y1 - 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.y1 = el.y2; if (x != 0) @@ -628,7 +628,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } } } - + + // TRELLIS_IO wires if (tilewire >= TILE_WIRE_JDIA && tilewire <= TILE_WIRE_ECLKD) { el.x1 = x + 0.5f; el.x2 = x + 0.5f + 0.005f; @@ -734,10 +735,10 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr el.x1 = x + switchbox_x1; else el.x1 = x + switchbox_x2; - el.y1 = y + switchbox_y1 + 0.0017f * 16 - 0.0017f * (src_id - TILE_WIRE_H01E0001); + el.y1 = y + switchbox_y1 + 0.0017f * (10 + src_id - TILE_WIRE_H01E0001); } if (src_type == id_WIRE_TYPE_H02) { - el.x1 = x + switchbox_x1 + 0.0017f * (16 + (src_id - TILE_WIRE_H02W0701) + 20 * (src.location.x % 3)); + el.x1 = x + switchbox_x1 + 0.0017f * (20 + (src_id - TILE_WIRE_H02W0701) + 20 * (src.location.x % 3)); el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_H06) { @@ -754,7 +755,7 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } } if (src_type == id_WIRE_TYPE_V01) { - el.x1 = x + switchbox_x2 - 0.0017f * 16 + 0.0017f * (src_id - TILE_WIRE_V01N0001); + el.x1 = x + switchbox_x1 + 0.0017f * (10 + src_id - TILE_WIRE_V01N0001); if (y == src.location.y) el.y1 = y + switchbox_y2; else @@ -925,10 +926,10 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, el.x2 = x + switchbox_x1; else el.x2 = x + switchbox_x2; - el.y2 = y + switchbox_y1 + 0.0017f * 16 - 0.0017f * (dst_id - TILE_WIRE_H01E0001); + el.y2 = y + switchbox_y1 + 0.0017f * (10 + dst_id - TILE_WIRE_H01E0001); } if (dst_type == id_WIRE_TYPE_H02) { - el.x2 = x + switchbox_x1 + 0.0017f * (16 + (dst_id - TILE_WIRE_H02W0701) + 20 * (dst.location.x % 3)); + el.x2 = x + switchbox_x1 + 0.0017f * (20 + (dst_id - TILE_WIRE_H02W0701) + 20 * (dst.location.x % 3)); el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_H06) { @@ -945,7 +946,7 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } } if (dst_type == id_WIRE_TYPE_V01) { - el.x2 = x + switchbox_x2 - 0.0017f * 16 + 0.0017f * (dst_id - TILE_WIRE_V01N0001); + el.x2 = x + switchbox_x1 + 0.0017f * (10 + dst_id - TILE_WIRE_V01N0001); if (y == dst.location.y) el.y2 = y + switchbox_y2; else -- cgit v1.2.3 From f2b8e347a99b1aac348e4c12a4b0ddeb25118a21 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 10:43:30 +0100 Subject: cleanup and formating --- ecp5/gfx.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 5f2aead4..68a3ff7d 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -23,7 +23,7 @@ NEXTPNR_NAMESPACE_BEGIN void gfxTileBel(std::vector &g, int x, int y, int z, int w, int h, IdString bel_type, - GraphicElement::style_t style) + GraphicElement::style_t style) { GraphicElement el; el.type = GraphicElement::TYPE_BOX; @@ -34,16 +34,16 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int el.y1 = y + slice_y1 + (z)*slice_pitch; el.y2 = y + slice_y2 + (z)*slice_pitch; g.push_back(el); - + el.style = GraphicElement::STYLE_FRAME; el.x1 = x + slice_x2 + 0.0255f; el.x2 = el.x1 + 0.0017f; - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + (3-z) * 26) + + el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + (3 - z) * 26) + 3 * slice_pitch - 0.0007f; el.y2 = el.y1 + 0.0017f * 5; g.push_back(el); } else if (bel_type == id_TRELLIS_IO || bel_type == id_IOLOGIC || bel_type == id_SIOLOGIC || - bel_type == id_DQSBUFM) { + bel_type == id_DQSBUFM) { bool top_bottom = (y == 0 || y == (h - 1)); if (top_bottom) { el.x1 = x + io_cell_h_x1 + (z + 2) * 0.10; @@ -105,7 +105,7 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int el.y2 = y + 0.8; g.push_back(el); } else if (bel_type == id_DLLDELD || bel_type == id_CLKDIVF || bel_type == id_ECLKSYNCB || - bel_type == id_TRELLIS_ECLKBUF || bel_type == id_ECLKBRIDGECS) { + bel_type == id_TRELLIS_ECLKBUF || bel_type == id_ECLKBRIDGECS) { el.x1 = x + 0.1 + z * 0.05; el.x2 = x + 0.14 + z * 0.05; el.y1 = y + 0.475; @@ -628,7 +628,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } } } - + // TRELLIS_IO wires if (tilewire >= TILE_WIRE_JDIA && tilewire <= TILE_WIRE_ECLKD) { el.x1 = x + 0.5f; @@ -1247,7 +1247,6 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire dst_id - TILE_WIRE_H00L0000 + 30); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_H00) { - // toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_H00L0000); straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } @@ -1312,7 +1311,6 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire // To V00 if (src_type == id_WIRE_TYPE_V02 && dst_type == id_WIRE_TYPE_V00) { - // toSameSideH1Hor(g,el,x,y,src,src_type,src_id,dst,dst_type,dst_id,style, dst_id - TILE_WIRE_V00T0000); straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } if (src_type == id_WIRE_TYPE_H02 && dst_type == id_WIRE_TYPE_V00) { @@ -1398,14 +1396,16 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire dst_id - TILE_WIRE_JCE0); } - if ((src_type == id_WIRE_TYPE_H02 || src_type == id_WIRE_TYPE_V00 || src_type == id_WIRE_TYPE_V01 || src_type == id_WIRE_TYPE_V02) - && dst_type == id_WIRE_TYPE_NONE && + if ((src_type == id_WIRE_TYPE_H02 || src_type == id_WIRE_TYPE_V00 || src_type == id_WIRE_TYPE_V01 || + src_type == id_WIRE_TYPE_V02) && + dst_type == id_WIRE_TYPE_NONE && ((dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) || (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } - if ((dst_type == id_WIRE_TYPE_H02 || dst_type == id_WIRE_TYPE_V00 || dst_type == id_WIRE_TYPE_V01 || dst_type == id_WIRE_TYPE_V02) - && src_type == id_WIRE_TYPE_NONE && + if ((dst_type == id_WIRE_TYPE_H02 || dst_type == id_WIRE_TYPE_V00 || dst_type == id_WIRE_TYPE_V01 || + dst_type == id_WIRE_TYPE_V02) && + src_type == id_WIRE_TYPE_NONE && ((src_id >= TILE_WIRE_FCO && src_id <= TILE_WIRE_FCI) || (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7))) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); -- cgit v1.2.3 From d5174110fa49a18be8507a0edf246ada3de41627 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 10:57:24 +0100 Subject: more pips on connection box --- ecp5/gfx.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 68a3ff7d..1560bdf5 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -1411,6 +1411,15 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } + if (dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) && + src_type == id_WIRE_TYPE_NONE && (src_id >= TILE_WIRE_FCO && src_id <= TILE_WIRE_FCI)) { + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_FCO); + } + if (dst_type == id_WIRE_TYPE_NONE && (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JCE0) && + src_type == id_WIRE_TYPE_NONE && (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JCE0)) { + toSameSideVer(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id, style, src_id - TILE_WIRE_JCE0); + } + if (src_type == id_WIRE_TYPE_NONE && (dst_type == id_WIRE_TYPE_PLL || dst_type == id_WIRE_TYPE_GSR || dst_type == id_WIRE_TYPE_JTAG || dst_type == id_WIRE_TYPE_OSC || dst_type == id_WIRE_TYPE_SED || dst_type == id_WIRE_TYPE_DTR || -- cgit v1.2.3 From b271e5947273656a3fb0d3b173f6dbce856fbb52 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 15 Dec 2019 17:20:48 +0100 Subject: Add global wires --- ecp5/gfx.cc | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 1560bdf5..ea1a5a10 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -716,6 +716,39 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } } + if (wire_type == id_WIRE_TYPE_G_HPBX) { + el.x1 = x; + el.x2 = x + 1; + el.y1 = y + 0.1f + 0.0017f * (tilewire - TILE_WIRE_G_HPBX0000 + 1); + el.y2 = el.y1; + g.push_back(el); + + el.x1 = x + switchbox_x1 + 0.0017f * (200 + (tilewire - TILE_WIRE_G_HPBX0000)); + el.x2 = el.x1; + el.y2 = y + switchbox_y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_G_VPTX) { + el.x1 = x + 0.1f + 0.0017f * (tilewire - TILE_WIRE_G_VPTX0000 + 1); + el.x2 = el.x1; + el.y1 = y; + el.y2 = y + 1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_L_HPBX) { + el.x1 = x - 3; + el.x2 = x + 0.08f; + el.y1 = y + 0.0017f + 0.0017f * (tilewire - TILE_WIRE_L_HPBX0000 + 1); + el.y2 = el.y1; + g.push_back(el); + } + if (wire_type == id_WIRE_TYPE_R_HPBX) { + el.x1 = x + 0.2; + el.x2 = x + 3; + el.y1 = y + 0.0017f + 0.0017f * (tilewire - TILE_WIRE_R_HPBX0000 + 1); + el.y2 = el.y1; + g.push_back(el); + } } void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdString src_type, GfxTileWireId src_id) @@ -770,6 +803,10 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr el.y1 = y + switchbox_y1 + 0.0017f * (96 + (src_id - TILE_WIRE_V06N0303) + 10 * (src.location.y % 9)); } if (src_type == id_WIRE_TYPE_NONE) { + if (src_id >= TILE_WIRE_CLK0 && src_id <= TILE_WIRE_LSR1) { + el.x1 = x + switchbox_x2; + el.y1 = y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_CLK0 - 5) + 3 * slice_pitch; + } if (src_id >= TILE_WIRE_FCO && src_id <= TILE_WIRE_FCI) { int gap = (src_id - TILE_WIRE_FCO) / 24; el.x1 = src.location.x + switchbox_x2; @@ -907,6 +944,10 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr el.x1 = src.location.x + slice_x1 + 0.0017f * (num + 1); el.y1 = src.location.y + slice_y2 - 1 * slice_pitch - 0.015f; } + if (src_type == id_WIRE_TYPE_G_HPBX) { + el.x1 = x + switchbox_x1 + 0.0017f * (200 + (src_id - TILE_WIRE_G_HPBX0000)); + el.y1 = y + switchbox_y1; + } } void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, IdString dst_type, GfxTileWireId dst_id) @@ -962,6 +1003,10 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } if (dst_type == id_WIRE_TYPE_NONE) { + if (dst_id >= TILE_WIRE_CLK0 && dst_id <= TILE_WIRE_LSR1) { + el.x2 = x + switchbox_x2; + el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_CLK0 - 5) + 3 * slice_pitch; + } if (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) { int gap = (dst_id - TILE_WIRE_FCO) / 24; el.x2 = x + switchbox_x2; @@ -1100,6 +1145,10 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, el.x2 = dst.location.x + slice_x1 + 0.0017f * (num + 1); el.y2 = dst.location.y + slice_y2 - 1 * slice_pitch - 0.015f; } + if (dst_type == id_WIRE_TYPE_G_HPBX) { + el.x2 = x + switchbox_x1 + 0.0017f * (200 + (dst_id - TILE_WIRE_G_HPBX0000)); + el.y2 = y + switchbox_y1; + } } void straightLine(std::vector &g, GraphicElement &el, int x, int y, int w, int h, WireId src, @@ -1461,6 +1510,15 @@ void gfxTilePip(std::vector &g, int x, int y, int w, int h, Wire (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7)) { straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); } + + if (dst_type == id_WIRE_TYPE_NONE && src_type == id_WIRE_TYPE_G_HPBX && + ((dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7) || + (dst_id >= TILE_WIRE_CLK0 && dst_id <= TILE_WIRE_FCI))) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } + if ((dst_type == id_WIRE_TYPE_H01 || dst_type == id_WIRE_TYPE_V01) && src_type == id_WIRE_TYPE_G_HPBX) { + straightLine(g, el, x, y, w, h, src, src_type, src_id, dst, dst_type, dst_id); + } } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From a05954249a46f87a218aad7db6db28f2a02444ec Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 20 Dec 2019 14:02:00 +0100 Subject: optimize and set order --- ecp5/gfx.cc | 512 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 236 insertions(+), 276 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index ea1a5a10..884388a8 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -156,253 +156,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y2 = el.y1; g.push_back(el); } - } - if (wire_type == id_WIRE_TYPE_PIO) { - bool top_bottom = (y == 0 || y == (h - 1)); - int gap = 3 - (tilewire - TILE_WIRE_PADDOD_PIO) / 7; - int num = (tilewire - TILE_WIRE_PADDOD_PIO) % 7; - if (top_bottom) { - el.x1 = x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); - el.x2 = el.x1; - if (y == h - 1) { - el.y1 = y + 1 - io_cell_h_y2; - el.y2 = el.y1 - 0.015f; - } else { - el.y1 = y + io_cell_h_y2; - el.y2 = el.y1 + 0.015f; - } - } else { - if (x == 0) { - el.x1 = x + 1 - io_cell_v_x1; - el.x2 = el.x1 + 0.015f; - } else { - el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; - } - el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); - el.y2 = el.y1; - } - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_DDRDLL) { - int num = (tilewire - TILE_WIRE_DDRDEL_DDRDLL); - el.x1 = x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); - el.x2 = el.x1; - if (y == h - 1) { - el.y1 = y + 0.2; - el.y2 = el.y1 - 0.015f; - } else { - el.y1 = y + 0.8; - el.y2 = el.y1 + 0.015f; - } - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_CCLK) { - int num = (tilewire - TILE_WIRE_JPADDI_CCLK); - el.x1 = x + slice_x1 + 0.0017f * (num + 1); - el.x2 = el.x1; - el.y1 = y + slice_y2 - 1 * slice_pitch; - el.y2 = el.y1 - 0.015f; - g.push_back(el); - } - - if (wire_type == id_WIRE_TYPE_IOLOGIC) { - int gap = 7 - (tilewire - TILE_WIRE_JLOADND_IOLOGIC) / 42; - int num = (tilewire - TILE_WIRE_JLOADND_IOLOGIC) % 42; - if (x == 0) { - el.x1 = x + 1 - io_cell_v_x1; - el.x2 = el.x1 + 0.015f; - } else { - el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; - } - el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_SIOLOGIC) { - int gap = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; - int num = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; - el.x1 = x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); - el.x2 = el.x1; - if (y == h - 1) { - el.y1 = y + 1 - io_cell_h_y2; - el.y2 = el.y1 - 0.015f; - } else { - el.y1 = y + io_cell_h_y2; - el.y2 = el.y1 + 0.015f; - } - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_DQS) { - int num = (tilewire - TILE_WIRE_DDRDEL_DQS); - if (x == 0) { - el.x1 = x + 1 - io_cell_v_x1; - el.x2 = el.x1 + 0.015f; - } else { - el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; - } - el.y1 = y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); - el.y2 = el.y1; - g.push_back(el); - } - - if (wire_type == id_WIRE_TYPE_EBR) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_MULT18) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_ALU54) { - int num = (tilewire - TILE_WIRE_JCLK0_ALU54) % 225; - int group = (tilewire - TILE_WIRE_JCLK0_ALU54) / 225; - if (group == 0) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - } else { - el.x1 = x + 0.97 + 0.005f; - el.x2 = x + 0.97; - } - el.y1 = y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_PLL) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLKI_PLL + 1); - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_GSR) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCLK_GSR + 1); - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_JTAG) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_OSC) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_SED) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_DTR) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JSTARTPULSE_DTR + 1); - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_EXTREF) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_DCU) { - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_PCSCLKDIV) { - int num = (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; - int group = 1 - (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; - el.y2 = el.y1; - g.push_back(el); - } - - if (wire_type == id_WIRE_TYPE_V01) { - if (tilewire >= TILE_WIRE_V01N0001 && tilewire <= TILE_WIRE_V01S0100) { - el.x1 = x + switchbox_x1 + 0.0017f * (10 + tilewire - TILE_WIRE_V01N0001); - el.x2 = el.x1; - if (y == h - 2) - el.y1 = y + 1.1; - else - el.y1 = y + switchbox_y1 + 1; - - if (y == 0) - el.y2 = y + 0.9; - else - el.y2 = y + switchbox_y2; - - g.push_back(el); - } - } - if (wire_type == id_WIRE_TYPE_H01) { - if (tilewire >= TILE_WIRE_H01E0001 && tilewire <= TILE_WIRE_HL7W0001) { - if (x == w - 1) - el.x1 = x + 0.1; - else - el.x1 = x + switchbox_x1; - if (x == 1) - el.x2 = x - 0.1; - else - el.x2 = x + switchbox_x2 - 1; - el.y1 = y + switchbox_y1 + 0.0017f * (10 + 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; - 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; - 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_H02) { + } else if (wire_type == id_WIRE_TYPE_H02) { if (x == 0) el.x1 = 0.9; else @@ -443,9 +197,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y1 = y + switchbox_y1; if (x != 0 && x != 1) g.push_back(el); - } - - if (wire_type == id_WIRE_TYPE_V02) { + } else if (wire_type == id_WIRE_TYPE_V02) { if (y == 0) el.y1 = 0.9; else @@ -486,9 +238,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + switchbox_x1; if (y != 0 && y != 1) g.push_back(el); - } - - if (wire_type == id_WIRE_TYPE_H06) { + } else if (wire_type == id_WIRE_TYPE_H06) { if (x == 0) el.x1 = 0.9; else @@ -529,8 +279,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y1 = y + switchbox_y1; if (x != 0 && x != 1 && x != 2 && x != 3) g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_V06) { + } else if (wire_type == id_WIRE_TYPE_V06) { if (y == 0) el.y1 = 0.9; else @@ -571,8 +320,62 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + switchbox_x1; if (y != 0 && y != 1 && y != 2 && y != 3) g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_NONE) { + } else if (wire_type == id_WIRE_TYPE_V01) { + if (tilewire >= TILE_WIRE_V01N0001 && tilewire <= TILE_WIRE_V01S0100) { + el.x1 = x + switchbox_x1 + 0.0017f * (10 + tilewire - TILE_WIRE_V01N0001); + el.x2 = el.x1; + if (y == h - 2) + el.y1 = y + 1.1; + else + el.y1 = y + switchbox_y1 + 1; + + if (y == 0) + el.y2 = y + 0.9; + else + el.y2 = y + switchbox_y2; + + g.push_back(el); + } + } else if (wire_type == id_WIRE_TYPE_H01) { + if (tilewire >= TILE_WIRE_H01E0001 && tilewire <= TILE_WIRE_HL7W0001) { + if (x == w - 1) + el.x1 = x + 0.1; + else + el.x1 = x + switchbox_x1; + if (x == 1) + el.x2 = x - 0.1; + else + el.x2 = x + switchbox_x2 - 1; + el.y1 = y + switchbox_y1 + 0.0017f * (10 + tilewire - TILE_WIRE_H01E0001); + el.y2 = el.y1; + g.push_back(el); + } + } else if (wire_type == id_WIRE_TYPE_V00) { + int group = (tilewire - TILE_WIRE_V00T0000) / 2; + 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); + } else if (wire_type == id_WIRE_TYPE_H00) { + int group = (tilewire - TILE_WIRE_H00L0000) / 2; + 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); + } else if (wire_type == id_WIRE_TYPE_NONE) { if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <= TILE_WIRE_SBOUNCE) { el.x1 = x + switchbox_x2 - 0.0017f * 4; el.x2 = x + switchbox_x2 - 0.0017f * 8; @@ -584,8 +387,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y2 = el.y1; } g.push_back(el); - } - if (tilewire >= TILE_WIRE_WBOUNCE && tilewire <= TILE_WIRE_EBOUNCE) { + } else if (tilewire >= TILE_WIRE_WBOUNCE && tilewire <= TILE_WIRE_EBOUNCE) { el.y1 = y + switchbox_y1 + 0.0017f * 4; el.y2 = y + switchbox_y1 + 0.0017f * 8; if (tilewire == TILE_WIRE_WBOUNCE) { @@ -596,8 +398,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x2 = el.x1; } g.push_back(el); - } - if (tilewire >= TILE_WIRE_CLK0 && tilewire <= TILE_WIRE_LSR1) { + } else if (tilewire >= TILE_WIRE_CLK0 && tilewire <= TILE_WIRE_LSR1) { 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; @@ -630,7 +431,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } // TRELLIS_IO wires - if (tilewire >= TILE_WIRE_JDIA && tilewire <= TILE_WIRE_ECLKD) { + else if (tilewire >= TILE_WIRE_JDIA && tilewire <= TILE_WIRE_ECLKD) { el.x1 = x + 0.5f; el.x2 = x + 0.5f + 0.005f; bool top = (y == (h - 1)); @@ -642,7 +443,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } - if (tilewire >= TILE_WIRE_JCE0 && tilewire <= TILE_WIRE_JQ7) { + else if (tilewire >= TILE_WIRE_JCE0 && tilewire <= TILE_WIRE_JQ7) { el.x1 = x + switchbox_x2; el.x2 = x + switchbox_x2 + 0.005f; el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; @@ -650,7 +451,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } - if (tilewire >= TILE_WIRE_FCO && tilewire <= TILE_WIRE_FCI) { + else if (tilewire >= TILE_WIRE_FCO && tilewire <= TILE_WIRE_FCI) { int gap = (tilewire - TILE_WIRE_FCO) / 24; el.x1 = x + switchbox_x2; el.x2 = x + slice_x1 - 0.005f; @@ -659,7 +460,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } - if (tilewire >= TILE_WIRE_MUXCLK3 && tilewire <= TILE_WIRE_MUXLSR0) { + else if (tilewire >= TILE_WIRE_MUXCLK3 && tilewire <= TILE_WIRE_MUXLSR0) { int gap = (tilewire - TILE_WIRE_MUXCLK3) / 2; int part = (tilewire - TILE_WIRE_MUXCLK3) % 2; el.x1 = x + slice_x2 + 0.0051f; @@ -670,7 +471,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } - if (tilewire >= TILE_WIRE_WD3 && tilewire <= TILE_WIRE_WD0) { + else if (tilewire >= TILE_WIRE_WD3 && tilewire <= TILE_WIRE_WD0) { int part = (tilewire - TILE_WIRE_WD3) % 4; int group = (tilewire - TILE_WIRE_WD3) / 2; el.x1 = x + slice_x2 + 0.005f; @@ -688,8 +489,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x1 = x + slice_x2 + 0.005f; el.y1 = el.y2; g.push_back(el); - } - if (tilewire >= TILE_WIRE_WAD3 && tilewire <= TILE_WIRE_WAD0) { + } else if (tilewire >= TILE_WIRE_WAD3 && tilewire <= TILE_WIRE_WAD0) { int part = (tilewire - TILE_WIRE_WAD3) % 4; el.x1 = x + slice_x2 + 0.005f; el.x2 = x + slice_x2 + 0.005f + 0.0017f * (8 - part); @@ -715,8 +515,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y1 = el.y2; g.push_back(el); } - } - if (wire_type == id_WIRE_TYPE_G_HPBX) { + } else if (wire_type == id_WIRE_TYPE_G_HPBX) { el.x1 = x; el.x2 = x + 1; el.y1 = y + 0.1f + 0.0017f * (tilewire - TILE_WIRE_G_HPBX0000 + 1); @@ -727,27 +526,188 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x2 = el.x1; el.y2 = y + switchbox_y1; g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_G_VPTX) { + } else if (wire_type == id_WIRE_TYPE_G_VPTX) { el.x1 = x + 0.1f + 0.0017f * (tilewire - TILE_WIRE_G_VPTX0000 + 1); el.x2 = el.x1; el.y1 = y; el.y2 = y + 1; g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_L_HPBX) { + } else if (wire_type == id_WIRE_TYPE_L_HPBX) { el.x1 = x - 3; el.x2 = x + 0.08f; el.y1 = y + 0.0017f + 0.0017f * (tilewire - TILE_WIRE_L_HPBX0000 + 1); el.y2 = el.y1; g.push_back(el); - } - if (wire_type == id_WIRE_TYPE_R_HPBX) { + } else if (wire_type == id_WIRE_TYPE_R_HPBX) { el.x1 = x + 0.2; el.x2 = x + 3; el.y1 = y + 0.0017f + 0.0017f * (tilewire - TILE_WIRE_R_HPBX0000 + 1); el.y2 = el.y1; g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_PIO) { + bool top_bottom = (y == 0 || y == (h - 1)); + int gap = 3 - (tilewire - TILE_WIRE_PADDOD_PIO) / 7; + int num = (tilewire - TILE_WIRE_PADDOD_PIO) % 7; + if (top_bottom) { + el.x1 = x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); + el.x2 = el.x1; + if (y == h - 1) { + el.y1 = y + 1 - io_cell_h_y2; + el.y2 = el.y1 - 0.015f; + } else { + el.y1 = y + io_cell_h_y2; + el.y2 = el.y1 + 0.015f; + } + } else { + if (x == 0) { + el.x1 = x + 1 - io_cell_v_x1; + el.x2 = el.x1 + 0.015f; + } else { + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } + el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y2 = el.y1; + } + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_DDRDLL) { + int num = (tilewire - TILE_WIRE_DDRDEL_DDRDLL); + el.x1 = x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); + el.x2 = el.x1; + if (y == h - 1) { + el.y1 = y + 0.2; + el.y2 = el.y1 - 0.015f; + } else { + el.y1 = y + 0.8; + el.y2 = el.y1 + 0.015f; + } + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_CCLK) { + int num = (tilewire - TILE_WIRE_JPADDI_CCLK); + el.x1 = x + slice_x1 + 0.0017f * (num + 1); + el.x2 = el.x1; + el.y1 = y + slice_y2 - 1 * slice_pitch; + el.y2 = el.y1 - 0.015f; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_IOLOGIC) { + int gap = 7 - (tilewire - TILE_WIRE_JLOADND_IOLOGIC) / 42; + int num = (tilewire - TILE_WIRE_JLOADND_IOLOGIC) % 42; + if (x == 0) { + el.x1 = x + 1 - io_cell_v_x1; + el.x2 = el.x1 + 0.015f; + } else { + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } + el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_SIOLOGIC) { + int gap = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; + int num = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; + el.x1 = x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); + el.x2 = el.x1; + if (y == h - 1) { + el.y1 = y + 1 - io_cell_h_y2; + el.y2 = el.y1 - 0.015f; + } else { + el.y1 = y + io_cell_h_y2; + el.y2 = el.y1 + 0.015f; + } + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_DQS) { + int num = (tilewire - TILE_WIRE_DDRDEL_DQS); + if (x == 0) { + el.x1 = x + 1 - io_cell_v_x1; + el.x2 = el.x1 + 0.015f; + } else { + el.x1 = x + io_cell_v_x1; + el.x2 = el.x1 - 0.015f; + } + el.y1 = y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_EBR) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_MULT18) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_ALU54) { + int num = (tilewire - TILE_WIRE_JCLK0_ALU54) % 225; + int group = (tilewire - TILE_WIRE_JCLK0_ALU54) / 225; + if (group == 0) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + } else { + el.x1 = x + 0.97 + 0.005f; + el.x2 = x + 0.97; + } + el.y1 = y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_PLL) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLKI_PLL + 1); + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_GSR) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCLK_GSR + 1); + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_JTAG) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_OSC) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_SED) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_DTR) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JSTARTPULSE_DTR + 1); + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_EXTREF) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_DCU) { + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + el.y2 = el.y1; + g.push_back(el); + } else if (wire_type == id_WIRE_TYPE_PCSCLKDIV) { + int num = (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; + int group = 1 - (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; + el.x1 = x + slice_x1 - 0.005f; + el.x2 = x + slice_x1; + el.y1 = y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; + el.y2 = el.y1; + g.push_back(el); } } -- cgit v1.2.3 From 6cca93543bb9177f3ead83590c0d835c0bb8a3eb Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 28 Dec 2019 14:27:14 +0100 Subject: move constants to gfx.cc --- ecp5/gfx.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 884388a8..c1c08377 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -22,6 +22,24 @@ NEXTPNR_NAMESPACE_BEGIN +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; + void gfxTileBel(std::vector &g, int x, int y, int z, int w, int h, IdString bel_type, GraphicElement::style_t style) { -- cgit v1.2.3 From 59f4755e8f7de0266f4ab1f07f986a424bb321a2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 28 Dec 2019 15:01:36 +0100 Subject: made most of frequent numbers constants --- ecp5/gfx.cc | 558 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 285 insertions(+), 273 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index c1c08377..3f64f0f0 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -24,6 +24,7 @@ NEXTPNR_NAMESPACE_BEGIN const float slice_x1 = 0.92; const float slice_x2 = 0.94; +const float slice_x2_wide = 0.97; const float slice_y1 = 0.71; const float slice_y2 = 0.745 + 0.0068; const float slice_pitch = 0.0374 + 0.0068; @@ -33,13 +34,24 @@ 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_gap = 0.10; 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; +const float wire_distance = 0.0017f; +const float wire_distance_small = 0.00085f; + +const float wire_length = 0.005f; +const float wire_length_long = 0.015f; + +const float dll_cell_x1 = 0.2; +const float dll_cell_x2 = 0.8; +const float dll_cell_y1 = 0.2; +const float dll_cell_y2 = 0.8; + void gfxTileBel(std::vector &g, int x, int y, int z, int w, int h, IdString bel_type, GraphicElement::style_t style) { @@ -54,18 +66,18 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int g.push_back(el); el.style = GraphicElement::STYLE_FRAME; - el.x1 = x + slice_x2 + 0.0255f; - el.x2 = el.x1 + 0.0017f; - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + (3 - z) * 26) + + el.x1 = x + slice_x2 + 15*wire_distance; + el.x2 = el.x1 + wire_distance; + el.y1 = y + slice_y2 - wire_distance * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + (3 - z) * 26) + 3 * slice_pitch - 0.0007f; - el.y2 = el.y1 + 0.0017f * 5; + el.y2 = el.y1 + wire_distance * 5; g.push_back(el); } else if (bel_type == id_TRELLIS_IO || bel_type == id_IOLOGIC || bel_type == id_SIOLOGIC || bel_type == id_DQSBUFM) { bool top_bottom = (y == 0 || y == (h - 1)); if (top_bottom) { - el.x1 = x + io_cell_h_x1 + (z + 2) * 0.10; - el.x2 = x + io_cell_h_x1 + (z + 2) * 0.10 + 0.08f; + el.x1 = x + io_cell_h_x1 + (z + 2) * io_cell_gap; + el.x2 = x + io_cell_h_x1 + (z + 2) * io_cell_gap + 0.08f; if (y == h - 1) { el.y1 = y + 1 - io_cell_h_y1; el.y2 = y + 1 - io_cell_h_y2; @@ -81,8 +93,8 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int el.x1 = x + io_cell_v_x1; el.x2 = x + io_cell_v_x2; } - el.y1 = y + io_cell_v_y1 + z * 0.10; - el.y2 = y + io_cell_v_y1 + z * 0.10 + 0.08f; + el.y1 = y + io_cell_v_y1 + z * io_cell_gap; + el.y2 = y + io_cell_v_y1 + z * io_cell_gap + 0.08f; } g.push_back(el); } else if (bel_type == id_DCCA) { @@ -93,34 +105,34 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int g.push_back(el); } else if (bel_type == id_DP16KD || bel_type == id_MULT18X18D || bel_type == id_ALU54B) { el.x1 = x + slice_x1; - el.x2 = x + 0.97; + el.x2 = x + slice_x2_wide; el.y1 = y + slice_y1 - 1 * slice_pitch; el.y2 = y + slice_y2 + 3 * slice_pitch; g.push_back(el); } else if (bel_type == id_EHXPLLL) { el.x1 = x + slice_x1; - el.x2 = x + 0.97; + el.x2 = x + slice_x2_wide; el.y1 = y + slice_y1; el.y2 = y + slice_y2; g.push_back(el); } else if (bel_type == id_DCUA) { el.x1 = x + slice_x1; - el.x2 = x + 0.97; + el.x2 = x + slice_x2_wide; el.y1 = y + slice_y2; el.y2 = y + 0.25; g.push_back(el); } else if (bel_type == id_EXTREFB || bel_type == id_PCSCLKDIV || bel_type == id_DTR || bel_type == id_USRMCLK || bel_type == id_SEDGA || bel_type == id_GSR || bel_type == id_JTAGG || bel_type == id_OSCG) { el.x1 = x + slice_x1; - el.x2 = x + 0.97; + el.x2 = x + slice_x2_wide; el.y1 = y + slice_y1 + (z)*slice_pitch; el.y2 = y + slice_y2 + (z)*slice_pitch; g.push_back(el); } else if (bel_type == id_DDRDLL) { - el.x1 = x + 0.2; - el.x2 = x + 0.8; - el.y1 = y + 0.2; - el.y2 = y + 0.8; + el.x1 = x + dll_cell_x1; + el.x2 = x + dll_cell_x2; + el.y1 = y + dll_cell_y1; + el.y2 = y + dll_cell_y2; g.push_back(el); } else if (bel_type == id_DLLDELD || bel_type == id_CLKDIVF || bel_type == id_ECLKSYNCB || bel_type == id_TRELLIS_ECLKBUF || bel_type == id_ECLKBRIDGECS) { @@ -142,35 +154,35 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS 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.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap * 2) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap * 2) + 3 * slice_pitch; el.y2 = el.y1; 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; + el.y2 = el.y1 - wire_distance; 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; + el.y2 = el.y1 + wire_distance; 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; + el.y2 = el.y1 - wire_distance * 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.x1 = x + slice_x2 + wire_length; el.x2 = x + slice_x2; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap * 14) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap * 14) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } @@ -178,17 +190,17 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (x == 0) el.x1 = 0.9; else - el.x1 = x + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x1 = x + switchbox_x1 + wire_distance * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.x2 = el.x1; el.y1 = y + switchbox_y1; - el.y2 = y + switchbox_y1 - 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.y2 = y + switchbox_y1 - wire_distance * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); if (x != 0 && x != w - 1) g.push_back(el); if (x == w - 2) el.x2 = x + 1 + 0.1; else - el.x2 = x + 1 + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x2 = x + 1 + switchbox_x1 + wire_distance * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.y1 = el.y2; if (x != w - 1) g.push_back(el); @@ -201,12 +213,12 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (x == w - 1) el.x1 = x + 0.1; else - el.x1 = x + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x1 = x + switchbox_x1 + wire_distance * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); if (x == 1) el.x2 = x - 1 + 0.9; else - el.x2 = x - 1 + switchbox_x1 + 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); - el.y2 = y + switchbox_y1 - 0.0017f * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.x2 = x - 1 + switchbox_x1 + wire_distance * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); + el.y2 = y + switchbox_y1 - wire_distance * (20 + (tilewire - TILE_WIRE_H02W0701) + 20 * (x % 3)); el.y1 = el.y2; if (x != 0) g.push_back(el); @@ -219,17 +231,17 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (y == 0) el.y1 = 0.9; else - el.y1 = y + switchbox_y1 + 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); + el.y1 = y + switchbox_y1 + wire_distance * (20 + (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)); + el.x2 = x + switchbox_x1 - wire_distance * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); if (y != 0 && y != h - 1) g.push_back(el); if (y == h - 2) el.y2 = y + 1 + 0.1; else - el.y2 = y + 1 + switchbox_y1 + 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); + el.y2 = y + 1 + switchbox_y1 + wire_distance * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); el.x1 = el.x2; if (y != h - 1) g.push_back(el); @@ -242,12 +254,12 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (y == h - 1) el.y1 = y + 0.1; else - el.y1 = y + switchbox_y1 + 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); + el.y1 = y + switchbox_y1 + wire_distance * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); if (y == 1) el.y2 = y - 1 + 0.9; else - el.y2 = y - 1 + switchbox_y1 + 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); - el.x2 = x + switchbox_x1 - 0.0017f * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); + el.y2 = y - 1 + switchbox_y1 + wire_distance * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); + el.x2 = x + switchbox_x1 - wire_distance * (20 + (tilewire - TILE_WIRE_V02N0701) + 20 * (y % 3)); el.x1 = el.x2; if (y != 0) g.push_back(el); @@ -260,17 +272,17 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (x == 0) el.x1 = 0.9; else - el.x1 = x + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + el.x1 = x + switchbox_x1 + wire_distance * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); el.x2 = el.x1; el.y1 = y + switchbox_y1; - el.y2 = y + switchbox_y1 - 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + el.y2 = y + switchbox_y1 - wire_distance * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); if (x != 0 && x != w - 1) g.push_back(el); if (x == w - 2 || x == w - 3 || x == w - 4) el.x2 = w - 1 + 0.1; else - el.x2 = x + 3 + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + el.x2 = x + 3 + switchbox_x1 + wire_distance * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); el.y1 = el.y2; if (x != w - 1) g.push_back(el); @@ -283,12 +295,12 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (x == w - 1) el.x1 = x + 0.1; else - el.x1 = x + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + el.x1 = x + switchbox_x1 + wire_distance * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); if (x == 1 || x == 2 || x == 3) el.x2 = 0.9; else - el.x2 = x - 3 + switchbox_x1 + 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); - el.y2 = y + switchbox_y1 - 0.0017f * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + el.x2 = x - 3 + switchbox_x1 + wire_distance * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); + el.y2 = y + switchbox_y1 - wire_distance * (96 + (tilewire - TILE_WIRE_H06W0303) + 10 * (x % 9)); el.y1 = el.y2; if (x != 0) g.push_back(el); @@ -301,17 +313,17 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (y == 0) el.y1 = 0.9; else - el.y1 = y + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + el.y1 = y + switchbox_y1 + wire_distance * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); el.y2 = el.y1; el.x1 = x + switchbox_x1; - el.x2 = x + switchbox_x1 - 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + el.x2 = x + switchbox_x1 - wire_distance * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); if (y != 0 && y != h - 1) g.push_back(el); if (y == h - 2 || y == h - 3 || y == h - 4) el.y2 = h - 1 + 0.1; else - el.y2 = y + 3 + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + el.y2 = y + 3 + switchbox_y1 + wire_distance * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); el.x1 = el.x2; if (y != h - 1) g.push_back(el); @@ -324,12 +336,12 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS if (y == h - 1) el.y1 = y + 0.1; else - el.y1 = y + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + el.y1 = y + switchbox_y1 + wire_distance * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); if (y == 1 || y == 2 || y == 3) el.y2 = 0.9; else - el.y2 = y - 3 + switchbox_y1 + 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); - el.x2 = x + switchbox_x1 - 0.0017f * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + el.y2 = y - 3 + switchbox_y1 + wire_distance * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); + el.x2 = x + switchbox_x1 - wire_distance * (96 + (tilewire - TILE_WIRE_V06N0303) + 10 * (y % 9)); el.x1 = el.x2; if (y != 0) g.push_back(el); @@ -340,7 +352,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } else if (wire_type == id_WIRE_TYPE_V01) { if (tilewire >= TILE_WIRE_V01N0001 && tilewire <= TILE_WIRE_V01S0100) { - el.x1 = x + switchbox_x1 + 0.0017f * (10 + tilewire - TILE_WIRE_V01N0001); + el.x1 = x + switchbox_x1 + wire_distance * (10 + tilewire - TILE_WIRE_V01N0001); el.x2 = el.x1; if (y == h - 2) el.y1 = y + 1.1; @@ -364,82 +376,82 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.x2 = x - 0.1; else el.x2 = x + switchbox_x2 - 1; - el.y1 = y + switchbox_y1 + 0.0017f * (10 + tilewire - TILE_WIRE_H01E0001); + el.y1 = y + switchbox_y1 + wire_distance * (10 + tilewire - TILE_WIRE_H01E0001); el.y2 = el.y1; g.push_back(el); } } else if (wire_type == id_WIRE_TYPE_V00) { int group = (tilewire - TILE_WIRE_V00T0000) / 2; - el.x1 = x + switchbox_x2 - 0.0017f * (8 - ((tilewire - TILE_WIRE_V00T0000) % 2) * 4); + el.x1 = x + switchbox_x2 - wire_distance * (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; + el.y2 = y + switchbox_y1 - wire_distance * 4; } else { el.y1 = y + switchbox_y2; - el.y2 = y + switchbox_y2 + 0.0017f * 4; + el.y2 = y + switchbox_y2 + wire_distance * 4; } g.push_back(el); } else if (wire_type == id_WIRE_TYPE_H00) { int group = (tilewire - TILE_WIRE_H00L0000) / 2; - el.y1 = y + switchbox_y1 + 0.0017f * (8 - ((tilewire - TILE_WIRE_H00L0000) % 2) * 4); + el.y1 = y + switchbox_y1 + wire_distance * (8 - ((tilewire - TILE_WIRE_H00L0000) % 2) * 4); el.y2 = el.y1; if (group) { - el.x1 = x + switchbox_x2 + 0.0017f * 4; + el.x1 = x + switchbox_x2 + wire_distance * 4; el.x2 = x + switchbox_x2; } else { - el.x1 = x + switchbox_x1 - 0.0017f * 4; + el.x1 = x + switchbox_x1 - wire_distance * 4; el.x2 = x + switchbox_x1; } g.push_back(el); } else if (wire_type == id_WIRE_TYPE_NONE) { if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <= TILE_WIRE_SBOUNCE) { - el.x1 = x + switchbox_x2 - 0.0017f * 4; - el.x2 = x + switchbox_x2 - 0.0017f * 8; + el.x1 = x + switchbox_x2 - wire_distance * 4; + el.x2 = x + switchbox_x2 - wire_distance * 8; if (tilewire == TILE_WIRE_NBOUNCE) { - el.y1 = y + switchbox_y2 + 0.0017f * 4; + el.y1 = y + switchbox_y2 + wire_distance * 4; el.y2 = el.y1; } else { - el.y1 = y + switchbox_y1 - 0.0017f * 4; + el.y1 = y + switchbox_y1 - wire_distance * 4; el.y2 = el.y1; } g.push_back(el); } else if (tilewire >= TILE_WIRE_WBOUNCE && tilewire <= TILE_WIRE_EBOUNCE) { - el.y1 = y + switchbox_y1 + 0.0017f * 4; - el.y2 = y + switchbox_y1 + 0.0017f * 8; + el.y1 = y + switchbox_y1 + wire_distance * 4; + el.y2 = y + switchbox_y1 + wire_distance * 8; if (tilewire == TILE_WIRE_WBOUNCE) { - el.x1 = x + switchbox_x1 - 0.0017f * 4; + el.x1 = x + switchbox_x1 - wire_distance * 4; el.x2 = el.x1; } else { - el.x1 = x + switchbox_x2 + 0.0017f * 4; + el.x1 = x + switchbox_x2 + wire_distance * 4; el.x2 = el.x1; } g.push_back(el); } else if (tilewire >= TILE_WIRE_CLK0 && tilewire <= TILE_WIRE_LSR1) { 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.x2 = x + slice_x2 + 15*wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; + el.y1 = y + slice_y2 - wire_distance * (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)); + el.y2 = y + slice_y2 - wire_distance * (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.x1 = x + slice_x2 + 15*wire_distance + wire_distance; + el.x2 = x + slice_x2 + 15*wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; el.y1 = y + slice_y2 - - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + tilewire - TILE_WIRE_CLK0) + + wire_distance * (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.x1 = x + slice_x2 + 3*wire_distance; + el.x2 = x + slice_x2 + 15*wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; el.y1 = y + slice_y2 - - 0.0017f * + wire_distance * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 - 1 + (tilewire - TILE_WIRE_CLK0) / 2) + i * slice_pitch; el.y2 = el.y1; @@ -451,20 +463,20 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS // TRELLIS_IO wires else if (tilewire >= TILE_WIRE_JDIA && tilewire <= TILE_WIRE_ECLKD) { el.x1 = x + 0.5f; - el.x2 = x + 0.5f + 0.005f; + el.x2 = x + 0.5f + wire_length; bool top = (y == (h - 1)); if (top) - el.y1 = y + 1 - (slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + el.y1 = y + 1 - (slice_y2 - wire_distance * (tilewire - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); else - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (tilewire >= TILE_WIRE_JCE0 && tilewire <= TILE_WIRE_JQ7) { el.x1 = x + switchbox_x2; - el.x2 = x + switchbox_x2 + 0.005f; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + el.x2 = x + switchbox_x2 + wire_length; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } @@ -472,8 +484,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS else if (tilewire >= TILE_WIRE_FCO && tilewire <= TILE_WIRE_FCI) { int gap = (tilewire - TILE_WIRE_FCO) / 24; 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.x2 = x + slice_x1 - wire_length; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } @@ -481,9 +493,9 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS else if (tilewire >= TILE_WIRE_MUXCLK3 && tilewire <= TILE_WIRE_MUXLSR0) { int gap = (tilewire - TILE_WIRE_MUXCLK3) / 2; int part = (tilewire - TILE_WIRE_MUXCLK3) % 2; - 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) + + el.x1 = x + slice_x2 + 3*wire_distance; + el.x2 = x + slice_x2 + 15*wire_distance; + el.y1 = y + slice_y2 - wire_distance * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + gap * 26) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); @@ -492,43 +504,43 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS else if (tilewire >= TILE_WIRE_WD3 && tilewire <= TILE_WIRE_WD0) { int part = (tilewire - TILE_WIRE_WD3) % 4; int group = (tilewire - TILE_WIRE_WD3) / 2; - 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) + + el.x1 = x + slice_x2 + wire_length; + el.x2 = x + slice_x2 + wire_length + wire_distance * (4 - part); + el.y1 = y + slice_y2 - wire_distance * (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) + + el.y2 = y + slice_y2 - wire_distance * (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.x1 = x + slice_x2 + wire_length; el.y1 = el.y2; g.push_back(el); } else if (tilewire >= TILE_WIRE_WAD3 && tilewire <= TILE_WIRE_WAD0) { int part = (tilewire - TILE_WIRE_WAD3) % 4; - 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) + + el.x1 = x + slice_x2 + wire_length; + el.x2 = x + slice_x2 + wire_length + wire_distance * (8 - part); + el.y1 = y + slice_y2 - wire_distance * (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) + + el.y2 = y + slice_y2 - wire_distance * (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.x1 = x + slice_x2 + wire_length; 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) + + el.x1 = x + slice_x2 + wire_length; + el.x2 = x + slice_x2 + wire_length + wire_distance * (8 - part); + el.y2 = y + slice_y2 - wire_distance * (TILE_WIRE_WAD3B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + 14 * 2) + 3 * slice_pitch; el.y1 = el.y2; g.push_back(el); @@ -536,16 +548,16 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } else if (wire_type == id_WIRE_TYPE_G_HPBX) { el.x1 = x; el.x2 = x + 1; - el.y1 = y + 0.1f + 0.0017f * (tilewire - TILE_WIRE_G_HPBX0000 + 1); + el.y1 = y + 0.1f + wire_distance * (tilewire - TILE_WIRE_G_HPBX0000 + 1); el.y2 = el.y1; g.push_back(el); - el.x1 = x + switchbox_x1 + 0.0017f * (200 + (tilewire - TILE_WIRE_G_HPBX0000)); + el.x1 = x + switchbox_x1 + wire_distance * (200 + (tilewire - TILE_WIRE_G_HPBX0000)); el.x2 = el.x1; el.y2 = y + switchbox_y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_G_VPTX) { - el.x1 = x + 0.1f + 0.0017f * (tilewire - TILE_WIRE_G_VPTX0000 + 1); + el.x1 = x + 0.1f + wire_distance * (tilewire - TILE_WIRE_G_VPTX0000 + 1); el.x2 = el.x1; el.y1 = y; el.y2 = y + 1; @@ -553,13 +565,13 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } else if (wire_type == id_WIRE_TYPE_L_HPBX) { el.x1 = x - 3; el.x2 = x + 0.08f; - el.y1 = y + 0.0017f + 0.0017f * (tilewire - TILE_WIRE_L_HPBX0000 + 1); + el.y1 = y + wire_distance + wire_distance * (tilewire - TILE_WIRE_L_HPBX0000 + 1); el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_R_HPBX) { el.x1 = x + 0.2; el.x2 = x + 3; - el.y1 = y + 0.0017f + 0.0017f * (tilewire - TILE_WIRE_R_HPBX0000 + 1); + el.y1 = y + wire_distance + wire_distance * (tilewire - TILE_WIRE_R_HPBX0000 + 1); el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_PIO) { @@ -567,163 +579,163 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS int gap = 3 - (tilewire - TILE_WIRE_PADDOD_PIO) / 7; int num = (tilewire - TILE_WIRE_PADDOD_PIO) % 7; if (top_bottom) { - el.x1 = x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); + el.x1 = x + io_cell_h_x1 + (gap + 2) * io_cell_gap + wire_distance * (num + 1); el.x2 = el.x1; if (y == h - 1) { el.y1 = y + 1 - io_cell_h_y2; - el.y2 = el.y1 - 0.015f; + el.y2 = el.y1 - wire_length_long; } else { el.y1 = y + io_cell_h_y2; - el.y2 = el.y1 + 0.015f; + el.y2 = el.y1 + wire_length_long; } } else { if (x == 0) { el.x1 = x + 1 - io_cell_v_x1; - el.x2 = el.x1 + 0.015f; + el.x2 = el.x1 + wire_length_long; } else { el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; + el.x2 = el.x1 - wire_length_long; } - el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y1 = y + io_cell_v_y1 + gap * io_cell_gap + wire_distance * (num + 1); el.y2 = el.y1; } g.push_back(el); } else if (wire_type == id_WIRE_TYPE_DDRDLL) { int num = (tilewire - TILE_WIRE_DDRDEL_DDRDLL); - el.x1 = x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); + el.x1 = x + io_cell_h_x1 + 0.2 + wire_distance * (num + 1); el.x2 = el.x1; if (y == h - 1) { - el.y1 = y + 0.2; - el.y2 = el.y1 - 0.015f; + el.y1 = y + dll_cell_y1; + el.y2 = el.y1 - wire_length_long; } else { - el.y1 = y + 0.8; - el.y2 = el.y1 + 0.015f; + el.y1 = y + dll_cell_y2; + el.y2 = el.y1 + wire_length_long; } g.push_back(el); } else if (wire_type == id_WIRE_TYPE_CCLK) { int num = (tilewire - TILE_WIRE_JPADDI_CCLK); - el.x1 = x + slice_x1 + 0.0017f * (num + 1); + el.x1 = x + slice_x1 + wire_distance * (num + 1); el.x2 = el.x1; el.y1 = y + slice_y2 - 1 * slice_pitch; - el.y2 = el.y1 - 0.015f; + el.y2 = el.y1 - wire_length_long; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_IOLOGIC) { int gap = 7 - (tilewire - TILE_WIRE_JLOADND_IOLOGIC) / 42; int num = (tilewire - TILE_WIRE_JLOADND_IOLOGIC) % 42; if (x == 0) { el.x1 = x + 1 - io_cell_v_x1; - el.x2 = el.x1 + 0.015f; + el.x2 = el.x1 + wire_length_long; } else { el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; + el.x2 = el.x1 - wire_length_long; } - el.y1 = y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y1 = y + io_cell_v_y1 + gap * io_cell_gap + wire_distance * (num + 1); el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_SIOLOGIC) { int gap = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; int num = (tilewire - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; - el.x1 = x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); + el.x1 = x + io_cell_h_x1 + (5 - gap) * io_cell_gap + wire_distance * (num + 1); el.x2 = el.x1; if (y == h - 1) { el.y1 = y + 1 - io_cell_h_y2; - el.y2 = el.y1 - 0.015f; + el.y2 = el.y1 - wire_length_long; } else { el.y1 = y + io_cell_h_y2; - el.y2 = el.y1 + 0.015f; + el.y2 = el.y1 + wire_length_long; } g.push_back(el); } else if (wire_type == id_WIRE_TYPE_DQS) { int num = (tilewire - TILE_WIRE_DDRDEL_DQS); if (x == 0) { el.x1 = x + 1 - io_cell_v_x1; - el.x2 = el.x1 + 0.015f; + el.x2 = el.x1 + wire_length_long; } else { el.x1 = x + io_cell_v_x1; - el.x2 = el.x1 - 0.015f; + el.x2 = el.x1 - wire_length_long; } - el.y1 = y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); + el.y1 = y + io_cell_v_y1 + 8 * io_cell_gap + wire_distance * (num + 1); el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_EBR) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_MULT18) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.00085f * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance_small * (tilewire - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_ALU54) { int num = (tilewire - TILE_WIRE_JCLK0_ALU54) % 225; int group = (tilewire - TILE_WIRE_JCLK0_ALU54) / 225; if (group == 0) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; } else { - el.x1 = x + 0.97 + 0.005f; - el.x2 = x + 0.97; + el.x1 = x + slice_x2_wide + wire_length; + el.x2 = x + slice_x2_wide; } - el.y1 = y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance_small * (num + 1) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_PLL) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLKI_PLL + 1); + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_CLKI_PLL + 1); el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_GSR) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JCLK_GSR + 1); + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_JCLK_GSR + 1); el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_JTAG) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_OSC) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_SED) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_DTR) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_JSTARTPULSE_DTR + 1); + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_JSTARTPULSE_DTR + 1); el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_EXTREF) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_DCU) { - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; el.y2 = el.y1; g.push_back(el); } else if (wire_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; int group = 1 - (tilewire - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; - el.x1 = x + slice_x1 - 0.005f; + el.x1 = x + slice_x1 - wire_length; el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (num + 1) + group * slice_pitch; el.y2 = el.y1; g.push_back(el); } @@ -733,7 +745,7 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr { if (src_type == id_WIRE_TYPE_H00) { int group = (src_id - TILE_WIRE_H00L0000) / 2; - el.y1 = y + switchbox_y1 + 0.0017f * (8 - ((src_id - TILE_WIRE_H00L0000) % 2) * 4); + el.y1 = y + switchbox_y1 + wire_distance * (8 - ((src_id - TILE_WIRE_H00L0000) % 2) * 4); if (group) { el.x1 = x + switchbox_x2; @@ -746,19 +758,19 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr el.x1 = x + switchbox_x1; else el.x1 = x + switchbox_x2; - el.y1 = y + switchbox_y1 + 0.0017f * (10 + src_id - TILE_WIRE_H01E0001); + el.y1 = y + switchbox_y1 + wire_distance * (10 + src_id - TILE_WIRE_H01E0001); } if (src_type == id_WIRE_TYPE_H02) { - el.x1 = x + switchbox_x1 + 0.0017f * (20 + (src_id - TILE_WIRE_H02W0701) + 20 * (src.location.x % 3)); + el.x1 = x + switchbox_x1 + wire_distance * (20 + (src_id - TILE_WIRE_H02W0701) + 20 * (src.location.x % 3)); el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_H06) { - el.x1 = x + switchbox_x1 + 0.0017f * (96 + (src_id - TILE_WIRE_H06W0303) + 10 * (src.location.x % 9)); + el.x1 = x + switchbox_x1 + wire_distance * (96 + (src_id - TILE_WIRE_H06W0303) + 10 * (src.location.x % 9)); el.y1 = y + switchbox_y1; } if (src_type == id_WIRE_TYPE_V00) { int group = (src_id - TILE_WIRE_V00T0000) / 2; - el.x1 = x + switchbox_x2 - 0.0017f * (8 - ((src_id - TILE_WIRE_V00T0000) % 2) * 4); + el.x1 = x + switchbox_x2 - wire_distance * (8 - ((src_id - TILE_WIRE_V00T0000) % 2) * 4); if (group) { el.y1 = y + switchbox_y1; } else { @@ -766,7 +778,7 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } } if (src_type == id_WIRE_TYPE_V01) { - el.x1 = x + switchbox_x1 + 0.0017f * (10 + src_id - TILE_WIRE_V01N0001); + el.x1 = x + switchbox_x1 + wire_distance * (10 + src_id - TILE_WIRE_V01N0001); if (y == src.location.y) el.y1 = y + switchbox_y2; else @@ -774,53 +786,53 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } if (src_type == id_WIRE_TYPE_V02) { el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f * (20 + (src_id - TILE_WIRE_V02N0701) + 20 * (src.location.y % 3)); + el.y1 = y + switchbox_y1 + wire_distance * (20 + (src_id - TILE_WIRE_V02N0701) + 20 * (src.location.y % 3)); } if (src_type == id_WIRE_TYPE_V06) { el.x1 = x + switchbox_x1; - el.y1 = y + switchbox_y1 + 0.0017f * (96 + (src_id - TILE_WIRE_V06N0303) + 10 * (src.location.y % 9)); + el.y1 = y + switchbox_y1 + wire_distance * (96 + (src_id - TILE_WIRE_V06N0303) + 10 * (src.location.y % 9)); } if (src_type == id_WIRE_TYPE_NONE) { if (src_id >= TILE_WIRE_CLK0 && src_id <= TILE_WIRE_LSR1) { el.x1 = x + switchbox_x2; - el.y1 = y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_CLK0 - 5) + 3 * slice_pitch; + el.y1 = y + slice_y2 - wire_distance * (src_id - TILE_WIRE_CLK0 - 5) + 3 * slice_pitch; } if (src_id >= TILE_WIRE_FCO && src_id <= TILE_WIRE_FCI) { int gap = (src_id - TILE_WIRE_FCO) / 24; el.x1 = src.location.x + switchbox_x2; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; } if (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7) { - el.x1 = src.location.x + switchbox_x2 + 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + el.x1 = src.location.x + switchbox_x2 + wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; } if (src_id >= TILE_WIRE_JDIA && src_id <= TILE_WIRE_ECLKD) { bool top = (src.location.y == (h - 1)); - el.x1 = src.location.x + 0.5f + 0.005f; + el.x1 = src.location.x + 0.5f + wire_length; if (top) - el.y1 = src.location.y + 1 - (slice_y2 - 0.0017f * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + el.y1 = src.location.y + 1 - (slice_y2 - wire_distance * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); else - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; } } if (src_type == id_WIRE_TYPE_IOLOGIC) { int gap = 7 - (src_id - TILE_WIRE_JLOADND_IOLOGIC) / 42; int num = (src_id - TILE_WIRE_JLOADND_IOLOGIC) % 42; if (src.location.x == 0) { - el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; + el.x1 = src.location.x + 1 - io_cell_v_x1 + wire_length_long; } else { - el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + el.x1 = src.location.x + io_cell_v_x1 - wire_length_long; } - el.y1 = src.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y1 = src.location.y + io_cell_v_y1 + gap * io_cell_gap + wire_distance * (num + 1); } if (src_type == id_WIRE_TYPE_SIOLOGIC) { int gap = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; int num = (src_id - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; - el.x1 = src.location.x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); + el.x1 = src.location.x + io_cell_h_x1 + (5 - gap) * io_cell_gap + wire_distance * (num + 1); if (src.location.y == h - 1) { - el.y1 = src.location.y + 1 - io_cell_h_y2 - 0.015f; + el.y1 = src.location.y + 1 - io_cell_h_y2 - wire_length_long; } else { - el.y1 = src.location.y + io_cell_h_y2 + 0.015f; + el.y1 = src.location.y + io_cell_h_y2 + wire_length_long; } } if (src_type == id_WIRE_TYPE_PIO) { @@ -828,102 +840,102 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr int gap = 3 - (src_id - TILE_WIRE_PADDOD_PIO) / 7; int num = (src_id - TILE_WIRE_PADDOD_PIO) % 7; if (top_bottom) { - el.x1 = src.location.x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); + el.x1 = src.location.x + io_cell_h_x1 + (gap + 2) * io_cell_gap + wire_distance * (num + 1); if (src.location.y == h - 1) { - el.y1 = src.location.y + 1 - io_cell_h_y2 - 0.015f; + el.y1 = src.location.y + 1 - io_cell_h_y2 - wire_length_long; } else { - el.y1 = src.location.y + 1 - io_cell_h_y2 + 0.015f; + el.y1 = src.location.y + 1 - io_cell_h_y2 + wire_length_long; } } else { if (x == 0) { - el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; + el.x1 = src.location.x + 1 - io_cell_v_x1 + wire_length_long; } else { - el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + el.x1 = src.location.x + io_cell_v_x1 - wire_length_long; } - el.y1 = src.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y1 = src.location.y + io_cell_v_y1 + gap * io_cell_gap + wire_distance * (num + 1); } } if (src_type == id_WIRE_TYPE_EBR) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; } if (src_type == id_WIRE_TYPE_MULT18) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.00085f * (src_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance_small * (src_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; } if (src_type == id_WIRE_TYPE_ALU54) { int num = (src_id - TILE_WIRE_JCLK0_ALU54) % 225; int group = (src_id - TILE_WIRE_JCLK0_ALU54) / 225; if (group == 0) { - el.x1 = src.location.x + slice_x1 - 0.005f; + el.x1 = src.location.x + slice_x1 - wire_length; } else { - el.x1 = src.location.x + 0.97 + 0.005f; + el.x1 = src.location.x + slice_x2_wide + wire_length; } - el.y1 = src.location.y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; + el.y1 = src.location.y + slice_y2 - wire_distance_small * (num + 1) + 3 * slice_pitch; } if (src_type == id_WIRE_TYPE_PLL) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_CLKI_PLL + 1); + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_CLKI_PLL + 1); } if (src_type == id_WIRE_TYPE_GSR) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JCLK_GSR + 1); + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_JCLK_GSR + 1); } if (src_type == id_WIRE_TYPE_JTAG) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; } if (src_type == id_WIRE_TYPE_OSC) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; } if (src_type == id_WIRE_TYPE_SED) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; } if (src_type == id_WIRE_TYPE_DTR) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_JSTARTPULSE_DTR + 1); + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_JSTARTPULSE_DTR + 1); } if (src_type == id_WIRE_TYPE_EXTREF) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; } if (src_type == id_WIRE_TYPE_DCU) { - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (src_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; } if (src_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (src_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; int group = 1 - (src_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; - el.x1 = src.location.x + slice_x1 - 0.005f; - el.y1 = src.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; + el.x1 = src.location.x + slice_x1 - wire_length; + el.y1 = src.location.y + slice_y2 - wire_distance * (num + 1) + group * slice_pitch; } if (src_type == id_WIRE_TYPE_DQS) { int num = (src_id - TILE_WIRE_DDRDEL_DQS); if (src.location.x == 0) { - el.x1 = src.location.x + 1 - io_cell_v_x1 + 0.015f; + el.x1 = src.location.x + 1 - io_cell_v_x1 + wire_length_long; } else { - el.x1 = src.location.x + io_cell_v_x1 - 0.015f; + el.x1 = src.location.x + io_cell_v_x1 - wire_length_long; } - el.y1 = src.location.y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); + el.y1 = src.location.y + io_cell_v_y1 + 8 * io_cell_gap + wire_distance * (num + 1); } if (src_type == id_WIRE_TYPE_DDRDLL) { int num = (src_id - TILE_WIRE_DDRDEL_DDRDLL); - el.x1 = src.location.x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); + el.x1 = src.location.x + io_cell_h_x1 + dll_cell_x1 + wire_distance * (num + 1); if (src.location.y == h - 1) { - el.y1 = src.location.y + 0.2 - 0.015f; + el.y1 = src.location.y + dll_cell_y1 - wire_length_long; } else { - el.y1 = src.location.y + 0.8 + 0.015f; + el.y1 = src.location.y + dll_cell_y2 + wire_length_long; } } if (src_type == id_WIRE_TYPE_CCLK) { int num = (src_id - TILE_WIRE_JPADDI_CCLK); - el.x1 = src.location.x + slice_x1 + 0.0017f * (num + 1); - el.y1 = src.location.y + slice_y2 - 1 * slice_pitch - 0.015f; + el.x1 = src.location.x + slice_x1 + wire_distance * (num + 1); + el.y1 = src.location.y + slice_y2 - 1 * slice_pitch - wire_length_long; } if (src_type == id_WIRE_TYPE_G_HPBX) { - el.x1 = x + switchbox_x1 + 0.0017f * (200 + (src_id - TILE_WIRE_G_HPBX0000)); + el.x1 = x + switchbox_x1 + wire_distance * (200 + (src_id - TILE_WIRE_G_HPBX0000)); el.y1 = y + switchbox_y1; } } @@ -932,7 +944,7 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, { if (dst_type == id_WIRE_TYPE_H00) { int group = (dst_id - TILE_WIRE_H00L0000) / 2; - el.y2 = y + switchbox_y1 + 0.0017f * (8 - ((dst_id - TILE_WIRE_H00L0000) % 2) * 4); + el.y2 = y + switchbox_y1 + wire_distance * (8 - ((dst_id - TILE_WIRE_H00L0000) % 2) * 4); if (group) { el.x2 = x + switchbox_x2; @@ -945,19 +957,19 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, el.x2 = x + switchbox_x1; else el.x2 = x + switchbox_x2; - el.y2 = y + switchbox_y1 + 0.0017f * (10 + dst_id - TILE_WIRE_H01E0001); + el.y2 = y + switchbox_y1 + wire_distance * (10 + dst_id - TILE_WIRE_H01E0001); } if (dst_type == id_WIRE_TYPE_H02) { - el.x2 = x + switchbox_x1 + 0.0017f * (20 + (dst_id - TILE_WIRE_H02W0701) + 20 * (dst.location.x % 3)); + el.x2 = x + switchbox_x1 + wire_distance * (20 + (dst_id - TILE_WIRE_H02W0701) + 20 * (dst.location.x % 3)); el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_H06) { - el.x2 = x + switchbox_x1 + 0.0017f * (96 + (dst_id - TILE_WIRE_H06W0303) + 10 * (dst.location.x % 9)); + el.x2 = x + switchbox_x1 + wire_distance * (96 + (dst_id - TILE_WIRE_H06W0303) + 10 * (dst.location.x % 9)); el.y2 = y + switchbox_y1; } if (dst_type == id_WIRE_TYPE_V00) { int group = (dst_id - TILE_WIRE_V00T0000) / 2; - el.x2 = x + switchbox_x2 - 0.0017f * (8 - ((dst_id - TILE_WIRE_V00T0000) % 2) * 4); + el.x2 = x + switchbox_x2 - wire_distance * (8 - ((dst_id - TILE_WIRE_V00T0000) % 2) * 4); if (group) { el.y2 = y + switchbox_y1; } else { @@ -965,7 +977,7 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } } if (dst_type == id_WIRE_TYPE_V01) { - el.x2 = x + switchbox_x1 + 0.0017f * (10 + dst_id - TILE_WIRE_V01N0001); + el.x2 = x + switchbox_x1 + wire_distance * (10 + dst_id - TILE_WIRE_V01N0001); if (y == dst.location.y) el.y2 = y + switchbox_y2; else @@ -973,34 +985,34 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } if (dst_type == id_WIRE_TYPE_V02) { el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f * (20 + (dst_id - TILE_WIRE_V02N0701) + 20 * (dst.location.y % 3)); + el.y2 = y + switchbox_y1 + wire_distance * (20 + (dst_id - TILE_WIRE_V02N0701) + 20 * (dst.location.y % 3)); } if (dst_type == id_WIRE_TYPE_V06) { el.x2 = x + switchbox_x1; - el.y2 = y + switchbox_y1 + 0.0017f * (96 + (dst_id - TILE_WIRE_V06N0303) + 10 * (dst.location.y % 9)); + el.y2 = y + switchbox_y1 + wire_distance * (96 + (dst_id - TILE_WIRE_V06N0303) + 10 * (dst.location.y % 9)); } if (dst_type == id_WIRE_TYPE_NONE) { if (dst_id >= TILE_WIRE_CLK0 && dst_id <= TILE_WIRE_LSR1) { el.x2 = x + switchbox_x2; - el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_CLK0 - 5) + 3 * slice_pitch; + el.y2 = y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_CLK0 - 5) + 3 * slice_pitch; } if (dst_id >= TILE_WIRE_FCO && dst_id <= TILE_WIRE_FCI) { int gap = (dst_id - TILE_WIRE_FCO) / 24; el.x2 = x + switchbox_x2; - el.y2 = y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; + el.y2 = y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; } if (dst_id >= TILE_WIRE_JCE0 && dst_id <= TILE_WIRE_JQ7) { el.x2 = dst.location.x + switchbox_x2; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_JCE0 + 1) + 3 * slice_pitch; } if (dst_id >= TILE_WIRE_JDIA && dst_id <= TILE_WIRE_ECLKD) { bool top = (dst.location.y == (h - 1)); el.x2 = dst.location.x + 0.5f; if (top) - el.y2 = dst.location.y + 1 - (slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + el.y2 = dst.location.y + 1 - (slice_y2 - wire_distance * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); else - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; } } @@ -1008,20 +1020,20 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, int gap = 7 - (dst_id - TILE_WIRE_JLOADND_IOLOGIC) / 42; int num = (dst_id - TILE_WIRE_JLOADND_IOLOGIC) % 42; if (dst.location.x == 0) { - el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; + el.x2 = dst.location.x + 1 - io_cell_v_x1 + wire_length_long; } else { - el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + el.x2 = dst.location.x + io_cell_v_x1 - wire_length_long; } - el.y2 = dst.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y2 = dst.location.y + io_cell_v_y1 + gap * io_cell_gap + wire_distance * (num + 1); } if (dst_type == id_WIRE_TYPE_SIOLOGIC) { int gap = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC) / 20; int num = (dst_id - TILE_WIRE_JLOADNB_SIOLOGIC) % 20; - el.x2 = dst.location.x + io_cell_h_x1 + (5 - gap) * 0.10 + 0.0017f * (num + 1); + el.x2 = dst.location.x + io_cell_h_x1 + (5 - gap) * io_cell_gap + wire_distance * (num + 1); if (dst.location.y == h - 1) { - el.y2 = dst.location.y + 1 - io_cell_h_y2 - 0.015f; + el.y2 = dst.location.y + 1 - io_cell_h_y2 - wire_length_long; } else { - el.y2 = dst.location.y + io_cell_h_y2 + 0.015f; + el.y2 = dst.location.y + io_cell_h_y2 + wire_length_long; } } if (dst_type == id_WIRE_TYPE_PIO) { @@ -1029,102 +1041,102 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, int gap = 3 - (dst_id - TILE_WIRE_PADDOD_PIO) / 7; int num = (dst_id - TILE_WIRE_PADDOD_PIO) % 7; if (top_bottom) { - el.x2 = dst.location.x + io_cell_h_x1 + (gap + 2) * 0.10 + 0.0017f * (num + 1); + el.x2 = dst.location.x + io_cell_h_x1 + (gap + 2) * io_cell_gap + wire_distance * (num + 1); if (dst.location.y == h - 1) { - el.y2 = dst.location.y + 1 - io_cell_h_y2 - 0.015f; + el.y2 = dst.location.y + 1 - io_cell_h_y2 - wire_length_long; } else { - el.y2 = dst.location.y + 1 - io_cell_h_y2 + 0.015f; + el.y2 = dst.location.y + 1 - io_cell_h_y2 + wire_length_long; } } else { if (x == 0) { - el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; + el.x2 = dst.location.x + 1 - io_cell_v_x1 + wire_length_long; } else { - el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + el.x2 = dst.location.x + io_cell_v_x1 - wire_length_long; } - el.y2 = dst.location.y + io_cell_v_y1 + gap * 0.10 + 0.0017f * (num + 1); + el.y2 = dst.location.y + io_cell_v_y1 + gap * io_cell_gap + wire_distance * (num + 1); } } if (dst_type == id_WIRE_TYPE_EBR) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_JADA0_EBR + 1) + 3 * slice_pitch; } if (dst_type == id_WIRE_TYPE_MULT18) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.00085f * (dst_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance_small * (dst_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; } if (dst_type == id_WIRE_TYPE_ALU54) { int num = (dst_id - TILE_WIRE_JCLK0_ALU54) % 225; int group = (dst_id - TILE_WIRE_JCLK0_ALU54) / 225; if (group == 0) { - el.x2 = dst.location.x + slice_x1 - 0.005f; + el.x2 = dst.location.x + slice_x1 - wire_length; } else { - el.x2 = dst.location.x + 0.97 + 0.005f; + el.x2 = dst.location.x + slice_x2_wide + wire_length; } - el.y2 = dst.location.y + slice_y2 - 0.00085f * (num + 1) + 3 * slice_pitch; + el.y2 = dst.location.y + slice_y2 - wire_distance_small * (num + 1) + 3 * slice_pitch; } if (dst_type == id_WIRE_TYPE_PLL) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_CLKI_PLL + 1); + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_CLKI_PLL + 1); } if (dst_type == id_WIRE_TYPE_GSR) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JCLK_GSR + 1); + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_JCLK_GSR + 1); } if (dst_type == id_WIRE_TYPE_JTAG) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_JJCE1_JTAG + 1) + 1 * slice_pitch; } if (dst_type == id_WIRE_TYPE_OSC) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_SEDSTDBY_OSC + 1) + 2 * slice_pitch; } if (dst_type == id_WIRE_TYPE_SED) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_SEDSTDBY_SED + 1) + 3 * slice_pitch; } if (dst_type == id_WIRE_TYPE_DTR) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_JSTARTPULSE_DTR + 1); + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_JSTARTPULSE_DTR + 1); } if (dst_type == id_WIRE_TYPE_EXTREF) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_REFCLKP_EXTREF + 1) + 1 * slice_pitch; } if (dst_type == id_WIRE_TYPE_DCU) { - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (dst_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; } if (dst_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; int group = 1 - (dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) / 7; - el.x2 = dst.location.x + slice_x1 - 0.005f; - el.y2 = dst.location.y + slice_y2 - 0.0017f * (num + 1) + group * slice_pitch; + el.x2 = dst.location.x + slice_x1 - wire_length; + el.y2 = dst.location.y + slice_y2 - wire_distance * (num + 1) + group * slice_pitch; } if (dst_type == id_WIRE_TYPE_DQS) { int num = (dst_id - TILE_WIRE_DDRDEL_DQS); if (dst.location.x == 0) { - el.x2 = dst.location.x + 1 - io_cell_v_x1 + 0.015f; + el.x2 = dst.location.x + 1 - io_cell_v_x1 + wire_length_long; } else { - el.x2 = dst.location.x + io_cell_v_x1 - 0.015f; + el.x2 = dst.location.x + io_cell_v_x1 - wire_length_long; } - el.y2 = dst.location.y + io_cell_v_y1 + 8 * 0.10 + 0.0017f * (num + 1); + el.y2 = dst.location.y + io_cell_v_y1 + 8 * io_cell_gap + wire_distance * (num + 1); } if (dst_type == id_WIRE_TYPE_DDRDLL) { int num = (dst_id - TILE_WIRE_DDRDEL_DDRDLL); - el.x2 = dst.location.x + io_cell_h_x1 + 0.2 + 0.0017f * (num + 1); + el.x2 = dst.location.x + io_cell_h_x1 + dll_cell_x1 + wire_distance * (num + 1); if (dst.location.y == h - 1) { - el.y2 = dst.location.y + 0.2 - 0.015f; + el.y2 = dst.location.y + dll_cell_y1 - wire_length_long; } else { - el.y2 = dst.location.y + 0.8 + 0.015f; + el.y2 = dst.location.y + dll_cell_y2 + wire_length_long; } } if (dst_type == id_WIRE_TYPE_CCLK) { int num = (dst_id - TILE_WIRE_JPADDI_CCLK); - el.x2 = dst.location.x + slice_x1 + 0.0017f * (num + 1); - el.y2 = dst.location.y + slice_y2 - 1 * slice_pitch - 0.015f; + el.x2 = dst.location.x + slice_x1 + wire_distance * (num + 1); + el.y2 = dst.location.y + slice_y2 - 1 * slice_pitch - wire_length_long; } if (dst_type == id_WIRE_TYPE_G_HPBX) { - el.x2 = x + switchbox_x1 + 0.0017f * (200 + (dst_id - TILE_WIRE_G_HPBX0000)); + el.x2 = x + switchbox_x1 + wire_distance * (200 + (dst_id - TILE_WIRE_G_HPBX0000)); el.y2 = y + switchbox_y1; } } @@ -1144,7 +1156,7 @@ void toSameSideHor(std::vector &g, GraphicElement &el, int x, in int sign = (src_type == dst_type) ? 1 : -1; setSource(el, x, y, w, h, src, src_type, src_id); el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 + sign * 0.0017f * idx; + el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 + sign * wire_distance * idx; g.push_back(el); GraphicElement el2; @@ -1168,7 +1180,7 @@ void toSameSideVer(std::vector &g, GraphicElement &el, int x, in { int sign = (src_type == dst_type) ? 1 : -1; setSource(el, x, y, w, h, src, src_type, src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 + sign * 0.0017f * idx; + el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 + sign * wire_distance * idx; el.y2 = el.y1; g.push_back(el); @@ -1192,7 +1204,7 @@ void toSameSideH1Ver(std::vector &g, GraphicElement &el, int x, GraphicElement::style_t style, int idx) { setSource(el, x, y, w, h, src, src_type, src_id); - el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 - 0.0017f * idx; + el.x2 = x + switchbox_x1 + (switchbox_x2 - switchbox_x1) / 2 - wire_distance * idx; el.y2 = el.y1; g.push_back(el); @@ -1243,7 +1255,7 @@ void toSameSideV1Ver(std::vector &g, GraphicElement &el, int x, { setSource(el, x, y, w, h, src, src_type, src_id); el.x2 = el.x1; - el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 - 0.0017f * idx; + el.y2 = y + switchbox_y1 + (switchbox_y2 - switchbox_y1) / 2 - wire_distance * idx; g.push_back(el); GraphicElement el2; -- cgit v1.2.3 From fb5480cde349008ab74e6b7179ac1b1fc8ffef1f Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 28 Dec 2019 15:02:13 +0100 Subject: clangformat --- ecp5/gfx.cc | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'ecp5/gfx.cc') diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc index 3f64f0f0..dc6bed21 100644 --- a/ecp5/gfx.cc +++ b/ecp5/gfx.cc @@ -66,7 +66,7 @@ void gfxTileBel(std::vector &g, int x, int y, int z, int w, int g.push_back(el); el.style = GraphicElement::STYLE_FRAME; - el.x1 = x + slice_x2 + 15*wire_distance; + el.x1 = x + slice_x2 + 15 * wire_distance; el.x2 = el.x1 + wire_distance; el.y1 = y + slice_y2 - wire_distance * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + (3 - z) * 26) + 3 * slice_pitch - 0.0007f; @@ -430,7 +430,7 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); } else if (tilewire >= TILE_WIRE_CLK0 && tilewire <= TILE_WIRE_LSR1) { el.x1 = x + switchbox_x2; - el.x2 = x + slice_x2 + 15*wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; + el.x2 = x + slice_x2 + 15 * wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; el.y1 = y + slice_y2 - wire_distance * (tilewire - TILE_WIRE_CLK0 - 5) + 3 * slice_pitch; el.y2 = el.y1; g.push_back(el); @@ -438,8 +438,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS el.y2 = y + slice_y2 - wire_distance * (3 + (tilewire - TILE_WIRE_CLK0)); g.push_back(el); for (int i = 0; i < 4; i++) { - el.x1 = x + slice_x2 + 15*wire_distance + wire_distance; - el.x2 = x + slice_x2 + 15*wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; + el.x1 = x + slice_x2 + 15 * wire_distance + wire_distance; + el.x2 = x + slice_x2 + 15 * wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; el.y1 = y + slice_y2 - wire_distance * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + tilewire - TILE_WIRE_CLK0) + i * slice_pitch; @@ -448,8 +448,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS } if (tilewire == TILE_WIRE_CLK1 || tilewire == TILE_WIRE_LSR1) { for (int i = 0; i < 2; i++) { - el.x1 = x + slice_x2 + 3*wire_distance; - el.x2 = x + slice_x2 + 15*wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; + el.x1 = x + slice_x2 + 3 * wire_distance; + el.x2 = x + slice_x2 + 15 * wire_distance + (8 - (tilewire - TILE_WIRE_CLK0)) * wire_distance; el.y1 = y + slice_y2 - wire_distance * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 - 1 + (tilewire - TILE_WIRE_CLK0) / 2) + @@ -493,8 +493,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS else if (tilewire >= TILE_WIRE_MUXCLK3 && tilewire <= TILE_WIRE_MUXLSR0) { int gap = (tilewire - TILE_WIRE_MUXCLK3) / 2; int part = (tilewire - TILE_WIRE_MUXCLK3) % 2; - el.x1 = x + slice_x2 + 3*wire_distance; - el.x2 = x + slice_x2 + 15*wire_distance; + el.x1 = x + slice_x2 + 3 * wire_distance; + el.x2 = x + slice_x2 + 15 * wire_distance; el.y1 = y + slice_y2 - wire_distance * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + gap * 26) + 3 * slice_pitch; el.y2 = el.y1; @@ -512,7 +512,8 @@ void gfxTileWire(std::vector &g, int x, int y, int w, int h, IdS g.push_back(el); el.x1 = el.x2; - el.y2 = y + slice_y2 - wire_distance * (TILE_WIRE_WD1B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + (part & 1) + 14 * 2) + + el.y2 = y + slice_y2 - + wire_distance * (TILE_WIRE_WD1B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + (part & 1) + 14 * 2) + (3 - group) * slice_pitch; g.push_back(el); @@ -800,7 +801,8 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr if (src_id >= TILE_WIRE_FCO && src_id <= TILE_WIRE_FCI) { int gap = (src_id - TILE_WIRE_FCO) / 24; el.x1 = src.location.x + switchbox_x2; - el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_FCO + 1 + gap * 2) + 3 * slice_pitch; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_FCO + 1 + gap * 2) + + 3 * slice_pitch; } if (src_id >= TILE_WIRE_JCE0 && src_id <= TILE_WIRE_JQ7) { el.x1 = src.location.x + switchbox_x2 + wire_length; @@ -810,7 +812,8 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr bool top = (src.location.y == (h - 1)); el.x1 = src.location.x + 0.5f + wire_length; if (top) - el.y1 = src.location.y + 1 - (slice_y2 - wire_distance * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + el.y1 = src.location.y + 1 - + (slice_y2 - wire_distance * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); else el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; } @@ -861,7 +864,8 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } if (src_type == id_WIRE_TYPE_MULT18) { el.x1 = src.location.x + slice_x1 - wire_length; - el.y1 = src.location.y + slice_y2 - wire_distance_small * (src_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.y1 = src.location.y + slice_y2 - wire_distance_small * (src_id - TILE_WIRE_JCLK0_MULT18 + 1) + + 3 * slice_pitch; } if (src_type == id_WIRE_TYPE_ALU54) { int num = (src_id - TILE_WIRE_JCLK0_ALU54) % 225; @@ -903,7 +907,8 @@ void setSource(GraphicElement &el, int x, int y, int w, int h, WireId src, IdStr } if (src_type == id_WIRE_TYPE_DCU) { el.x1 = src.location.x + slice_x1 - wire_length; - el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + el.y1 = src.location.y + slice_y2 - wire_distance * (src_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + + 0 * slice_pitch; } if (src_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (src_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; @@ -1010,7 +1015,8 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, bool top = (dst.location.y == (h - 1)); el.x2 = dst.location.x + 0.5f; if (top) - el.y2 = dst.location.y + 1 - (slice_y2 - wire_distance * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); + el.y2 = dst.location.y + 1 - + (slice_y2 - wire_distance * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch); else el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_JDIA + 1) + 3 * slice_pitch; } @@ -1062,7 +1068,8 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } if (dst_type == id_WIRE_TYPE_MULT18) { el.x2 = dst.location.x + slice_x1 - wire_length; - el.y2 = dst.location.y + slice_y2 - wire_distance_small * (dst_id - TILE_WIRE_JCLK0_MULT18 + 1) + 3 * slice_pitch; + el.y2 = dst.location.y + slice_y2 - wire_distance_small * (dst_id - TILE_WIRE_JCLK0_MULT18 + 1) + + 3 * slice_pitch; } if (dst_type == id_WIRE_TYPE_ALU54) { int num = (dst_id - TILE_WIRE_JCLK0_ALU54) % 225; @@ -1104,7 +1111,8 @@ void setDestination(GraphicElement &el, int x, int y, int w, int h, WireId dst, } if (dst_type == id_WIRE_TYPE_DCU) { el.x2 = dst.location.x + slice_x1 - wire_length; - el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + 0 * slice_pitch; + el.y2 = dst.location.y + slice_y2 - wire_distance * (dst_id - TILE_WIRE_CH0_RX_REFCLK_DCU + 1) + + 0 * slice_pitch; } if (dst_type == id_WIRE_TYPE_PCSCLKDIV) { int num = (dst_id - TILE_WIRE_CLKI_PCSCLKDIV1) % 7; -- cgit v1.2.3