HAL
netlist.cpp
Go to the documentation of this file.
2 
7 #include "hal_core/netlist/net.h"
10 
11 namespace hal
12 {
13  Netlist::Netlist(const GateLibrary* library) : m_gate_library(library)
14  {
15  m_event_handler = std::make_unique<EventHandler>();
16  m_manager = new NetlistInternalManager(this, m_event_handler.get());
17  m_netlist_id = 1;
18  m_next_gate_id = 1;
19  m_next_net_id = 1;
20  m_next_module_id = 1;
21  m_next_grouping_id = 1;
22  m_top_module = nullptr; // this triggers the internal manager to allow creation of a module without parent
23  m_top_module = create_module("top_module", nullptr);
24  }
25 
27  {
28  delete m_manager;
29  }
30 
31  bool Netlist::operator==(const Netlist& other) const
32  {
33  if (m_file_name != other.get_input_filename() || m_design_name != other.get_design_name() || m_device_name != other.get_device_name())
34  {
35  log_info("netlist", "the netlists with IDs {} and {} are not equal due to an unequal file name, design name, or device name.", m_netlist_id, other.get_id());
36  return false;
37  }
38 
39  if (m_gate_library != other.get_gate_library())
40  {
41  log_info("netlist", "the netlists with IDs {} and {} are not equal due to an unequal gate library.", m_netlist_id, other.get_id());
42  return false;
43  }
44 
45  if (m_gates.size() != other.get_gates().size() || m_nets.size() != other.get_nets().size() || m_modules.size() != other.get_modules().size())
46  {
47  log_info("netlist", "the netlists with IDs {} and {} are not equal due to an unequal number of gates, nets, or modules.", m_netlist_id, other.get_id());
48  return false;
49  }
50 
51  for (const Net* net : other.get_nets())
52  {
53  if (const auto it = m_nets_map.find(net->get_id()); it == m_nets_map.end() || *it->second != *net)
54  {
55  log_info("netlist", "the netlists with IDs {} and {} are not equal due to unequal nets.", m_netlist_id, other.get_id());
56  return false;
57  }
58  }
59 
60  // modules are checked recursively
61  if (*m_top_module != *other.get_top_module())
62  {
63  log_info("netlist", "the netlists with IDs {} and {} are not equal due to unequal modules.", m_netlist_id, other.get_id());
64  return false;
65  }
66 
67  return true;
68  }
69 
70  bool Netlist::operator!=(const Netlist& other) const
71  {
72  return !operator==(other);
73  }
74 
76  {
77  return m_netlist_id;
78  }
79 
80  void Netlist::set_id(const u32 id)
81  {
82  if (id != m_netlist_id)
83  {
84  auto old_id = m_netlist_id;
85  m_netlist_id = id;
86  m_event_handler->notify(NetlistEvent::event::id_changed, this, old_id);
87  }
88  }
89 
90  std::filesystem::path Netlist::get_input_filename() const
91  {
92  return m_file_name;
93  }
94 
95  void Netlist::set_input_filename(const std::filesystem::path& input_filename)
96  {
97  if (input_filename != m_file_name)
98  {
99  m_file_name = input_filename;
100  m_event_handler->notify(NetlistEvent::event::input_filename_changed, this);
101  }
102  }
103 
104  const std::string& Netlist::get_design_name() const
105  {
106  return m_design_name;
107  }
108 
109  void Netlist::set_design_name(const std::string& design_name)
110  {
111  if (design_name != m_design_name)
112  {
113  m_design_name = design_name;
114  m_event_handler->notify(NetlistEvent::event::design_name_changed, this);
115  }
116  }
117 
118  const std::string& Netlist::get_device_name() const
119  {
120  return m_device_name;
121  }
122 
123  void Netlist::set_device_name(const std::string& device_name)
124  {
125  if (device_name != m_device_name)
126  {
127  m_device_name = device_name;
128  m_event_handler->notify(NetlistEvent::event::device_name_changed, this);
129  }
130  }
131 
133  {
134  return m_gate_library;
135  }
136 
138  {
139  return m_event_handler.get();
140  }
141 
143  {
144  if (auto res = m_manager->copy_netlist(this); res.is_error())
145  {
146  return ERR(res.get_error());
147  }
148  else
149  {
150  return res;
151  }
152  }
153 
154  /*
155  * ################################################################
156  * gate functions
157  * ################################################################
158  */
159 
161  {
162  if (!m_free_gate_ids.empty())
163  {
164  return *(m_free_gate_ids.begin());
165  }
166  while (m_used_gate_ids.find(m_next_gate_id) != m_used_gate_ids.end())
167  {
168  m_next_gate_id++;
169  }
170  return m_next_gate_id;
171  }
172 
173  Gate* Netlist::create_gate(const u32 id, GateType* gt, const std::string& name, i32 x, i32 y)
174  {
175  return m_manager->create_gate(id, gt, name, x, y);
176  }
177 
178  Gate* Netlist::create_gate(GateType* gt, const std::string& name, i32 x, i32 y)
179  {
180  return create_gate(get_unique_gate_id(), gt, name, x, y);
181  }
182 
184  {
185  return m_manager->delete_gate(gate);
186  }
187 
188  bool Netlist::is_gate_in_netlist(const Gate* gate) const
189  {
190  return gate != nullptr && m_gates_set.find(gate) != m_gates_set.end();
191  }
192 
193  Gate* Netlist::get_gate_by_id(const u32 gate_id) const
194  {
195  if (auto it = m_gates_map.find(gate_id); it != m_gates_map.end())
196  {
197  return it->second.get();
198  }
199 
200  log_debug("netlist", "there is no gate with ID {} in the netlist with ID {}.", gate_id, m_netlist_id);
201  return nullptr;
202  }
203 
204  const std::vector<Gate*>& Netlist::get_gates() const
205  {
206  return m_gates;
207  }
208 
209  std::vector<Gate*> Netlist::get_gates(const std::function<bool(const Gate*)>& filter) const
210  {
211  if (!filter)
212  {
213  return m_gates;
214  }
215  std::vector<Gate*> res;
216  for (Gate* g : m_gates)
217  {
218  if (!filter(g))
219  {
220  continue;
221  }
222  res.push_back(g);
223  }
224 
225  return res;
226  }
227 
229  {
230  if (!is_gate_in_netlist(gate))
231  {
232  return false;
233  }
234  if (is_vcc_gate(gate))
235  {
236  log_debug("netlist", "gate '{}' with ID {} is already registered as global VCC gate in the netlist with ID {}.", gate->get_name(), gate->get_id(), m_netlist_id);
237  return true;
238  }
239  m_vcc_gates.push_back(gate);
240  m_event_handler->notify(NetlistEvent::event::marked_global_vcc, this, gate->get_id());
241  return true;
242  }
243 
245  {
246  if (!is_gate_in_netlist(gate))
247  {
248  return false;
249  }
250  if (is_gnd_gate(gate))
251  {
252  log_debug("netlist", "gate '{}' with ID {} is already registered as global GND gate in the netlist with ID {}.", gate->get_name(), gate->get_id(), m_netlist_id);
253  return true;
254  }
255  m_gnd_gates.push_back(gate);
256  m_event_handler->notify(NetlistEvent::event::marked_global_gnd, this, gate->get_id());
257  return true;
258  }
259 
261  {
262  if (!is_gate_in_netlist(gate))
263  {
264  return false;
265  }
266  auto it = std::find(m_vcc_gates.begin(), m_vcc_gates.end(), gate);
267  if (it == m_vcc_gates.end())
268  {
269  log_debug("netlist", "gate '{}' with ID {} is not registered as global VCC gate in the netlist with ID {}.", gate->get_name(), gate->get_id(), m_netlist_id);
270  return false;
271  }
272  m_vcc_gates.erase(it);
273  m_event_handler->notify(NetlistEvent::event::unmarked_global_vcc, this, gate->get_id());
274  return true;
275  }
276 
278  {
279  if (!is_gate_in_netlist(gate))
280  {
281  return false;
282  }
283  auto it = std::find(m_gnd_gates.begin(), m_gnd_gates.end(), gate);
284  if (it == m_gnd_gates.end())
285  {
286  log_debug("netlist", "gate '{}' with ID {} is not registered as global GND gate in the netlist with ID {}.", gate->get_name(), gate->get_id(), m_netlist_id);
287  return false;
288  }
289  m_gnd_gates.erase(it);
290  m_event_handler->notify(NetlistEvent::event::unmarked_global_gnd, this, gate->get_id());
291  return true;
292  }
293 
294  bool Netlist::is_vcc_gate(const Gate* gate) const
295  {
296  return (std::find(m_vcc_gates.begin(), m_vcc_gates.end(), gate) != m_vcc_gates.end());
297  }
298 
299  bool Netlist::is_gnd_gate(const Gate* gate) const
300  {
301  return (std::find(m_gnd_gates.begin(), m_gnd_gates.end(), gate) != m_gnd_gates.end());
302  }
303 
304  const std::vector<Gate*>& Netlist::get_vcc_gates() const
305  {
306  return m_vcc_gates;
307  }
308 
309  const std::vector<Gate*>& Netlist::get_gnd_gates() const
310  {
311  return m_gnd_gates;
312  }
313 
314  /*
315  * ################################################################
316  * net functions
317  * ################################################################
318  */
319 
321  {
322  if (!m_free_net_ids.empty())
323  {
324  return *(m_free_net_ids.begin());
325  }
326  while (m_used_net_ids.find(m_next_net_id) != m_used_net_ids.end())
327  {
328  m_next_net_id++;
329  }
330  return m_next_net_id;
331  }
332 
333  Net* Netlist::create_net(const u32 id, const std::string& name)
334  {
335  return m_manager->create_net(id, name);
336  }
337 
338  Net* Netlist::create_net(const std::string& name)
339  {
340  return m_manager->create_net(get_unique_net_id(), name);
341  }
342 
344  {
345  return m_manager->delete_net(n);
346  }
347 
348  bool Netlist::is_net_in_netlist(const Net* n) const
349  {
350  return n != nullptr && m_nets_set.find(n) != m_nets_set.end();
351  }
352 
354  {
355  if (auto it = m_nets_map.find(net_id); it != m_nets_map.end())
356  {
357  return it->second.get();
358  }
359 
360  log_debug("netlist", "there is no net with ID {} in the netlist with ID {}.", net_id, m_netlist_id);
361  return nullptr;
362  }
363 
364  const std::vector<Net*>& Netlist::get_nets() const
365  {
366  return m_nets;
367  }
368 
369  std::vector<Net*> Netlist::get_nets(const std::function<bool(const Net*)>& filter) const
370  {
371  if (!filter)
372  {
373  return m_nets;
374  }
375  std::vector<Net*> res;
376  for (auto net : m_nets)
377  {
378  if (!filter(net))
379  {
380  continue;
381  }
382  res.push_back(net);
383  }
384  return res;
385  }
386 
388  {
389  if (!is_net_in_netlist(n))
390  {
391  return false;
392  }
393  if (is_global_input_net(n))
394  {
395  log_debug("netlist", "net '{}' with ID {} is already registered as global input net in the netlist with ID {}.", n->get_name(), n->get_id(), m_netlist_id);
396  return true;
397  }
398  m_global_input_nets.push_back(n);
399 
400  // update internal nets and port nets
401  if (m_manager->m_net_checks_enabled)
402  {
403  for (Endpoint* ep : n->get_sources())
404  {
405  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
406  }
407  for (Endpoint* ep : n->get_destinations())
408  {
409  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
410  }
411  }
412 
413  m_event_handler->notify(NetlistEvent::event::marked_global_input, this, n->get_id());
414  return true;
415  }
416 
418  {
419  if (!is_net_in_netlist(n))
420  {
421  return false;
422  }
423  if (is_global_output_net(n))
424  {
425  log_debug("netlist", "net '{}' with ID {} is already registered as global output net in the netlist with ID {}.", n->get_name(), n->get_id(), m_netlist_id);
426  return true;
427  }
428  m_global_output_nets.push_back(n);
429 
430  // update internal nets and port nets
431  if (m_manager->m_net_checks_enabled)
432  {
433  for (Endpoint* ep : n->get_sources())
434  {
435  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
436  }
437  for (Endpoint* ep : n->get_destinations())
438  {
439  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
440  }
441  }
442 
443  m_event_handler->notify(NetlistEvent::event::marked_global_output, this, n->get_id());
444  return true;
445  }
446 
448  {
449  if (!is_net_in_netlist(n))
450  {
451  return false;
452  }
453  auto it = std::find(m_global_input_nets.begin(), m_global_input_nets.end(), n);
454  if (it == m_global_input_nets.end())
455  {
456  log_debug("netlist", "net '{}' with ID {} is not registered as global input net in the netlist with ID {}.", n->get_name(), n->get_id(), m_netlist_id);
457  return false;
458  }
459  m_global_input_nets.erase(it);
460 
461  // update internal nets and port nets
462  if (m_manager->m_net_checks_enabled)
463  {
464  for (Endpoint* ep : n->get_sources())
465  {
466  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
467  }
468  for (Endpoint* ep : n->get_destinations())
469  {
470  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
471  }
472  }
473 
474  m_event_handler->notify(NetlistEvent::event::unmarked_global_input, this, n->get_id());
475  return true;
476  }
477 
479  {
480  if (!is_net_in_netlist(n))
481  {
482  return false;
483  }
484  auto it = std::find(m_global_output_nets.begin(), m_global_output_nets.end(), n);
485  if (it == m_global_output_nets.end())
486  {
487  log_debug("netlist", "net '{}' with ID {} is not registered as global output net in the netlist with ID {}.", n->get_name(), n->get_id(), m_netlist_id);
488  return false;
489  }
490  m_global_output_nets.erase(it);
491 
492  // update internal nets and port nets
493  if (m_manager->m_net_checks_enabled)
494  {
495  for (Endpoint* ep : n->get_sources())
496  {
497  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
498  }
499  for (Endpoint* ep : n->get_destinations())
500  {
501  m_manager->module_check_net(ep->get_gate()->get_module(), n, true);
502  }
503  }
504 
505  m_event_handler->notify(NetlistEvent::event::unmarked_global_output, this, n->get_id());
506  return true;
507  }
508 
509  bool Netlist::is_global_input_net(const Net* n) const
510  {
511  return (std::find(m_global_input_nets.begin(), m_global_input_nets.end(), n) != m_global_input_nets.end());
512  }
513 
515  {
516  return (std::find(m_global_output_nets.begin(), m_global_output_nets.end(), n) != m_global_output_nets.end());
517  }
518 
519  const std::vector<Net*>& Netlist::get_global_input_nets() const
520  {
521  return m_global_input_nets;
522  }
523 
524  const std::vector<Net*>& Netlist::get_global_output_nets() const
525  {
526  return m_global_output_nets;
527  }
528 
529  std::vector<Net*> Netlist::get_gnd_nets() const
530  {
531  std::vector<Net*> gnd_nets;
532  for (const auto& gnd_gate : m_gnd_gates)
533  {
534  for (const auto& o_net : gnd_gate->get_fan_out_nets())
535  {
536  if (o_net->is_gnd_net())
537  {
538  gnd_nets.push_back(o_net);
539  }
540  }
541  }
542 
543  return gnd_nets;
544  }
545 
546  std::vector<Net*> Netlist::get_vcc_nets() const
547  {
548  std::vector<Net*> vcc_nets;
549  for (const auto& vcc_gate : m_vcc_gates)
550  {
551  for (const auto& o_net : vcc_gate->get_fan_out_nets())
552  {
553  if (o_net->is_vcc_net())
554  {
555  vcc_nets.push_back(o_net);
556  }
557  }
558  }
559 
560  return vcc_nets;
561  }
562 
563  void Netlist::enable_automatic_net_checks(bool enable_checks)
564  {
565  m_manager->m_net_checks_enabled = enable_checks;
566  }
567 
568  /*
569  * ################################################################
570  * module functions
571  * ################################################################
572  */
573 
575  {
576  if (!m_free_module_ids.empty())
577  {
578  return *(m_free_module_ids.begin());
579  }
580  while (m_used_module_ids.find(m_next_module_id) != m_used_module_ids.end())
581  {
582  m_next_module_id++;
583  }
584  return m_next_module_id;
585  }
586 
587  Module* Netlist::create_module(const u32 id, const std::string& name, Module* parent, const std::vector<Gate*>& gates)
588  {
589  auto m = m_manager->create_module(id, parent, name);
590  if (m == nullptr)
591  {
592  return nullptr;
593  }
594  m->assign_gates(gates);
595  return m;
596  }
597 
598  Module* Netlist::create_module(const std::string& name, Module* parent, const std::vector<Gate*>& gates)
599  {
600  return create_module(get_unique_module_id(), name, parent, gates);
601  }
602 
604  {
605  return m_manager->delete_module(module);
606  }
607 
609  {
610  return m_top_module;
611  }
612 
614  {
615  if (auto it = m_modules_map.find(id); it != m_modules_map.end())
616  {
617  return it->second.get();
618  }
619 
620  log_debug("netlist", "there is no module with ID {} in the netlist with ID {}.", id, m_netlist_id);
621  return nullptr;
622  }
623 
624  const std::vector<Module*>& Netlist::get_modules() const
625  {
626  return m_modules;
627  }
628 
629  std::vector<Module*> Netlist::get_modules(const std::function<bool(const Module*)>& filter) const
630  {
631  if (!filter)
632  {
633  return m_modules;
634  }
635  std::vector<Module*> res;
636  for (auto module : m_modules)
637  {
638  if (!filter(module))
639  {
640  continue;
641  }
642  res.push_back(module);
643  }
644  return res;
645  }
646 
648  {
649  return (module != nullptr) && (m_modules_set.find(module) != m_modules_set.end());
650  }
651 
652  /*
653  * ################################################################
654  * grouping functions
655  * ################################################################
656  */
657 
659  {
660  if (!m_free_grouping_ids.empty())
661  {
662  return *(m_free_grouping_ids.begin());
663  }
664  while (m_used_grouping_ids.find(m_next_grouping_id) != m_used_grouping_ids.end())
665  {
666  m_next_grouping_id++;
667  }
668  return m_next_grouping_id;
669  }
670 
671  Grouping* Netlist::create_grouping(const u32 id, const std::string& name)
672  {
673  return m_manager->create_grouping(id, name);
674  }
675 
677  {
678  return m_manager->create_grouping(get_unique_grouping_id(), name);
679  }
680 
682  {
683  return m_manager->delete_grouping(g);
684  }
685 
687  {
688  return n != nullptr && m_groupings_set.find(n) != m_groupings_set.end();
689  }
690 
692  {
693  if (auto it = m_groupings_map.find(grouping_id); it != m_groupings_map.end())
694  {
695  return it->second.get();
696  }
697 
698  log_debug("netlist", "there is no grouping with ID {} in the netlist with ID {}.", grouping_id, m_netlist_id);
699  return nullptr;
700  }
701 
702  const std::vector<Grouping*>& Netlist::get_groupings() const
703  {
704  return m_groupings;
705  }
706 
707  std::vector<Grouping*> Netlist::get_groupings(const std::function<bool(const Grouping*)>& filter) const
708  {
709  if (!filter)
710  {
711  return m_groupings;
712  }
713  std::vector<Grouping*> res;
714  for (auto grouping : m_groupings)
715  {
716  if (!filter(grouping))
717  {
718  continue;
719  }
720  res.push_back(grouping);
721  }
722  return res;
723  }
724 
725  /*
726  * ################################################################
727  * getter/setter for ID tracking
728  * ################################################################
729  */
730 
732  {
733  return m_next_gate_id;
734  }
735 
737  {
738  m_next_gate_id = id;
739  }
740 
741  std::set<u32> Netlist::get_used_gate_ids() const
742  {
743  return m_used_gate_ids;
744  }
745 
746  void Netlist::set_used_gate_ids(const std::set<u32> ids)
747  {
748  m_used_gate_ids = ids;
749  }
750 
751  std::set<u32> Netlist::get_free_gate_ids() const
752  {
753  return m_free_gate_ids;
754  }
755 
756  void Netlist::set_free_gate_ids(const std::set<u32> ids)
757  {
758  m_free_gate_ids = ids;
759  }
760 
762  {
763  return m_next_net_id;
764  }
765 
767  {
768  m_next_net_id = id;
769  }
770 
771  std::set<u32> Netlist::get_used_net_ids() const
772  {
773  return m_used_net_ids;
774  }
775 
776  void Netlist::set_used_net_ids(const std::set<u32> ids)
777  {
778  m_used_net_ids = ids;
779  }
780 
781  std::set<u32> Netlist::get_free_net_ids() const
782  {
783  return m_free_net_ids;
784  }
785 
786  void Netlist::set_free_net_ids(const std::set<u32> ids)
787  {
788  m_free_net_ids = ids;
789  }
790 
792  {
793  return m_next_module_id;
794  }
795 
797  {
798  m_next_module_id = id;
799  }
800 
801  std::set<u32> Netlist::get_used_module_ids() const
802  {
803  return m_used_module_ids;
804  }
805 
806  void Netlist::set_used_module_ids(const std::set<u32> ids)
807  {
808  m_used_module_ids = ids;
809  }
810 
811  std::set<u32> Netlist::get_free_module_ids() const
812  {
813  return m_free_module_ids;
814  }
815 
816  void Netlist::set_free_module_ids(const std::set<u32> ids)
817  {
818  m_free_module_ids = ids;
819  }
820 
822  {
823  return m_next_grouping_id;
824  }
825 
827  {
828  m_next_grouping_id = id;
829  }
830 
831  std::set<u32> Netlist::get_used_grouping_ids() const
832  {
833  return m_used_grouping_ids;
834  }
835 
836  void Netlist::set_used_grouping_ids(const std::set<u32> ids)
837  {
838  m_used_grouping_ids = ids;
839  }
840 
841  std::set<u32> Netlist::get_free_grouping_ids() const
842  {
843  return m_free_grouping_ids;
844  }
845 
846  void Netlist::set_free_grouping_ids(const std::set<u32> ids)
847  {
848  m_free_grouping_ids = ids;
849  }
850 
851  /*
852  * ################################################################
853  * utility functions
854  * ################################################################
855  */
856 
858  {
859  m_manager->clear_caches();
860  }
861 
862  bool Netlist::load_gate_locations_from_data(const std::string& data_category, const std::pair<std::string, std::string>& data_identifiers)
863  {
864  std::string category;
865  std::pair<std::string, std::string> identifiers;
866 
867  if (data_category.empty())
868  {
869  category = m_gate_library->get_gate_location_data_category();
870  identifiers = m_gate_library->get_gate_location_data_identifiers();
871  }
872  else
873  {
874  category = data_category;
875  identifiers = data_identifiers;
876  }
877 
878  u32 failed = 0;
879  for (Gate* gate : m_gates)
880  {
881  if (gate->has_data(category, identifiers.first))
882  {
883  try
884  {
885  i32 x_loc = std::stoi(std::get<1>(gate->get_data(category, identifiers.first)));
886  i32 y_loc = std::stoi(std::get<1>(gate->get_data(category, identifiers.second)));
887 
888  gate->set_location(std::make_pair(x_loc, y_loc));
889 
890  continue;
891  }
892  catch (const std::exception& e)
893  {
894  log_error("netlist", "{}", e.what());
895  return false;
896  }
897  }
898 
899  failed++;
900  }
901 
902  if (failed > 0)
903  {
904  log_warning("netlist", "failed to load locations of {} gates.", failed);
905  }
906 
907  return true;
908  }
909 
910 } // namespace hal
Definition: gate.h:58
const std::string & get_name() const
Definition: gate.cpp:105
u32 get_id() const
Definition: gate.cpp:95
const std::pair< std::string, std::string > & get_gate_location_data_identifiers() const
const std::string & get_gate_location_data_category() const
bool assign_gates(const std::vector< Gate * > &gates)
Definition: module.cpp:327
Definition: net.h:58
@ marked_global_gnd
associated_data = id of gate
@ unmarked_global_output
associated_data = id of net
@ id_changed
associated_data = old id
@ device_name_changed
no associated_data
@ unmarked_global_gnd
associated_data = id of gate
@ input_filename_changed
no associated_data
@ unmarked_global_vcc
associated_data = id of gate
@ marked_global_vcc
associated_data = id of gate
@ unmarked_global_input
associated_data = id of net
@ design_name_changed
no associated_data
@ marked_global_output
associated_data = id of net
@ marked_global_input
associated_data = id of net
bool operator!=(const Netlist &other) const
Definition: netlist.cpp:70
void set_input_filename(const std::filesystem::path &path)
Definition: netlist.cpp:95
Module * get_top_module() const
Definition: netlist.cpp:608
const std::vector< Gate * > & get_gates() const
Definition: netlist.cpp:204
std::vector< Net * > get_vcc_nets() const
Definition: netlist.cpp:546
u32 get_unique_gate_id()
Definition: netlist.cpp:160
bool mark_vcc_gate(Gate *gate)
Definition: netlist.cpp:228
const std::vector< Net * > & get_global_input_nets() const
Definition: netlist.cpp:519
bool mark_gnd_gate(Gate *gate)
Definition: netlist.cpp:244
void set_used_gate_ids(const std::set< u32 > ids)
Definition: netlist.cpp:746
u32 get_unique_grouping_id()
Definition: netlist.cpp:658
void set_used_net_ids(const std::set< u32 > ids)
Definition: netlist.cpp:776
Grouping * create_grouping(const u32 grouping_id, const std::string &name="")
Definition: netlist.cpp:671
bool is_gate_in_netlist(const Gate *gate) const
Definition: netlist.cpp:188
Gate * get_gate_by_id(const u32 gate_id) const
Definition: netlist.cpp:193
bool is_module_in_netlist(const Module *module) const
Definition: netlist.cpp:647
bool delete_grouping(Grouping *grouping)
Definition: netlist.cpp:681
bool load_gate_locations_from_data(const std::string &data_category="", const std::pair< std::string, std::string > &data_identifiers=std::pair< std::string, std::string >())
Definition: netlist.cpp:862
void set_free_grouping_ids(const std::set< u32 > ids)
Definition: netlist.cpp:846
std::set< u32 > get_free_module_ids() const
Definition: netlist.cpp:811
u32 get_unique_module_id()
Definition: netlist.cpp:574
bool delete_net(Net *net)
Definition: netlist.cpp:343
bool is_gnd_gate(const Gate *gate) const
Definition: netlist.cpp:299
Net * create_net(const u32 net_id, const std::string &name)
Definition: netlist.cpp:333
std::vector< Net * > get_gnd_nets() const
Definition: netlist.cpp:529
const std::vector< Gate * > & get_gnd_gates() const
Definition: netlist.cpp:309
std::set< u32 > get_used_net_ids() const
Definition: netlist.cpp:771
void set_next_gate_id(const u32 id)
Definition: netlist.cpp:736
void set_free_module_ids(const std::set< u32 > ids)
Definition: netlist.cpp:816
void set_design_name(const std::string &name)
Definition: netlist.cpp:109
std::set< u32 > get_free_gate_ids() const
Definition: netlist.cpp:751
void enable_automatic_net_checks(bool enable_checks=true)
Definition: netlist.cpp:563
std::set< u32 > get_used_grouping_ids() const
Definition: netlist.cpp:831
bool delete_module(Module *module)
Definition: netlist.cpp:603
const std::vector< Gate * > & get_vcc_gates() const
Definition: netlist.cpp:304
bool unmark_gnd_gate(Gate *gate)
Definition: netlist.cpp:277
friend class NetlistInternalManager
Definition: netlist.h:57
bool delete_gate(Gate *gate)
Definition: netlist.cpp:183
bool is_grouping_in_netlist(const Grouping *grouping) const
Definition: netlist.cpp:686
u32 get_next_net_id() const
Definition: netlist.cpp:761
bool operator==(const Netlist &other) const
Definition: netlist.cpp:31
u32 get_id() const
Definition: netlist.cpp:75
u32 get_next_module_id() const
Definition: netlist.cpp:791
Result< std::unique_ptr< Netlist > > copy() const
Definition: netlist.cpp:142
const std::vector< Module * > & get_modules() const
Definition: netlist.cpp:624
void set_id(const u32 id)
Definition: netlist.cpp:80
std::set< u32 > get_used_gate_ids() const
Definition: netlist.cpp:741
u32 get_unique_net_id()
Definition: netlist.cpp:320
bool unmark_vcc_gate(Gate *gate)
Definition: netlist.cpp:260
void set_free_net_ids(const std::set< u32 > ids)
Definition: netlist.cpp:786
const std::string & get_device_name() const
Definition: netlist.cpp:118
void clear_caches()
Definition: netlist.cpp:857
void set_next_module_id(const u32 id)
Definition: netlist.cpp:796
bool mark_global_input_net(Net *net)
Definition: netlist.cpp:387
bool is_net_in_netlist(const Net *net) const
Definition: netlist.cpp:348
std::set< u32 > get_used_module_ids() const
Definition: netlist.cpp:801
Module * get_module_by_id(u32 module_id) const
Definition: netlist.cpp:613
bool is_vcc_gate(const Gate *gate) const
Definition: netlist.cpp:294
Gate * create_gate(const u32 gate_id, GateType *gate_type, const std::string &name="", i32 x=-1, i32 y=-1)
Definition: netlist.cpp:173
void set_free_gate_ids(const std::set< u32 > ids)
Definition: netlist.cpp:756
bool mark_global_output_net(Net *net)
Definition: netlist.cpp:417
void set_next_grouping_id(const u32 id)
Definition: netlist.cpp:826
Net * get_net_by_id(u32 net_id) const
Definition: netlist.cpp:353
std::set< u32 > get_free_grouping_ids() const
Definition: netlist.cpp:841
void set_used_grouping_ids(const std::set< u32 > ids)
Definition: netlist.cpp:836
const std::string & get_design_name() const
Definition: netlist.cpp:104
const std::vector< Net * > & get_global_output_nets() const
Definition: netlist.cpp:524
const std::vector< Net * > & get_nets() const
Definition: netlist.cpp:364
bool unmark_global_output_net(Net *net)
Definition: netlist.cpp:478
void set_device_name(const std::string &name)
Definition: netlist.cpp:123
const std::vector< Grouping * > & get_groupings() const
Definition: netlist.cpp:702
bool is_global_input_net(const Net *net) const
Definition: netlist.cpp:509
void set_next_net_id(const u32 id)
Definition: netlist.cpp:766
void set_used_module_ids(const std::set< u32 > ids)
Definition: netlist.cpp:806
u32 get_next_grouping_id() const
Definition: netlist.cpp:821
u32 get_next_gate_id() const
Definition: netlist.cpp:731
std::filesystem::path get_input_filename() const
Definition: netlist.cpp:90
const GateLibrary * get_gate_library() const
Definition: netlist.cpp:132
Netlist(const GateLibrary *gate_library)
Definition: netlist.cpp:13
Grouping * get_grouping_by_id(u32 grouping_id) const
Definition: netlist.cpp:691
std::set< u32 > get_free_net_ids() const
Definition: netlist.cpp:781
EventHandler * get_event_handler() const
Definition: netlist.cpp:137
bool unmark_global_input_net(Net *net)
Definition: netlist.cpp:447
bool is_global_output_net(const Net *net) const
Definition: netlist.cpp:514
Module * create_module(const u32 module_id, const std::string &name, Module *parent, const std::vector< Gate * > &gates={})
Definition: netlist.cpp:587
int32_t i32
Definition: defines.h:36
#define log_error(channel,...)
Definition: log.h:78
#define log_debug(channel,...)
Definition: log.h:74
#define log_info(channel,...)
Definition: log.h:70
#define log_warning(channel,...)
Definition: log.h:76
#define ERR(message)
Definition: result.h:53
const Module * module(const Gate *g, const NodeBoxes &boxes)
n
Definition: test.py:6
quint32 u32
Net * net
std::string name
i32 id