HAL
graphics_gate.cpp
Go to the documentation of this file.
2 
4 #include "hal_core/netlist/net.h"
5 
6 namespace hal
7 {
8  GraphicsGate::GraphicsGate(Gate* g) : GraphicsNode(ItemType::Gate, g->get_id()), mGate(g), mType(QString::fromStdString(g->get_type()->get_name()))
9  {
10  QString textLines[3];
11  textLines[0] = QString::fromStdString(g->get_name());
12  const GateType* gt = g->get_type();
13  for (const GatePin* input_pin : gt->get_input_pins())
14  {
15  const Net* n = g->get_fan_in_net(input_pin);
16  if (n)
17  {
18  mInputByNet.insert(n->get_id(), mInputPins.size());
19  }
20  else
21  {
23  }
24  mInputPins.append(QString::fromStdString(input_pin->get_name()));
25  }
26 
27  for (const GatePin* output_pin : gt->get_output_pins())
28  {
29  const Net* n = g->get_fan_out_net(output_pin);
30  if (n)
31  {
32  mOutputByNet.insert(n->get_id(), mOutputPins.size());
33  }
34  else
35  {
37  }
38  mOutputPins.append(QString::fromStdString(output_pin->get_name()));
39  }
40 
41  textLines[1] = QString::fromStdString(gt->get_name());
42  setNodeText(textLines,true);
43  }
44 } // namespace hal
Definition: gate.h:58
std::vector< GatePin * > get_output_pins() const
Definition: gate_type.cpp:285
const std::string & get_name() const
Definition: gate_type.cpp:64
std::vector< GatePin * > get_input_pins() const
Definition: gate_type.cpp:269
QVector< QString > mOutputPins
Definition: graphics_gate.h:77
QVector< QString > mInputPins
Definition: graphics_gate.h:72
Abstract base class for nodes (e.g. gates, modules)
Definition: graphics_node.h:42
QMultiHash< u32, int > mInputByNet
QMultiHash< u32, int > mOutputByNet
void setNodeText(const QString *lines, bool init)
Definition: net.h:58
ItemType
The ItemType enum provides the enum type to classify graphic items into Modules, Gates or Nets....
Definition: gui_def.h:45
n
Definition: test.py:6
typename QHash< Key, T >::iterator insert(const Key &key, const T &value)
QString fromStdString(const std::string &str)
void append(const T &value)
int size() const const