PandA-2024.02
standard_hls.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) 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  */
41 #include "standard_hls.hpp"
42 
43 #include "Parameter.hpp"
45 #include "application_manager.hpp"
46 #include "behavioral_helper.hpp"
47 #include "call_graph_manager.hpp"
48 #include "cpu_time.hpp"
49 #include "datapath_creator.hpp"
50 #include "dbgPrintHelper.hpp"
51 #include "function_behavior.hpp"
52 #include "module_interface.hpp"
53 #include "omp_functions.hpp"
54 #include "technology_manager.hpp"
55 
56 #include "hls.hpp"
57 #include "hls_constraints.hpp"
58 #include "hls_device.hpp"
59 #include "hls_manager.hpp"
60 
63 
65 #include "add_library.hpp"
66 
68 #include "custom_set.hpp"
69 #include <tuple>
70 
71 standard_hls::standard_hls(const ParameterConstRef _parameters, const HLS_managerRef _HLSMgr, unsigned int _funId,
72  const DesignFlowManagerConstRef _design_flow_manager)
73  : HLSFunctionStep(_parameters, _HLSMgr, _funId, _design_flow_manager, HLSFlowStep_Type::STANDARD_HLS_FLOW)
74 {
75  composed = true;
76 }
77 
78 standard_hls::~standard_hls() = default;
79 
82 {
84  switch(relationship_type)
85  {
87  {
89  ret.insert(std::make_tuple(synthesis_flow, HLSFlowStepSpecializationConstRef(),
91  ret.insert(std::make_tuple(parameters->getOption<HLSFlowStep_Type>(OPT_datapath_architecture),
93  if(HLSMgr->get_HLS(funId))
94  {
95  ret.insert(std::make_tuple(HLSMgr->get_HLS(funId)->controller_type, HLSFlowStepSpecializationConstRef(),
97  }
98  HLSFlowStep_Type top_entity_type;
99 
100  bool found = false;
101  if(parameters->isOption(OPT_context_switch))
102  {
103  auto omp_functions = GetPointer<OmpFunctions>(HLSMgr->Rfuns);
104  THROW_ASSERT(omp_functions, "OMP_functions must not be null");
105  if(omp_functions->kernel_functions.find(funId) != omp_functions->kernel_functions.end())
106  {
107  found = true;
108  }
109  if(omp_functions->parallelized_functions.find(funId) != omp_functions->parallelized_functions.end())
110  {
111  found = true;
112  }
113  if(omp_functions->atomic_functions.find(funId) != omp_functions->atomic_functions.end())
114  {
115  found = true;
116  }
117  if(found) // use new top_entity
118  {
120  ret.insert(std::make_tuple(top_entity_type, HLSFlowStepSpecializationConstRef(),
122  }
123  }
124  if(!found) // use standard
125  {
126  top_entity_type =
127  HLSMgr->hasToBeInterfaced(funId) && (HLSMgr->CGetCallGraphManager()->ExistsAddressedFunction() ||
128  parameters->getOption<bool>(OPT_memory_mapped_top)) ?
131  }
132  ret.insert(std::make_tuple(top_entity_type, HLSFlowStepSpecializationConstRef(),
134  ret.insert(std::make_tuple(HLSFlowStep_Type::ADD_LIBRARY,
137  if(HLSMgr->hasToBeInterfaced(funId))
138  {
139  ret.insert(std::make_tuple(HLSFlowStep_Type::ADD_LIBRARY,
142  ret.insert(std::make_tuple(parameters->getOption<HLSFlowStep_Type>(OPT_interface_type),
144  }
145  break;
146  }
148  {
149  break;
150  }
152  {
153  break;
154  }
155  default:
156  THROW_UNREACHABLE("");
157  }
158  return ret;
159 }
160 
162 {
163  const auto top_function_ids = HLSMgr->CGetCallGraphManager()->GetRootFunctions();
164  if(top_function_ids.count(funId))
165  {
166  STOP_TIME(HLSMgr->HLS_execution_time);
167  }
169 }
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Definition: hls_step.hpp:205
Data structure representing the entire HLS information.
File containing functions and utilities to support the printing of debug messagges.
This step adds the current module to the technology library.
Definition of the class representing a generic C application.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
const unsigned int funId
identifier of the function to be processed (0 means that it is a global step)
~standard_hls() override
Destructor.
Base class to model interfaces for high-level synthesis.
Class specification of the manager of the technology library data structures.
Include a set of utilities used to manage CPU time measures.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Definition: exceptions.hpp:292
Factory for hls flow step.
bool composed
True if this step represents a composition of design flow steps (e.g., a flow); must be set by specia...
HLSFlowStep_Type
Definition: hls_step.hpp:95
redefinition of set to manage ordered/unordered structures
#define STOP_TIME(time_var)
Macro used to store the elapsed time into time_var.
Definition: cpu_time.hpp:136
Construction of top entity memory mapped interface.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
Definition of the class to create the structural description of the component.
Data structure definition for HLS constraints.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
this class is used to manage the command-line or XML options.
Wrapper to call graph.
DesignFlowStep_Status InternalExec() override
Execute the step.
refcount< const HLSFlowStepSpecialization > HLSFlowStepSpecializationConstRef
const refcount definition of the class
Definition: hls_step.hpp:93
const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > ComputeHLSRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
Information about speciaization of add_library.
Definition: add_library.hpp:58
standard_hls(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
Datastructure to describe functions allocation in high-level synthesis.
Data structure definition for high-level synthesis flow.
Superclass include.
HLS specialization of generic_device.
A brief description of the C++ Header File.
#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