PandA-2024.02
parallel_memory_conn_binding.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) 2015-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  */
42 
43 #include "Parameter.hpp"
44 #include "hls.hpp"
45 #include "hls_manager.hpp"
46 #include "omp_functions.hpp"
48 #include "structural_manager.hpp"
49 #include "structural_objects.hpp"
50 
52  const ParameterConstRef _parameters)
53  : conn_binding(_behavioral_helper, _parameters)
54 {
55 }
56 
58 
60 {
61  conn_binding::add_to_SM(HLSMgr, HLS, SM);
62  const auto memory_banks_number = parameters->getOption<unsigned int>(OPT_memory_banks_number);
63  const structural_objectRef circuit = SM->get_circ();
64  for(const auto& component : GetPointer<ParallelMemoryFuBinding>(HLS->Rfu)->component_to_allow_mem_access)
65  {
66  const auto done = component.second->find_member("done", port_o_K, component.second);
67  THROW_ASSERT(done, "");
68  GetPointer<port_o>(done)->add_n_ports(memory_banks_number, done);
69  const auto component_done = component.first->find_member(DONE_PORT_NAME, port_o_K, component.first);
70  THROW_ASSERT(component_done, "");
71  const auto component_done_signal =
72  GetPointer<port_o>(component_done)->find_bounded_object(component.first->get_owner());
73  THROW_ASSERT(component_done_signal, component_done->get_path());
74  for(unsigned int memory_bank_index = 0; memory_bank_index < memory_banks_number; memory_bank_index++)
75  {
76  SM->add_connection(component_done_signal, GetPointer<port_o>(done)->get_port(memory_bank_index));
77  }
78 
79  const auto op = component.second->find_member("op", port_o_K, component.second);
80  GetPointer<port_o>(op)->add_n_ports(memory_banks_number, op);
81  const auto access_allowed_component = component.first->find_member("access_allowed", port_o_K, component.first);
82  THROW_ASSERT(access_allowed_component, "");
83  const auto access_allowed_component_sign = SM->add_sign_vector("access_allowed_" + component.first->get_id(),
84  memory_banks_number, circuit, op->get_typeRef());
85  SM->add_connection(op, access_allowed_component_sign);
86  SM->add_connection(access_allowed_component_sign, access_allowed_component);
87 
88  const auto start = component.first->find_member("start_port", port_o_K, component.first);
89  THROW_ASSERT(start, "");
90  const auto start_signal = GetPointer<port_o>(start)->find_bounded_object(component.first->get_owner());
91  THROW_ASSERT(start_signal, "");
92  const auto start_ama = component.second->find_member("start_port", port_o_K, component.second);
93  THROW_ASSERT(start_ama, "");
94  GetPointer<port_o>(start_ama)->add_n_ports(memory_banks_number, start_ama);
95  for(unsigned int memory_bank_index = 0; memory_bank_index < memory_banks_number; memory_bank_index++)
96  {
97  SM->add_connection(GetPointer<port_o>(start_ama)->get_port(memory_bank_index), start_signal);
98  }
99  }
100 }
void add_connection(structural_objectRef src, structural_objectRef dest)
Create a connection between a source structural object and a destination structural object...
Data structure representing the entire HLS information.
ParallelMemoryConnBinding(const BehavioralHelperConstRef _behavioral_helper, const ParameterConstRef parameters)
Constructor.
const structural_objectRef get_circ() const
Get a reference to circ field.
virtual void add_to_SM(const HLS_managerRef HLSMgr, const hlsRef HLS, const structural_managerRef SM)
Add the interconnection to the structural representation of the datapath.
generic_objRef get_port(unsigned int var, direction_type dir)
Returns reference to generic object associated to a given variable, for a specific port direction...
const ParameterConstRef parameters
The set of input parameters.
virtual structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const =0
Return the object named id of a given type which belongs to or it is associated with the object...
fu_bindingRef Rfu
Store the refcounted functional unit binding of the operations.
Definition: hls.hpp:121
#define DONE_PORT_NAME
Class managing the interconnection binding.
Data structure used to store the functional-unit binding of the vertices.
Data structure used to store the interconnection binding of datapath elements when parallel memory co...
This class describes all classes used to represent a structural object.
~ParallelMemoryConnBinding() override
Destructor.
this class is used to manage the command-line or XML options.
Class implementation of the structural_manager.
Datastructure to describe functions allocation in high-level synthesis.
Data structure definition for high-level synthesis flow.
void add_to_SM(const HLS_managerRef HLSMgr, const hlsRef HLS, const structural_managerRef SM) override
Add the interconnection to the structural representation of the datapath.
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)
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
Definition: exceptions.hpp:289

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