PandA-2024.02
hls_function_bit_value.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  */
42 
43 #include "behavioral_helper.hpp"
44 #include "exceptions.hpp"
45 #include "function_behavior.hpp"
46 #include "hls.hpp"
47 #include "hls_manager.hpp"
48 #include "memory.hpp"
49 #include "utility.hpp"
50 
52 #include "design_flow_graph.hpp"
53 #include "design_flow_manager.hpp"
54 
57 #include "frontend_flow_step.hpp"
60 
61 #include "custom_map.hpp"
62 #include <cmath>
63 #include <vector>
64 
65 #include <iosfwd>
66 
67 #include "Parameter.hpp"
68 #include "dbgPrintHelper.hpp"
69 
72 #include "string_manipulation.hpp" // for GET_CLASS
73 
75  unsigned _funId, const DesignFlowManagerConstRef _design_flow_manager)
76  : HLSFunctionStep(_parameters, _HLSMgr, _funId, _design_flow_manager, HLSFlowStep_Type::HLS_FUNCTION_BIT_VALUE,
78 {
79  debug_level = _parameters->get_class_debug_level(GET_CLASS(*this));
80 }
81 
83 
85 {
87 }
88 
91 {
93  relationships;
94  switch(relationship_type)
95  {
97  {
98  relationships.insert(std::make_tuple(parameters->getOption<HLSFlowStep_Type>(OPT_memory_allocation_algorithm),
101  break;
102  }
104  {
105  break;
106  }
108  {
109  break;
110  }
111  default:
112  THROW_UNREACHABLE("");
113  }
114  return relationships;
115 }
116 
118  const DesignFlowStep::RelationshipType relationship_type)
119 {
120  if(relationship_type == INVALIDATION_RELATIONSHIP)
121  {
122  if(GetStatus() == DesignFlowStep_Status::SUCCESS && !parameters->getOption<int>(OPT_gcc_openmp_simd))
123  {
124  if(parameters->isOption(OPT_bitvalue_ipa) && parameters->getOption<bool>(OPT_bitvalue_ipa))
125  {
126  {
127  const auto frontend_step = design_flow_manager.lock()->GetDesignFlowStep(
128  ApplicationFrontendFlowStep::ComputeSignature(FrontendFlowStepType::BIT_VALUE_IPA));
129  const auto design_flow_graph = design_flow_manager.lock()->CGetDesignFlowGraph();
130  const auto design_flow_step =
131  frontend_step != NULL_VERTEX ?
132  design_flow_graph->CGetDesignFlowStepInfo(frontend_step)->design_flow_step :
133  GetPointer<const FrontendFlowStepFactory>(
134  design_flow_manager.lock()->CGetDesignFlowStepFactory("Frontend"))
135  ->CreateApplicationFrontendFlowStep(FrontendFlowStepType::BIT_VALUE_IPA);
136  relationship.insert(design_flow_step);
137  }
138  }
139  const auto frontend_step = design_flow_manager.lock()->GetDesignFlowStep(
140  FunctionFrontendFlowStep::ComputeSignature(FrontendFlowStepType::BIT_VALUE_OPT, funId));
141  const auto design_flow_graph = design_flow_manager.lock()->CGetDesignFlowGraph();
142  const auto design_flow_step =
143  frontend_step != NULL_VERTEX ?
144  design_flow_graph->CGetDesignFlowStepInfo(frontend_step)->design_flow_step :
145  GetPointer<const FrontendFlowStepFactory>(
146  design_flow_manager.lock()->CGetDesignFlowStepFactory("Frontend"))
147  ->CreateFunctionFrontendFlowStep(FrontendFlowStepType::BIT_VALUE_OPT, funId);
148  relationship.insert(design_flow_step);
149  }
150  }
151  HLS_step::ComputeRelationships(relationship, relationship_type);
152 }
153 
155 {
156  const auto curr_address_bitsize = HLSMgr->get_address_bitsize();
157  auto m64P = parameters->getOption<std::string>(OPT_gcc_m32_mx32).find("-m64") != std::string::npos;
158  const auto default_address_bitsize = parameters->isOption(OPT_addr_bus_bitsize) ?
159  parameters->getOption<unsigned int>(OPT_addr_bus_bitsize) :
160  (m64P ? 64 : 32);
161  if(default_address_bitsize != curr_address_bitsize)
162  {
163  const auto frontend_step = design_flow_manager.lock()->GetDesignFlowStep(
164  FunctionFrontendFlowStep::ComputeSignature(FrontendFlowStepType::BIT_VALUE, funId));
165  const auto design_flow_graph = design_flow_manager.lock()->CGetDesignFlowGraph();
166  const auto design_flow_step = frontend_step != NULL_VERTEX ?
167  design_flow_graph->CGetDesignFlowStepInfo(frontend_step)->design_flow_step :
168  GetPointer<const FrontendFlowStepFactory>(
169  design_flow_manager.lock()->CGetDesignFlowStepFactory("Frontend"))
170  ->CreateFunctionFrontendFlowStep(FrontendFlowStepType::BIT_VALUE, funId);
171  HLSMgr->Rmem->set_enable_hls_bit_value(true);
172  design_flow_step->Initialize();
173  const auto return_status = design_flow_step->Exec();
174  HLSMgr->Rmem->set_enable_hls_bit_value(false);
175  return return_status;
176  }
178 }
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
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.
Step successfully executed.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Proxy class calling the bit value analysis just before the hls_bit_value step taking into account the...
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)
exceptions managed by PandA
This class contains the base representation for a generic frontend flow step which works on a single ...
redefinition of map to manage ordered/unordered structures
Auxiliary methods for manipulating string.
#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.
HLSFlowStep_Type
Definition: hls_step.hpp:95
HLSFunctionBitValue(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
Classes to describe design flow graph.
static const std::string ComputeSignature(const FrontendFlowStepType frontend_flow_step_type)
Compute the signature of a function frontend flow step.
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
This class contains the base representation for a generic frontend flow step.
DesignFlowStep_Status GetStatus() const
Return the status of this design step.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
Wrapper of design_flow.
void ComputeRelationships(DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
Definition: hls_step.cpp:302
refcount< T > lock() const
Definition: refcount.hpp:212
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
This class contains the methods to create a frontend flow step.
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.
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.
int debug_level
The debug level.
void ComputeRelationships(DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
DesignFlowStep_Status InternalExec() override
Execute the step.
Data structure definition for high-level synthesis flow.
Superclass include.
This class contains the base representation for a generic frontend flow step which works on the whole...
#define NULL_VERTEX
null vertex definition
Definition: graph.hpp:1305
Datastructure to represent memory information in high-level synthesis.
A brief description of the C++ Header File.
~HLSFunctionBitValue() override
Destructor.
static const std::string ComputeSignature(const FrontendFlowStepType frontend_flow_step_type, const unsigned int function_id)
Compute the signature of a function frontend flow step.

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