diff --git a/compiler.cpp b/compiler.cpp index 37c6476..b2d5ae9 100644 --- a/compiler.cpp +++ b/compiler.cpp @@ -405,6 +405,61 @@ QString Compiler::Desc (Component comp) { } +QString Compiler::IECLabel (Component comp) { + + static const QMap s = { + { Empty, "Empty" }, + { Cross, "Cross" }, + { Tunnel, "Tunnel" }, + { Mesh, "Mesh" }, + { Bus1, "Bus1" }, + { Bus2, "Bus2" }, + { Bus3, "Bus3" }, + { Bus4, "Bus4" }, + { Bus5, "Bus5" }, + { Bus6, "Bus6" }, + { Write, "Trace" }, + { Read, "Trace" }, + { Trace1, "Trace" }, + { Trace2, "Trace" }, + { Trace3, "Trace" }, + { Trace4, "Trace" }, + { Trace5, "Trace" }, + { Trace6, "Trace" }, + { Trace7, "Trace" }, + { Trace8, "Trace" }, + { Trace9, "Trace" }, + { Trace10, "Trace" }, + { Trace11, "Trace" }, + { Trace12, "Trace" }, + { Trace13, "Trace" }, + { Trace14, "Trace" }, + { Trace15, "Trace" }, + { Trace16, "Trace" }, + { Buffer, "1" }, + { And, "&" }, + { Or, "≥1" }, + { Nor, "≥1" }, + { Not, "1" }, + { Nand, "&" }, + { Xor, "=1" }, + { Xnor, "=1" }, + { LatchOn, "LatchOn" }, + { LatchOff, "LatchOff" }, + { Clock, "Clock" }, + { LED, "LED" }, + { Timer, "Timer" }, + { Random, "Random" }, + { Break, "Break" }, + { Wifi0, "Wifi0" }, + { Wifi1, "Wifi1" }, + { Wifi2, "Wifi2" }, + { Wifi3, "Wifi3" } + }; + + return s[comp]; + +} Compiler::GraphResults Compiler::buildGraphViz (GraphSettings settings) const { @@ -431,7 +486,11 @@ Compiler::GraphResults Compiler::buildGraphViz (GraphSettings settings) const { QMap attrs; QString cluster; - QString label = Desc(graph.entities[id]); + QString label; + if (settings.iecsymbols) + label = IECLabel(graph.entities[id]); + else + label = Desc(graph.entities[id]); if (settings.timinglabels && cgraph[id]->mintiming >= 0 && cgraph[id]->maxtiming >= 0) label += QString(" (%1-%2)").arg(cgraph[id]->mintiming).arg(cgraph[id]->maxtiming); if (cgraph[id]->isloop) @@ -459,6 +518,11 @@ Compiler::GraphResults Compiler::buildGraphViz (GraphSettings settings) const { attrs["shape"] = "box"; } + if (settings.iecsymbols) { + if (cgraph[id]->purpose == Node::Other) + attrs["shape"] = "square"; + } + if (settings.positions != GraphSettings::None) { float posx = (id % bpwidth_) * settings.scale; float posy = (bpheight_ - id / bpwidth_) * settings.scale; @@ -484,11 +548,19 @@ Compiler::GraphResults Compiler::buildGraphViz (GraphSettings settings) const { QMap attrs; + const auto isInverted = [] (Component type) { + return type == Not || type == Nand || type == Nor || type == Xnor; + }; + { const Node *from = cgraph[conn.first]; const Node *to = cgraph[conn.second]; if (from->critpath && to->critpath && from->maxtiming >= to->maxtiming - 1) attrs["color"] = "red"; + if (isInverted(from->type)) { + attrs["dir"] = "both"; + attrs["arrowtail"] = "odot"; + } } QStringList attrstrs; diff --git a/compiler.h b/compiler.h index ccb3925..c1cd8f1 100644 --- a/compiler.h +++ b/compiler.h @@ -99,6 +99,7 @@ class Compiler : public QObject { static Component Comp (Blueprint::Ink ink); static QString Desc (Component comp); + static QString IECLabel (Component comp); explicit Compiler (const Blueprint *bp, QObject *parent = nullptr); @@ -120,7 +121,8 @@ class Compiler : public QObject { float scale; bool squareio; bool highlightloops; - GraphSettings () : compressed(false), ioclusters(false), timings(false), timinglabels(false), positions(None), scale(1.0f), squareio(false), highlightloops(true) { } + bool iecsymbols; + GraphSettings () : compressed(false), ioclusters(false), timings(false), timinglabels(false), positions(None), scale(1.0f), squareio(false), highlightloops(true), iecsymbols(false) { } }; struct GraphResults { diff --git a/mainwindow.cpp b/mainwindow.cpp index 98dab60..79c2ca5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -351,6 +351,7 @@ void MainWindow::on_btnNetlistGraph_clicked() s.positions = (Compiler::GraphSettings::PosMode)ui_->cbPositions->currentIndex(); s.scale = ui_->txtPosScale->text().toFloat(); s.squareio = ui_->chkSquareIO->isChecked(); + s.iecsymbols = ui_->chkIECSymbols->isChecked(); Compiler::GraphResults r = c.buildGraphViz(s); ui_->txtNetlistOut->setPlainText(r.graphviz.join("\n")); if (r.stats.critpathlen != -1) { diff --git a/mainwindow.ui b/mainwindow.ui index 901024e..74c689e 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 709 - 477 + 525 @@ -871,6 +871,13 @@ + + + + IEC Gate Symbols + + + @@ -1097,7 +1104,7 @@ - + diff --git a/vcbtool.pro b/vcbtool.pro index 6ef9109..94237db 100644 --- a/vcbtool.pro +++ b/vcbtool.pro @@ -1,5 +1,5 @@ QMAKE_TARGET_DESCRIPTION = "VCB Tool" -VERSION = 1.8.3 +VERSION = 1.8.4 DEFINES += VCBTOOL_VERSION='\\"$$VERSION\\"' QT += core gui