PandA-2024.02
structural_manager.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_MANAGER_HPP
47 #define STRUCTURAL_MANAGER_HPP
48 
49 #include "config_HAVE_EUCALYPTUS_BUILT.hpp"
50 
51 #include "NP_functionality.hpp"
52 #include "graph.hpp"
53 #include "refcount.hpp"
54 #include "structural_objects.hpp"
55 #include <iosfwd> // for ostream
56 #include <string>
57 
58 #define TREENODE_CHECK (-1)
59 
70 struct graphs_collection;
71 struct graph;
73 class xml_element;
75 
80 {
81  public:
82  // no copy constructor
83  structural_manager(const structural_manager& inst) = delete;
84 
86  {
89  };
90 
91  private:
94 
97 
110 
115 
122  bool check_type(structural_objectRef src_type, structural_objectRef dest_type);
129 
133  void check_structure(structural_objectRef obj, bool permissive = false);
134 
141 
142  public:
147  explicit structural_manager(const ParameterConstRef Param);
148 
149  void set_top_info(const std::string& id, const technology_managerRef& LM, const std::string& Library = "");
150 
155 
162  static bool check_object(std::string id, structural_objectRef owner, so_kind type);
163 
170  // structural_objectRef getc_object(const structural_objectRef &o_tn, int tn) const;
171 
178  void set_top_info(std::string id, structural_type_descriptorRef module_type, unsigned int treenode = 0);
187  structural_objectRef create(std::string id, so_kind ctype, structural_objectRef owner,
188  structural_type_descriptorRef obj_type, unsigned int treenode = 0);
189 
199  structural_objectRef add_module_from_technology_library(const std::string& id, const std::string& fu_name,
200  const std::string& library_name,
201  const structural_objectRef owner,
202  const technology_managerConstRef TM);
203 
205 
207 
209 
218  static structural_objectRef add_port(const std::string& id, port_o::port_direction pdir, structural_objectRef owner,
219  structural_type_descriptorRef type_descr, unsigned int treenode = 0);
220 
228  structural_objectRef owner);
229 
240  static structural_objectRef add_port_vector(std::string id, port_o::port_direction pdir, unsigned int n_ports,
242  unsigned int treenode = 0);
250  static structural_objectRef add_sign(std::string id, structural_objectRef owner,
251  structural_type_descriptorRef sign_type, unsigned int treenode = 0);
252 
253  static structural_objectRef add_sign_vector(std::string id, unsigned int n_signs, structural_objectRef owner,
254  structural_type_descriptorRef sign_type, unsigned int treenode = 0);
255 
261 
267  structural_objectRef& to_signal);
268 
278  std::string value, unsigned int treenode = 0);
279 
287  std::string functionality_description);
288 
294  void SetParameter(const std::string& name, const std::string& value);
295 
311 
316  void print(std::ostream& os) const;
320  void WriteDot(const std::string& file_name, circuit_graph_type gt, graph* g = nullptr) const;
321 
327  {
328  return circuit;
329  }
330 
340  static void xload(const xml_element* node, structural_managerRef const& CM);
345  void xwrite(xml_element* rootnode, const technology_nodeRef& tn = technology_nodeRef()) const;
347 
353  friend std::ostream& operator<<(std::ostream& os, const structural_manager& s)
354  {
355  s.print(os);
356  return os;
357  }
363  friend std::ostream& operator<<(std::ostream& os, const structural_managerRef s)
364  {
365  if(s)
366  {
367  s->print(os);
368  }
369  return os;
370  }
375  const vertex& get_PI(structural_objectRef level) const;
376 
377  void INIT(bool permissive = false);
378 
379  int get_debug_level() const
380  {
381  return debug_level;
382  }
383 };
384 
389 
390 #endif
void add_connection(structural_objectRef src, structural_objectRef dest)
Create a connection between a source structural object and a destination structural object...
void remove_module(structural_objectRef obj)
static void xload(const xml_element *node, structural_managerRef const &CM)
Load a structural manager from an xml file.
void remove_empty_signal(structural_objectRef &signal)
Remove an existing signal from the SM.
void * top(node_stack *head)
Definition: tree.c:75
friend std::ostream & operator<<(std::ostream &os, const structural_managerRef s)
Friend definition of the << operator.
void remove_connection(structural_objectRef src, structural_objectRef dest)
so_kind
Enumerative type for structural object classes, it is used with get_kind() function to know the actua...
const structural_objectRef get_circ() const
Get a reference to circ field.
structural_manager(const structural_manager &inst)=delete
static bool check_object(std::string id, structural_objectRef owner, so_kind type)
Verify if the component is already associated with owner.
This class manages the tree structures extracted from the raw file.
Class specification of the graph structures.
int debug_level
debug level
This class manages the circuit structures.
const ParameterConstRef Param
class containing all the parameters
void print(std::ostream &os) const
Function that prints the circuit data structure.
refcount< technology_node > technology_nodeRef
refcount definition of the class
port_direction
Enumerative type describing the direction of a port.
void add_sensitivity(structural_objectRef obj, structural_objectRef pr)
Add an object to the sensitivity list of process/service.
void INIT(bool permissive=false)
structural_objectRef create(std::string id, so_kind ctype, structural_objectRef owner, structural_type_descriptorRef obj_type, unsigned int treenode=0)
Create a new object of the circuit.
void check_structure(structural_objectRef obj, bool permissive=false)
perform some check on the circuit manager.
static void add_NP_functionality(structural_objectRef cir, NP_functionality::NP_functionaly_type dt, std::string functionality_description)
Add a not-parsed functionality.
void set_top_info(const std::string &id, const technology_managerRef &LM, const std::string &Library="")
~structural_manager()
Destructor.
This class manages the technology library structures.
static structural_objectRef add_port(const std::string &id, port_o::port_direction pdir, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port.
const vertex & get_PI(structural_objectRef level) const
Return the PI vertex of the circuit, at a specific level.
bool check_type(structural_objectRef src_type, structural_objectRef dest_type)
Check if two type structural object are consistent.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
bool check_bound(structural_objectRef src, structural_objectRef sign)
Function that check if a signal (or port) is already bound on a port.
General class used to describe a graph in PandA.
Definition: graph.hpp:771
structural_objectRef circuit
Structure that represent circuit.
REF_FORWARD_DECL(structural_object)
graph * data_graph
Graph only composed by the data flow in the circuit.
CONSTREF_FORWARD_DECL(technology_manager)
structural_objectRef add_constant(std::string id, structural_objectRef owner, structural_type_descriptorRef type, std::string value, unsigned int treenode=0)
Create a new constant;.
structural_objectRef add_module_from_technology_library(const std::string &id, const std::string &fu_name, const std::string &library_name, const structural_objectRef owner, const technology_managerConstRef TM)
Create a new object starting from a library component.
Template definition of refcount.
void SetParameter(const std::string &name, const std::string &value)
Specify a parameter for the top module.
bulk graph.
Definition: graph.hpp:287
void reconnect_signal_member(structural_objectRef &member, structural_objectRef &from_signal, structural_objectRef &to_signal)
Disconnects a member from from_signal and reconnects it to to_signal.
This class describes all classes used to represent a structural object.
graph * circuit_graph
Graph containing all lines of the circuit.
static structural_objectRef add_sign(std::string id, structural_objectRef owner, structural_type_descriptorRef sign_type, unsigned int treenode=0)
Create a new signal.
friend std::ostream & operator<<(std::ostream &os, const structural_manager &s)
Friend definition of the << operator.
void change_connection(structural_objectRef old_obj, structural_objectRef new_obj, structural_objectRef owner)
static void change_port_direction(structural_objectRef port_object, port_o::port_direction pdir, structural_objectRef owner)
Change the direction of the port.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
int level
Definition: main.c:98
NP_functionaly_type
functionality type descriptors.
Not parsed functionality manager.
uint32_t sign
graphs_collection * og
Bulk graph used to represent all graphs.
void build_graph(const structural_objectRef &top, graphs_collection *bg)
build a graph starting from a structural object.
static structural_objectRef add_port_vector(std::string id, port_o::port_direction pdir, unsigned int n_ports, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port_vector.
Abstract pure class for the technology structure.
Base object for all the structural objects.
void xwrite(xml_element *rootnode, const technology_nodeRef &tn=technology_nodeRef()) const
Add a component to an xml tree.
void WriteDot(const std::string &file_name, circuit_graph_type gt, graph *g=nullptr) const
Function that writes the dot file of the graph by using the AT&T dot format.
static structural_objectRef add_sign_vector(std::string id, unsigned int n_signs, structural_objectRef owner, structural_type_descriptorRef sign_type, unsigned int treenode=0)

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