From 841714a3d6bf475586812db3ba39bbd4dd4606de Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 10 Jul 2018 15:09:11 +0200 Subject: Improve ic40 gfx Signed-off-by: Clifford Wolf --- ice40/arch.cc | 80 +++++++---------------------- ice40/gfx.cc | 141 +++++++++++++++++++++++++++++++++++++++++++++++---- ice40/gfx.h | 159 +++++++++++++++++++++++++--------------------------------- 3 files changed, 216 insertions(+), 164 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index 2eb7d1c3..0b82914a 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -436,69 +436,25 @@ std::vector Arch::getBelGraphics(BelId bel) const if (chip_info->bel_data[bel.index].z == 0) { int tx = chip_info->bel_data[bel.index].x; int ty = chip_info->bel_data[bel.index].y; - // Local tracks to LUT input switchbox - GraphicElement lc_lut_sw; - lc_lut_sw.type = GraphicElement::G_BOX; - lc_lut_sw.x1 = tx + lc_lut_swbox_x1; - lc_lut_sw.x2 = tx + lc_lut_swbox_x2; - lc_lut_sw.y1 = ty + lc_lut_swbox_y1; - lc_lut_sw.y2 = ty + lc_lut_swbox_y2; - lc_lut_sw.z = 0; - ret.push_back(lc_lut_sw); - // Local tracks switchbox - GraphicElement lc_sw; - lc_sw.type = GraphicElement::G_BOX; - lc_sw.x1 = tx + locals_swbox_x1; - lc_sw.x2 = tx + locals_swbox_x2; - lc_sw.y1 = ty + locals_swbox_y1; - lc_sw.y2 = ty + locals_swbox_y2; - ret.push_back(lc_sw); - - // lutff_global switchbox - GraphicElement lff_glb_sw; - lff_glb_sw.type = GraphicElement::G_BOX; - lff_glb_sw.x1 = tx + lutff_global_swbox_x1; - lff_glb_sw.x2 = tx + lutff_global_swbox_x2; - lff_glb_sw.y1 = ty + lutff_global_swbox_y1; - lff_glb_sw.y2 = ty + lutff_global_swbox_y2; - ret.push_back(lff_glb_sw); - - // glb2local switchbox - GraphicElement glb2local_sw; - glb2local_sw.type = GraphicElement::G_BOX; - glb2local_sw.x1 = tx + glb2local_swbox_x1; - glb2local_sw.x2 = tx + glb2local_swbox_x2; - glb2local_sw.y1 = ty + glb2local_swbox_y1; - glb2local_sw.y2 = ty + glb2local_swbox_y2; - ret.push_back(glb2local_sw); - - // span12 switchbox - GraphicElement sp12_sw; - sp12_sw.type = GraphicElement::G_BOX; - sp12_sw.x1 = tx + span12_swbox_x1; - sp12_sw.x2 = tx + span12_swbox_x2; - sp12_sw.y1 = ty + span12_swbox_y1; - sp12_sw.y2 = ty + span12_swbox_y2; - ret.push_back(sp12_sw); - - // span4v switchbox - GraphicElement sp4v_sw; - sp4v_sw.type = GraphicElement::G_BOX; - sp4v_sw.x1 = tx + span4h_swbox_x1; - sp4v_sw.x2 = tx + span4h_swbox_x2; - sp4v_sw.y1 = ty + span4h_swbox_y1; - sp4v_sw.y2 = ty + span4h_swbox_y2; - ret.push_back(sp4v_sw); - - // span4h switchbox - GraphicElement sp4h_sw; - sp4h_sw.type = GraphicElement::G_BOX; - sp4h_sw.x1 = tx + span4v_swbox_x1; - sp4h_sw.x2 = tx + span4v_swbox_x2; - sp4h_sw.y1 = ty + span4v_swbox_y1; - sp4h_sw.y2 = ty + span4v_swbox_y2; - ret.push_back(sp4h_sw); + // Main switchbox + GraphicElement main_sw; + main_sw.type = GraphicElement::G_BOX; + main_sw.x1 = tx + main_swbox_x1; + main_sw.x2 = tx + main_swbox_x2; + main_sw.y1 = ty + main_swbox_y1; + main_sw.y2 = ty + main_swbox_y2; + ret.push_back(main_sw); + + // Local tracks to LUT input switchbox + GraphicElement local_sw; + local_sw.type = GraphicElement::G_BOX; + local_sw.x1 = tx + local_swbox_x1; + local_sw.x2 = tx + local_swbox_x2; + local_sw.y1 = ty + local_swbox_y1; + local_sw.y2 = ty + local_swbox_y2; + local_sw.z = 0; + ret.push_back(local_sw); // All the wires for (int i = TILE_WIRE_GLB2LOCAL_0; i <= TILE_WIRE_SP12_H_L_23; i++) diff --git a/ice40/gfx.cc b/ice40/gfx.cc index 58e52d65..e72b2515 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -37,6 +37,12 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.y1 = y1; el.y2 = y1; g.push_back(el); + + el.x1 = x + main_swbox_x1 + 0.0025 * (idx + 35); + el.x2 = el.x1; + el.y1 = y1; + el.y2 = y + main_swbox_y1; + g.push_back(el); } if (id >= TILE_WIRE_SP4_H_R_0 && id <= TILE_WIRE_SP4_H_R_47) { @@ -73,6 +79,12 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.y1 = y2; el.y2 = y3; g.push_back(el); + + el.x1 = x + main_swbox_x1 + 0.0025 * ((idx ^ 1) + 35); + el.x2 = el.x1; + el.y1 = y2; + el.y2 = y + main_swbox_y1; + g.push_back(el); } // Vertical Span-4 Wires @@ -89,6 +101,12 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.x1 = x1; el.x2 = x1; g.push_back(el); + + el.y1 = y + 0.03 + 0.0025 * (270 - idx); + el.y2 = el.y1; + el.x1 = x1; + el.x2 = x + main_swbox_x1; + g.push_back(el); } if (id >= TILE_WIRE_SP4_V_B_0 && id <= TILE_WIRE_SP4_V_B_47) { @@ -126,13 +144,17 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.x2 = x3; g.push_back(el); - float y1 = y + 0.03 + 0.0025 * (154 - idx); - - el.y1 = y1; - el.y2 = y1; + el.y1 = y + 0.03 + 0.0025 * (145 - idx); + el.y2 = el.y1; el.x1 = x; el.x2 = x2; g.push_back(el); + + el.y1 = y + 0.03 + 0.0025 * (270 - idx); + el.y2 = el.y1; + el.x1 = x2; + el.x2 = x + main_swbox_x1; + g.push_back(el); } // Horizontal Span-12 Wires @@ -149,6 +171,12 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.y1 = y1; el.y2 = y1; g.push_back(el); + + el.x1 = x + main_swbox_x1 + 0.0025 * (idx + 5); + el.x2 = el.x1; + el.y1 = y1; + el.y2 = y + main_swbox_y1; + g.push_back(el); } if (id >= TILE_WIRE_SP12_H_R_0 && id <= TILE_WIRE_SP12_H_R_23) { @@ -185,20 +213,26 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.y1 = y2; el.y2 = y3; g.push_back(el); + + el.x1 = x + main_swbox_x1 + 0.0025 * (idx + 5); + el.x2 = el.x1; + el.y1 = y2; + el.y2 = y + main_swbox_y1; + g.push_back(el); } - // Veritcal Right Span-4 + // Vertical Right Span-4 if (id >= TILE_WIRE_SP4_R_V_B_0 && id <= TILE_WIRE_SP4_R_V_B_47) { int idx = id - TILE_WIRE_SP4_R_V_B_0; GraphicElement el; el.type = GraphicElement::G_LINE; - float y1 = y + 0.03 + 0.0025 * (154 - idx); + float y1 = y + 0.03 + 0.0025 * (145 - idx); el.y1 = y1; el.y2 = y1; - el.x1 = x + 0.6; + el.x1 = x + main_swbox_x2; el.x2 = x + 1.0; g.push_back(el); } @@ -217,6 +251,12 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.x1 = x1; el.x2 = x1; g.push_back(el); + + el.y1 = y + 0.03 + 0.0025 * (300 - idx); + el.y2 = el.y1; + el.x1 = x1; + el.x2 = x + main_swbox_x1; + g.push_back(el); } if (id >= TILE_WIRE_SP12_V_B_0 && id <= TILE_WIRE_SP12_V_B_23) { @@ -253,6 +293,65 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.x1 = x2; el.x2 = x3; g.push_back(el); + + el.y1 = y + 0.03 + 0.0025 * (300 - (idx ^ 1)); + el.y2 = el.y1; + el.x1 = x2; + el.x2 = x + main_swbox_x1; + g.push_back(el); + } + + // Global2Local + + if (id >= TILE_WIRE_GLB2LOCAL_0 && id <= TILE_WIRE_GLB2LOCAL_3) { + int idx = id - TILE_WIRE_GLB2LOCAL_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + el.x1 = x + main_swbox_x1 + 0.005 * (idx + 5); + el.x2 = el.x1; + el.y1 = y + main_swbox_y2; + el.y2 = el.y1 + 0.02; + g.push_back(el); + } + + // GlobalNets + + if (id >= TILE_WIRE_GLB_NETWK_0 && id <= TILE_WIRE_GLB_NETWK_7) { + int idx = id - TILE_WIRE_GLB_NETWK_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + el.x1 = x + main_swbox_x1 - 0.05; + el.x2 = x + main_swbox_x1; + el.y1 = y + main_swbox_y2 - 0.005 * (13 - idx); + el.y2 = el.y1; + g.push_back(el); + } + + // Neighbours + + if (id >= TILE_WIRE_NEIGH_OP_BNL_0 && id <= TILE_WIRE_NEIGH_OP_TOP_7) { + int idx = id - TILE_WIRE_NEIGH_OP_BNL_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + el.y1 = y + main_swbox_y1 + 0.0025 * (idx + 10) + 0.01 * (idx / 8); + el.y2 = el.y1; + el.x1 = x + main_swbox_x1 - 0.05; + el.x2 = x + main_swbox_x1; + g.push_back(el); + } + + // Local Tracks + + if (id >= TILE_WIRE_LOCAL_G0_0 && id <= TILE_WIRE_LOCAL_G3_7) { + int idx = id - TILE_WIRE_LOCAL_G0_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + el.x1 = x + main_swbox_x2; + el.x2 = x + local_swbox_x1; + float yoff = y + (local_swbox_y1 + local_swbox_y2) / 2 - 0.005 * 16 - 0.075; + el.y1 = yoff + 0.005 * idx + 0.05 * (idx / 8); + el.y2 = el.y1; + g.push_back(el); } // LC Inputs @@ -263,7 +362,7 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) int input = idx % 4; GraphicElement el; el.type = GraphicElement::G_LINE; - el.x1 = x + lc_lut_swbox_x2; + el.x1 = x + local_swbox_x2; el.x2 = x + logic_cell_x1; el.y1 = y + 0.4675 + (0.005 * input) + z * logic_cell_pitch; el.y2 = el.y1; @@ -275,13 +374,13 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) if (id >= TILE_WIRE_LUTFF_0_OUT && id <= TILE_WIRE_LUTFF_7_OUT) { int idx = id - TILE_WIRE_LUTFF_0_OUT; - float y1 = y + 0.03 + 0.0025 * (102 - idx); + float y1 = y + 0.03 + 0.0025 * (159 - idx); GraphicElement el; el.type = GraphicElement::G_LINE; el.y1 = y1; el.y2 = y1; - el.x1 = x + 0.3; + el.x1 = x + main_swbox_x2; el.x2 = x + 0.97 + 0.0025 * idx; g.push_back(el); @@ -294,6 +393,28 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.x1 = x + logic_cell_x2; g.push_back(el); } + + // LC Control + + if (id >= TILE_WIRE_LUTFF_GLOBAL_CEN && id <= TILE_WIRE_LUTFF_GLOBAL_S_R) { + int idx = id - TILE_WIRE_LUTFF_GLOBAL_CEN; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + el.x1 = x + main_swbox_x2 - 0.005 * (idx + 5); + el.x2 = el.x1; + el.y1 = y + main_swbox_y2; + el.y2 = el.y1 + 0.005 * (idx + 3); + g.push_back(el); + + el.y1 = el.y2; + el.x2 = x + logic_cell_x2 - 0.005 * (2 - idx + 5); + g.push_back(el); + + el.y2 = y + logic_cell_y2 + 7*logic_cell_pitch; + el.x1 = el.x2; + g.push_back(el); + } } NEXTPNR_NAMESPACE_END diff --git a/ice40/gfx.h b/ice40/gfx.h index 0fdfc326..9fce27e8 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -24,42 +24,17 @@ NEXTPNR_NAMESPACE_BEGIN -const float lc_lut_swbox_x1 = 0.75; -const float lc_lut_swbox_x2 = 0.8; -const float lc_lut_swbox_y1 = 0.45; -const float lc_lut_swbox_y2 = 0.9375; - -const float locals_swbox_x1 = 0.6; -const float locals_swbox_x2 = 0.7; -const float locals_swbox_y1 = 0.65; -const float locals_swbox_y2 = 0.75; - -const float lutff_global_swbox_x1 = 0.65; -const float lutff_global_swbox_x2 = 0.7; -const float lutff_global_swbox_y1 = 0.91; -const float lutff_global_swbox_y2 = 0.96; - -const float glb2local_swbox_x1 = 0.45; -const float glb2local_swbox_x2 = 0.55; -const float glb2local_swbox_y1 = 0.80; -const float glb2local_swbox_y2 = 0.85; - -const float span12_swbox_x1 = 0.500; -const float span12_swbox_x2 = 0.575; -const float span12_swbox_y1 = 0.525; -const float span12_swbox_y2 = 0.625; - -const float span4h_swbox_x1 = 0.400; -const float span4h_swbox_x2 = 0.475; -const float span4h_swbox_y1 = 0.425; -const float span4h_swbox_y2 = 0.525; - -const float span4v_swbox_x1 = 0.300; -const float span4v_swbox_x2 = 0.375; -const float span4v_swbox_y1 = 0.300; -const float span4v_swbox_y2 = 0.400; - -const float logic_cell_x1 = 0.82; +const float main_swbox_x1 = 0.35; +const float main_swbox_x2 = 0.60; +const float main_swbox_y1 = 0.27; +const float main_swbox_y2 = 0.95; + +const float local_swbox_x1 = 0.63; +const float local_swbox_x2 = 0.73; +const float local_swbox_y1 = 0.45; +const float local_swbox_y2 = 0.9375; + +const float logic_cell_x1 = 0.76; const float logic_cell_x2 = 0.95; const float logic_cell_y1 = 0.45; const float logic_cell_y2 = 0.50; @@ -190,75 +165,75 @@ enum GfxTileWireId { TILE_WIRE_LUTFF_GLOBAL_S_R, TILE_WIRE_NEIGH_OP_BNL_0, - TILE_WIRE_NEIGH_OP_BNR_0, - TILE_WIRE_NEIGH_OP_BOT_0, - TILE_WIRE_NEIGH_OP_LFT_0, - TILE_WIRE_NEIGH_OP_RGT_0, - TILE_WIRE_NEIGH_OP_TNL_0, - TILE_WIRE_NEIGH_OP_TNR_0, - TILE_WIRE_NEIGH_OP_TOP_0, - TILE_WIRE_NEIGH_OP_BNL_1, - TILE_WIRE_NEIGH_OP_BNR_1, - TILE_WIRE_NEIGH_OP_BOT_1, - TILE_WIRE_NEIGH_OP_LFT_1, - TILE_WIRE_NEIGH_OP_RGT_1, - TILE_WIRE_NEIGH_OP_TNL_1, - TILE_WIRE_NEIGH_OP_TNR_1, - TILE_WIRE_NEIGH_OP_TOP_1, - TILE_WIRE_NEIGH_OP_BNL_2, - TILE_WIRE_NEIGH_OP_BNR_2, - TILE_WIRE_NEIGH_OP_BOT_2, - TILE_WIRE_NEIGH_OP_LFT_2, - TILE_WIRE_NEIGH_OP_RGT_2, - TILE_WIRE_NEIGH_OP_TNL_2, - TILE_WIRE_NEIGH_OP_TNR_2, - TILE_WIRE_NEIGH_OP_TOP_2, - TILE_WIRE_NEIGH_OP_BNL_3, - TILE_WIRE_NEIGH_OP_BNR_3, - TILE_WIRE_NEIGH_OP_BOT_3, - TILE_WIRE_NEIGH_OP_LFT_3, - TILE_WIRE_NEIGH_OP_RGT_3, - TILE_WIRE_NEIGH_OP_TNL_3, - TILE_WIRE_NEIGH_OP_TNR_3, - TILE_WIRE_NEIGH_OP_TOP_3, - TILE_WIRE_NEIGH_OP_BNL_4, - TILE_WIRE_NEIGH_OP_BNR_4, - TILE_WIRE_NEIGH_OP_BOT_4, - TILE_WIRE_NEIGH_OP_LFT_4, - TILE_WIRE_NEIGH_OP_RGT_4, - TILE_WIRE_NEIGH_OP_TNL_4, - TILE_WIRE_NEIGH_OP_TNR_4, - TILE_WIRE_NEIGH_OP_TOP_4, - TILE_WIRE_NEIGH_OP_BNL_5, - TILE_WIRE_NEIGH_OP_BNR_5, - TILE_WIRE_NEIGH_OP_BOT_5, - TILE_WIRE_NEIGH_OP_LFT_5, - TILE_WIRE_NEIGH_OP_RGT_5, - TILE_WIRE_NEIGH_OP_TNL_5, - TILE_WIRE_NEIGH_OP_TNR_5, - TILE_WIRE_NEIGH_OP_TOP_5, - TILE_WIRE_NEIGH_OP_BNL_6, - TILE_WIRE_NEIGH_OP_BNR_6, - TILE_WIRE_NEIGH_OP_BOT_6, - TILE_WIRE_NEIGH_OP_LFT_6, - TILE_WIRE_NEIGH_OP_RGT_6, - TILE_WIRE_NEIGH_OP_TNL_6, - TILE_WIRE_NEIGH_OP_TNR_6, - TILE_WIRE_NEIGH_OP_TOP_6, - TILE_WIRE_NEIGH_OP_BNL_7, + + TILE_WIRE_NEIGH_OP_BNR_0, + TILE_WIRE_NEIGH_OP_BNR_1, + TILE_WIRE_NEIGH_OP_BNR_2, + TILE_WIRE_NEIGH_OP_BNR_3, + TILE_WIRE_NEIGH_OP_BNR_4, + TILE_WIRE_NEIGH_OP_BNR_5, + TILE_WIRE_NEIGH_OP_BNR_6, TILE_WIRE_NEIGH_OP_BNR_7, + + TILE_WIRE_NEIGH_OP_BOT_0, + TILE_WIRE_NEIGH_OP_BOT_1, + TILE_WIRE_NEIGH_OP_BOT_2, + TILE_WIRE_NEIGH_OP_BOT_3, + TILE_WIRE_NEIGH_OP_BOT_4, + TILE_WIRE_NEIGH_OP_BOT_5, + TILE_WIRE_NEIGH_OP_BOT_6, TILE_WIRE_NEIGH_OP_BOT_7, + + TILE_WIRE_NEIGH_OP_LFT_0, + TILE_WIRE_NEIGH_OP_LFT_1, + TILE_WIRE_NEIGH_OP_LFT_2, + TILE_WIRE_NEIGH_OP_LFT_3, + TILE_WIRE_NEIGH_OP_LFT_4, + TILE_WIRE_NEIGH_OP_LFT_5, + TILE_WIRE_NEIGH_OP_LFT_6, TILE_WIRE_NEIGH_OP_LFT_7, + + TILE_WIRE_NEIGH_OP_RGT_0, + TILE_WIRE_NEIGH_OP_RGT_1, + TILE_WIRE_NEIGH_OP_RGT_2, + TILE_WIRE_NEIGH_OP_RGT_3, + TILE_WIRE_NEIGH_OP_RGT_4, + TILE_WIRE_NEIGH_OP_RGT_5, + TILE_WIRE_NEIGH_OP_RGT_6, TILE_WIRE_NEIGH_OP_RGT_7, + + TILE_WIRE_NEIGH_OP_TNL_0, + TILE_WIRE_NEIGH_OP_TNL_1, + TILE_WIRE_NEIGH_OP_TNL_2, + TILE_WIRE_NEIGH_OP_TNL_3, + TILE_WIRE_NEIGH_OP_TNL_4, + TILE_WIRE_NEIGH_OP_TNL_5, + TILE_WIRE_NEIGH_OP_TNL_6, TILE_WIRE_NEIGH_OP_TNL_7, + + TILE_WIRE_NEIGH_OP_TNR_0, + TILE_WIRE_NEIGH_OP_TNR_1, + TILE_WIRE_NEIGH_OP_TNR_2, + TILE_WIRE_NEIGH_OP_TNR_3, + TILE_WIRE_NEIGH_OP_TNR_4, + TILE_WIRE_NEIGH_OP_TNR_5, + TILE_WIRE_NEIGH_OP_TNR_6, TILE_WIRE_NEIGH_OP_TNR_7, + + TILE_WIRE_NEIGH_OP_TOP_0, + TILE_WIRE_NEIGH_OP_TOP_1, + TILE_WIRE_NEIGH_OP_TOP_2, + TILE_WIRE_NEIGH_OP_TOP_3, + TILE_WIRE_NEIGH_OP_TOP_4, + TILE_WIRE_NEIGH_OP_TOP_5, + TILE_WIRE_NEIGH_OP_TOP_6, TILE_WIRE_NEIGH_OP_TOP_7, TILE_WIRE_SP4_V_B_0, -- cgit v1.2.3