HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
logic_evaluator_dialog.cpp
Go to the documentation of this file.
5 #include "gui/gui_globals.h"
10 
11 #include <QHBoxLayout>
12 #include <QVBoxLayout>
13 #include <QGridLayout>
14 #include <QCheckBox>
15 #include <QLabel>
16 #include <QStyle>
17 #include <QSet>
18 #include <QFile>
19 #include <QDir>
20 #include <QProcess>
21 #include <QTemporaryFile>
22 #include <QDebug>
23 #include <QSpacerItem>
24 #include <QScrollArea>
25 #include <QScrollBar>
26 
27 namespace hal {
28 
29  const char* LOGIC_EVALUATOR_GET = "logic_evaluator_get";
30  const char* LOGIC_EVALUATOR_SET = "logic_evaluator_set";
31  const char* LOGIC_EVALUATOR_CALC = "logic_evaluator_calc";
32  const char* COMPILER = "gcc";
33 
34  LogicEvaluatorDialog::LogicEvaluatorDialog(const std::vector<Gate *>& gates, bool skipCompile, QWidget *parent)
35  : QDialog(parent), mGates(gates), mSimulationInput(new SimulationInput), mActionCompile(nullptr), mActionIndicate(nullptr)
36  {
38  setWindowTitle(QString("Logic Evaluator %1 Gates").arg(gates.size()));
39 
40  if (gates.empty())
41  {
42  log_warning("logic_evaluator", "No eligible gates selected for logic evaluator, window will close");
43  close();
44  }
45 
46  QWidget* mainWidget = new QWidget;
47 
48  mSimulationInput->add_gates(gates);
49  mSimulationInput->compute_net_groups();
50 
51  calculateEvaluationOrder();
52  QHBoxLayout* topLayout = new QHBoxLayout(mainWidget);
54  topLayout->setSpacing(0);
55  QVBoxLayout* inpLayout = new QVBoxLayout;
57  inpLayout->setSpacing(4);
58  QVBoxLayout* outLayout = new QVBoxLayout;
59  outLayout->setSpacing(4);
61 
62  // input pingroups
63  std::unordered_set<const Net*> inputNets = mSimulationInput->get_input_nets();
64  for (SimulationInput::NetGroup grp : mSimulationInput->get_net_groups())
65  {
66  if (!grp.is_input())
67  continue;
68  for (const Net* n : grp.get_nets())
69  {
70  auto it = inputNets.find(n);
71  if (it != inputNets.end()) inputNets.erase(it);
72  }
73  LogicEvaluatorPingroup* lep = new LogicEvaluatorPingroup(grp.get_nets(), false, QString::fromStdString(grp.get_name()), mainWidget);
75  mInputs.append(lep);
76  inpLayout->addWidget(lep);
77  }
78 
79  // input single pins
80  for (const Net* n : inputNets)
81  {
82  LogicEvaluatorPingroup* lep = new LogicEvaluatorPingroup(n, false, mainWidget);
84  mInputs.append(lep);
85  inpLayout->addWidget(lep);
86  }
87 
88  // output pingroups
89  std::unordered_set<const Net*> outputNets(mSimulationInput->get_output_nets().begin(),mSimulationInput->get_output_nets().end());
90  for (SimulationInput::NetGroup grp : mSimulationInput->get_net_groups())
91  {
92  if (!grp.is_output())
93  continue;
94  bool isOutputGroup = true;
95 
96  std::vector<const Net*> temp;
97  for (const Net* n : grp.get_nets())
98  {
99  auto it = outputNets.find(n);
100  if (it == outputNets.end())
101  {
102  isOutputGroup = false;
103  break;
104  }
105  else
106  {
107  outputNets.erase(it);
108  temp.push_back(n);
109  }
110  }
111  if (!isOutputGroup)
112  {
113  for (const Net* n : temp)
114  outputNets.insert(n);
115  continue;
116  }
117  LogicEvaluatorPingroup* lep = new LogicEvaluatorPingroup(grp.get_nets(), true, QString::fromStdString(grp.get_name()), mainWidget);
119  mOutputs.append(lep);
120  outLayout->addWidget(lep);
121  }
122 
123  // output single pins
124  for (const Net* n : outputNets)
125  {
126  QStringList netName;
127  netName.append(QString::fromStdString(n->get_name()));
128  LogicEvaluatorPingroup* lep = new LogicEvaluatorPingroup(n, true, mainWidget);
130  mOutputs.append(lep);
131  outLayout->addWidget(lep);
132  }
133 
134  QTreeView* tview = new QTreeView;
135  ModuleModel* tmodel = new ModuleModel(this);
136  tmodel->populateFromGatelist(gates);
137  tview->setModel(tmodel);
138  tview->expandAll();
139  tview->setColumnWidth(0,250);
140  tview->setColumnWidth(1,40);
141  tview->setColumnWidth(2,110);
142 
143  mMenuBar = new QMenuBar(this);
144  QMenu* options = mMenuBar->addMenu("Options");
145  mActionCompile = options->addAction("Run compiled logic");
146  connect(mActionCompile, &QAction::toggled, this, &LogicEvaluatorDialog::handleCompiledToggled);
147  mActionCompile->setCheckable(true);
148  mActionCompile->setChecked(false);
149  mActionIndicate = options->addAction("Show in graphic view");
150  connect(mActionIndicate, &QAction::toggled, this, &LogicEvaluatorDialog::handleIndicateToggled);
151  mActionIndicate->setCheckable(true);
152  QMenu* launch = mMenuBar->addMenu("Launch");
153  QAction* relaunch = launch->addAction("Relaunch");
154  connect(relaunch, &QAction::triggered, this, &LogicEvaluatorDialog::handleRelaunchTriggered);
155  QAction* ttable = launch->addAction("Truth Table");
156  connect(ttable, &QAction::triggered, this, &LogicEvaluatorDialog::handleTruthtableTriggered);
157 
158  inpLayout->addStretch();
159  outLayout->addStretch();
160  topLayout->addLayout(inpLayout);
161  tview->setMinimumWidth(400);
162  topLayout->addWidget(tview);
163  topLayout->addLayout(outLayout);
164  topLayout->setMenuBar(mMenuBar);
165 
166 
167  QScrollArea* mainScroll = new QScrollArea;
168  mainScroll->setWidget(mainWidget);
169  mainScroll->setWidgetResizable(false);
173 
174  QVBoxLayout* mainLayout = new QVBoxLayout(this);
175 
176  mainLayout->addWidget(mainScroll);
177 
178  if (!skipCompile)
179  {
180  mActionCompile->setChecked(true);
181  }
182 
183  QStyle* s = style();
184 
185  s->unpolish(this);
186  s->polish(this);
187 
188  recalc();
189 
190  QSize minSize = mainScroll->minimumSize(); // remember minimum size assigned from system
191  mainScroll->setMinimumWidth(mainWidget->sizeHint().width()+16); // set minimum with to content + scrollbar
192  adjustSize(); // adjust dialog size
193  mainScroll->setMinimumSize(minSize); // reset minimum size so user can shrink if needed
194  }
195 
197  {
198  delete mSimulationInput;
199  }
200 
201  void LogicEvaluatorDialog::handleRelaunchTriggered()
202  {
203  LogicEvaluatorSelectGates lesg(mGates, this);
204  if (lesg.exec() == QDialog::Accepted)
205  lower();
206  }
207 
208  void LogicEvaluatorDialog::handleTruthtableTriggered()
209  {
210  if (!mSharedLib.handle) return;
211  if (!mTruthtable)
212  {
213  QList<const Net*> inpList;
214  QList<const Net*> outList;
215  for (const LogicEvaluatorPingroup* lepg : mInputs)
216  for (int i=lepg->size()-1; i>=0; i--)
217  inpList.append(lepg->getValue(i).first);
218  for (const LogicEvaluatorPingroup* lepg : mOutputs)
219  for (int i=lepg->size()-1; i>=0; i--)
220  outList.append(lepg->getValue(i).first);
221  if (inpList.isEmpty() || outList.isEmpty()) return;
222  if (inpList.size() > 10)
223  {
224  log_warning("logic_evaluator", "Cannot generate truth table for {} logic inputs.", inpList.size());
225  return;
226  }
227  mTruthtable = new LogicEvaluatorTruthtableModel(inpList,outList,this);
228 
229  int maxInput = 1 << inpList.size();
230 
231  for (int inputVal = 0; inputVal < maxInput; inputVal++)
232  {
233  QList<int> values;
234  int mask = 1;
235  for (const Net* n : inpList)
236  {
237  int bitVal = (inputVal&mask) ? 1 : 0;
238  values.append(bitVal);
239  mSharedLib.set(mExternalArrayIndex[n], bitVal);
240  mask <<= 1;
241  }
242  mSharedLib.calc();
243  for (const Net* n : outList)
244  {
245  int bitVal = mSharedLib.get(mExternalArrayIndex[n]);
246  values.append(bitVal);
247  }
248  mTruthtable->addColumn(new LogicEvaluatorTruthtableColumn(inpList.size()+outList.size(),values));
249  }
250  }
251  if (!mTruthtable) return;
252 
253  LogicEvaluatorTruthtable lett(mTruthtable, this);
254  if (lett.exec() == QDialog::Accepted)
255  {
256  QMap<const Net*,int> vals = lett.selectedColumn();
257  for (auto it = vals.constBegin(); it != vals.constEnd(); ++it)
258  {
259  const Net* n = it.key();
260  BooleanFunction::Value bv = it.value() ? BooleanFunction::Value::ONE : BooleanFunction::Value::ZERO;
261  for (LogicEvaluatorPingroup* lepg : mInputs)
262  lepg->setValue(n,bv);
263  }
264  }
265  }
266 
267  void LogicEvaluatorDialog::handleCompiledToggled(bool checked)
268  {
269  if (checked && !mSharedLib.handle)
270  {
271  compile();
272  if (!mSharedLib.handle)
273  mActionCompile->setChecked(false);
274  }
275  }
276 
277  void LogicEvaluatorDialog::handleIndicateToggled(bool checked)
278  {
279  if (checked)
280  recalc();
281  else
282  omitNetlistVisualization();
283  }
284 
285  void LogicEvaluatorDialog::SharedLibHandle::close()
286  {
287  if (handle)
288  {
289  dlclose(handle);
290  handle = nullptr;
291  }
292  QFile::remove(fnSharedLib);
293  }
294 
296  {
297  // get input signals
298  QString codeEvalFunction;
299  mExternalArrayIndex.clear();
300 
301  for (const LogicEvaluatorPingroup* lepg : mInputs)
302  {
303  for (int i=0; i<lepg->size(); i++)
304  {
305  QPair<const Net*, BooleanFunction::Value> v = lepg->getValue(i);
306  const Net* n = v.first;
307  int sz = mExternalArrayIndex.size();
308  codeEvalFunction += QString(" // input[%1] - Net %2 <%3>;\n").arg(sz).arg(n->get_id()).arg(n->get_name().c_str());
309  mExternalArrayIndex[n] = sz;
310  }
311  }
312 
313  // propagate by gates
314  for (const Gate* g : mEvaluationOrder)
315  {
316  struct FunctionReference
317  {
318  QString theFunction;
319  QSet<QString> dependencies;
320  bool placed;
321  FunctionReference() : placed(false) {;}
322  FunctionReference(const BooleanFunction& func)
323  : placed(false)
324  {
325  theFunction = QString::fromStdString(func.to_string());
326  for (std::string dep : func.get_variable_names())
327  dependencies.insert(QString::fromStdString(dep));
328  }
329  void replace(const QString& var, const QString& ccExpression)
330  {
331  auto it = dependencies.find(var);
332  if (it == dependencies.end()) return;
333  theFunction.replace(var, ccExpression);
334  dependencies.erase(it);
335  }
336  };
337 
338  QMap<const GatePin*,FunctionReference> referableOutputPins;
339  int unresolved = 0;
340 
341  // collect all functions
342  for (const GatePin* gp : g->get_type()->get_output_pins())
343  {
344  QString pinNameOut = QString::fromStdString(gp->get_name());
345  referableOutputPins[gp] = FunctionReference(g->get_boolean_function(gp));
346  ++unresolved;
347  }
348 
349  // replace input pins by C-Variable
350  for (const GatePin* gp : g->get_type()->get_input_pins())
351  {
352  QString pinNameIn = QString::fromStdString(gp->get_name());
353  const Net* nIn = g->get_fan_in_net(gp);
354  int inxIn = mExternalArrayIndex.value(nIn,-1);
355  if (inxIn < 0) return false;
356  QString ccVar = QString("logic_evaluator_signals[%1]").arg(inxIn);
357  for (auto it = referableOutputPins.begin(); it != referableOutputPins.end(); ++it)
358  it->replace(pinNameIn, ccVar);
359  }
360 
361  QString gateFunctions;
362 
363  // place and resolve outputs
364  int lastUnresolved = 0;
365  while (unresolved || lastUnresolved == unresolved)
366  {
367  lastUnresolved = unresolved;
368  for (auto it = referableOutputPins.begin(); it != referableOutputPins.end(); ++it)
369  {
370  if (!it->dependencies.isEmpty() || it->placed) continue;
371  const GatePin* gp = it.key();
372  const Net* nOut = g->get_fan_out_net(gp);
373  int inxOut = mExternalArrayIndex.value(nOut,-1);
374  if (inxOut < 0)
375  {
376  inxOut = mExternalArrayIndex.size();
377  mExternalArrayIndex[nOut] = inxOut;
378  }
379  QString pinNameOut = QString::fromStdString(gp->get_name());
380  QString ccVar = QString("logic_evaluator_signals[%1]").arg(inxOut);
381  for (auto jt = referableOutputPins.begin(); jt != referableOutputPins.end(); ++jt)
382  if (it != jt) jt->replace(pinNameOut, ccVar);
383  gateFunctions += QString(" %1 = %2;\n").arg(ccVar).arg(it->theFunction);
384  it->placed=true;
385  --unresolved;
386  }
387  }
388 
389  if (unresolved) return false;
390 
391  codeEvalFunction += gateFunctions;
392  }
393 
394  for (LogicEvaluatorPingroup* lepg : mOutputs)
395  {
396  int k = lepg->size();
397  for (int i=0; i<k; i++)
398  {
399  const Net* n = lepg->getValue(i).first;
400  int inx = mExternalArrayIndex.value(n,-1);
401  if (inx < 0) return false;
402  codeEvalFunction += QString(" // output[%1] - Net %2 <%3>;\n").arg(inx).arg(n->get_id()).arg(n->get_name().c_str());
403  }
404  }
405  QString ccode;
406  ccode += QString("int logic_evaluator_signals[%1];\n\n").arg(mExternalArrayIndex.size());
407  ccode += "void " + QString(LOGIC_EVALUATOR_SET);
408  ccode += "(int inx, int val) {\n"
409  " logic_evaluator_signals[inx] = val;\n"
410  "}\n\n";
411  ccode += "int " + QString(LOGIC_EVALUATOR_GET);
412  ccode += "(int inx) {\n"
413  " return logic_evaluator_signals[inx];\n"
414  "}\n\n";
415  ccode += "void " + QString(LOGIC_EVALUATOR_CALC);
416  ccode += "() {\n";
417  ccode += codeEvalFunction + "\n}\n";
418 
419  // write code to file
420  QTemporaryFile ftemp(QDir().temp().absoluteFilePath("logic_evaluator_shared_lib_XXXXXX.c"));
421  ftemp.setAutoRemove(true);
422  if (!ftemp.open())
423  return false;
424  mSharedLib.fnSharedLib = ftemp.fileName();
425  mSharedLib.fnSharedLib.replace(QRegularExpression("\.c$"), QString(".%1").arg(LIBRARY_FILE_EXTENSION));
426  ftemp.write(ccode.toUtf8());
427  ftemp.close();
428 
429  // compile code
430  QProcess proc(this);
431  QStringList args;
432  args << "-shared" << "-Wall" << "-Werror" << "-fpic" << "-o" << mSharedLib.fnSharedLib << ftemp.fileName();
433  if (proc.execute(COMPILER, args) < 0)
434  {
435  log_warning("logic_evaluator", "Failed to run compiler '{}', cannot compile logic.", COMPILER);
436  return false;
437  }
438  proc.waitForStarted();
439  proc.waitForFinished();
440 
441  if (proc.exitCode() || proc.exitStatus() != QProcess::NormalExit)
442  {
443  log_warning("logic_evaluator", "Failed to compile '{}', stdout: '{}', stderr: '{}", ftemp.fileName().toStdString(), proc.readAllStandardOutput().constData(), proc.readAllStandardError().constData());
444  return false;
445  }
446 
447  // load shared libraray
448 
449  mSharedLib.handle = dlopen(mSharedLib.fnSharedLib.toUtf8().constData(), RTLD_LAZY);
450  if (!mSharedLib.handle)
451  {
452  log_warning("logic_evaluator", "Failed to load shared library '{}' dlerror: '{}'.", mSharedLib.fnSharedLib.toStdString(), dlerror());
453  return false;
454  }
455 
456  // reset errors
457  dlerror();
458 
459  mSharedLib.get = (int(*)(int)) dlsym(mSharedLib.handle, LOGIC_EVALUATOR_GET);
460  const char* dlsymError = dlerror();
461  if (dlsymError) {
462  log_warning("logic_evaluator", "Cannot resolve symbol '{}' in shared library, dlerror: '{}'.", LOGIC_EVALUATOR_GET, dlsymError);
463  mSharedLib.close();
464  return false;
465  }
466 
467  mSharedLib.set = (void(*)(int,int)) dlsym(mSharedLib.handle, LOGIC_EVALUATOR_SET);
468  dlsymError = dlerror();
469  if (dlsymError) {
470  log_warning("logic_evaluator", "Cannot resolve symbol '{}' in shared library, dlerror: '{}'.", LOGIC_EVALUATOR_SET, dlsymError);
471  mSharedLib.close();
472  return false;
473  }
474 
475  mSharedLib.calc = (void(*)(void)) dlsym(mSharedLib.handle, LOGIC_EVALUATOR_CALC);
476  dlsymError = dlerror();
477  if (dlsymError) {
478  log_warning("logic_evaluator", "Cannot resolve symbol '{}' in shared library, dlerror: '{}'.", LOGIC_EVALUATOR_CALC, dlsymError);
479  mSharedLib.close();
480  return false;
481  }
482 
483  log_info("logic_evaluator", "Temporary shared library '{}' successfully build and loaded.", mSharedLib.fnSharedLib.toStdString());
484 
485  return true;
486  }
487 
489  {
490  mSignals.clear();
491  if (mActionCompile->isChecked() && mSharedLib.handle)
492  recalcCompiled();
493  else
494  recalcInterpreted();
495 
496  for (LogicEvaluatorPingroup* lepg : mOutputs)
497  {
498  int k = lepg->size();
499  for (int i=0; i<k; i++)
500  {
501  const Net* n = lepg->getValue(i).first;
502  lepg->setValue(n, mSignals.value(n, BooleanFunction::Value::X));
503  }
504  }
505 
506  if (mActionIndicate->isChecked())
507  visualizeResultsInNetlist();
508  }
509 
510  void LogicEvaluatorDialog::recalcCompiled()
511  {
512  for (const LogicEvaluatorPingroup* lepg : mInputs)
513  {
514  for (int i=0; i<lepg->size(); i++)
515  {
516  QPair<const Net*, BooleanFunction::Value> v = lepg->getValue(i);
517  const Net* n = v.first;
518  int inx = mExternalArrayIndex.value(n,-1);
519  if (inx < 0)
520  {
521  log_warning("logic_evaluator", "No shared library index for input net id={} '{}'.", n->get_id(), n->get_name());
522  return;
523  }
524  mSharedLib.set(inx, (int) v.second);
525  }
526  }
527 
528  mSharedLib.calc();
529 
530  for (auto it=mExternalArrayIndex.begin(); it!=mExternalArrayIndex.end(); ++it)
531  {
532  const Net* n = it.key();
533  int val = mSharedLib.get(it.value());
534  mSignals[n] = (BooleanFunction::Value) val;
535  }
536  }
537 
538  void LogicEvaluatorDialog::recalcInterpreted()
539  {
540  // get input signals
541  for (const LogicEvaluatorPingroup* lepg : mInputs)
542  {
543  for (int i=0; i<lepg->size(); i++)
544  {
545  QPair<const Net*, BooleanFunction::Value> v = lepg->getValue(i);
546  mSignals[v.first] = v.second;
547  }
548  }
549 
550  // propagate by gates
551  for (const Gate* g : mEvaluationOrder)
552  {
553  std::unordered_map<std::string, BooleanFunction::Value> gateSignals;
554  for (const GatePin* gp : g->get_type()->get_input_pins())
555  {
556  const Net* n = g->get_fan_in_net(gp);
557  gateSignals[gp->get_name()] = mSignals.value(n, BooleanFunction::Value::X);
558  }
559  for (const GatePin* gp : g->get_type()->get_output_pins())
560  {
561  const Net* n = g->get_fan_out_net(gp);
562  auto res = g->get_boolean_function(gp).evaluate(gateSignals);
563  if (res.is_ok())
564  mSignals[n] = res.get();
565  else
566  log_warning("logic_evaluator", "Failed to evaluate boolean function '{}'.", g->get_boolean_function(gp).to_string());
567  }
568  }
569  }
570 
571  void LogicEvaluatorDialog::calculateEvaluationOrder()
572  {
573  mEvaluationOrder.clear();
574  QHash<const Gate*, std::vector<Net*> > undeterminedInput;
575 
576  // setup hash, declare all inpus as undetermined;
577  for (const Gate* g: mSimulationInput->get_gates())
578  {
579  undeterminedInput.insert(g, g->get_fan_in_nets());
580  }
581 
582  std::unordered_set<const Net*> inputSignals = mSimulationInput->get_input_nets();
583 
584  int resolved = 1;
585  while (!undeterminedInput.isEmpty() && resolved)
586  {
587  resolved = 0;
588  std::unordered_set<const Net*> outputSignals;
589  auto it = undeterminedInput.begin();
590  while (it != undeterminedInput.end())
591  {
592  auto jt = it.value().begin();
593  while (jt != it.value().end())
594  {
595  if (inputSignals.find(*jt) == inputSignals.end())
596  ++jt;
597  else
598  jt = it.value().erase(jt);
599  }
600 
601  // has no more undetermined inputs ?
602  if (it.value().empty())
603  {
604  mEvaluationOrder.append(it.key());
605  for (const Net* n : it.key()->get_fan_out_nets())
606  outputSignals.insert(n);
607  it = undeterminedInput.erase(it);
608  ++resolved;
609  }
610  else
611  {
612  ++it;
613  }
614  }
615  inputSignals = outputSignals;
616  }
617  if (!undeterminedInput.isEmpty())
618  {
619  std::string leftover;
620  for (const Gate* g : undeterminedInput.keys())
621  leftover += " [" + std::to_string(g->get_id()) + ',' + g->get_name() + ']';
622  log_warning("logic_evaluator", "Cannot determine evaluation order, {} gate(s) left with undetermined input: {}.", undeterminedInput.size(), leftover);
623  }
624  }
625 
626  void LogicEvaluatorDialog::visualizeResultsInNetlist()
627  {
628  GroupingTableModel* gtm = gContentManager->getGroupingManagerWidget()->getModel();
629  const char* color[] = {"#707071", "#102080", "#802010" };
630  static const char* grpNames[3] = {"x state", "0 state", "1 state"};
631  Grouping* grp[3];
632  for (int i=0; i<3; i++)
633  {
634  grp[i] = gtm->groupingByName(grpNames[i]);
635  if (!grp[i])
636  {
637  grp[i] = gNetlist->create_grouping(grpNames[i]);
638  gtm->recolorGrouping(grp[i]->get_id(),QColor(color[i]));
639  }
640  }
641 
642  for (auto it = mSignals.constBegin(); it != mSignals.constEnd(); ++it)
643  {
644  int grpIndex = 1 + (int) it.value();
645  Q_ASSERT(grpIndex >= 0 && grpIndex <= 2);
646  grp[grpIndex]->assign_net(const_cast<Net*>(it.key()),true);
647  }
648  }
649 
650  void LogicEvaluatorDialog::omitNetlistVisualization()
651  {
652  GroupingTableModel* gtm = gContentManager->getGroupingManagerWidget()->getModel();
653  static const char* grpNames[3] = {"x state", "0 state", "1 state"};
654  for (int i=0; i<3; i++)
655  {
656  Grouping* grp = gtm->groupingByName(grpNames[i]);
657  if (grp) gNetlist->delete_grouping(grp);
658  }
659  }
660 
661 }
#define LIBRARY_FILE_EXTENSION
Definition: arch_linux.h:34
const std::string & get_name() const
Definition: base_pin.h:110
PinType get_type() const
Definition: base_pin.h:150
std::set< std::string > get_variable_names() const
Value
represents the type of the node
static std::string to_string(Value value)
GroupingManagerWidget * getGroupingManagerWidget()
Definition: gate.h:58
GroupingTableModel * getModel() const
Grouping * groupingByName(const QString &name) const
LogicEvaluatorDialog(const std::vector< Gate * > &gates, bool skipCompile, QWidget *parent=nullptr)
void addColumn(LogicEvaluatorTruthtableColumn *letc)
A model for displaying multiple netlist elements.
Definition: module_model.h:54
void populateFromGatelist(const std::vector< Gate * > &gates)
Definition: net.h:58
u32 get_id() const
Definition: net.cpp:88
const std::string & get_name() const
Definition: net.cpp:98
Grouping * create_grouping(const u32 grouping_id, const std::string &name="")
Definition: netlist.cpp:671
bool delete_grouping(Grouping *grouping)
Definition: netlist.cpp:681
const std::vector< NetGroup > & get_net_groups() const
const std::vector< const Net * > & get_output_nets() const
const std::unordered_set< const Net * > & get_input_nets() const
void add_gates(const std::vector< Gate * > &gates)
const std::unordered_set< const Gate * > & get_gates() const
#define log_info(channel,...)
Definition: log.h:70
#define log_warning(channel,...)
Definition: log.h:76
T replace(const T &str, const T &search, const T &replace)
Definition: utils.h:384
Definition: defines.h:45
const char * COMPILER
const char * LOGIC_EVALUATOR_CALC
ContentManager * gContentManager
Definition: plugin_gui.cpp:78
const char * LOGIC_EVALUATOR_SET
const char * LOGIC_EVALUATOR_GET
Netlist * gNetlist
Definition: gui_globals.h:69
void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy)
void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy)
void setCheckable(bool)
void setChecked(bool)
void toggled(bool checked)
void triggered(bool checked)
void addLayout(QLayout *layout, int stretch)
void addStretch(int stretch)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
void setSpacing(int spacing)
const char * constData() const const
bool remove()
virtual void close() override
T & value() const const
QHash::iterator begin()
QHash::iterator end()
QHash::iterator erase(QHash::iterator pos)
QHash::iterator insert(const Key &key, const T &value)
bool isEmpty() const const
QList< Key > keys() const const
int size() const const
qint64 write(const char *data, qint64 maxSize)
void setMenuBar(QWidget *widget)
void setSizeConstraint(QLayout::SizeConstraint)
void append(const T &value)
bool isEmpty() const const
int size() const const
QMap::iterator begin()
QMap::const_iterator constBegin() const const
QMap::const_iterator constEnd() const const
QMap::iterator end()
QAction * addAction(const QString &text)
QAction * addMenu(QMenu *menu)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
int execute(const QString &program, const QStringList &arguments)
int exitCode() const const
QProcess::ExitStatus exitStatus() const const
QByteArray readAllStandardError()
QByteArray readAllStandardOutput()
bool waitForFinished(int msecs)
bool waitForStarted(int msecs)
void setWidget(QWidget *widget)
void setWidgetResizable(bool resizable)
QSet::iterator end()
QSet::iterator erase(QSet::iterator pos)
QSet::iterator find(const T &value)
QSet::iterator insert(const T &value)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromStdString(const std::string &str)
QString & replace(int position, int n, QChar after)
int size() const const
std::string toStdString() const const
QByteArray toUtf8() const const
virtual void polish(QWidget *widget)
virtual void unpolish(QWidget *widget)
ScrollBarAlwaysOff
WA_DeleteOnClose
virtual QString fileName() const const override
void setAutoRemove(bool b)
void expandAll()
void setColumnWidth(int column, int width)
virtual void setModel(QAbstractItemModel *model) override
QWidget(QWidget *parent, Qt::WindowFlags f)
void adjustSize()
bool close()
void lower()
QRegion mask() const const
void setMinimumWidth(int minw)
void setAttribute(Qt::WidgetAttribute attribute, bool on)
void setSizePolicy(QSizePolicy)
QStyle * style() const const
void setWindowTitle(const QString &)