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(), QString::fromStdString(g->get_name())), mGate(g), mType(QString::fromStdString(g->get_type()->get_name()))
9  {
10  const GateType* gt = g->get_type();
11  for (const GatePin* input_pin : gt->get_input_pins())
12  {
13  const Net* n = g->get_fan_in_net(input_pin);
14  if (n)
15  {
16  mInputByNet.insert(n->get_id(), mInputPins.size());
17  }
18  else
19  {
21  }
22  mInputPins.append(QString::fromStdString(input_pin->get_name()));
23  }
24 
25  for (const GatePin* output_pin : gt->get_output_pins())
26  {
27  const Net* n = g->get_fan_out_net(output_pin);
28  if (n)
29  {
30  mOutputByNet.insert(n->get_id(), mOutputPins.size());
31  }
32  else
33  {
35  }
36  mOutputPins.append(QString::fromStdString(output_pin->get_name()));
37  }
38 
40  }
41 } // 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:41
QMultiHash< u32, int > mInputByNet
QMultiHash< u32, int > mOutputByNet
QString mNodeText[3]
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