Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JC3 committed Aug 9, 2023
2 parents 71096a2 + b4db16d commit 0b476a1
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
74 changes: 73 additions & 1 deletion compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,61 @@ QString Compiler::Desc (Component comp) {

}

QString Compiler::IECLabel (Component comp) {

static const QMap<Component,QString> 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 {

Expand All @@ -431,7 +486,11 @@ Compiler::GraphResults Compiler::buildGraphViz (GraphSettings settings) const {
QMap<QString,QString> 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)
Expand Down Expand Up @@ -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;
Expand All @@ -484,11 +548,19 @@ Compiler::GraphResults Compiler::buildGraphViz (GraphSettings settings) const {

QMap<QString,QString> 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;
Expand Down
4 changes: 3 additions & 1 deletion compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 9 additions & 2 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>709</width>
<height>477</height>
<height>525</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -871,6 +871,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkIECSymbols">
<property name="text">
<string>IEC Gate Symbols</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
Expand Down Expand Up @@ -1097,7 +1104,7 @@
<resources/>
<connections/>
<buttongroups>
<buttongroup name="grpConvertLayer"/>
<buttongroup name="grpFontChoice"/>
<buttongroup name="grpConvertLayer"/>
</buttongroups>
</ui>
2 changes: 1 addition & 1 deletion vcbtool.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
QMAKE_TARGET_DESCRIPTION = "VCB Tool"
VERSION = 1.8.3
VERSION = 1.8.4
DEFINES += VCBTOOL_VERSION='\\"$$VERSION\\"'

QT += core gui
Expand Down

0 comments on commit 0b476a1

Please sign in to comment.