PandA-2024.02
cg_node.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  */
43 #ifndef CG_NODE_HPP
44 #define CG_NODE_HPP
45 
46 #include "edge_info.hpp" // for EdgeInfo
47 #include "graph.hpp" // for graph, vertex
48 #include "graph_info.hpp" // for GraphInfo
49 #include "refcount.hpp" // for REF_FORWARD_DECL
50 #include "typed_node_info.hpp" // for TypedNodeInfo
51 #include <ostream> // for operator<<, ostream
52 #include <string> // for operator<<, string
53 #include <utility>
54 
61 
63 #define DATA_SELECTOR 1
64 #define CLOCK_SELECTOR 2
66 #define CHANNEL_SELECTOR 4
68 #define ALL_LINES_SELECTOR (DATA_SELECTOR | CLOCK_SELECTOR | CHANNEL_SELECTOR)
70 #define PURE_DATA_SELECTOR (DATA_SELECTOR | CHANNEL_SELECTOR)
72 
76 struct cg_node_info : public TypedNodeInfo
77 {
82 
88  void print(std::ostream& os, int detail_level = 0) const override
89  {
90  TypedNodeInfo::print(os, detail_level);
91  os << " " << reference << std::endl;
92  }
93 
95  cg_node_info() : TypedNodeInfo(), is_critical(false)
96  {
97  }
98 };
99 
100 #define GET_REFERENCE(data, node_index) Cget_node_info<cg_node_info>(node_index, *(data))->reference
101 
102 #define GET_CRITICAL(data, node_index) Cget_node_info<cg_node_info>(node_index, *(data))->is_critical
103 
107 struct cg_edge_info : public EdgeInfo
108 {
119  void print(std::ostream& os) const;
120 
122  cg_edge_info() : is_critical(false)
123  {
124  }
125 };
126 
132 #define GET_FROM_PORT(data, edge_index) Cget_edge_info<cg_edge_info>(edge_index, *(data))->from_port
133 
139 #define GET_EDGE_CRITICAL(data, edge_index) Cget_node_info<cg_edge_info>(edge_index, *(data))->is_critical
140 
147 #define EDGE_ADD_FROM_PORT(data, edge_index, from) get_edge_info<cg_edge_info>(edge_index, *(data))->from_port = from
148 
154 #define GET_TO_PORT(data, edge_index) Cget_edge_info<cg_edge_info>(edge_index, *(data))->to_port
155 
162 #define EDGE_ADD_TO_PORT(data, edge_index, _to) get_edge_info<cg_edge_info>(edge_index, *(data))->to_port = _to
163 
169 #define EDGE_SET_CRITICAL(data, edge_index, critical) \
170  get_edge_info<cg_edge_info>(edge_index, *(data))->is_critical = critical
171 
175 struct cg_graph_info : public GraphInfo
176 {
180 
183 
184  std::string Entry_name;
185  std::string Exit_name;
186 
191  void print(std::ostream& os) const
192  {
193  os << "Entry " << Entry_name << "Exit " << Exit_name << std::endl;
194  }
195 
199  cg_graph_info(vertex en, const std::string& en_name, vertex ex, const std::string& ex_name)
200  : Entry(en), Exit(ex), Entry_name(en_name), Exit_name(ex_name)
201  {
202  }
203 
207  cg_graph_info() : Entry_name(ENTRY), Exit_name(EXIT)
208  {
209  }
210 
214  ~cg_graph_info() override = default;
215 };
216 
218 {
219  public:
220  explicit cg_edge_writer(const graph* _g);
221  void operator()(std::ostream& out, const EdgeDescriptor& e) const;
222 
223  private:
224  const graph* g;
225 };
226 
228 {
229  public:
230  explicit cg_label_writer(const graph* _g);
231 
232  void operator()(std::ostream& out, const vertex& v) const;
233 
234  private:
235  const graph* g;
236 };
237 
238 #endif
#define EXIT
Definition: global.h:46
cg_graph_info(vertex en, const std::string &en_name, vertex ex, const std::string &ex_name)
Constructor.
Definition: cg_node.hpp:199
REF_FORWARD_DECL(structural_object)
void print(std::ostream &os) const
Print the information associated with the current node of the graph.
Definition: cg_node.hpp:191
const graph * g
Definition: cg_node.hpp:235
Base class storing user data information to the whole graph.
Definition: graph_info.hpp:60
void print(std::ostream &, int detail_level=0) const override
Print the information associated with the node of the graph.
Class specification of the graph structures.
structural_objectRef to_port
destination port/channel to the edge is attached
Definition: cg_node.hpp:112
cg_node_info()
Constructor.
Definition: cg_node.hpp:95
Base class description of data information associated with each node of a graph.
vertex Entry
primary input node.
Definition: cg_node.hpp:179
cg_edge_info()
Constructor.
Definition: cg_node.hpp:122
Information associated with a circuit graph edge.
Definition: cg_node.hpp:107
#define ENTRY
Superclass include.
void print(std::ostream &os, int detail_level=0) const override
Print the information associated with the current node of the graph.
Definition: cg_node.hpp:88
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
General class used to describe a graph in PandA.
Definition: graph.hpp:771
Base class storing user data information.
Definition: edge_info.hpp:55
Base class for graph property.
Information associated with a circuit graph node.
Definition: cg_node.hpp:76
Template definition of refcount.
const graph * g
Definition: cg_node.hpp:224
Base class description of data information associated with each edge of a graph.
structural_objectRef reference
Definition of the internal graph associated with the node.
Definition: cg_node.hpp:81
std::string Entry_name
Definition: cg_node.hpp:184
structural_objectRef from_port
port from which the edge is generated
Definition: cg_node.hpp:110
Information associated with the whole graph of a circuit.
Definition: cg_node.hpp:175
bool is_critical
Definition: cg_node.hpp:83
bool is_critical
flag to check if the edge is involved into the critical path
Definition: cg_node.hpp:114
cg_graph_info()
Empty constructor.
Definition: cg_node.hpp:207
Base object for all the structural objects.
vertex Exit
primary output node
Definition: cg_node.hpp:182
std::string Exit_name
Definition: cg_node.hpp:185
boost::graph_traits< graph >::edge_descriptor EdgeDescriptor
edge definition.
Definition: graph.hpp:1316

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