aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2019-12-15 09:21:58 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2019-12-15 09:21:58 +0100
commit436260e47ee89879193fb42614b76ac5a5880f3b (patch)
treed7696c47ed5f9e9695defb6f0a58f3a699c8c5f2 /ecp5
parentfb27f1a031f0517158a07694b0495e239072b6ce (diff)
downloadnextpnr-436260e47ee89879193fb42614b76ac5a5880f3b.tar.gz
nextpnr-436260e47ee89879193fb42614b76ac5a5880f3b.tar.bz2
nextpnr-436260e47ee89879193fb42614b76ac5a5880f3b.zip
move bel creation to gfx.cc
Diffstat (limited to 'ecp5')
-rw-r--r--ecp5/arch.cc124
-rw-r--r--ecp5/gfx.cc97
-rw-r--r--ecp5/gfx.h2
3 files changed, 101 insertions, 122 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index a67bc101..e678d3b3 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -625,9 +625,7 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
int x = decal.location.x;
int y = decal.location.y;
GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
-
GfxTileWireId tilewire = GfxTileWireId(locInfo(wire)->wire_data[wire.index].tile_wire);
-
gfxTileWire(ret, x, y, chip_info->width, chip_info->height, wire_type, tilewire, style);
} else if (decal.type == DecalId::TYPE_PIP) {
PipId pip;
@@ -650,126 +648,8 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
int x = decal.location.x;
int y = decal.location.y;
int z = locInfo(bel)->bel_data[bel.index].z;
-
- if (bel_type == id_TRELLIS_SLICE) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x1;
- el.x2 = x + slice_x2;
- el.y1 = y + slice_y1 + (z)*slice_pitch;
- el.y2 = y + slice_y2 + (z)*slice_pitch;
- ret.push_back(el);
-
- el.style = GraphicElement::STYLE_FRAME;
- el.x1 = x + slice_x2 + 0.0255f;
- el.x2 = el.x1 + 0.0017f;
- el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + z * 26) +
- 3 * slice_pitch - 0.0007f;
- el.y2 = el.y1 + 0.0017f * 5;
- ret.push_back(el);
- } else if (bel_type == id_TRELLIS_IO || bel_type == id_IOLOGIC || bel_type == id_SIOLOGIC ||
- bel_type == id_DQSBUFM) {
- bool top_bottom = (y == 0 || y == (chip_info->height - 1));
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- if (top_bottom) {
- el.x1 = x + io_cell_h_x1 + (z + 2) * 0.10;
- el.x2 = x + io_cell_h_x1 + (z + 2) * 0.10 + 0.08f;
- if (y == chip_info->height - 1) {
- el.y1 = y + 1 - io_cell_h_y1;
- el.y2 = y + 1 - io_cell_h_y2;
- } else {
- el.y1 = y + io_cell_h_y1;
- el.y2 = y + io_cell_h_y2;
- }
- } else {
- if (x == 0) {
- el.x1 = x + 1 - io_cell_v_x1;
- el.x2 = x + 1 - io_cell_v_x2;
- } else {
- el.x1 = x + io_cell_v_x1;
- el.x2 = x + io_cell_v_x2;
- }
- el.y1 = y + io_cell_v_y1 + z * 0.10;
- el.y2 = y + io_cell_v_y1 + z * 0.10 + 0.08f;
- }
- ret.push_back(el);
- } else if (bel_type == id_DCCA) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + switchbox_x1 + (z)*0.025;
- el.y1 = y + 0.14;
- el.x2 = x + switchbox_x1 + (z)*0.025 + 0.020;
- el.y2 = y + 0.18;
- ret.push_back(el);
- } else if (bel_type == id_DP16KD || bel_type == id_MULT18X18D || bel_type == id_ALU54B) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x1;
- el.x2 = x + 0.97;
- el.y1 = y + slice_y1 - 1 * slice_pitch;
- el.y2 = y + slice_y2 + 3 * slice_pitch;
- ret.push_back(el);
- } else if (bel_type == id_EHXPLLL) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x1;
- el.x2 = x + 0.97;
- el.y1 = y + slice_y1;
- el.y2 = y + slice_y2;
- ret.push_back(el);
- } else if (bel_type == id_DCUA) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x1;
- el.x2 = x + 0.97;
- el.y1 = y + slice_y2;
- el.y2 = y + 0.25;
- ret.push_back(el);
- } else if (bel_type == id_EXTREFB || bel_type == id_PCSCLKDIV || bel_type == id_DTR || bel_type == id_USRMCLK) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x1;
- el.x2 = x + 0.97;
- el.y1 = y + slice_y1 + (z)*slice_pitch;
- el.y2 = y + slice_y2 + (z)*slice_pitch;
- ret.push_back(el);
- } else if (bel_type == id_SEDGA || bel_type == id_GSR || bel_type == id_JTAGG || bel_type == id_OSCG) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + slice_x1;
- el.x2 = x + 0.97;
- el.y1 = y + slice_y1 + (z)*slice_pitch;
- el.y2 = y + slice_y2 + (z)*slice_pitch;
- ret.push_back(el);
- } else if (bel_type == id_DDRDLL) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + 0.2;
- el.x2 = x + 0.8;
- el.y1 = y + 0.2;
- el.y2 = y + 0.8;
- ret.push_back(el);
- } else if (bel_type == id_DLLDELD || bel_type == id_CLKDIVF || bel_type == id_ECLKSYNCB ||
- bel_type == id_TRELLIS_ECLKBUF || bel_type == id_ECLKBRIDGECS) {
- GraphicElement el;
- el.type = GraphicElement::TYPE_BOX;
- el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
- el.x1 = x + 0.1 + z * 0.05;
- el.x2 = x + 0.14 + z * 0.05;
- el.y1 = y + 0.475;
- el.y2 = y + 0.525;
- ret.push_back(el);
- }
+ GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
+ gfxTileBel(ret, x, y, z, chip_info->width, chip_info->height, bel_type, style);
}
return ret;
diff --git a/ecp5/gfx.cc b/ecp5/gfx.cc
index 858ac5fb..6245bd24 100644
--- a/ecp5/gfx.cc
+++ b/ecp5/gfx.cc
@@ -22,6 +22,103 @@
NEXTPNR_NAMESPACE_BEGIN
+void gfxTileBel(std::vector<GraphicElement> &g, int x, int y, int z, int w, int h, IdString bel_type,
+ GraphicElement::style_t style)
+{
+ GraphicElement el;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = style;
+ if (bel_type == id_TRELLIS_SLICE) {
+ el.x1 = x + slice_x1;
+ el.x2 = x + slice_x2;
+ el.y1 = y + slice_y1 + (z)*slice_pitch;
+ el.y2 = y + slice_y2 + (z)*slice_pitch;
+ g.push_back(el);
+
+ el.style = GraphicElement::STYLE_FRAME;
+ el.x1 = x + slice_x2 + 0.0255f;
+ el.x2 = el.x1 + 0.0017f;
+ el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 5 + z * 26) +
+ 3 * slice_pitch - 0.0007f;
+ el.y2 = el.y1 + 0.0017f * 5;
+ g.push_back(el);
+ } else if (bel_type == id_TRELLIS_IO || bel_type == id_IOLOGIC || bel_type == id_SIOLOGIC ||
+ bel_type == id_DQSBUFM) {
+ bool top_bottom = (y == 0 || y == (h - 1));
+ if (top_bottom) {
+ el.x1 = x + io_cell_h_x1 + (z + 2) * 0.10;
+ el.x2 = x + io_cell_h_x1 + (z + 2) * 0.10 + 0.08f;
+ if (y == h - 1) {
+ el.y1 = y + 1 - io_cell_h_y1;
+ el.y2 = y + 1 - io_cell_h_y2;
+ } else {
+ el.y1 = y + io_cell_h_y1;
+ el.y2 = y + io_cell_h_y2;
+ }
+ } else {
+ if (x == 0) {
+ el.x1 = x + 1 - io_cell_v_x1;
+ el.x2 = x + 1 - io_cell_v_x2;
+ } else {
+ el.x1 = x + io_cell_v_x1;
+ el.x2 = x + io_cell_v_x2;
+ }
+ el.y1 = y + io_cell_v_y1 + z * 0.10;
+ el.y2 = y + io_cell_v_y1 + z * 0.10 + 0.08f;
+ }
+ g.push_back(el);
+ } else if (bel_type == id_DCCA) {
+ el.x1 = x + switchbox_x1 + (z)*0.025;
+ el.y1 = y + 0.14;
+ el.x2 = x + switchbox_x1 + (z)*0.025 + 0.020;
+ el.y2 = y + 0.18;
+ g.push_back(el);
+ } else if (bel_type == id_DP16KD || bel_type == id_MULT18X18D || bel_type == id_ALU54B) {
+ el.x1 = x + slice_x1;
+ el.x2 = x + 0.97;
+ el.y1 = y + slice_y1 - 1 * slice_pitch;
+ el.y2 = y + slice_y2 + 3 * slice_pitch;
+ g.push_back(el);
+ } else if (bel_type == id_EHXPLLL) {
+ el.x1 = x + slice_x1;
+ el.x2 = x + 0.97;
+ el.y1 = y + slice_y1;
+ el.y2 = y + slice_y2;
+ g.push_back(el);
+ } else if (bel_type == id_DCUA) {
+ el.x1 = x + slice_x1;
+ el.x2 = x + 0.97;
+ el.y1 = y + slice_y2;
+ el.y2 = y + 0.25;
+ g.push_back(el);
+ } else if (bel_type == id_EXTREFB || bel_type == id_PCSCLKDIV || bel_type == id_DTR || bel_type == id_USRMCLK) {
+ el.x1 = x + slice_x1;
+ el.x2 = x + 0.97;
+ el.y1 = y + slice_y1 + (z)*slice_pitch;
+ el.y2 = y + slice_y2 + (z)*slice_pitch;
+ g.push_back(el);
+ } else if (bel_type == id_SEDGA || bel_type == id_GSR || bel_type == id_JTAGG || bel_type == id_OSCG) {
+ el.x1 = x + slice_x1;
+ el.x2 = x + 0.97;
+ el.y1 = y + slice_y1 + (z)*slice_pitch;
+ el.y2 = y + slice_y2 + (z)*slice_pitch;
+ g.push_back(el);
+ } else if (bel_type == id_DDRDLL) {
+ el.x1 = x + 0.2;
+ el.x2 = x + 0.8;
+ el.y1 = y + 0.2;
+ el.y2 = y + 0.8;
+ g.push_back(el);
+ } else if (bel_type == id_DLLDELD || bel_type == id_CLKDIVF || bel_type == id_ECLKSYNCB ||
+ bel_type == id_TRELLIS_ECLKBUF || bel_type == id_ECLKBRIDGECS) {
+ el.x1 = x + 0.1 + z * 0.05;
+ el.x2 = x + 0.14 + z * 0.05;
+ el.y1 = y + 0.475;
+ el.y2 = y + 0.525;
+ g.push_back(el);
+ }
+}
+
void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire,
GraphicElement::style_t style)
{
diff --git a/ecp5/gfx.h b/ecp5/gfx.h
index 90bb16a0..210ba56d 100644
--- a/ecp5/gfx.h
+++ b/ecp5/gfx.h
@@ -2161,6 +2161,8 @@ enum GfxTileWireId
};
+void gfxTileBel(std::vector<GraphicElement> &g, int x, int y, int z, int w, int h, IdString bel_type,
+ GraphicElement::style_t style);
void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, int w, int h, IdString wire_type, GfxTileWireId tilewire,
GraphicElement::style_t style);
void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, int w, int h, WireId src, IdString src_type,