aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/nextpnr.h28
-rw-r--r--gui/fpgaviewwidget.cc20
-rw-r--r--ice40/arch.cc28
-rw-r--r--ice40/gfx.cc6
-rw-r--r--ice40/main.cc4
5 files changed, 45 insertions, 41 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index e9e491f4..5e32d5b6 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -145,21 +145,25 @@ struct GraphicElement
{
enum type_t
{
- G_NONE,
- G_LINE,
- G_ARROW,
- G_BOX,
- G_CIRCLE,
- G_LABEL
- } type = G_NONE;
+ TYPE_NONE,
+ TYPE_LINE,
+ TYPE_ARROW,
+ TYPE_BOX,
+ TYPE_CIRCLE,
+ TYPE_LABEL,
+
+ TYPE_MAX
+ } type = TYPE_NONE;
enum style_t
{
- G_FRAME, // Static "frame". Contrast between G_INACTIVE and G_ACTIVE
- G_HIDDEN, // Only display when object is selected or highlighted
- G_INACTIVE, // Render using low-contrast color
- G_ACTIVE, // Render using high-contast color
- } style = G_FRAME;
+ STYLE_FRAME, // Static "frame". Contrast between STYLE_INACTIVE and STYLE_ACTIVE
+ STYLE_HIDDEN, // Only display when object is selected or highlighted
+ STYLE_INACTIVE, // Render using low-contrast color
+ STYLE_ACTIVE, // Render using high-contast color
+
+ STYLE_MAX
+ } style = STYLE_FRAME;
float x1 = 0, y1 = 0, x2 = 0, y2 = 0, z = 0;
std::string text;
diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc
index 6637f2b7..e9096bf4 100644
--- a/gui/fpgaviewwidget.cc
+++ b/gui/fpgaviewwidget.cc
@@ -320,7 +320,7 @@ void FPGAViewWidget::drawDecal(LineShaderData &out, const DecalXY &decal)
offsetX = decal.x;
offsetY = decal.y;
- if (el.type == GraphicElement::G_BOX) {
+ if (el.type == GraphicElement::TYPE_BOX) {
auto line = PolyLine(true);
line.point(offsetX + scale * el.x1, offsetY + scale * el.y1);
line.point(offsetX + scale * el.x2, offsetY + scale * el.y1);
@@ -329,7 +329,7 @@ void FPGAViewWidget::drawDecal(LineShaderData &out, const DecalXY &decal)
line.build(out);
}
- if (el.type == GraphicElement::G_LINE || el.type == GraphicElement::G_ARROW) {
+ if (el.type == GraphicElement::TYPE_LINE || el.type == GraphicElement::TYPE_ARROW) {
PolyLine(offsetX + scale * el.x1, offsetY + scale * el.y1, offsetX + scale * el.x2, offsetY + scale * el.y2)
.build(out);
}
@@ -345,16 +345,16 @@ void FPGAViewWidget::drawDecal(LineShaderData out[], const DecalXY &decal)
offsetX = decal.x;
offsetY = decal.y;
- if (el.type == GraphicElement::G_BOX) {
+ if (el.type == GraphicElement::TYPE_BOX) {
auto line = PolyLine(true);
line.point(offsetX + scale * el.x1, offsetY + scale * el.y1);
line.point(offsetX + scale * el.x2, offsetY + scale * el.y1);
line.point(offsetX + scale * el.x2, offsetY + scale * el.y2);
line.point(offsetX + scale * el.x1, offsetY + scale * el.y2);
switch (el.style) {
- case GraphicElement::G_FRAME:
- case GraphicElement::G_INACTIVE:
- case GraphicElement::G_ACTIVE:
+ case GraphicElement::STYLE_FRAME:
+ case GraphicElement::STYLE_INACTIVE:
+ case GraphicElement::STYLE_ACTIVE:
line.build(out[el.style]);
break;
default:
@@ -362,13 +362,13 @@ void FPGAViewWidget::drawDecal(LineShaderData out[], const DecalXY &decal)
}
}
- if (el.type == GraphicElement::G_LINE || el.type == GraphicElement::G_ARROW) {
+ if (el.type == GraphicElement::TYPE_LINE || el.type == GraphicElement::TYPE_ARROW) {
auto line = PolyLine(offsetX + scale * el.x1, offsetY + scale * el.y1, offsetX + scale * el.x2,
offsetY + scale * el.y2);
switch (el.style) {
- case GraphicElement::G_FRAME:
- case GraphicElement::G_INACTIVE:
- case GraphicElement::G_ACTIVE:
+ case GraphicElement::STYLE_FRAME:
+ case GraphicElement::STYLE_INACTIVE:
+ case GraphicElement::STYLE_ACTIVE:
line.build(out[el.style]);
break;
default:
diff --git a/ice40/arch.cc b/ice40/arch.cc
index d08463d2..3803f842 100644
--- a/ice40/arch.cc
+++ b/ice40/arch.cc
@@ -654,8 +654,8 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
if (type == GroupId::TYPE_FRAME) {
GraphicElement el;
- el.type = GraphicElement::G_LINE;
- el.style = GraphicElement::G_FRAME;
+ el.type = GraphicElement::TYPE_LINE;
+ el.style = GraphicElement::STYLE_FRAME;
el.x1 = x + 0.01, el.x2 = x + 0.02, el.y1 = y + 0.01, el.y2 = y + 0.01;
ret.push_back(el);
@@ -680,8 +680,8 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
if (type == GroupId::TYPE_MAIN_SW) {
GraphicElement el;
- el.type = GraphicElement::G_BOX;
- el.style = GraphicElement::G_FRAME;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = GraphicElement::STYLE_FRAME;
el.x1 = x + main_swbox_x1;
el.x2 = x + main_swbox_x2;
@@ -692,8 +692,8 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
if (type == GroupId::TYPE_LOCAL_SW) {
GraphicElement el;
- el.type = GraphicElement::G_BOX;
- el.style = GraphicElement::G_FRAME;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = GraphicElement::STYLE_FRAME;
el.x1 = x + local_swbox_x1;
el.x2 = x + local_swbox_x2;
@@ -707,7 +707,7 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
int n = chip_info->wire_data[decal.index].num_segments;
const WireSegmentPOD *p = chip_info->wire_data[decal.index].segments.get();
- GraphicElement::style_t style = decal.active ? GraphicElement::G_ACTIVE : GraphicElement::G_INACTIVE;
+ GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
for (int i = 0; i < n; i++)
gfxTileWire(ret, p[i].x, p[i].y, GfxTileWireId(p[i].index), style);
@@ -715,7 +715,7 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
if (decal.type == DecalId::TYPE_PIP) {
const PipInfoPOD &p = chip_info->pip_data[decal.index];
- GraphicElement::style_t style = decal.active ? GraphicElement::G_ACTIVE : GraphicElement::G_HIDDEN;
+ 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);
}
@@ -727,8 +727,8 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
if (bel_type == TYPE_ICESTORM_LC) {
GraphicElement el;
- el.type = GraphicElement::G_BOX;
- el.style = decal.active ? GraphicElement::G_ACTIVE : GraphicElement::G_INACTIVE;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
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 +
@@ -740,8 +740,8 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
if (bel_type == TYPE_SB_IO) {
GraphicElement el;
- el.type = GraphicElement::G_BOX;
- el.style = decal.active ? GraphicElement::G_ACTIVE : GraphicElement::G_INACTIVE;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
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 +
@@ -754,8 +754,8 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
if (bel_type == TYPE_ICESTORM_RAM) {
for (int i = 0; i < 2; i++) {
GraphicElement el;
- el.type = GraphicElement::G_BOX;
- el.style = decal.active ? GraphicElement::G_ACTIVE : GraphicElement::G_INACTIVE;
+ el.type = GraphicElement::TYPE_BOX;
+ el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
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 + i;
diff --git a/ice40/gfx.cc b/ice40/gfx.cc
index 0a583e8e..0798862a 100644
--- a/ice40/gfx.cc
+++ b/ice40/gfx.cc
@@ -24,7 +24,7 @@ NEXTPNR_NAMESPACE_BEGIN
void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId id, GraphicElement::style_t style)
{
GraphicElement el;
- el.type = GraphicElement::G_LINE;
+ el.type = GraphicElement::TYPE_LINE;
el.style = style;
// Horizontal Span-4 Wires
@@ -647,7 +647,7 @@ void pipGfx(std::vector<GraphicElement> &g, int x, int y, float x1, float y1, fl
float ty = 0.5 * (y1 + y2);
GraphicElement el;
- el.type = GraphicElement::G_ARROW;
+ el.type = GraphicElement::TYPE_ARROW;
el.style = style;
if (fabsf(x1 - swx1) < 0.001 && fabsf(x2 - swx1) < 0.001) {
@@ -704,7 +704,7 @@ void gfxTilePip(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId src,
if (src == TILE_WIRE_CARRY_IN && dst == TILE_WIRE_CARRY_IN_MUX) {
GraphicElement el;
- el.type = GraphicElement::G_ARROW;
+ el.type = GraphicElement::TYPE_ARROW;
el.style = style;
el.x1 = x + logic_cell_x1 + 0.005 * 3;
el.x2 = el.x1;
diff --git a/ice40/main.cc b/ice40/main.cc
index 6201831a..32815b26 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -52,13 +52,13 @@ void svg_dump_decal(const Context *ctx, const DecalXY &decal)
const std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\"";
for (auto &el : ctx->getDecalGraphics(decal.decal)) {
- if (el.type == GraphicElement::G_BOX) {
+ if (el.type == GraphicElement::TYPE_BOX) {
std::cout << "<rect x=\"" << (offset + scale * (decal.x + el.x1)) << "\" y=\""
<< (offset + scale * (decal.y + el.y1)) << "\" height=\"" << (scale * (el.y2 - el.y1))
<< "\" width=\"" << (scale * (el.x2 - el.x1)) << "\" " << style << "/>\n";
}
- if (el.type == GraphicElement::G_LINE) {
+ if (el.type == GraphicElement::TYPE_LINE) {
std::cout << "<line x1=\"" << (offset + scale * (decal.x + el.x1)) << "\" y1=\""
<< (offset + scale * (decal.y + el.y1)) << "\" x2=\"" << (offset + scale * (decal.x + el.x2))
<< "\" y2=\"" << (offset + scale * (decal.y + el.y2)) << "\" " << style << "/>\n";