PandA-2024.02
ModuleGenerator.cpp
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) 2022-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 #include "ModuleGenerator.hpp"
47 
48 #include "structural_objects.hpp"
49 
51  : name(port->get_id()),
52  type(port->get_typeRef()->get_name()),
53  type_size(port->get_typeRef()->vector_size != 0 ? port->get_typeRef()->vector_size : port->get_typeRef()->size),
54  alignment(GetPointerS<const port_o>(port)->get_port_alignment())
55 {
56 }
57 
58 void ModuleGenerator::Exec(std::ostream& out, structural_objectRef _mod, unsigned int function_id, vertex op_v,
59  const std::vector<parameter>& _p, const HDLWriter_Language language)
60 {
61  const auto mod = GetPointer<module>(_mod);
62  std::vector<parameter> _ports_in(mod->get_in_port_size(), parameter());
63  for(auto i = 0U; i < _ports_in.size(); ++i)
64  {
65  _ports_in[i] = parameter(mod->get_in_port(i));
66  }
67  std::vector<parameter> _ports_out(mod->get_out_port_size(), parameter());
68  for(auto i = 0U; i < _ports_out.size(); ++i)
69  {
70  _ports_out[i] = parameter(mod->get_out_port(i));
71  }
72  std::vector<parameter> _ports_inout(mod->get_in_out_port_size(), parameter());
73  for(auto i = 0U; i < _ports_inout.size(); ++i)
74  {
75  _ports_inout[i] = parameter(mod->get_in_out_port(i));
76  }
77  InternalExec(out, _mod, function_id, op_v, language, _p, _ports_in, _ports_out, _ports_inout);
78 }
virtual void InternalExec(std::ostream &out, structural_objectRef mod, unsigned int function_id, vertex op_v, const HDLWriter_Language language, const std::vector< parameter > &_p, const std::vector< parameter > &_ports_in, const std::vector< parameter > &_ports_out, const std::vector< parameter > &_ports_inout)=0
This class describes a port associated with a component or a channel.
HDLWriter_Language
void Exec(std::ostream &out, structural_objectRef mod, unsigned int function_id, vertex op_v, const std::vector< parameter > &_p, const HDLWriter_Language language)
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
This class describes all classes used to represent a structural object.
T * GetPointerS(const refcount< U > &t)
Template function used to hide static_cast The template parameter T represents a type of an object ha...
Definition: refcount.hpp:249

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