ecp5: Add Bel graphics
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
e3a403fa29
commit
f3127f7dfd
57
ecp5/arch.cc
57
ecp5/arch.cc
@ -21,6 +21,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include "gfx.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
#include "placer1.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;
|
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;
|
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 {}; }
|
DecalXY Arch::getWireDecal(WireId wire) const { return {}; }
|
||||||
|
|
||||||
|
@ -120,17 +120,21 @@ struct GroupId
|
|||||||
|
|
||||||
struct DecalId
|
struct DecalId
|
||||||
{
|
{
|
||||||
char type = 0; // Bel/Wire/Pip/Frame (b/w/p/f)
|
enum
|
||||||
|
{
|
||||||
|
TYPE_FRAME,
|
||||||
|
TYPE_BEL
|
||||||
|
} type;
|
||||||
Location location;
|
Location location;
|
||||||
uint32_t z = 0;
|
uint32_t z = 0;
|
||||||
|
bool active = false;
|
||||||
bool operator==(const DecalId &other) const
|
bool operator==(const DecalId &other) const
|
||||||
{
|
{
|
||||||
return type == other.type && location == other.location && z == other.z;
|
return type == other.type && location == other.location && z == other.z && active == other.active;
|
||||||
}
|
}
|
||||||
bool operator!=(const DecalId &other) const
|
bool operator!=(const DecalId &other) const
|
||||||
{
|
{
|
||||||
return type != other.type || location != other.location || z != other.z;
|
return type != other.type || location != other.location || z != other.z || active != other.active;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -200,6 +204,7 @@ template <> struct hash<NEXTPNR_NAMESPACE_PREFIX DecalId>
|
|||||||
boost::hash_combine(seed, hash<int>()(decal.type));
|
boost::hash_combine(seed, hash<int>()(decal.type));
|
||||||
boost::hash_combine(seed, hash<NEXTPNR_NAMESPACE_PREFIX Location>()(decal.location));
|
boost::hash_combine(seed, hash<NEXTPNR_NAMESPACE_PREFIX Location>()(decal.location));
|
||||||
boost::hash_combine(seed, hash<int>()(decal.z));
|
boost::hash_combine(seed, hash<int>()(decal.z));
|
||||||
|
boost::hash_combine(seed, hash<bool>()(decal.active));
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
35
ecp5/gfx.h
Normal file
35
ecp5/gfx.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* nextpnr -- Next Generation Place and Route
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 David Shah <david@symbioticeda.com>
|
||||||
|
*
|
||||||
|
* 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 ECP5_GFX_H
|
||||||
|
#define ECP5_GFX_H
|
||||||
|
|
||||||
|
#include "nextpnr.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
const float logic_cell_x1 = 0.76;
|
||||||
|
const float logic_cell_x2 = 0.95;
|
||||||
|
const float logic_cell_y1 = 0.05;
|
||||||
|
const float logic_cell_y2 = 0.15;
|
||||||
|
const float logic_cell_pitch = 0.125;
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif
|
10
ecp5/main.cc
10
ecp5/main.cc
@ -100,16 +100,18 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("help") || argc == 1) {
|
if (vm.count("help") || argc == 1) {
|
||||||
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
|
std::cout << boost::filesystem::basename(argv[0])
|
||||||
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
<< " -- Next Generation Place and Route (git "
|
||||||
|
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
std::cout << options << "\n";
|
std::cout << options << "\n";
|
||||||
return argc != 1;
|
return argc != 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("version")) {
|
if (vm.count("version")) {
|
||||||
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
|
std::cout << boost::filesystem::basename(argv[0])
|
||||||
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
<< " -- Next Generation Place and Route (git "
|
||||||
|
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user