From a1cd9fcf73685a5b0c4e721d405550096d85d566 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 14:53:20 +0200 Subject: Reduce line width, adding some switchboxes Signed-off-by: David Shah --- ice40/arch.cc | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index 72f9c1f3..aed99b7b 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -424,12 +424,36 @@ std::vector Arch::getBelGraphics(BelId bel) const if (bel_type == TYPE_ICESTORM_LC) { GraphicElement el; el.type = GraphicElement::G_BOX; - el.x1 = chip_info->bel_data[bel.index].x + 0.1; - el.x2 = chip_info->bel_data[bel.index].x + 0.9; - el.y1 = chip_info->bel_data[bel.index].y + 0.10 + (chip_info->bel_data[bel.index].z) * (0.8 / 8); - el.y2 = chip_info->bel_data[bel.index].y + 0.18 + (chip_info->bel_data[bel.index].z) * (0.8 / 8); + el.x1 = chip_info->bel_data[bel.index].x + 0.82; + el.x2 = chip_info->bel_data[bel.index].x + 0.92; + el.y1 = chip_info->bel_data[bel.index].y + 0.30 + (chip_info->bel_data[bel.index].z) * (0.6 / 8); + el.y2 = chip_info->bel_data[bel.index].y + 0.35 + (chip_info->bel_data[bel.index].z) * (0.6 / 8); el.z = 0; ret.push_back(el); + + 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 + 0.75; + lc_lut_sw.x2 = tx + 0.8; + lc_lut_sw.y1 = ty + 0.30; + lc_lut_sw.y2 = ty + 0.875; + 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 + 0.6; + lc_sw.x2 = tx + 0.7; + lc_sw.y1 = ty + 0.65; + lc_sw.y2 = ty + 0.75; + ret.push_back(lc_sw); + + + } } if (bel_type == TYPE_SB_IO) { -- cgit v1.2.3 From 3be10f629a7a5eb68cfca01ac8a1464585817f22 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 9 Jul 2018 15:02:29 +0200 Subject: Add ice40 wire gfx enums Signed-off-by: Clifford Wolf --- ice40/arch.cc | 6 +- ice40/gfx.cc | 28 ++++ ice40/gfx.h | 456 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 489 insertions(+), 1 deletion(-) create mode 100644 ice40/gfx.cc create mode 100644 ice40/gfx.h (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index aed99b7b..ecd0a411 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -22,6 +22,8 @@ #include "log.h" #include "nextpnr.h" #include "util.h" +#include "gfx.h" + NEXTPNR_NAMESPACE_BEGIN // ----------------------------------------------------------------------- @@ -452,7 +454,9 @@ std::vector Arch::getBelGraphics(BelId bel) const lc_sw.y2 = ty + 0.75; ret.push_back(lc_sw); - + // All the wires + for (int i = TILE_WIRE_GLB2LOCAL_0; i <= TILE_WIRE_SP12_H_L_23; i++) + gfxTileWire(ret, tx, ty, GfxTileWireId(i)); } } diff --git a/ice40/gfx.cc b/ice40/gfx.cc new file mode 100644 index 00000000..46824b06 --- /dev/null +++ b/ice40/gfx.cc @@ -0,0 +1,28 @@ +/* + * nextpnr -- Next Generation Place and Route + * + * Copyright (C) 2018 Clifford Wolf + * + * 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, GfxTileWireId id) +{ +} + +NEXTPNR_NAMESPACE_END diff --git a/ice40/gfx.h b/ice40/gfx.h new file mode 100644 index 00000000..e9cc0e16 --- /dev/null +++ b/ice40/gfx.h @@ -0,0 +1,456 @@ +/* + * nextpnr -- Next Generation Place and Route + * + * Copyright (C) 2018 Clifford Wolf + * + * 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. + * + */ + +#ifndef GFX_H +#define GFX_H + +#include "nextpnr.h" + +NEXTPNR_NAMESPACE_BEGIN + +enum GfxTileWireId { + TILE_WIRE_GLB2LOCAL_0, + TILE_WIRE_GLB2LOCAL_1, + TILE_WIRE_GLB2LOCAL_2, + TILE_WIRE_GLB2LOCAL_3, + + TILE_WIRE_GLB_NETWK_0, + TILE_WIRE_GLB_NETWK_1, + TILE_WIRE_GLB_NETWK_2, + TILE_WIRE_GLB_NETWK_3, + TILE_WIRE_GLB_NETWK_4, + TILE_WIRE_GLB_NETWK_5, + TILE_WIRE_GLB_NETWK_6, + TILE_WIRE_GLB_NETWK_7, + + TILE_WIRE_LOCAL_G0_0, + TILE_WIRE_LOCAL_G0_1, + TILE_WIRE_LOCAL_G0_2, + TILE_WIRE_LOCAL_G0_3, + TILE_WIRE_LOCAL_G0_4, + TILE_WIRE_LOCAL_G0_5, + TILE_WIRE_LOCAL_G0_6, + TILE_WIRE_LOCAL_G0_7, + + TILE_WIRE_LOCAL_G1_0, + TILE_WIRE_LOCAL_G1_1, + TILE_WIRE_LOCAL_G1_2, + TILE_WIRE_LOCAL_G1_3, + TILE_WIRE_LOCAL_G1_4, + TILE_WIRE_LOCAL_G1_5, + TILE_WIRE_LOCAL_G1_6, + TILE_WIRE_LOCAL_G1_7, + + TILE_WIRE_LOCAL_G2_0, + TILE_WIRE_LOCAL_G2_1, + TILE_WIRE_LOCAL_G2_2, + TILE_WIRE_LOCAL_G2_3, + TILE_WIRE_LOCAL_G2_4, + TILE_WIRE_LOCAL_G2_5, + TILE_WIRE_LOCAL_G2_6, + TILE_WIRE_LOCAL_G2_7, + + TILE_WIRE_LOCAL_G3_0, + TILE_WIRE_LOCAL_G3_1, + TILE_WIRE_LOCAL_G3_2, + TILE_WIRE_LOCAL_G3_3, + TILE_WIRE_LOCAL_G3_4, + TILE_WIRE_LOCAL_G3_5, + TILE_WIRE_LOCAL_G3_6, + TILE_WIRE_LOCAL_G3_7, + + TILE_WIRE_CARRY_IN, + TILE_WIRE_CARRY_IN_MUX, + + TILE_WIRE_LUTFF_0_COUT, + TILE_WIRE_LUTFF_0_IN_0, + TILE_WIRE_LUTFF_0_IN_1, + TILE_WIRE_LUTFF_0_IN_2, + TILE_WIRE_LUTFF_0_IN_3, + TILE_WIRE_LUTFF_0_LOUT, + TILE_WIRE_LUTFF_0_OUT, + + TILE_WIRE_LUTFF_1_COUT, + TILE_WIRE_LUTFF_1_IN_0, + TILE_WIRE_LUTFF_1_IN_1, + TILE_WIRE_LUTFF_1_IN_2, + TILE_WIRE_LUTFF_1_IN_3, + TILE_WIRE_LUTFF_1_LOUT, + TILE_WIRE_LUTFF_1_OUT, + + TILE_WIRE_LUTFF_2_COUT, + TILE_WIRE_LUTFF_2_IN_0, + TILE_WIRE_LUTFF_2_IN_1, + TILE_WIRE_LUTFF_2_IN_2, + TILE_WIRE_LUTFF_2_IN_3, + TILE_WIRE_LUTFF_2_LOUT, + TILE_WIRE_LUTFF_2_OUT, + + TILE_WIRE_LUTFF_3_COUT, + TILE_WIRE_LUTFF_3_IN_0, + TILE_WIRE_LUTFF_3_IN_1, + TILE_WIRE_LUTFF_3_IN_2, + TILE_WIRE_LUTFF_3_IN_3, + TILE_WIRE_LUTFF_3_LOUT, + TILE_WIRE_LUTFF_3_OUT, + + TILE_WIRE_LUTFF_4_COUT, + TILE_WIRE_LUTFF_4_IN_0, + TILE_WIRE_LUTFF_4_IN_1, + TILE_WIRE_LUTFF_4_IN_2, + TILE_WIRE_LUTFF_4_IN_3, + TILE_WIRE_LUTFF_4_LOUT, + TILE_WIRE_LUTFF_4_OUT, + + TILE_WIRE_LUTFF_5_COUT, + TILE_WIRE_LUTFF_5_IN_0, + TILE_WIRE_LUTFF_5_IN_1, + TILE_WIRE_LUTFF_5_IN_2, + TILE_WIRE_LUTFF_5_IN_3, + TILE_WIRE_LUTFF_5_LOUT, + TILE_WIRE_LUTFF_5_OUT, + + TILE_WIRE_LUTFF_6_COUT, + TILE_WIRE_LUTFF_6_IN_0, + TILE_WIRE_LUTFF_6_IN_1, + TILE_WIRE_LUTFF_6_IN_2, + TILE_WIRE_LUTFF_6_IN_3, + TILE_WIRE_LUTFF_6_LOUT, + TILE_WIRE_LUTFF_6_OUT, + + TILE_WIRE_LUTFF_7_COUT, + TILE_WIRE_LUTFF_7_IN_0, + TILE_WIRE_LUTFF_7_IN_1, + TILE_WIRE_LUTFF_7_IN_2, + TILE_WIRE_LUTFF_7_IN_3, + TILE_WIRE_LUTFF_7_OUT, + + TILE_WIRE_LUTFF_GLOBAL_CEN, + TILE_WIRE_LUTFF_GLOBAL_CLK, + 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_7, + TILE_WIRE_NEIGH_OP_BOT_7, + TILE_WIRE_NEIGH_OP_LFT_7, + TILE_WIRE_NEIGH_OP_RGT_7, + TILE_WIRE_NEIGH_OP_TNL_7, + TILE_WIRE_NEIGH_OP_TNR_7, + TILE_WIRE_NEIGH_OP_TOP_7, + + TILE_WIRE_SP4_V_B_0, + TILE_WIRE_SP4_V_B_1, + TILE_WIRE_SP4_V_B_2, + TILE_WIRE_SP4_V_B_3, + TILE_WIRE_SP4_V_B_4, + TILE_WIRE_SP4_V_B_5, + TILE_WIRE_SP4_V_B_6, + TILE_WIRE_SP4_V_B_7, + TILE_WIRE_SP4_V_B_8, + TILE_WIRE_SP4_V_B_9, + TILE_WIRE_SP4_V_B_10, + TILE_WIRE_SP4_V_B_11, + TILE_WIRE_SP4_V_B_12, + TILE_WIRE_SP4_V_B_13, + TILE_WIRE_SP4_V_B_14, + TILE_WIRE_SP4_V_B_15, + TILE_WIRE_SP4_V_B_16, + TILE_WIRE_SP4_V_B_17, + TILE_WIRE_SP4_V_B_18, + TILE_WIRE_SP4_V_B_19, + TILE_WIRE_SP4_V_B_20, + TILE_WIRE_SP4_V_B_21, + TILE_WIRE_SP4_V_B_22, + TILE_WIRE_SP4_V_B_23, + TILE_WIRE_SP4_V_B_24, + TILE_WIRE_SP4_V_B_25, + TILE_WIRE_SP4_V_B_26, + TILE_WIRE_SP4_V_B_27, + TILE_WIRE_SP4_V_B_28, + TILE_WIRE_SP4_V_B_29, + TILE_WIRE_SP4_V_B_30, + TILE_WIRE_SP4_V_B_31, + TILE_WIRE_SP4_V_B_32, + TILE_WIRE_SP4_V_B_33, + TILE_WIRE_SP4_V_B_34, + TILE_WIRE_SP4_V_B_35, + TILE_WIRE_SP4_V_B_36, + TILE_WIRE_SP4_V_B_37, + TILE_WIRE_SP4_V_B_38, + TILE_WIRE_SP4_V_B_39, + TILE_WIRE_SP4_V_B_40, + TILE_WIRE_SP4_V_B_41, + TILE_WIRE_SP4_V_B_42, + TILE_WIRE_SP4_V_B_43, + TILE_WIRE_SP4_V_B_44, + TILE_WIRE_SP4_V_B_45, + TILE_WIRE_SP4_V_B_46, + TILE_WIRE_SP4_V_B_47, + + TILE_WIRE_SP4_V_T_36, + TILE_WIRE_SP4_V_T_37, + TILE_WIRE_SP4_V_T_38, + TILE_WIRE_SP4_V_T_39, + TILE_WIRE_SP4_V_T_40, + TILE_WIRE_SP4_V_T_41, + TILE_WIRE_SP4_V_T_42, + TILE_WIRE_SP4_V_T_43, + TILE_WIRE_SP4_V_T_44, + TILE_WIRE_SP4_V_T_45, + TILE_WIRE_SP4_V_T_46, + TILE_WIRE_SP4_V_T_47, + + TILE_WIRE_sp4_R_V_B_0, + TILE_WIRE_sp4_R_V_B_1, + TILE_WIRE_sp4_R_V_B_2, + TILE_WIRE_sp4_R_V_B_3, + TILE_WIRE_sp4_R_V_B_4, + TILE_WIRE_sp4_R_V_B_5, + TILE_WIRE_sp4_R_V_B_6, + TILE_WIRE_sp4_R_V_B_7, + TILE_WIRE_sp4_R_V_B_8, + TILE_WIRE_sp4_R_V_B_9, + TILE_WIRE_sp4_R_V_B_10, + TILE_WIRE_sp4_R_V_B_11, + TILE_WIRE_sp4_R_V_B_12, + TILE_WIRE_sp4_R_V_B_13, + TILE_WIRE_sp4_R_V_B_14, + TILE_WIRE_sp4_R_V_B_15, + TILE_WIRE_sp4_R_V_B_16, + TILE_WIRE_sp4_R_V_B_17, + TILE_WIRE_sp4_R_V_B_18, + TILE_WIRE_sp4_R_V_B_19, + TILE_WIRE_sp4_R_V_B_20, + TILE_WIRE_sp4_R_V_B_21, + TILE_WIRE_sp4_R_V_B_22, + TILE_WIRE_sp4_R_V_B_23, + TILE_WIRE_sp4_R_V_B_24, + TILE_WIRE_sp4_R_V_B_25, + TILE_WIRE_sp4_R_V_B_26, + TILE_WIRE_sp4_R_V_B_27, + TILE_WIRE_sp4_R_V_B_28, + TILE_WIRE_sp4_R_V_B_29, + TILE_WIRE_sp4_R_V_B_30, + TILE_WIRE_sp4_R_V_B_31, + TILE_WIRE_sp4_R_V_B_32, + TILE_WIRE_sp4_R_V_B_33, + TILE_WIRE_sp4_R_V_B_34, + TILE_WIRE_sp4_R_V_B_35, + TILE_WIRE_sp4_R_V_B_36, + TILE_WIRE_sp4_R_V_B_37, + TILE_WIRE_sp4_R_V_B_38, + TILE_WIRE_sp4_R_V_B_39, + TILE_WIRE_sp4_R_V_B_40, + TILE_WIRE_sp4_R_V_B_41, + TILE_WIRE_sp4_R_V_B_42, + TILE_WIRE_sp4_R_V_B_43, + TILE_WIRE_sp4_R_V_B_44, + TILE_WIRE_sp4_R_V_B_45, + TILE_WIRE_sp4_R_V_B_46, + TILE_WIRE_sp4_R_V_B_47, + + TILE_WIRE_SP4_H_L_36, + TILE_WIRE_SP4_H_L_37, + TILE_WIRE_SP4_H_L_38, + TILE_WIRE_SP4_H_L_39, + TILE_WIRE_SP4_H_L_40, + TILE_WIRE_SP4_H_L_41, + TILE_WIRE_SP4_H_L_42, + TILE_WIRE_SP4_H_L_43, + TILE_WIRE_SP4_H_L_44, + TILE_WIRE_SP4_H_L_45, + TILE_WIRE_SP4_H_L_46, + TILE_WIRE_SP4_H_L_47, + + TILE_WIRE_SP4_H_R_0, + TILE_WIRE_SP4_H_R_1, + TILE_WIRE_SP4_H_R_2, + TILE_WIRE_SP4_H_R_3, + TILE_WIRE_SP4_H_R_4, + TILE_WIRE_SP4_H_R_5, + TILE_WIRE_SP4_H_R_6, + TILE_WIRE_SP4_H_R_7, + TILE_WIRE_SP4_H_R_8, + TILE_WIRE_SP4_H_R_9, + TILE_WIRE_SP4_H_R_10, + TILE_WIRE_SP4_H_R_11, + TILE_WIRE_SP4_H_R_12, + TILE_WIRE_SP4_H_R_13, + TILE_WIRE_SP4_H_R_14, + TILE_WIRE_SP4_H_R_15, + TILE_WIRE_SP4_H_R_16, + TILE_WIRE_SP4_H_R_17, + TILE_WIRE_SP4_H_R_18, + TILE_WIRE_SP4_H_R_19, + TILE_WIRE_SP4_H_R_20, + TILE_WIRE_SP4_H_R_21, + TILE_WIRE_SP4_H_R_22, + TILE_WIRE_SP4_H_R_23, + TILE_WIRE_SP4_H_R_24, + TILE_WIRE_SP4_H_R_25, + TILE_WIRE_SP4_H_R_26, + TILE_WIRE_SP4_H_R_27, + TILE_WIRE_SP4_H_R_28, + TILE_WIRE_SP4_H_R_29, + TILE_WIRE_SP4_H_R_30, + TILE_WIRE_SP4_H_R_31, + TILE_WIRE_SP4_H_R_32, + TILE_WIRE_SP4_H_R_33, + TILE_WIRE_SP4_H_R_34, + TILE_WIRE_SP4_H_R_35, + TILE_WIRE_SP4_H_R_36, + TILE_WIRE_SP4_H_R_37, + TILE_WIRE_SP4_H_R_38, + TILE_WIRE_SP4_H_R_39, + TILE_WIRE_SP4_H_R_40, + TILE_WIRE_SP4_H_R_41, + TILE_WIRE_SP4_H_R_42, + TILE_WIRE_SP4_H_R_43, + TILE_WIRE_SP4_H_R_44, + TILE_WIRE_SP4_H_R_45, + TILE_WIRE_SP4_H_R_46, + TILE_WIRE_SP4_H_R_47, + + TILE_WIRE_SP12_V_B_0, + TILE_WIRE_SP12_V_B_1, + TILE_WIRE_SP12_V_B_2, + TILE_WIRE_SP12_V_B_3, + TILE_WIRE_SP12_V_B_4, + TILE_WIRE_SP12_V_B_5, + TILE_WIRE_SP12_V_B_6, + TILE_WIRE_SP12_V_B_7, + TILE_WIRE_SP12_V_B_8, + TILE_WIRE_SP12_V_B_9, + TILE_WIRE_SP12_V_B_10, + TILE_WIRE_SP12_V_B_11, + TILE_WIRE_SP12_V_B_12, + TILE_WIRE_SP12_V_B_13, + TILE_WIRE_SP12_V_B_14, + TILE_WIRE_SP12_V_B_15, + TILE_WIRE_SP12_V_B_16, + TILE_WIRE_SP12_V_B_17, + TILE_WIRE_SP12_V_B_18, + TILE_WIRE_SP12_V_B_19, + TILE_WIRE_SP12_V_B_20, + TILE_WIRE_SP12_V_B_21, + TILE_WIRE_SP12_V_B_22, + TILE_WIRE_SP12_V_B_23, + + TILE_WIRE_SP12_V_T_22, + TILE_WIRE_SP12_V_T_23, + + TILE_WIRE_SP12_H_R_0, + TILE_WIRE_SP12_H_R_1, + TILE_WIRE_SP12_H_R_2, + TILE_WIRE_SP12_H_R_3, + TILE_WIRE_SP12_H_R_4, + TILE_WIRE_SP12_H_R_5, + TILE_WIRE_SP12_H_R_6, + TILE_WIRE_SP12_H_R_7, + TILE_WIRE_SP12_H_R_8, + TILE_WIRE_SP12_H_R_9, + + TILE_WIRE_SP12_H_R_10, + TILE_WIRE_SP12_H_R_11, + TILE_WIRE_SP12_H_R_12, + TILE_WIRE_SP12_H_R_13, + TILE_WIRE_SP12_H_R_14, + TILE_WIRE_SP12_H_R_15, + TILE_WIRE_SP12_H_R_16, + TILE_WIRE_SP12_H_R_17, + TILE_WIRE_SP12_H_R_18, + TILE_WIRE_SP12_H_R_19, + + TILE_WIRE_SP12_H_R_20, + TILE_WIRE_SP12_H_R_21, + TILE_WIRE_SP12_H_R_22, + TILE_WIRE_SP12_H_R_23, + + TILE_WIRE_SP12_H_L_22, + TILE_WIRE_SP12_H_L_23 +}; + +void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id); + +NEXTPNR_NAMESPACE_END + +#endif // GFX_H -- cgit v1.2.3 From 1f36242d43eca636a82aa198e15cf821b59681e1 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 15:09:17 +0200 Subject: Add lutff_global switchbox Signed-off-by: David Shah --- ice40/arch.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index ecd0a411..7016bc07 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -457,6 +457,14 @@ std::vector Arch::getBelGraphics(BelId bel) const // All the wires for (int i = TILE_WIRE_GLB2LOCAL_0; i <= TILE_WIRE_SP12_H_L_23; i++) gfxTileWire(ret, tx, ty, GfxTileWireId(i)); + // lutff_global switchbox + GraphicElement lff_glb_sw; + lff_glb_sw.type = GraphicElement::G_BOX; + lff_glb_sw.x1 = tx + 0.65; + lff_glb_sw.x2 = tx + 0.7; + lff_glb_sw.y1 = ty + 0.875; + lff_glb_sw.y2 = ty + 0.925; + ret.push_back(lff_glb_sw); } } -- cgit v1.2.3 From 6198a68968c6e8c66ad8209bf31b77b9511102d8 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 9 Jul 2018 15:45:01 +0200 Subject: Add horizontal ice40 span4 wire gfx Signed-off-by: Clifford Wolf --- ice40/gfx.cc | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'ice40') diff --git a/ice40/gfx.cc b/ice40/gfx.cc index 46824b06..5a30c79d 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -23,6 +23,55 @@ NEXTPNR_NAMESPACE_BEGIN void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) { + if (id >= TILE_WIRE_SP4_H_L_36 && id <= TILE_WIRE_SP4_H_L_47) { + int idx = (id - TILE_WIRE_SP4_H_L_36) + 48; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float y1 = y + 0.03 + 0.0025 * (60 - idx); + + el.x1 = x + 0.0; + el.x2 = x + 0.9; + el.y1 = y1; + el.y2 = y1; + g.push_back(el); + } + + if (id >= TILE_WIRE_SP4_H_R_0 && id <= TILE_WIRE_SP4_H_R_47) { + int idx = id - TILE_WIRE_SP4_H_R_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float y1 = y + 0.03 + 0.0025 * (60 - idx); + float y2 = y + 0.03 + 0.0025 * (60 - (idx ^ 1)); + float y3 = y + 0.03 + 0.0025 * (60 - (idx ^ 1) - 12); + + if (idx >= 12) { + el.x1 = x; + el.x2 = x + 0.01; + el.y1 = y1; + el.y2 = y1; + g.push_back(el); + + el.x1 = x + 0.01; + el.x2 = x + 0.02; + el.y1 = y1; + el.y2 = y2; + g.push_back(el); + } + + el.x1 = x + 0.02; + el.x2 = x + 0.9; + el.y1 = y2; + el.y2 = y2; + g.push_back(el); + + el.x1 = x + 0.9; + el.x2 = x + 1.0; + el.y1 = y2; + el.y2 = y3; + g.push_back(el); + } } NEXTPNR_NAMESPACE_END -- cgit v1.2.3 From 953560ae17aa54a94c35e7475b908b628aadd647 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 16:02:02 +0200 Subject: Add switchboxes Signed-off-by: David Shah --- ice40/arch.cc | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index 7016bc07..d6947834 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -454,9 +454,6 @@ std::vector Arch::getBelGraphics(BelId bel) const lc_sw.y2 = ty + 0.75; ret.push_back(lc_sw); - // All the wires - for (int i = TILE_WIRE_GLB2LOCAL_0; i <= TILE_WIRE_SP12_H_L_23; i++) - gfxTileWire(ret, tx, ty, GfxTileWireId(i)); // lutff_global switchbox GraphicElement lff_glb_sw; lff_glb_sw.type = GraphicElement::G_BOX; @@ -465,6 +462,47 @@ std::vector Arch::getBelGraphics(BelId bel) const lff_glb_sw.y1 = ty + 0.875; lff_glb_sw.y2 = ty + 0.925; ret.push_back(lff_glb_sw); + + // glb2local switchbox + GraphicElement glb2local_sw; + glb2local_sw.type = GraphicElement::G_BOX; + glb2local_sw.x1 = tx + 0.45; + glb2local_sw.x2 = tx + 0.55; + glb2local_sw.y1 = ty + 0.80; + glb2local_sw.y2 = ty + 0.85; + ret.push_back(glb2local_sw); + + // span12 switchbox + GraphicElement sp12_sw; + sp12_sw.type = GraphicElement::G_BOX; + sp12_sw.x1 = tx + 0.500; + sp12_sw.x2 = tx + 0.575; + sp12_sw.y1 = ty + 0.525; + sp12_sw.y2 = ty + 0.625; + ret.push_back(sp12_sw); + + // span4v switchbox + GraphicElement sp4v_sw; + sp4v_sw.type = GraphicElement::G_BOX; + sp4v_sw.x1 = tx + 0.400; + sp4v_sw.x2 = tx + 0.475; + sp4v_sw.y1 = ty + 0.425; + sp4v_sw.y2 = ty + 0.525; + ret.push_back(sp4v_sw); + + // span4h switchbox + GraphicElement sp4h_sw; + sp4h_sw.type = GraphicElement::G_BOX; + sp4h_sw.x1 = tx + 0.300; + sp4h_sw.x2 = tx + 0.375; + sp4h_sw.y1 = ty + 0.3; + sp4h_sw.y2 = ty + 0.4; + ret.push_back(sp4h_sw); + + + // All the wires + for (int i = TILE_WIRE_GLB2LOCAL_0; i <= TILE_WIRE_SP12_H_L_23; i++) + gfxTileWire(ret, tx, ty, GfxTileWireId(i)); } } -- cgit v1.2.3 From 5b6fa934d87b838cef9037bf2b14465b7e5cf742 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 16:07:16 +0200 Subject: Make LCs smaller and move them down Signed-off-by: David Shah --- ice40/arch.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index d6947834..a86d6e56 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -428,8 +428,8 @@ std::vector Arch::getBelGraphics(BelId bel) const el.type = GraphicElement::G_BOX; el.x1 = chip_info->bel_data[bel.index].x + 0.82; el.x2 = chip_info->bel_data[bel.index].x + 0.92; - el.y1 = chip_info->bel_data[bel.index].y + 0.30 + (chip_info->bel_data[bel.index].z) * (0.6 / 8); - el.y2 = chip_info->bel_data[bel.index].y + 0.35 + (chip_info->bel_data[bel.index].z) * (0.6 / 8); + el.y1 = chip_info->bel_data[bel.index].y + 0.45 + (chip_info->bel_data[bel.index].z) * (0.5 / 8); + el.y2 = chip_info->bel_data[bel.index].y + 0.5 + (chip_info->bel_data[bel.index].z) * (0.5 / 8); el.z = 0; ret.push_back(el); @@ -441,8 +441,8 @@ std::vector Arch::getBelGraphics(BelId bel) const lc_lut_sw.type = GraphicElement::G_BOX; lc_lut_sw.x1 = tx + 0.75; lc_lut_sw.x2 = tx + 0.8; - lc_lut_sw.y1 = ty + 0.30; - lc_lut_sw.y2 = ty + 0.875; + lc_lut_sw.y1 = ty + 0.45; + lc_lut_sw.y2 = ty + 0.9375; lc_lut_sw.z = 0; ret.push_back(lc_lut_sw); // Local tracks switchbox @@ -459,8 +459,8 @@ std::vector Arch::getBelGraphics(BelId bel) const lff_glb_sw.type = GraphicElement::G_BOX; lff_glb_sw.x1 = tx + 0.65; lff_glb_sw.x2 = tx + 0.7; - lff_glb_sw.y1 = ty + 0.875; - lff_glb_sw.y2 = ty + 0.925; + lff_glb_sw.y1 = ty + 0.910; + lff_glb_sw.y2 = ty + 0.960; ret.push_back(lff_glb_sw); // glb2local switchbox -- cgit v1.2.3 From 4576fc7c20c7a211556b9b160a9eb35b5f8bb5b7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 9 Jul 2018 16:12:41 +0200 Subject: Vertical wires and span-12 wires Signed-off-by: Clifford Wolf --- ice40/gfx.cc | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ice40/gfx.h | 2 - 2 files changed, 158 insertions(+), 2 deletions(-) (limited to 'ice40') diff --git a/ice40/gfx.cc b/ice40/gfx.cc index 5a30c79d..613f1a31 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -23,6 +23,8 @@ NEXTPNR_NAMESPACE_BEGIN void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) { + // Horizontal Span-4 Wires + if (id >= TILE_WIRE_SP4_H_L_36 && id <= TILE_WIRE_SP4_H_L_47) { int idx = (id - TILE_WIRE_SP4_H_L_36) + 48; GraphicElement el; @@ -72,6 +74,162 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.y2 = y3; g.push_back(el); } + + // Vertical Span-4 Wires + + if (id >= TILE_WIRE_SP4_V_T_36 && id <= TILE_WIRE_SP4_V_T_47) { + int idx = (id - TILE_WIRE_SP4_V_T_36) + 48; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (60 - idx); + + el.y1 = y + 0.0; + el.y2 = y + 0.9; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + } + + if (id >= TILE_WIRE_SP4_V_B_0 && id <= TILE_WIRE_SP4_V_B_47) { + int idx = id - TILE_WIRE_SP4_V_B_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (60 - idx); + float x2 = x + 0.03 + 0.0025 * (60 - (idx ^ 1)); + float x3 = x + 0.03 + 0.0025 * (60 - (idx ^ 1) - 12); + + if (idx >= 12) { + el.y1 = y; + el.y2 = y + 0.01; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + + el.y1 = y + 0.01; + el.y2 = y + 0.02; + el.x1 = x1; + el.x2 = x2; + g.push_back(el); + } + + el.y1 = y + 0.02; + el.y2 = y + 0.9; + el.x1 = x2; + el.x2 = x2; + g.push_back(el); + + el.y1 = y + 0.9; + el.y2 = y + 1.0; + el.x1 = x2; + el.x2 = x3; + g.push_back(el); + } + + // Horizontal Span-12 Wires + + if (id >= TILE_WIRE_SP12_H_L_22 && id <= TILE_WIRE_SP12_H_L_23) { + int idx = (id - TILE_WIRE_SP12_H_L_22) + 24; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float y1 = y + 0.03 + 0.0025 * (90 - idx); + + el.x1 = x + 0.0; + el.x2 = x + 0.98333; + el.y1 = y1; + el.y2 = y1; + g.push_back(el); + } + + if (id >= TILE_WIRE_SP12_H_R_0 && id <= TILE_WIRE_SP12_H_R_23) { + int idx = id - TILE_WIRE_SP12_H_R_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float y1 = y + 0.03 + 0.0025 * (90 - idx); + float y2 = y + 0.03 + 0.0025 * (90 - (idx ^ 1)); + float y3 = y + 0.03 + 0.0025 * (90 - (idx ^ 1) - 2); + + if (idx >= 2) { + el.x1 = x; + el.x2 = x + 0.01; + el.y1 = y1; + el.y2 = y1; + g.push_back(el); + + el.x1 = x + 0.01; + el.x2 = x + 0.02; + el.y1 = y1; + el.y2 = y2; + g.push_back(el); + } + + el.x1 = x + 0.02; + el.x2 = x + 0.98333; + el.y1 = y2; + el.y2 = y2; + g.push_back(el); + + el.x1 = x + 0.98333; + el.x2 = x + 1.0; + el.y1 = y2; + el.y2 = y3; + g.push_back(el); + } + + // Vertical Span-12 Wires + + if (id >= TILE_WIRE_SP12_V_T_22 && id <= TILE_WIRE_SP12_V_T_23) { + int idx = (id - TILE_WIRE_SP12_V_T_22) + 24; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (90 - idx); + + el.y1 = y + 0.0; + el.y2 = y + 0.98333; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + } + + if (id >= TILE_WIRE_SP12_V_B_0 && id <= TILE_WIRE_SP12_V_B_23) { + int idx = id - TILE_WIRE_SP12_V_B_0; + GraphicElement el; + el.type = GraphicElement::G_LINE; + + float x1 = x + 0.03 + 0.0025 * (90 - idx); + float x2 = x + 0.03 + 0.0025 * (90 - (idx ^ 1)); + float x3 = x + 0.03 + 0.0025 * (90 - (idx ^ 1) - 2); + + if (idx >= 2) { + el.y1 = y; + el.y2 = y + 0.01; + el.x1 = x1; + el.x2 = x1; + g.push_back(el); + + el.y1 = y + 0.01; + el.y2 = y + 0.02; + el.x1 = x1; + el.x2 = x2; + g.push_back(el); + } + + el.y1 = y + 0.02; + el.y2 = y + 0.98333; + el.x1 = x2; + el.x2 = x2; + g.push_back(el); + + el.y1 = y + 0.98333; + el.y2 = y + 1.0; + el.x1 = x2; + el.x2 = x3; + g.push_back(el); + } } NEXTPNR_NAMESPACE_END diff --git a/ice40/gfx.h b/ice40/gfx.h index e9cc0e16..fa8d51eb 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -428,7 +428,6 @@ enum GfxTileWireId { TILE_WIRE_SP12_H_R_7, TILE_WIRE_SP12_H_R_8, TILE_WIRE_SP12_H_R_9, - TILE_WIRE_SP12_H_R_10, TILE_WIRE_SP12_H_R_11, TILE_WIRE_SP12_H_R_12, @@ -439,7 +438,6 @@ enum GfxTileWireId { TILE_WIRE_SP12_H_R_17, TILE_WIRE_SP12_H_R_18, TILE_WIRE_SP12_H_R_19, - TILE_WIRE_SP12_H_R_20, TILE_WIRE_SP12_H_R_21, TILE_WIRE_SP12_H_R_22, -- cgit v1.2.3 From ba6f3b45b84be2aca06d82ce5b32f68a70f05ebb Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 9 Jul 2018 16:39:18 +0200 Subject: Add ice40 gfx right vertical span-4 Signed-off-by: Clifford Wolf --- ice40/gfx.cc | 36 +++++++++++++++++++---- ice40/gfx.h | 96 ++++++++++++++++++++++++++++++------------------------------ 2 files changed, 78 insertions(+), 54 deletions(-) (limited to 'ice40') diff --git a/ice40/gfx.cc b/ice40/gfx.cc index 613f1a31..1006f7b9 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -96,9 +96,9 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) GraphicElement el; el.type = GraphicElement::G_LINE; - float x1 = x + 0.03 + 0.0025 * (60 - idx); - float x2 = x + 0.03 + 0.0025 * (60 - (idx ^ 1)); - float x3 = x + 0.03 + 0.0025 * (60 - (idx ^ 1) - 12); + float x1 = x + 0.03 + 0.0025 * (60 - (idx ^ 1)); + float x2 = x + 0.03 + 0.0025 * (60 - idx); + float x3 = x + 0.03 + 0.0025 * (60 - idx - 12); if (idx >= 12) { el.y1 = y; @@ -125,6 +125,14 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.x1 = x2; el.x2 = x3; g.push_back(el); + + float y1 = y + 0.03 + 0.0025 * (142 - idx); + + el.y1 = y1; + el.y2 = y1; + el.x1 = x; + el.x2 = x2; + g.push_back(el); } // Horizontal Span-12 Wires @@ -148,9 +156,9 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) GraphicElement el; el.type = GraphicElement::G_LINE; - float y1 = y + 0.03 + 0.0025 * (90 - idx); - float y2 = y + 0.03 + 0.0025 * (90 - (idx ^ 1)); - float y3 = y + 0.03 + 0.0025 * (90 - (idx ^ 1) - 2); + float y1 = y + 0.03 + 0.0025 * (90 - (idx ^ 1)); + float y2 = y + 0.03 + 0.0025 * (90 - idx); + float y3 = y + 0.03 + 0.0025 * (90 - idx - 2); if (idx >= 2) { el.x1 = x; @@ -179,6 +187,22 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) g.push_back(el); } + // Veritcal 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 * (142 - idx); + + el.y1 = y1; + el.y2 = y1; + el.x1 = x + 0.6; + el.x2 = x + 1.0; + g.push_back(el); + } + // Vertical Span-12 Wires if (id >= TILE_WIRE_SP12_V_T_22 && id <= TILE_WIRE_SP12_V_T_23) { diff --git a/ice40/gfx.h b/ice40/gfx.h index fa8d51eb..07643bca 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -279,54 +279,54 @@ enum GfxTileWireId { TILE_WIRE_SP4_V_T_46, TILE_WIRE_SP4_V_T_47, - TILE_WIRE_sp4_R_V_B_0, - TILE_WIRE_sp4_R_V_B_1, - TILE_WIRE_sp4_R_V_B_2, - TILE_WIRE_sp4_R_V_B_3, - TILE_WIRE_sp4_R_V_B_4, - TILE_WIRE_sp4_R_V_B_5, - TILE_WIRE_sp4_R_V_B_6, - TILE_WIRE_sp4_R_V_B_7, - TILE_WIRE_sp4_R_V_B_8, - TILE_WIRE_sp4_R_V_B_9, - TILE_WIRE_sp4_R_V_B_10, - TILE_WIRE_sp4_R_V_B_11, - TILE_WIRE_sp4_R_V_B_12, - TILE_WIRE_sp4_R_V_B_13, - TILE_WIRE_sp4_R_V_B_14, - TILE_WIRE_sp4_R_V_B_15, - TILE_WIRE_sp4_R_V_B_16, - TILE_WIRE_sp4_R_V_B_17, - TILE_WIRE_sp4_R_V_B_18, - TILE_WIRE_sp4_R_V_B_19, - TILE_WIRE_sp4_R_V_B_20, - TILE_WIRE_sp4_R_V_B_21, - TILE_WIRE_sp4_R_V_B_22, - TILE_WIRE_sp4_R_V_B_23, - TILE_WIRE_sp4_R_V_B_24, - TILE_WIRE_sp4_R_V_B_25, - TILE_WIRE_sp4_R_V_B_26, - TILE_WIRE_sp4_R_V_B_27, - TILE_WIRE_sp4_R_V_B_28, - TILE_WIRE_sp4_R_V_B_29, - TILE_WIRE_sp4_R_V_B_30, - TILE_WIRE_sp4_R_V_B_31, - TILE_WIRE_sp4_R_V_B_32, - TILE_WIRE_sp4_R_V_B_33, - TILE_WIRE_sp4_R_V_B_34, - TILE_WIRE_sp4_R_V_B_35, - TILE_WIRE_sp4_R_V_B_36, - TILE_WIRE_sp4_R_V_B_37, - TILE_WIRE_sp4_R_V_B_38, - TILE_WIRE_sp4_R_V_B_39, - TILE_WIRE_sp4_R_V_B_40, - TILE_WIRE_sp4_R_V_B_41, - TILE_WIRE_sp4_R_V_B_42, - TILE_WIRE_sp4_R_V_B_43, - TILE_WIRE_sp4_R_V_B_44, - TILE_WIRE_sp4_R_V_B_45, - TILE_WIRE_sp4_R_V_B_46, - TILE_WIRE_sp4_R_V_B_47, + TILE_WIRE_SP4_R_V_B_0, + TILE_WIRE_SP4_R_V_B_1, + TILE_WIRE_SP4_R_V_B_2, + TILE_WIRE_SP4_R_V_B_3, + TILE_WIRE_SP4_R_V_B_4, + TILE_WIRE_SP4_R_V_B_5, + TILE_WIRE_SP4_R_V_B_6, + TILE_WIRE_SP4_R_V_B_7, + TILE_WIRE_SP4_R_V_B_8, + TILE_WIRE_SP4_R_V_B_9, + TILE_WIRE_SP4_R_V_B_10, + TILE_WIRE_SP4_R_V_B_11, + TILE_WIRE_SP4_R_V_B_12, + TILE_WIRE_SP4_R_V_B_13, + TILE_WIRE_SP4_R_V_B_14, + TILE_WIRE_SP4_R_V_B_15, + TILE_WIRE_SP4_R_V_B_16, + TILE_WIRE_SP4_R_V_B_17, + TILE_WIRE_SP4_R_V_B_18, + TILE_WIRE_SP4_R_V_B_19, + TILE_WIRE_SP4_R_V_B_20, + TILE_WIRE_SP4_R_V_B_21, + TILE_WIRE_SP4_R_V_B_22, + TILE_WIRE_SP4_R_V_B_23, + TILE_WIRE_SP4_R_V_B_24, + TILE_WIRE_SP4_R_V_B_25, + TILE_WIRE_SP4_R_V_B_26, + TILE_WIRE_SP4_R_V_B_27, + TILE_WIRE_SP4_R_V_B_28, + TILE_WIRE_SP4_R_V_B_29, + TILE_WIRE_SP4_R_V_B_30, + TILE_WIRE_SP4_R_V_B_31, + TILE_WIRE_SP4_R_V_B_32, + TILE_WIRE_SP4_R_V_B_33, + TILE_WIRE_SP4_R_V_B_34, + TILE_WIRE_SP4_R_V_B_35, + TILE_WIRE_SP4_R_V_B_36, + TILE_WIRE_SP4_R_V_B_37, + TILE_WIRE_SP4_R_V_B_38, + TILE_WIRE_SP4_R_V_B_39, + TILE_WIRE_SP4_R_V_B_40, + TILE_WIRE_SP4_R_V_B_41, + TILE_WIRE_SP4_R_V_B_42, + TILE_WIRE_SP4_R_V_B_43, + TILE_WIRE_SP4_R_V_B_44, + TILE_WIRE_SP4_R_V_B_45, + TILE_WIRE_SP4_R_V_B_46, + TILE_WIRE_SP4_R_V_B_47, TILE_WIRE_SP4_H_L_36, TILE_WIRE_SP4_H_L_37, -- cgit v1.2.3 From c6043ed570dd90095fdbee3435b83e626b74e327 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 16:42:30 +0200 Subject: Reorder gfx.h, add LUT0 inputs Signed-off-by: David Shah --- ice40/gfx.cc | 10 ++++++++++ ice40/gfx.h | 47 +++++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 22 deletions(-) (limited to 'ice40') diff --git a/ice40/gfx.cc b/ice40/gfx.cc index 1006f7b9..6954a9fb 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -254,6 +254,16 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.x2 = x3; g.push_back(el); } + + if (id >= TILE_WIRE_LUTFF_0_IN_0 && id <= TILE_WIRE_LUTFF_0_IN_3) { + GraphicElement el; + el.type = GraphicElement::G_LINE; + el.x1 = x + 0.8; + el.x2 = x + 0.82; + el.y1 = y + 0.4675 + (0.005 * (id - TILE_WIRE_LUTFF_0_IN_0)); + el.y2 = el.y1; + g.push_back(el); + } } NEXTPNR_NAMESPACE_END diff --git a/ice40/gfx.h b/ice40/gfx.h index 07643bca..4cd7d081 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -78,69 +78,72 @@ enum GfxTileWireId { TILE_WIRE_CARRY_IN, TILE_WIRE_CARRY_IN_MUX, - TILE_WIRE_LUTFF_0_COUT, TILE_WIRE_LUTFF_0_IN_0, TILE_WIRE_LUTFF_0_IN_1, TILE_WIRE_LUTFF_0_IN_2, TILE_WIRE_LUTFF_0_IN_3, - TILE_WIRE_LUTFF_0_LOUT, - TILE_WIRE_LUTFF_0_OUT, - TILE_WIRE_LUTFF_1_COUT, TILE_WIRE_LUTFF_1_IN_0, TILE_WIRE_LUTFF_1_IN_1, TILE_WIRE_LUTFF_1_IN_2, TILE_WIRE_LUTFF_1_IN_3, - TILE_WIRE_LUTFF_1_LOUT, - TILE_WIRE_LUTFF_1_OUT, - TILE_WIRE_LUTFF_2_COUT, TILE_WIRE_LUTFF_2_IN_0, TILE_WIRE_LUTFF_2_IN_1, TILE_WIRE_LUTFF_2_IN_2, TILE_WIRE_LUTFF_2_IN_3, - TILE_WIRE_LUTFF_2_LOUT, - TILE_WIRE_LUTFF_2_OUT, - TILE_WIRE_LUTFF_3_COUT, TILE_WIRE_LUTFF_3_IN_0, TILE_WIRE_LUTFF_3_IN_1, TILE_WIRE_LUTFF_3_IN_2, TILE_WIRE_LUTFF_3_IN_3, - TILE_WIRE_LUTFF_3_LOUT, - TILE_WIRE_LUTFF_3_OUT, - TILE_WIRE_LUTFF_4_COUT, TILE_WIRE_LUTFF_4_IN_0, TILE_WIRE_LUTFF_4_IN_1, TILE_WIRE_LUTFF_4_IN_2, TILE_WIRE_LUTFF_4_IN_3, - TILE_WIRE_LUTFF_4_LOUT, - TILE_WIRE_LUTFF_4_OUT, - TILE_WIRE_LUTFF_5_COUT, TILE_WIRE_LUTFF_5_IN_0, TILE_WIRE_LUTFF_5_IN_1, TILE_WIRE_LUTFF_5_IN_2, TILE_WIRE_LUTFF_5_IN_3, - TILE_WIRE_LUTFF_5_LOUT, - TILE_WIRE_LUTFF_5_OUT, - TILE_WIRE_LUTFF_6_COUT, TILE_WIRE_LUTFF_6_IN_0, TILE_WIRE_LUTFF_6_IN_1, TILE_WIRE_LUTFF_6_IN_2, TILE_WIRE_LUTFF_6_IN_3, - TILE_WIRE_LUTFF_6_LOUT, - TILE_WIRE_LUTFF_6_OUT, - TILE_WIRE_LUTFF_7_COUT, TILE_WIRE_LUTFF_7_IN_0, TILE_WIRE_LUTFF_7_IN_1, TILE_WIRE_LUTFF_7_IN_2, TILE_WIRE_LUTFF_7_IN_3, + + TILE_WIRE_LUTFF_0_LOUT, + TILE_WIRE_LUTFF_1_LOUT, + TILE_WIRE_LUTFF_2_LOUT, + TILE_WIRE_LUTFF_3_LOUT, + TILE_WIRE_LUTFF_4_LOUT, + TILE_WIRE_LUTFF_5_LOUT, + TILE_WIRE_LUTFF_6_LOUT, + + TILE_WIRE_LUTFF_0_OUT, + TILE_WIRE_LUTFF_1_OUT, + TILE_WIRE_LUTFF_2_OUT, + TILE_WIRE_LUTFF_3_OUT, + TILE_WIRE_LUTFF_4_OUT, + TILE_WIRE_LUTFF_5_OUT, + TILE_WIRE_LUTFF_6_OUT, TILE_WIRE_LUTFF_7_OUT, + TILE_WIRE_LUTFF_0_COUT, + TILE_WIRE_LUTFF_1_COUT, + TILE_WIRE_LUTFF_2_COUT, + TILE_WIRE_LUTFF_3_COUT, + TILE_WIRE_LUTFF_4_COUT, + TILE_WIRE_LUTFF_5_COUT, + TILE_WIRE_LUTFF_6_COUT, + TILE_WIRE_LUTFF_7_COUT, + TILE_WIRE_LUTFF_GLOBAL_CEN, TILE_WIRE_LUTFF_GLOBAL_CLK, TILE_WIRE_LUTFF_GLOBAL_S_R, -- cgit v1.2.3 From c921e4f24b24f4c14ecf3d4f8cb999cd8ead2a41 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 16:50:01 +0200 Subject: Add constants for switchbox locations Signed-off-by: David Shah --- ice40/arch.cc | 56 ++++++++++++++++++++++++++++---------------------------- ice40/gfx.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 28 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index a86d6e56..a50310cf 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -439,64 +439,64 @@ std::vector Arch::getBelGraphics(BelId bel) const // Local tracks to LUT input switchbox GraphicElement lc_lut_sw; lc_lut_sw.type = GraphicElement::G_BOX; - lc_lut_sw.x1 = tx + 0.75; - lc_lut_sw.x2 = tx + 0.8; - lc_lut_sw.y1 = ty + 0.45; - lc_lut_sw.y2 = ty + 0.9375; + 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 + 0.6; - lc_sw.x2 = tx + 0.7; - lc_sw.y1 = ty + 0.65; - lc_sw.y2 = ty + 0.75; + 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 + 0.65; - lff_glb_sw.x2 = tx + 0.7; - lff_glb_sw.y1 = ty + 0.910; - lff_glb_sw.y2 = ty + 0.960; + 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 + 0.45; - glb2local_sw.x2 = tx + 0.55; - glb2local_sw.y1 = ty + 0.80; - glb2local_sw.y2 = ty + 0.85; + 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 + 0.500; - sp12_sw.x2 = tx + 0.575; - sp12_sw.y1 = ty + 0.525; - sp12_sw.y2 = ty + 0.625; + 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 + 0.400; - sp4v_sw.x2 = tx + 0.475; - sp4v_sw.y1 = ty + 0.425; - sp4v_sw.y2 = ty + 0.525; + 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 + 0.300; - sp4h_sw.x2 = tx + 0.375; - sp4h_sw.y1 = ty + 0.3; - sp4h_sw.y2 = ty + 0.4; + 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); diff --git a/ice40/gfx.h b/ice40/gfx.h index 4cd7d081..15bb7300 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -24,6 +24,41 @@ 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; + enum GfxTileWireId { TILE_WIRE_GLB2LOCAL_0, TILE_WIRE_GLB2LOCAL_1, -- cgit v1.2.3 From b5cf1c8257de6e6c5a6d757231879d7aba0798cb Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 16:52:03 +0200 Subject: Adding all LUT input wires Signed-off-by: David Shah --- ice40/gfx.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ice40') diff --git a/ice40/gfx.cc b/ice40/gfx.cc index 6954a9fb..f29b38dc 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -255,12 +255,15 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) g.push_back(el); } - if (id >= TILE_WIRE_LUTFF_0_IN_0 && id <= TILE_WIRE_LUTFF_0_IN_3) { + if (id >= TILE_WIRE_LUTFF_0_IN_0 && id <= TILE_WIRE_LUTFF_7_IN_3) { + int idx = id - TILE_WIRE_LUTFF_0_IN_0; + int z = idx / 4; + int input = idx % 4; GraphicElement el; el.type = GraphicElement::G_LINE; - el.x1 = x + 0.8; + el.x1 = x + lc_lut_swbox_x2; el.x2 = x + 0.82; - el.y1 = y + 0.4675 + (0.005 * (id - TILE_WIRE_LUTFF_0_IN_0)); + el.y1 = y + 0.4675 + (0.005 * input) + z * (0.5 / 8); el.y2 = el.y1; g.push_back(el); } -- cgit v1.2.3 From 132c5b5019fa485d7e99311bb27cfdb47fc05226 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 9 Jul 2018 17:00:54 +0200 Subject: Make logic cell positioning a constant Signed-off-by: David Shah --- ice40/arch.cc | 8 ++++---- ice40/gfx.cc | 4 ++-- ice40/gfx.h | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index a50310cf..2eb7d1c3 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -426,10 +426,10 @@ std::vector Arch::getBelGraphics(BelId bel) const if (bel_type == TYPE_ICESTORM_LC) { GraphicElement el; el.type = GraphicElement::G_BOX; - el.x1 = chip_info->bel_data[bel.index].x + 0.82; - el.x2 = chip_info->bel_data[bel.index].x + 0.92; - el.y1 = chip_info->bel_data[bel.index].y + 0.45 + (chip_info->bel_data[bel.index].z) * (0.5 / 8); - el.y2 = chip_info->bel_data[bel.index].y + 0.5 + (chip_info->bel_data[bel.index].z) * (0.5 / 8); + el.x1 = chip_info->bel_data[bel.index].x + logic_cell_x1; + el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2; + el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch; + el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch; el.z = 0; ret.push_back(el); diff --git a/ice40/gfx.cc b/ice40/gfx.cc index f29b38dc..d59c00aa 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -262,8 +262,8 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) GraphicElement el; el.type = GraphicElement::G_LINE; el.x1 = x + lc_lut_swbox_x2; - el.x2 = x + 0.82; - el.y1 = y + 0.4675 + (0.005 * input) + z * (0.5 / 8); + el.x2 = x + logic_cell_x1; + el.y1 = y + 0.4675 + (0.005 * input) + z * logic_cell_pitch; el.y2 = el.y1; g.push_back(el); } diff --git a/ice40/gfx.h b/ice40/gfx.h index 15bb7300..784ba23f 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -59,6 +59,12 @@ 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 logic_cell_x2 = 0.92; +const float logic_cell_y1 = 0.45; +const float logic_cell_y2 = 0.50; +const float logic_cell_pitch = 0.0625; + enum GfxTileWireId { TILE_WIRE_GLB2LOCAL_0, TILE_WIRE_GLB2LOCAL_1, -- cgit v1.2.3 From 46d28551fca591ce6b1cd2e1de5385661077b7e3 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 9 Jul 2018 17:13:26 +0200 Subject: Add ice40 LC output gfx Signed-off-by: Clifford Wolf --- ice40/gfx.cc | 31 +++++++++++++++++++++++++++++-- ice40/gfx.h | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'ice40') diff --git a/ice40/gfx.cc b/ice40/gfx.cc index d59c00aa..58e52d65 100644 --- a/ice40/gfx.cc +++ b/ice40/gfx.cc @@ -126,7 +126,7 @@ 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 * (142 - idx); + float y1 = y + 0.03 + 0.0025 * (154 - idx); el.y1 = y1; el.y2 = y1; @@ -194,7 +194,7 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) GraphicElement el; el.type = GraphicElement::G_LINE; - float y1 = y + 0.03 + 0.0025 * (142 - idx); + float y1 = y + 0.03 + 0.0025 * (154 - idx); el.y1 = y1; el.y2 = y1; @@ -255,6 +255,8 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) g.push_back(el); } + // LC Inputs + if (id >= TILE_WIRE_LUTFF_0_IN_0 && id <= TILE_WIRE_LUTFF_7_IN_3) { int idx = id - TILE_WIRE_LUTFF_0_IN_0; int z = idx / 4; @@ -267,6 +269,31 @@ void gfxTileWire(std::vector &g, int x, int y, GfxTileWireId id) el.y2 = el.y1; g.push_back(el); } + + // LC Outputs + + 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); + + GraphicElement el; + el.type = GraphicElement::G_LINE; + el.y1 = y1; + el.y2 = y1; + el.x1 = x + 0.3; + el.x2 = x + 0.97 + 0.0025 * idx; + g.push_back(el); + + el.y1 = y1; + el.y2 = y + (logic_cell_y1 + logic_cell_y2) / 2 + idx * logic_cell_pitch; + el.x1 = el.x2; + g.push_back(el); + + el.y1 = el.y2; + el.x1 = x + logic_cell_x2; + g.push_back(el); + } } NEXTPNR_NAMESPACE_END diff --git a/ice40/gfx.h b/ice40/gfx.h index 784ba23f..0fdfc326 100644 --- a/ice40/gfx.h +++ b/ice40/gfx.h @@ -60,7 +60,7 @@ const float span4v_swbox_y1 = 0.300; const float span4v_swbox_y2 = 0.400; const float logic_cell_x1 = 0.82; -const float logic_cell_x2 = 0.92; +const float logic_cell_x2 = 0.95; const float logic_cell_y1 = 0.45; const float logic_cell_y2 = 0.50; const float logic_cell_pitch = 0.0625; -- cgit v1.2.3 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 From 7081cca01654030f9a3b731cebf36e68590e3ed1 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 11 Jul 2018 14:03:23 +0200 Subject: Add GUI Decals API Signed-off-by: Clifford Wolf --- ice40/arch.cc | 207 +++++++++++++++++++++++++++++-------------------------- ice40/arch.h | 10 +-- ice40/archdefs.h | 22 ++++++ 3 files changed, 139 insertions(+), 100 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index 0b82914a..a25c3d87 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -400,128 +400,143 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // ----------------------------------------------------------------------- -std::vector Arch::getFrameGraphics() const +DecalXY Arch::getFrameDecal() const { - std::vector ret; + DecalXY decalxy; + decalxy.decal.type = 'f'; + return decalxy; +} - for (int x = 0; x <= chip_info->width; x++) - for (int y = 0; y <= chip_info->height; y++) { - GraphicElement el; - el.type = GraphicElement::G_LINE; - el.x1 = x - 0.05, el.x2 = x + 0.05, el.y1 = y, el.y2 = y, el.z = 0; - ret.push_back(el); - el.x1 = x, el.x2 = x, el.y1 = y - 0.05, el.y2 = y + 0.05, el.z = 0; - ret.push_back(el); - } +DecalXY Arch::getBelDecal(BelId bel) const +{ + DecalXY decalxy; + decalxy.decal.type = 'b'; + decalxy.decal.z = bel.index; + return decalxy; +} - return ret; +DecalXY Arch::getWireDecal(WireId wire) const +{ + DecalXY decalxy; + return decalxy; } -std::vector Arch::getBelGraphics(BelId bel) const +DecalXY Arch::getPipDecal(PipId pip) const +{ + DecalXY decalxy; + return decalxy; +}; + +std::vector Arch::getDecalGraphics(DecalId decal) const { std::vector ret; - auto bel_type = getBelType(bel); - - if (bel_type == TYPE_ICESTORM_LC) { - GraphicElement el; - el.type = GraphicElement::G_BOX; - el.x1 = chip_info->bel_data[bel.index].x + logic_cell_x1; - el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2; - el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch; - el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch; - el.z = 0; - ret.push_back(el); - - 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; - - // 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++) - gfxTileWire(ret, tx, ty, GfxTileWireId(i)); - } + if (decal.type == 'f') + { + for (int x = 0; x <= chip_info->width; x++) + for (int y = 0; y <= chip_info->height; y++) { + GraphicElement el; + el.type = GraphicElement::G_LINE; + el.x1 = x - 0.05, el.x2 = x + 0.05, el.y1 = y, el.y2 = y, el.z = 0; + ret.push_back(el); + el.x1 = x, el.x2 = x, el.y1 = y - 0.05, el.y2 = y + 0.05, el.z = 0; + ret.push_back(el); + } } - if (bel_type == TYPE_SB_IO) { - if (chip_info->bel_data[bel.index].x == 0 || chip_info->bel_data[bel.index].x == chip_info->width - 1) { + if (decal.type == 'b') + { + BelId bel; + bel.index = decal.z; + + auto bel_type = getBelType(bel); + + if (bel_type == TYPE_ICESTORM_LC) { GraphicElement el; el.type = GraphicElement::G_BOX; - el.x1 = chip_info->bel_data[bel.index].x + 0.1; - el.x2 = chip_info->bel_data[bel.index].x + 0.9; - if (chip_info->bel_data[bel.index].z == 0) { - el.y1 = chip_info->bel_data[bel.index].y + 0.10; - el.y2 = chip_info->bel_data[bel.index].y + 0.45; - } else { - el.y1 = chip_info->bel_data[bel.index].y + 0.55; - el.y2 = chip_info->bel_data[bel.index].y + 0.90; - } + el.x1 = chip_info->bel_data[bel.index].x + logic_cell_x1; + el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2; + el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch; + el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch; el.z = 0; ret.push_back(el); - } else { - GraphicElement el; - el.type = GraphicElement::G_BOX; + if (chip_info->bel_data[bel.index].z == 0) { - el.x1 = chip_info->bel_data[bel.index].x + 0.10; - el.x2 = chip_info->bel_data[bel.index].x + 0.45; + int tx = chip_info->bel_data[bel.index].x; + int ty = chip_info->bel_data[bel.index].y; + + // 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++) + gfxTileWire(ret, tx, ty, GfxTileWireId(i)); + } + } + + if (bel_type == TYPE_SB_IO) { + if (chip_info->bel_data[bel.index].x == 0 || chip_info->bel_data[bel.index].x == chip_info->width - 1) { + GraphicElement el; + el.type = GraphicElement::G_BOX; + el.x1 = chip_info->bel_data[bel.index].x + 0.1; + el.x2 = chip_info->bel_data[bel.index].x + 0.9; + if (chip_info->bel_data[bel.index].z == 0) { + el.y1 = chip_info->bel_data[bel.index].y + 0.10; + el.y2 = chip_info->bel_data[bel.index].y + 0.45; + } else { + el.y1 = chip_info->bel_data[bel.index].y + 0.55; + el.y2 = chip_info->bel_data[bel.index].y + 0.90; + } + el.z = 0; + ret.push_back(el); } else { - el.x1 = chip_info->bel_data[bel.index].x + 0.55; - el.x2 = chip_info->bel_data[bel.index].x + 0.90; + GraphicElement el; + el.type = GraphicElement::G_BOX; + if (chip_info->bel_data[bel.index].z == 0) { + el.x1 = chip_info->bel_data[bel.index].x + 0.10; + el.x2 = chip_info->bel_data[bel.index].x + 0.45; + } else { + el.x1 = chip_info->bel_data[bel.index].x + 0.55; + el.x2 = chip_info->bel_data[bel.index].x + 0.90; + } + el.y1 = chip_info->bel_data[bel.index].y + 0.1; + el.y2 = chip_info->bel_data[bel.index].y + 0.9; + el.z = 0; + ret.push_back(el); } + } + + if (bel_type == TYPE_ICESTORM_RAM) { + GraphicElement el; + el.type = GraphicElement::G_BOX; + el.x1 = chip_info->bel_data[bel.index].x + 0.1; + el.x2 = chip_info->bel_data[bel.index].x + 0.9; el.y1 = chip_info->bel_data[bel.index].y + 0.1; - el.y2 = chip_info->bel_data[bel.index].y + 0.9; + el.y2 = chip_info->bel_data[bel.index].y + 1.9; el.z = 0; ret.push_back(el); } } - if (bel_type == TYPE_ICESTORM_RAM) { - GraphicElement el; - el.type = GraphicElement::G_BOX; - el.x1 = chip_info->bel_data[bel.index].x + 0.1; - el.x2 = chip_info->bel_data[bel.index].x + 0.9; - el.y1 = chip_info->bel_data[bel.index].y + 0.1; - el.y2 = chip_info->bel_data[bel.index].y + 1.9; - el.z = 0; - ret.push_back(el); - } - - return ret; -} - -std::vector Arch::getWireGraphics(WireId wire) const -{ - std::vector ret; - // FIXME return ret; } -std::vector Arch::getPipGraphics(PipId pip) const -{ - std::vector ret; - // FIXME - return ret; -}; - // ----------------------------------------------------------------------- bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, delay_t &delay) const diff --git a/ice40/arch.h b/ice40/arch.h index 43aa0829..03685152 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -643,10 +643,12 @@ struct Arch : BaseCtx // ------------------------------------------------- - std::vector getFrameGraphics() const; - std::vector getBelGraphics(BelId bel) const; - std::vector getWireGraphics(WireId wire) const; - std::vector getPipGraphics(PipId pip) const; + std::vector getDecalGraphics(DecalId decal) const; + + DecalXY getFrameDecal() const; + DecalXY getBelDecal(BelId bel) const; + DecalXY getWireDecal(WireId wire) const; + DecalXY getPipDecal(PipId pip) const; bool allGraphicsReload = false; bool frameGraphicsReload = false; diff --git a/ice40/archdefs.h b/ice40/archdefs.h index be2e406d..061e9b44 100644 --- a/ice40/archdefs.h +++ b/ice40/archdefs.h @@ -21,6 +21,8 @@ #error Include "archdefs.h" via "nextpnr.h" only. #endif +#include + NEXTPNR_NAMESPACE_BEGIN typedef int delay_t; @@ -107,6 +109,13 @@ struct PipId bool operator!=(const PipId &other) const { return index != other.index; } }; +struct DecalId +{ + char type = 0; // Bel/Wire/Pip/Frame (b/w/p/f) + uint8_t x = 0, y = 0; + uint32_t z = 0; +}; + NEXTPNR_NAMESPACE_END namespace std { @@ -135,4 +144,17 @@ template <> struct hash : hash template <> struct hash : hash { }; + +template <> struct hash +{ + std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX DecalId &decal) const noexcept { + std::size_t seed = 0; + boost::hash_combine(seed, hash()(decal.type)); + boost::hash_combine(seed, hash()(decal.x)); + boost::hash_combine(seed, hash()(decal.y)); + boost::hash_combine(seed, hash()(decal.z)); + return seed; + } +}; + } // namespace std -- cgit v1.2.3