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') 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