PandA-2024.02
structural_objects.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
46 #ifndef STRUCTURAL_OBJECTS_HPP
47 #define STRUCTURAL_OBJECTS_HPP
48 
50 #include "config_HAVE_TECHNOLOGY_BUILT.hpp"
51 
52 #include "NP_functionality.hpp"
53 #include "custom_map.hpp"
54 #include "exceptions.hpp"
55 #include "refcount.hpp"
56 #include "simple_indent.hpp"
57 
58 #include <boost/preprocessor/seq/for_each.hpp>
59 #include <ostream>
60 #include <string>
61 #include <utility>
62 #include <vector>
63 
78 class xml_element;
79 class simple_indent;
80 
82 
83 #define HIERARCHY_SEPARATOR "/"
84 
85 #define MEMORY_PARAMETER "MEMORY_PARAMETER"
86 #define PIPE_PARAMETER "PIPE_PARAMETER"
87 #define VALUE_PARAMETER "VALUE_PARAMETER"
88 
90 #define CLOCK_PORT_NAME "clock"
91 #define WENABLE_PORT_NAME "wenable"
92 #define START_PORT_NAME "start_port"
93 #define RESET_PORT_NAME "reset"
94 #define DONE_PORT_NAME "done_port"
95 #define RETURN_PORT_NAME "return_port"
96 #define START_PORT_NAME_CFC "start_port_CFC"
97 #define DONE_PORT_NAME_CFC "done_port_CFC"
98 #define MOUT_OE_PORT_NAME "Mout_oe_ram"
99 #define MOUT_BACK_PRESSURE_PORT_NAME "Mout_back_pressure"
100 #define PRESENT_STATE_PORT_NAME "present_state"
101 #define NEXT_STATE_PORT_NAME "next_state"
102 #define NOTIFIER_PORT_MISMATCH "out_mismatch"
103 #define NOTIFIER_PORT_MISMATCH_ID "out_mismatch_id"
104 #define NOTIFIER_PORT_MISMATCH_OFFSET "out_mismatch_trace_offset"
105 #define SELECTOR_REGISTER_FILE "selector_register_file"
106 #define SUSPENSION "suspension"
107 #define REQUEST_ACCEPTED "request_accepted"
108 #define TASKS_POOL_END "task_pool_end"
109 #define DONE_SCHEDULER "done_scheduler"
110 #define DONE_REQUEST "done_request"
111 #define PROXY_PREFIX "PROXY_PREF_"
112 #define WRAPPED_PROXY_PREFIX "WRAPPED_PROXY_PREF_"
113 
117 #define GET_SO_KIND_TEXT(meth) \
118  std::string get_kind_text() const override \
119  { \
120  return std::string(#meth); \
121  }
122 
131 {
133  enum s_type
134  {
135  OTHER = 0,
147  };
148 
151 
153  unsigned long long size;
154 
156  unsigned long long vector_size;
157 
159  std::string id_type;
160 
162  unsigned int treenode;
163 
168  : type(UNKNOWN), size(size_DEFAULT), vector_size(vector_size_DEFAULT), treenode(treenode_DEFAULT)
169  {
170  }
171 
179  structural_type_descriptor(const std::string& type_name, unsigned long long vector_size);
180 
185  explicit structural_type_descriptor(const std::string& module_name)
186  : type(OTHER),
187  size(size_DEFAULT),
188  vector_size(vector_size_DEFAULT),
189  id_type(module_name),
190  treenode(treenode_DEFAULT)
191  {
192  }
193 
199  structural_type_descriptor(unsigned int index, const BehavioralHelperConstRef helper);
200 
204  ~structural_type_descriptor() = default;
205 
212 
216  const std::string get_name() const;
217 
225 
231  void xload(const xml_element* Enode, structural_type_descriptorRef owner);
232 
237  void xwrite(xml_element* rootnode);
238 
243  void print(std::ostream& os) const;
244 
248  std::string get_kind_text() const
249  {
250  return std::string("structural_type_descriptor");
251  }
252 
256  friend std::ostream& operator<<(std::ostream& os, const structural_type_descriptorRef o)
257  {
258  if(o)
259  {
260  o->print(os);
261  }
262  return os;
263  }
264 
265  private:
270  static const s_type type_DEFAULT = OTHER;
271  static const unsigned int treenode_DEFAULT = 0;
272  static const unsigned int size_DEFAULT = 0;
273  static const unsigned int vector_size_DEFAULT = 0;
275  static const char* s_typeNames[];
277 };
278 
282 #define GET_TYPE_NAME(structural_obj) ((structural_obj)->get_typeRef()->id_type)
283 
287 #define GET_TYPE_SIZE(structural_obj) \
288  ((structural_obj)->get_typeRef()->vector_size ? \
289  ((structural_obj)->get_typeRef()->vector_size * (structural_obj)->get_typeRef()->size) : \
290  (structural_obj)->get_typeRef()->size)
291 
295 #define STD_GET_SIZE(structural_obj) \
296  ((structural_obj)->vector_size ? ((structural_obj)->vector_size * (structural_obj)->size) : (structural_obj)->size)
297 
302 
308 {
320 };
321 
325 #define GET_SO_KIND(meth) \
326  enum so_kind get_kind() const override \
327  { \
328  return (meth##_K); \
329  }
330 
336 {
339 
341  std::string id;
342 
345 
347  unsigned int treenode;
348 
350  bool black_box;
351 
354 
357 
358  protected:
360 
363 
367  std::string convert_so_short(so_kind in) const;
370 
371 #if HAVE_TECHNOLOGY_BUILT
372  std::vector<std::string> attribute_list;
373 
374  std::map<std::string, attributeRef> attributes;
375 #endif
376 
377  public:
382  structural_object(int debug_level, const structural_objectRef o);
383 
385  virtual ~structural_object() = default;
386 
390  const structural_objectRef get_owner() const;
391 
396  void set_owner(const structural_objectRef new_owner);
397 
402  void set_treenode(unsigned int n);
403 
407  unsigned int get_treenode() const;
408 
413  void set_id(const std::string& s);
414 
418  const std::string& get_id() const;
419 
424  void set_type(const structural_type_descriptorRef& s);
425 
429  const structural_type_descriptorRef& get_typeRef() const;
430 
434  void type_resize(unsigned long long new_bit_size);
435 
439  void type_resize(unsigned long long new_bit_size, unsigned long long new_vec_size);
445  void set_black_box(bool bb);
446 
450  bool get_black_box() const;
451 
457  void SetParameter(const std::string& name, const std::string& value);
458 
463  bool ExistsParameter(std::string name) const;
464 
470  std::string GetParameter(std::string name) const;
471 
478  std::string GetDefaultParameter(std::string name) const;
479 
484  CustomMap<std::string, std::string> GetParameters() const;
485 
491  virtual void AddParameter(const std::string& name, const std::string& default_value);
492 
499  const std::string get_path() const;
500 
505  virtual void copy(structural_objectRef dest) const;
506 
513  virtual structural_objectRef find_member(const std::string& id, so_kind type,
514  const structural_objectRef owner) const = 0;
515 
520  virtual structural_objectRef find_isomorphic(const structural_objectRef key) const = 0;
521 
528  virtual void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM);
529 
534  virtual void xwrite(xml_element* Enode);
535 
536 #if HAVE_TECHNOLOGY_BUILT
537 
541  virtual void xwrite_attributes(xml_element* rootnode, const technology_nodeRef& tn = technology_nodeRef());
542 #endif
543 
548  virtual void print(std::ostream& os) const;
549 
553  friend std::ostream& operator<<(std::ostream& os, const structural_objectRef o)
554  {
555  if(o)
556  {
557  o->print(os);
558  }
559  return os;
560  }
561 
567  virtual std::string get_kind_text() const = 0;
573  virtual enum so_kind get_kind() const = 0;
574 
575 #if HAVE_TECHNOLOGY_BUILT
576  void add_attribute(const std::string& name, const attributeRef& attribute);
577 
578  attributeRef get_attribute(const std::string& name) const;
579 
580  const std::vector<std::string>& get_attribute_list() const;
581 #endif
582 
583  private:
588  static const unsigned int treenode_DEFAULT = 0;
589  static const bool black_box_DEFAULT = true;
591 };
592 
597 
598 #define ENUM_ID(r, data, elem) elem,
599 #define PORT_INTERFACE_ENUM \
600  (PI_RNONE)(PI_WNONE)(PI_RACK)(PI_WACK)(PI_RVALID)(PI_WVALID)(PI_EMPTY_N)(PI_READ)(PI_FULL_N)(PI_WRITE)(PI_FDIN)( \
601  PI_FDOUT)(PI_ADDRESS)(PI_CHIPENABLE)(PI_WRITEENABLE)(PI_DIN)(PI_DOUT)(PI_M_AXI_OFF)(PI_M_AXI_DIRECT)( \
602  M_AXI_AWVALID)(M_AXI_AWREADY)(M_AXI_AWADDR)(M_AXI_AWID)(M_AXI_AWLEN)(M_AXI_AWSIZE)(M_AXI_AWBURST)( \
603  M_AXI_AWLOCK)(M_AXI_AWCACHE)(M_AXI_AWPROT)(M_AXI_AWQOS)(M_AXI_AWREGION)(M_AXI_AWUSER)(M_AXI_WVALID)( \
604  M_AXI_WREADY)(M_AXI_WDATA)(M_AXI_WSTRB)(M_AXI_WLAST)(M_AXI_WID)(M_AXI_WUSER)(M_AXI_ARVALID)(M_AXI_ARREADY)( \
605  M_AXI_ARADDR)(M_AXI_ARID)(M_AXI_ARLEN)(M_AXI_ARSIZE)(M_AXI_ARBURST)(M_AXI_ARLOCK)(M_AXI_ARCACHE)(M_AXI_ARPROT)( \
606  M_AXI_ARQOS)(M_AXI_ARREGION)(M_AXI_ARUSER)(M_AXI_RVALID)(M_AXI_RREADY)(M_AXI_RDATA)(M_AXI_RLAST)(M_AXI_RID)( \
607  M_AXI_RUSER)(M_AXI_RRESP)(M_AXI_BVALID)(M_AXI_BREADY)(M_AXI_BRESP)(M_AXI_BID)(M_AXI_BUSER)(S_AXIL_AWVALID)( \
608  S_AXIL_AWREADY)(S_AXIL_AWADDR)(S_AXIL_WVALID)(S_AXIL_WREADY)(S_AXIL_WDATA)(S_AXIL_WSTRB)(S_AXIL_ARVALID)( \
609  S_AXIL_ARREADY)(S_AXIL_ARADDR)(S_AXIL_RVALID)(S_AXIL_RREADY)(S_AXIL_RDATA)(S_AXIL_RRESP)(S_AXIL_BVALID)( \
610  S_AXIL_BREADY)(S_AXIL_BRESP)(PI_S_AXIS_TVALID)(PI_S_AXIS_TREADY)(PI_S_AXIS_TDATA)(PI_M_AXIS_TVALID)( \
611  PI_M_AXIS_TREADY)(PI_M_AXIS_TDATA)(PI_DEFAULT)
612 
613 #define PORT_DIRECTION_ENUM (IN)(OUT)(IO)(GEN)(UNKNOWN)(TLM_IN)(TLM_OUT)(TLM_INOUT)
614 
622 struct port_o : public structural_object
623 {
624  public:
627  {
629  };
630 
631  static std::string GetString(enum port_direction);
632 
635  {
636  LITTLE = 0,
639  };
640 
642  enum port_interface : int
643  {
645  };
646 
647  static std::string GetString(enum port_interface);
648 
649  static const unsigned int PARAMETRIC_PORT = static_cast<unsigned int>(-1);
650 
655  static port_direction to_port_direction(const std::string& val);
656 
661  static port_interface to_port_interface(const std::string& val);
662 
668  port_o(int debug_level, const structural_objectRef o, port_direction dir, so_kind _port_type);
669 
671  ~port_o() override = default;
672 
674  std::string size_parameter;
675 
680  void add_connection(structural_objectRef s);
681 
686  void remove_connection(structural_objectRef s);
687 
688  bool is_connected(structural_objectRef s) const;
689 
690  void substitute_connection(structural_objectRef old_conn, structural_objectRef new_conn);
691 
696  const structural_objectRef get_connection(unsigned int n) const;
697 
701  unsigned int get_connections_size() const;
702 
706  port_direction get_port_direction() const;
707 
711  void set_port_direction(port_direction dir);
712 
716  port_endianess get_port_endianess() const;
717 
721  void set_port_endianess(port_endianess end);
722 
726  port_interface get_port_interface() const;
727 
731  void set_port_interface(port_interface pi);
732 
736  unsigned int get_port_alignment() const;
737 
741  void set_port_alignment(unsigned int algn);
742 
746  structural_objectRef get_connected_signal() const;
747 
752  void set_port_size(unsigned int dim);
753 
758  unsigned long long get_port_size() const;
759 
764  void set_is_var_args(bool c);
768  bool get_is_var_args() const;
769 
774  void set_is_clock(bool c);
778  bool get_is_clock() const;
779 
784  void set_is_extern(bool c);
788  bool get_is_extern() const;
789 
793  void set_bus_bundle(const std::string& name);
794 
798  std::string get_bus_bundle() const;
799 
804  void set_is_global(bool c);
808  bool get_is_global() const;
809 
814  void set_is_memory(bool c);
818  bool get_is_memory() const;
819 
824  void set_is_slave(bool c);
828  bool get_is_slave() const;
829 
834  void set_is_master(bool c);
838  bool get_is_master() const;
839 
844  void set_is_data_bus(bool c);
845 
849  bool get_is_data_bus() const;
850 
855  void set_is_addr_bus(bool c);
856 
860  bool get_is_addr_bus() const;
861 
866  void set_is_size_bus(bool c);
867 
871  bool get_is_size_bus() const;
872 
877  void set_is_tag_bus(bool c);
878 
882  bool get_is_tag_bus() const;
883 
888  void set_is_doubled(bool c);
889 
893  bool get_is_doubled() const;
894 
899  void set_is_halved(bool c);
900 
904  bool get_is_halved() const;
905 
911  find_bounded_object(const structural_objectConstRef f_owner = structural_objectConstRef()) const;
912 
916  void set_critical();
917 
921  bool get_critical() const;
922 
926  void set_reverse();
927 
931  bool get_reverse() const;
932 
937  void copy(structural_objectRef dest) const override;
938 
945  structural_objectRef find_member(const std::string& id, so_kind type,
946  const structural_objectRef owner) const override;
947 
952  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
953 
960  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
961 
966  void xwrite(xml_element* rootnode) override;
967 
968 #if HAVE_TECHNOLOGY_BUILT
969 
973  void xwrite_attributes(xml_element* rootnode, const technology_nodeRef& tn = technology_nodeRef()) override;
974 #endif
975 
983  void add_n_ports(unsigned int n_ports, structural_objectRef owner);
984 
989  const structural_objectRef get_port(unsigned int n) const;
990 
994  unsigned int get_ports_size() const;
995 
999  unsigned int get_lsb() const
1000  {
1001  return lsb;
1002  }
1003 
1013  static bool resize_if_busport(unsigned long long bus_size_bitsize, unsigned long long bus_addr_bitsize,
1014  unsigned long long bus_data_bitsize, unsigned long long bus_tag_bitsize,
1015  structural_objectRef port);
1016 
1024  static void resize_std_port(unsigned long long bitsize_variable, unsigned long long n_elements, int debug_level,
1025  structural_objectRef port);
1026 
1032  static void fix_port_properties(structural_objectRef port_i, structural_objectRef cir_port);
1033 
1038  void print(std::ostream& os) const override;
1039 
1043  std::string get_kind_text() const override
1044  {
1045  if(port_type == port_vector_o_K)
1046  {
1047  return "port_vector_o";
1048  }
1049  else
1050  {
1051  return "port_o";
1052  }
1053  }
1057  enum so_kind get_kind() const override
1058  {
1059  return port_type;
1060  }
1061 
1062  private:
1064  std::vector<Wrefcount<structural_object>> connected_objects;
1065 
1068 
1071 
1074 
1075  unsigned int aligment;
1076 
1079 
1081  bool is_clock;
1082 
1085 
1088 
1091 
1094 
1096  bool is_slave;
1097 
1100 
1103 
1106 
1109 
1112 
1115 
1118 
1121 
1123  std::string bus_bundle;
1124 
1126  unsigned int lsb;
1127 
1129  std::vector<structural_objectRef> ports;
1130 
1133 
1138  static const bool is_clock_DEFAULT = false;
1139  static const bool is_extern_DEFAULT = false;
1140  static const bool is_global_DEFAULT = false;
1141  static const bool is_memory_DEFAULT = false;
1142  static const bool is_slave_DEFAULT = false;
1143  static const bool is_master_DEFAULT = false;
1144  static const bool is_data_bus_DEFAULT = false;
1145  static const bool is_addr_bus_DEFAULT = false;
1146  static const bool is_tag_bus_DEFAULT = false;
1147  static const bool is_size_bus_DEFAULT = false;
1148  static const bool is_doubled_DEFAULT = false;
1149  static const bool is_halved_DEFAULT = false;
1150  static const bool is_critical_DEFAULT = false;
1151  static const bool is_reverse_DEFAULT = false;
1152  static const bool is_var_args_DEFAULT = false;
1153  static const unsigned port_interface_alignment_DEFAULT = 0;
1155 };
1156 
1161 {
1162  public:
1167  event_o(int debug_level, const structural_objectRef o);
1168 
1170  ~event_o() override = default;
1171 
1176  void copy(structural_objectRef dest) const override;
1177 
1185  structural_objectRef find_member(const std::string& id, so_kind type,
1186  const structural_objectRef owner) const override;
1187 
1192  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
1193 
1200  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
1201 
1206  void xwrite(xml_element* rootnode) override;
1207 
1212  void print(std::ostream& os) const override;
1213 
1222 };
1223 
1228 {
1229  public:
1234  data_o(int debug_level, const structural_objectRef o);
1235 
1237  ~data_o() override = default;
1238 
1243  void copy(structural_objectRef dest) const override;
1244 
1252  structural_objectRef find_member(const std::string& id, so_kind type,
1253  const structural_objectRef owner) const override;
1254 
1259  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
1260 
1267  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
1268 
1273  void xwrite(xml_element* rootnode) override;
1274 
1279  void print(std::ostream& os) const override;
1280 
1289 };
1290 
1296 {
1297  public:
1302  {
1303  THREAD = 0,
1308  };
1309 
1310  private:
1312  std::vector<structural_objectRef> parameters;
1313 
1315  unsigned int function_id;
1316 
1319 
1321  std::vector<structural_objectRef> action_sensitivity;
1322 
1324  std::string scope;
1325 
1326  public:
1331  action_o(int debug_level, const structural_objectRef o);
1332 
1334  ~action_o() override = default;
1335 
1340  void add_parameter(structural_objectRef d);
1341 
1346  const structural_objectRef get_parameter(unsigned int n) const;
1347 
1351  unsigned int get_parameters_size() const;
1352 
1357  void set_fun_id(unsigned int id);
1358 
1363  unsigned int get_fun_id() const;
1364 
1369  void set_action_type(process_type at);
1370 
1374  process_type get_action_type() const;
1375 
1380  void add_event_to_sensitivity(structural_objectRef e);
1381 
1385  unsigned int get_sensitivity_size() const;
1386 
1391  const structural_objectRef get_sensitivity(unsigned int n) const;
1392 
1397  void set_scope(const std::string& sc);
1398 
1402  const std::string& get_scope() const;
1403 
1407  bool get_process_nservice() const;
1408 
1413  void copy(structural_objectRef dest) const override;
1414 
1421  structural_objectRef find_member(const std::string& id, so_kind type,
1422  const structural_objectRef owner) const override;
1423 
1428  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
1429 
1436  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
1437 
1442  void xwrite(xml_element* rootnode) override;
1443 
1448  void print(std::ostream& os) const override;
1449 
1458 
1459  private:
1461  static const char* process_typeNames[];
1462 };
1463 
1469 {
1471  std::string value;
1472 
1474  std::vector<Wrefcount<structural_object>> connected_objects;
1475 
1476  public:
1481  constant_o(int debug_level, const structural_objectRef o);
1482 
1488  constant_o(int debug_level, const structural_objectRef o, std::string value);
1489 
1491  ~constant_o() override = default;
1492 
1497  void add_connection(structural_objectRef p);
1498 
1503  structural_objectRef get_connection(unsigned int idx) const;
1504 
1508  unsigned int get_connected_objects_size() const;
1509 
1513  unsigned long long get_size() const;
1514 
1518  std::string get_value() const;
1519 
1524  void copy(structural_objectRef dest) const override;
1525 
1532  structural_objectRef find_member(const std::string& id, so_kind type,
1533  const structural_objectRef owner) const override;
1534 
1539  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
1540 
1547  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
1548 
1553  void xwrite(xml_element* rootnode) override;
1554 
1559  void print(std::ostream& os) const override;
1560 
1569 };
1570 
1577 {
1578  public:
1579  static const unsigned int PARAMETRIC_SIGNAL = static_cast<unsigned int>(-1);
1580 
1585  signal_o(int debug_level, const structural_objectRef o, so_kind _signal_type);
1586 
1588  ~signal_o() override = default;
1589 
1594  void add_port(structural_objectRef p);
1595 
1600  void remove_port(structural_objectRef s);
1601 
1602  bool is_connected(structural_objectRef s) const;
1603 
1604  void substitute_port(structural_objectRef old_conn, structural_objectRef new_conn);
1605 
1609  void set_critical();
1610 
1614  bool get_critical() const;
1615 
1620  const structural_objectRef get_port(unsigned int n) const;
1621 
1626  structural_objectRef get_port(unsigned int n);
1627 
1631  unsigned int get_connected_objects_size() const;
1632 
1637  bool is_full_connected() const;
1638 
1646  void add_n_signals(unsigned int n_signals, structural_objectRef owner);
1647 
1652  const structural_objectRef get_signal(unsigned int n) const;
1653 
1658  const structural_objectRef get_positional_signal(unsigned int n) const;
1659 
1663  unsigned int get_signals_size() const;
1664 
1668  unsigned int get_lsb() const
1669  {
1670  return lsb;
1671  }
1672 
1677  void copy(structural_objectRef dest) const override;
1678 
1685  structural_objectRef find_member(const std::string& id, so_kind type,
1686  const structural_objectRef owner) const override;
1687 
1692  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
1693 
1700  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
1701 
1706  void xwrite(xml_element* rootnode) override;
1707 
1712  void print(std::ostream& os) const override;
1713 
1717  std::string get_kind_text() const override
1718  {
1719  if(signal_type == signal_vector_o_K)
1720  {
1721  return "signal_vector_o";
1722  }
1723  else
1724  {
1725  return "signal_o";
1726  }
1727  }
1731  enum so_kind get_kind() const override
1732  {
1733  return signal_type;
1734  }
1735 
1736  private:
1738  std::vector<Wrefcount<structural_object>> connected_objects;
1739 
1742 
1744  std::vector<structural_objectRef> signals_;
1745 
1746  unsigned int lsb;
1747 
1750 };
1751 
1758 {
1760  std::vector<structural_objectRef> in_ports;
1761 
1763  std::vector<structural_objectRef> out_ports;
1764 
1766  std::vector<structural_objectRef> in_out_ports;
1767 
1769  std::vector<structural_objectRef> gen_ports;
1770 
1772  std::vector<structural_objectRef> internal_objects;
1773 
1775  std::vector<structural_objectRef> local_data;
1776 
1778  std::vector<structural_objectRef> list_of_event;
1779 
1781  std::vector<structural_objectRef> list_of_process;
1782 
1784  std::vector<structural_objectRef> list_of_service;
1785 
1788 
1790  unsigned int last_position_port;
1791 
1794 
1797 
1799  std::map<unsigned int, structural_objectRef> positional_map;
1800 
1803  std::map<std::string, structural_objectRef> index_signals;
1804 
1807  std::map<std::string, structural_objectRef> index_constants;
1808 
1811  std::map<std::string, structural_objectRef> index_components;
1812 
1815  std::map<std::string, structural_objectRef> index_channels;
1816 
1819  std::map<std::string, structural_objectRef> index_bus_connections;
1820 
1822  std::string description;
1823 
1825  std::string copyright;
1826 
1828  std::string authors;
1829 
1831  std::string license;
1832 
1834  std::string specialized;
1835 
1838 
1841 
1842  public:
1847  module(int debug_level, const structural_objectRef o);
1848 
1850  ~module() override = default;
1851 
1855  unsigned int get_num_ports() const;
1856 
1861  structural_objectRef get_positional_port(unsigned int index) const;
1862 
1867  void add_in_port(structural_objectRef p);
1868 
1873  const structural_objectRef get_in_port(unsigned int n) const;
1874 
1878  unsigned int get_in_port_size() const;
1879 
1884  void add_out_port(structural_objectRef p);
1885 
1890  const structural_objectRef get_out_port(unsigned int n) const;
1891 
1895  unsigned int get_out_port_size() const;
1896 
1901  void add_in_out_port(structural_objectRef p);
1902 
1907  const structural_objectRef get_in_out_port(unsigned int n) const;
1908 
1912  unsigned int get_in_out_port_size() const;
1913 
1918  void add_gen_port(structural_objectRef p);
1919 
1924  const structural_objectRef get_gen_port(unsigned int n) const;
1925 
1929  unsigned int get_gen_port_size() const;
1930 
1935  void remove_port(const std::string& id);
1936 
1941  void add_internal_object(structural_objectRef c);
1942 
1943  void remove_internal_object(structural_objectRef s);
1944 
1949  const structural_objectRef get_internal_object(unsigned int n) const;
1950 
1954  unsigned int get_internal_objects_size() const;
1955 
1960  void add_process(structural_objectRef p);
1961 
1966  const structural_objectRef get_process(unsigned int n) const;
1967 
1971  unsigned int get_process_size() const;
1972 
1977  void add_service(structural_objectRef p);
1978 
1983  const structural_objectRef get_service(unsigned int n) const;
1984 
1988  unsigned int get_service_size() const;
1989 
1994  void add_event(structural_objectRef e);
1995 
2000  const structural_objectRef get_event(unsigned int n) const;
2001 
2005  unsigned int get_event_size() const;
2006 
2011  void add_local_data(structural_objectRef d);
2012 
2017  const structural_objectRef get_local_data(unsigned int n) const;
2018 
2022  unsigned int get_local_data_size() const;
2023 
2028  void set_NP_functionality(NP_functionalityRef f);
2029 
2033  const NP_functionalityRef& get_NP_functionality() const;
2034 
2040  void get_NP_library_parameters(structural_objectRef owner,
2041  std::vector<std::pair<std::string, structural_objectRef>>& parameters) const;
2042 
2047  void copy(structural_objectRef dest) const override;
2048 
2055  structural_objectRef find_member(const std::string& id, so_kind type,
2056  const structural_objectRef owner) const override;
2057 
2062  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
2063 
2070  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override = 0;
2071 
2072 #if HAVE_TECHNOLOGY_BUILT
2073 
2077  void xwrite_attributes(xml_element* rootnode, const technology_nodeRef& tn = technology_nodeRef()) override = 0;
2078 #endif
2079 
2084  void xwrite(xml_element* rootnode) override = 0;
2085 
2089  bool is_var_args() const;
2090 
2095  void print(std::ostream& os) const override;
2096 
2100  void set_critical();
2101 
2105  bool get_critical() const;
2106 
2110  void set_generated();
2111 
2115  bool get_generated() const;
2116 
2121  void set_multi_unit_multiplicity(unsigned int value);
2122 
2127  unsigned int get_multi_unit_multiplicity() const;
2128 
2133  void set_keep_hierarchy(bool ky);
2134 
2139  bool get_keep_hierarchy() const;
2140 
2146  void change_port_direction(structural_objectRef port, port_o::port_direction pdir);
2147 
2151  const std::string get_description() const
2152  {
2153  return description;
2154  }
2155 
2159  void set_description(const std::string& d)
2160  {
2161  description = d;
2162  }
2163 
2167  const std::string get_copyright() const
2168  {
2169  return copyright;
2170  }
2171 
2175  void set_copyright(const std::string& c)
2176  {
2177  copyright = c;
2178  }
2179 
2183  const std::string get_authors() const
2184  {
2185  return authors;
2186  }
2187 
2191  void set_authors(const std::string& a)
2192  {
2193  authors = a;
2194  }
2195 
2199  const std::string get_license() const
2200  {
2201  return license;
2202  }
2203 
2207  void set_license(const std::string& l)
2208  {
2209  license = l;
2210  }
2211 
2216  const std::string get_specialized() const
2217  {
2218  return specialized;
2219  }
2220 
2224  void set_specialized(const std::string& s)
2225  {
2226  specialized = s;
2227  }
2228 
2229 #if HAVE_TECHNOLOGY_BUILT
2230 
2236  structural_type_descriptor::s_type get_parameter_type(const technology_managerConstRef TM,
2237  const std::string& name) const;
2238 
2244  structural_objectRef get_generic_object(const technology_managerConstRef TM) const;
2245 #endif
2246 
2252  void AddParameter(const std::string& name, const std::string& default_value) override;
2253 };
2254 
2258 class component_o : public module
2259 {
2260  public:
2265  component_o(int debug_level, const structural_objectRef o);
2266 
2268  ~component_o() override = default;
2269 
2274  void copy(structural_objectRef dest) const override;
2275 
2282  structural_objectRef find_member(const std::string& id, so_kind type,
2283  const structural_objectRef owner) const override;
2284 
2289  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
2290 
2297  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
2298 
2303  void xwrite(xml_element* rootnode) override;
2304 
2305 #if HAVE_TECHNOLOGY_BUILT
2306 
2310  void xwrite_attributes(xml_element* rootnode, const technology_nodeRef& tn = technology_nodeRef()) override;
2311 #endif
2312 
2317  void print(std::ostream& os) const override;
2318 
2327 };
2328 
2332 class channel_o : public module
2333 {
2335  std::map<unsigned int, std::string> impl_interfaces;
2336 
2338  std::vector<Wrefcount<structural_object>> connected_objects;
2339 
2340  public:
2345  channel_o(int debug_level, const structural_objectRef o);
2346 
2348  ~channel_o() override = default;
2349 
2353  void add_interface(unsigned int t, const std::string& _interface);
2354 
2359  const std::string& get_interface(unsigned int t) const;
2360 
2365  void add_port(structural_objectRef p);
2366 
2371  const structural_objectRef get_port(unsigned int n) const;
2372 
2376  unsigned int get_connected_objects_size() const;
2377 
2382  void copy(structural_objectRef dest) const override;
2383 
2390  structural_objectRef find_member(const std::string& id, so_kind type,
2391  const structural_objectRef owner) const override;
2392 
2397  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
2398 
2405  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
2406 
2411  void xwrite(xml_element* rootnode) override;
2412 
2413 #if HAVE_TECHNOLOGY_BUILT
2414 
2418  void xwrite_attributes(xml_element* rootnode, const technology_nodeRef& tn = technology_nodeRef()) override;
2419 #endif
2420 
2425  void print(std::ostream& os) const override;
2426 
2435 };
2436 
2442 {
2444  std::vector<Wrefcount<structural_object>> connections;
2445 
2446  public:
2451  bus_connection_o(int debug_level, const structural_objectRef o);
2452 
2454  ~bus_connection_o() override = default;
2455 
2460  void add_connection(structural_objectRef c);
2461 
2466  const structural_objectRef get_connection(unsigned int n) const;
2467 
2471  unsigned int get_connections_size() const;
2472 
2477  void copy(structural_objectRef dest) const override;
2478 
2485  structural_objectRef find_member(const std::string& id, so_kind type,
2486  const structural_objectRef owner) const override;
2487 
2492  structural_objectRef find_isomorphic(const structural_objectRef key) const override;
2493 
2500  void xload(const xml_element* Enode, structural_objectRef owner, structural_managerRef const& CM) override;
2501 
2506  void xwrite(xml_element* rootnode) override;
2507 
2512  void print(std::ostream& os) const override;
2513 
2522 };
2523 
2524 #endif
bool is_reverse
when true the port is dumped as [0:msb-1] instead of [msb-1:0]
std::vector< structural_objectRef > list_of_event
List of event associated with the module.
unsigned int get_lsb() const
return the index of the least significant port
void pi(UINT64 *A)
Definition: Keccak.c:102
std::vector< structural_objectRef > local_data
List of local data associated with the module.
void set_description(const std::string &d)
Set the description associated with the module.
static const char * s_typeNames[]
store the names of the enumerative s_type.
This class describes a generic data declaration object.
Structure representing the most relevant information about the type of a structural object...
friend std::ostream & operator<<(std::ostream &os, const structural_type_descriptorRef o)
Friend definition of the << operator.
const std::string get_copyright() const
Return the copyright associated with the module.
std::vector< structural_objectRef > signals_
The list of signals associated with the vector of signals.
std::map< std::string, structural_objectRef > index_channels
index for channels this table is used to quickly search internal channels used by find_member and fin...
Simple pretty print functor.
so_kind
Enumerative type for structural object classes, it is used with get_kind() function to know the actua...
std::string description
Store the module description.
This class describes a port associated with a component or a channel.
std::string get_kind_text() const override
return the name of the class as a string.
void set_specialized(const std::string &s)
Set the specialization string.
This class describes a generic channel.
bool is_critical
when true the signal is involved into the critical path of the netlist
bool is_data_bus
when true the port is a data bus
void set_license(const std::string &l)
Set the license associated with the module.
std::string specialized
when non empty it defines with respect what module has been specialized
std::vector< structural_objectRef > list_of_service
List of services associated with the module.
std::map< std::string, structural_objectRef > index_bus_connections
index for bus_connections this table is used to quickly search internal bus_connections used by find_...
This class manages the circuit structures.
CustomOrderedMap< T, U > CustomMap
Definition: custom_map.hpp:167
#define ENUM_ID(r, data, elem)
exceptions managed by PandA
port_direction dir
direction of a port
unsigned int lsb
unsigned int get_lsb() const
return the index of the least significant port
bool is_critical
when true the port is involved into the critical path of the netlist
std::vector< structural_objectRef > in_out_ports
Input-output ports of this module.
This class describes a generic systemC action.
structural_type_descriptorRef type
The description of the type.
std::vector< structural_objectRef > gen_ports
generic ports of this module
const std::string get_description() const
Return the description associated with the module.
bool is_size_bus
when true the port is a size bus
std::map< std::string, structural_objectRef > index_constants
index for constants this table is used to quickly search internal constants used by find_member and f...
#define PORT_DIRECTION_ENUM
friend std::ostream & operator<<(std::ostream &os, const structural_objectRef o)
Friend definition of the << operator.
redefinition of map to manage ordered/unordered structures
bool is_halved
when true the port has a halfed size
CONSTREF_FORWARD_DECL(BehavioralHelper)
so_kind port_type
port type
refcount< technology_node > technology_nodeRef
refcount definition of the class
structural_type_descriptor(const std::string &module_name)
Object factory for module objects.
int key[32]
Definition: aes.h:67
s_type type
The type of the port or the signal.
port_direction
Enumerative type describing the direction of a port.
bool is_extern
when true the port is an extern port
unsigned long long size
The size of the object (in bit). The objects having a size are: ports, signals, channels, data, and actions.
std::map< unsigned int, std::string > impl_interfaces
List of the interfaces associated with the channel.
unsigned int function_id
The index of the function which represents the behavior.
std::string copyright
Store the copyright description.
static bool check_type(structural_type_descriptorRef src_type, structural_type_descriptorRef dest_type)
Check if two type descriptors are consistent.
std::string id
Identifier for this component.
std::vector< structural_objectRef > parameters
The method procedure parameter.
bool is_addr_bus
when true the port is an address bus
#define PORT_INTERFACE_ENUM
bool is_generated
when true the component has been internally generated
s_type
Define the possible type of a structural object.
static const unsigned int vector_size_DEFAULT
std::vector< Wrefcount< structural_object > > connected_objects
List of ports bound to the signal object.
port_endianess
Enumerative type describing the endianess of a port; NONE means that it has not been specified yet...
This class manages the technology library structures.
port_interface
Enum type describing if the port is associated with a specific interface type.
std::vector< Wrefcount< structural_object > > connected_objects
List of ports bounded by the channel object.
unsigned int treenode
Treenode id of the type.
std::vector< structural_objectRef > action_sensitivity
Sensitivity list.
process_type
Define the possible types of a process.
bool is_memory
when true the port is a memory port
unsigned int aligment
#define index(x, y)
Definition: Keccak.c:74
bool is_master
when true the port is a master port
std::vector< structural_objectRef > in_ports
input port of this module
std::string get_kind_text() const
Definition of get_kind_text()
std::map< std::string, structural_objectRef > index_signals
index for signals this table is used to quickly search internal signals used by find_member and find_...
unsigned int treenode
index of the treenode in the tree_manager associated with the structural object.
static simple_indent PP
pretty print functor object used by all print members to indent the output of the print function...
This class describes a generic bus connection.
std::string get_kind_text() const override
return the name of the class as a string.
port_interface pi
port interface type of a port
process_type action_type
The type of the action.
void xload(const xml_element *Enode, structural_type_descriptorRef owner)
Load a structural_type_descriptor starting from an xml file.
void xwrite(xml_element *rootnode)
Add a structural_type_descriptor to an xml tree.
static const unsigned int size_DEFAULT
unsigned int last_position_port
store the last index of the positional binding
Template definition of refcount.
std::string value
Value of this element.
This class describes a simple logic/RTL signal.
Very simple pretty printer functor.
NP_functionalityRef NP_descriptions
Alternative descriptions of the behavior of the module.
const std::string get_specialized() const
Return a non-empty string when the component has been specialized.
unsigned int lsb
least significant bit
bool is_critical
when true the component is involved into the critical path of the netlist
std::string id_type
Original type id of the structural object.
std::string scope
Used to identify the scope of the action (public, private or protected)
std::map< unsigned int, structural_objectRef > positional_map
positional map, given the index return the port in that position
bool black_box
True if the structural object is a black box (e.g., a library component).
bool is_clock
when true the port is a clock port and has to be attached to a clock object
#define GET_SO_KIND_TEXT(meth)
Macro which defines the get_kind_text function that returns the parameter as a string.
bool is_tag_bus
when true the port is a tag bus
std::vector< structural_objectRef > ports
The list of ports associated with the port.
std::string license
Store some tags concerning the license type associated with the functional unit.
int debug_level
debug level for the object
std::vector< Wrefcount< structural_object > > connected_objects
The list of connections associated with the port.
Wrefcount< structural_object > owner
The owner of the object.
std::string size_parameter
custom size parameter
std::vector< Wrefcount< structural_object > > connected_objects
List of ports bounded by the constant object.
This class describes a generic event.
static const s_type type_DEFAULT
void set_copyright(const std::string &c)
Set the copyright associated with the module.
const std::string get_license() const
Return the license of the functional description of the module.
std::vector< structural_objectRef > out_ports
output ports of this module
Not parsed functionality manager.
so_kind signal_type
port type
std::string bus_bundle
bus bundle
std::vector< structural_objectRef > internal_objects
internal components/channels/signals/bus_connection_os (for structural modules)
This class describes a generic component.
bool is_slave
when true the port is a slave port
~structural_type_descriptor()=default
Destructor.
static const unsigned int treenode_DEFAULT
CustomMap< std::string, std::string > parameters
Map between parameter string and related values of an instance.
bool is_var_args
when true the port must be specialized at runtime depending on the number of input ...
const std::string get_authors() const
Return the authors of the functional description of the module.
void print(std::ostream &os) const
function that prints the class.
This class describes a constant value.
CustomMap< std::string, std::string > default_parameters
Map between parameter string and its default value.
std::map< std::string, structural_objectRef > index_components
index for components this table is used to quickly search internal components used by find_member and...
void set_authors(const std::string &a)
Set the authors associated with the module.
Not parsed functionality descriptor of a module.
This class describes a generic module.
#define GET_SO_KIND(meth)
Macro used to implement get_kind() function in structural_object hyerarchy classes.
const std::string get_name() const
Returns the name of the type descriptor.
bool keep_hierarchy
when true the module has the keep_hierarchy attribute active
Abstract pure class for the technology structure.
std::string authors
Store the list of authors.
bool is_doubled
when true the port has a doubled size
Base object for all the structural objects.
port_endianess end
endianess of a port
REF_FORWARD_DECL(structural_manager)
bool is_global
when true the port is a global port
std::vector< Wrefcount< structural_object > > connections
List of connections associated with the bus.
unsigned long long vector_size
The number of the elements of a vector.
void copy(structural_type_descriptorRef dest)
Method that copies the contents of the current structural_type_descriptorRef into another structural_...
std::vector< structural_objectRef > list_of_process
List of processes associated with the module.
unsigned int multi_unit_multiplicity
multi-unit multiplicity is the number of units implemented by this module all doing the same thing ...

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13