diff options
author | David Shah <davey1576@gmail.com> | 2018-07-31 14:39:37 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-07-31 14:39:37 +0200 |
commit | f3127f7dfd33469d29010b611aafb715a33b3be2 (patch) | |
tree | 755bb891121b7af47e94b50351789ebf5c878667 /ecp5/arch.cc | |
parent | e3a403fa2990602941ce756726488820182aff26 (diff) | |
download | nextpnr-f3127f7dfd33469d29010b611aafb715a33b3be2.tar.gz nextpnr-f3127f7dfd33469d29010b611aafb715a33b3be2.tar.bz2 nextpnr-f3127f7dfd33469d29010b611aafb715a33b3be2.zip |
ecp5: Add Bel graphics
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/arch.cc')
-rw-r--r-- | ecp5/arch.cc | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc index c8617190..7f7079bf 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -21,6 +21,7 @@ #include <algorithm> #include <cmath> #include <cstring> +#include "gfx.h" #include "log.h" #include "nextpnr.h" #include "placer1.h" @@ -421,16 +422,64 @@ bool Arch::route() { return router1(getCtx()); } // ----------------------------------------------------------------------- -std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decalId) const +std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const { std::vector<GraphicElement> ret; - // FIXME + + if (decal.type == DecalId::TYPE_FRAME) { + /* nothing */ + } + + if (decal.type == DecalId::TYPE_BEL) { + BelId bel; + bel.index = decal.z; + bel.location = decal.location; + int z = locInfo(bel)->bel_data[bel.index].z; + auto bel_type = getBelType(bel); + + if (bel_type == TYPE_TRELLIS_SLICE) { + GraphicElement el; + el.type = GraphicElement::TYPE_BOX; + el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; + el.x1 = bel.location.x + logic_cell_x1; + el.x2 = bel.location.x + logic_cell_x2; + el.y1 = bel.location.y + logic_cell_y1 + (z)*logic_cell_pitch; + el.y2 = bel.location.y + logic_cell_y2 + (z)*logic_cell_pitch; + ret.push_back(el); + } + + if (bel_type == TYPE_TRELLIS_IO) { + GraphicElement el; + el.type = GraphicElement::TYPE_BOX; + el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; + el.x1 = bel.location.x + logic_cell_x1; + el.x2 = bel.location.x + logic_cell_x2; + el.y1 = bel.location.y + logic_cell_y1 + (2 * z) * logic_cell_pitch; + el.y2 = bel.location.y + logic_cell_y2 + (2 * z + 1) * logic_cell_pitch; + ret.push_back(el); + } + } + return ret; } -DecalXY Arch::getFrameDecal() const { return {}; } +DecalXY Arch::getFrameDecal() const +{ + DecalXY decalxy; + decalxy.decal.type = DecalId::TYPE_FRAME; + decalxy.decal.active = true; + return decalxy; +} -DecalXY Arch::getBelDecal(BelId bel) const { return {}; } +DecalXY Arch::getBelDecal(BelId bel) const +{ + DecalXY decalxy; + decalxy.decal.type = DecalId::TYPE_BEL; + decalxy.decal.location = bel.location; + decalxy.decal.z = bel.index; + decalxy.decal.active = bel_to_cell.count(bel) && (bel_to_cell.at(bel) != IdString()); + return decalxy; +} DecalXY Arch::getWireDecal(WireId wire) const { return {}; } |