aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-08-19 18:44:25 +0200
committerGitHub <noreply@github.com>2018-08-19 18:44:25 +0200
commit634340cabb6ceaab5bfd75c48c86220e621fc1c9 (patch)
tree3f8204a00e13c994062377653ea586d660daa081
parent39e79db8547b0fb2e51267018add814a1c83e653 (diff)
parent801f63098348878d1dcd5e88735afeae014d7f22 (diff)
downloadnextpnr-634340cabb6ceaab5bfd75c48c86220e621fc1c9.tar.gz
nextpnr-634340cabb6ceaab5bfd75c48c86220e621fc1c9.tar.bz2
nextpnr-634340cabb6ceaab5bfd75c48c86220e621fc1c9.zip
Merge pull request #60 from YosysHQ/ice40ui
More iCE40 gfx
-rw-r--r--ice40/arch.cc46
-rw-r--r--ice40/chipdb.py4
-rw-r--r--ice40/gfx.cc59
3 files changed, 95 insertions, 14 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc
index c05eeee3..3983a24e 100644
--- a/ice40/arch.cc
+++ b/ice40/arch.cc
@@ -730,12 +730,28 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
for (int i = 0; i < n; i++)
gfxTileWire(ret, p[i].x, p[i].y, chip_info->width, chip_info->height, GfxTileWireId(p[i].index), style);
+
+#if 0
+ if (ret.empty()) {
+ WireId wire;
+ wire.index = decal.index;
+ log_warning("No gfx decal for wire %s (%d).\n", getWireName(wire).c_str(getCtx()), decal.index);
+ }
+#endif
}
if (decal.type == DecalId::TYPE_PIP) {
const PipInfoPOD &p = chip_info->pip_data[decal.index];
GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_HIDDEN;
gfxTilePip(ret, p.x, p.y, GfxTileWireId(p.src_seg), GfxTileWireId(p.dst_seg), style);
+
+#if 0
+ if (ret.empty()) {
+ PipId pip;
+ pip.index = decal.index;
+ log_warning("No gfx decal for pip %s (%d).\n", getPipName(pip).c_str(getCtx()), decal.index);
+ }
+#endif
}
if (decal.type == DecalId::TYPE_BEL) {
@@ -782,6 +798,36 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
ret.push_back(el);
}
}
+
+ if (bel_type == id_SB_GB) {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
+ el.x1 = chip_info->bel_data[bel.index].x + local_swbox_x1 + 0.05;
+ el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2 - 0.05;
+ el.y1 = chip_info->bel_data[bel.index].y + main_swbox_y2 - 0.05;
+ el.y2 = chip_info->bel_data[bel.index].y + main_swbox_y2 - 0.10;
+ ret.push_back(el);
+ }
+
+ if (bel_type == id_ICESTORM_PLL || bel_type == id_SB_WARMBOOT) {
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
+ el.x1 = chip_info->bel_data[bel.index].x + local_swbox_x1 + 0.05;
+ el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2 - 0.05;
+ el.y1 = chip_info->bel_data[bel.index].y + main_swbox_y2;
+ el.y2 = chip_info->bel_data[bel.index].y + main_swbox_y2 + 0.05;
+ ret.push_back(el);
+ }
+
+#if 0
+ if (ret.empty()) {
+ BelId bel;
+ bel.index = decal.index;
+ log_warning("No gfx decal for bel %s (%d).\n", getBelName(bel).c_str(getCtx()), decal.index);
+ }
+#endif
}
return ret;
diff --git a/ice40/chipdb.py b/ice40/chipdb.py
index c33d736c..5b2f3e57 100644
--- a/ice40/chipdb.py
+++ b/ice40/chipdb.py
@@ -727,10 +727,6 @@ def add_pip(src, dst, flags=0):
pip_xy[(src, dst)] = (x, y, 0, len(switches) - 1, flags)
-# Add virtual padin wires
-for i in range(8):
- add_wire(0, 0, "padin_%d" % i)
-
def add_bel_input(bel, wire, port):
if wire not in wire_belports:
wire_belports[wire] = set()
diff --git a/ice40/gfx.cc b/ice40/gfx.cc
index 02f2668b..74338b8d 100644
--- a/ice40/gfx.cc
+++ b/ice40/gfx.cc
@@ -554,7 +554,7 @@ void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, int w, int h, Gfx
int input = idx % 4;
el.x1 = x + local_swbox_x2;
el.x2 = x + lut_swbox_x1;
- el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 - 0.0075 + (0.005 * input) + z * logic_cell_pitch;
+ el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 + 0.0075 - (0.005 * input) + z * logic_cell_pitch;
el.y2 = el.y1;
g.push_back(el);
}
@@ -565,7 +565,7 @@ void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, int w, int h, Gfx
int input = idx % 4;
el.x1 = x + lut_swbox_x2;
el.x2 = x + logic_cell_x1;
- el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 - 0.0075 + (0.005 * input) + z * logic_cell_pitch;
+ el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 + 0.0075 - (0.005 * input) + z * logic_cell_pitch;
el.y2 = el.y1;
g.push_back(el);
}
@@ -814,6 +814,7 @@ static bool getWireXY_main(GfxTileWireId id, float &x, float &y)
int idx = id - TILE_WIRE_SPAN4_VERT_B_0;
y = 1.0 - (0.03 + 0.0025 * (270 - idx));
x = main_swbox_x1;
+ return true;
}
// Global2Local
@@ -920,22 +921,22 @@ void pipGfx(std::vector<GraphicElement> &g, int x, int y, float x1, float y1, fl
el.style = style;
if (fabsf(x1 - swx1) < 0.001 && fabsf(x2 - swx1) < 0.001) {
- tx = x1 + 0.25 * fabsf(y1 - y2);
+ tx = swx1 + 0.25 * fabsf(y1 - y2);
goto edge_pip;
}
if (fabsf(x1 - swx2) < 0.001 && fabsf(x2 - swx2) < 0.001) {
- tx = x1 - 0.25 * fabsf(y1 - y2);
+ tx = swx2 - 0.25 * fabsf(y1 - y2);
goto edge_pip;
}
if (fabsf(y1 - swy1) < 0.001 && fabsf(y2 - swy1) < 0.001) {
- ty = y1 + 0.25 * fabsf(x1 - x2);
+ ty = swy1 + 0.25 * fabsf(x1 - x2);
goto edge_pip;
}
- if (fabsf(y1 - swy1) < 0.001 && fabsf(y2 - swy1) < 0.001) {
- ty = y1 + 0.25 * fabsf(x1 - x2);
+ if (fabsf(y1 - swy2) < 0.001 && fabsf(y2 - swy2) < 0.001) {
+ ty = swy2 - 0.25 * fabsf(x1 - x2);
goto edge_pip;
}
@@ -985,7 +986,7 @@ void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId src,
el.style = style;
el.x1 = x + logic_cell_x1;
el.x2 = x + logic_cell_x2;
- el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 - 0.0075 + (0.005 * in_idx) + lut_idx * logic_cell_pitch;
+ el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 + 0.0075 - (0.005 * in_idx) + lut_idx * logic_cell_pitch;
el.y2 = y + (logic_cell_y1 + logic_cell_y2) / 2 + lut_idx * logic_cell_pitch;
g.push_back(el);
return;
@@ -1002,8 +1003,46 @@ void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId src,
el.style = style;
el.x1 = x + lut_swbox_x1;
el.x2 = x + lut_swbox_x2;
- el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 - 0.0075 + (0.005 * in_idx) + lut_idx * logic_cell_pitch;
- el.y2 = y + (logic_cell_y1 + logic_cell_y2) / 2 - 0.0075 + (0.005 * out_idx) + lut_idx * logic_cell_pitch;
+ el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 + 0.0075 - (0.005 * in_idx) + lut_idx * logic_cell_pitch;
+ el.y2 = y + (logic_cell_y1 + logic_cell_y2) / 2 + 0.0075 - (0.005 * out_idx) + lut_idx * logic_cell_pitch;
+ g.push_back(el);
+ return;
+ }
+
+ if ((src == TILE_WIRE_CARRY_IN_MUX || (src >= TILE_WIRE_LUTFF_0_COUT && src <= TILE_WIRE_LUTFF_6_COUT)) &&
+ (dst >= TILE_WIRE_LUTFF_0_IN_0 && dst <= TILE_WIRE_LUTFF_7_IN_3 && (dst - TILE_WIRE_LUTFF_0_IN_0) % 4 == 3)) {
+ int lut_idx = (dst - TILE_WIRE_LUTFF_0_IN_0) / 4;
+
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_ARROW;
+ el.style = style;
+ el.x1 = x + (local_swbox_x2 + lut_swbox_x1) / 2;
+ el.x2 = el.x1;
+ el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 + 0.0075 - (0.005 * 3) + lut_idx * logic_cell_pitch;
+ el.y2 = y + (logic_cell_y1 + logic_cell_y2 - logic_cell_pitch) / 2 + lut_idx * logic_cell_pitch;
+ g.push_back(el);
+
+ el.x1 = x + logic_cell_x1 + 0.005 * 3;
+ el.y1 = el.y2;
+ g.push_back(el);
+ return;
+ }
+
+ if ((src >= TILE_WIRE_LUTFF_0_LOUT && src <= TILE_WIRE_LUTFF_6_LOUT) &&
+ (dst >= TILE_WIRE_LUTFF_0_IN_0 && dst <= TILE_WIRE_LUTFF_7_IN_3 && (dst - TILE_WIRE_LUTFF_0_IN_0) % 4 == 2)) {
+ int lut_idx = (dst - TILE_WIRE_LUTFF_0_IN_0) / 4;
+
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_ARROW;
+ el.style = style;
+ el.x1 = x + (local_swbox_x2 + lut_swbox_x1) / 2 + 0.005;
+ el.x2 = el.x1;
+ el.y1 = y + (logic_cell_y1 + logic_cell_y2) / 2 + 0.0075 - (0.005 * 2) + lut_idx * logic_cell_pitch;
+ el.y2 = y + (logic_cell_y1 + logic_cell_y2 - logic_cell_pitch) / 2 + lut_idx * logic_cell_pitch + 0.003;
+ g.push_back(el);
+
+ el.x1 = x + logic_cell_x1 + 0.005 * 5;
+ el.y1 = el.y2;
g.push_back(el);
return;
}