PandA-2024.02
generate_fu_list.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  */
40 #include "generate_fu_list.hpp"
41 #include "Parameter.hpp"
42 #include "dbgPrintHelper.hpp" // for DEBUG_LEVEL_VERY_PEDANTIC
43 #include "design_flow_graph.hpp"
44 #include "design_flow_manager.hpp"
45 #include "library_manager.hpp"
46 #include "string_manipulation.hpp"
47 #include "structural_manager.hpp"
48 #include "structural_objects.hpp"
49 #include "technology_flow_step.hpp"
51 #include "technology_manager.hpp"
52 #include "technology_node.hpp"
53 #include <string>
54 #include <vector>
55 
56 GenerateFuList::GenerateFuList(const generic_deviceRef _device, const DesignFlowManagerConstRef _design_flow_manager,
57  const ParameterConstRef _parameters)
58  : DesignFlowStep(_design_flow_manager, _parameters),
59  ToDataFileStep(_design_flow_manager, ToDataFileStep_Type::GENERATE_FU_LIST, _parameters),
60  FunctionalUnitStep(_device, _design_flow_manager, _parameters)
61 {
62  debug_level = parameters->get_class_debug_level(GET_CLASS(*this));
63  if(parameters->getOption<std::string>(OPT_component_name) != "all")
64  {
65  auto to_be_splitted(parameters->getOption<std::string>(OPT_component_name));
66  const auto splitted = SplitString(to_be_splitted, ",");
67  for(const auto& component_to_be_characterized : splitted)
68  {
69  components_to_be_characterized.insert(component_to_be_characterized);
70  }
71  }
72 }
73 
75 {
76  const auto libraries = TM->get_library_list();
77  for(const auto& library : libraries)
78  {
79  const auto LM = TM->get_library_manager(library);
80  const auto fus = LM->get_library_fu();
81  for(const auto& fu : fus)
82  {
83  component = fu.first;
84  if(components_to_be_characterized.empty() or
86  {
87  AnalyzeFu(fu.second);
88  }
89  }
90  }
91  if(current_list != "")
92  {
93  cells.insert(current_list);
94  }
95  std::ofstream file_out(parameters->getOption<std::string>(OPT_output_file).c_str(), std::ios::out);
96  for(const auto& cell : cells)
97  {
98  file_out << cell << std::endl;
99  }
100  file_out.close();
102 }
103 
105  const DesignFlowStep::RelationshipType relationship_type)
106 {
107  switch(relationship_type)
108  {
110  {
111  const DesignFlowGraphConstRef design_flow_graph = design_flow_manager.lock()->CGetDesignFlowGraph();
112  const auto* technology_flow_step_factory = GetPointer<const TechnologyFlowStepFactory>(
113  design_flow_manager.lock()->CGetDesignFlowStepFactory("Technology"));
114  {
115  const std::string technology_flow_signature =
117  const vertex technology_flow_step =
118  design_flow_manager.lock()->GetDesignFlowStep(technology_flow_signature);
119  const DesignFlowStepRef technology_design_flow_step =
120  technology_flow_step ?
121  design_flow_graph->CGetDesignFlowStepInfo(technology_flow_step)->design_flow_step :
122  technology_flow_step_factory->CreateTechnologyFlowStep(
124  relationship.insert(technology_design_flow_step);
125  }
126  {
127  const std::string technology_flow_signature =
129  const vertex technology_flow_step =
130  design_flow_manager.lock()->GetDesignFlowStep(technology_flow_signature);
131  const DesignFlowStepRef technology_design_flow_step =
132  technology_flow_step ?
133  design_flow_graph->CGetDesignFlowStepInfo(technology_flow_step)->design_flow_step :
134  technology_flow_step_factory->CreateTechnologyFlowStep(
136  relationship.insert(technology_design_flow_step);
137  }
139  {
140  const std::string technology_flow_signature =
142  const vertex technology_flow_step =
143  design_flow_manager.lock()->GetDesignFlowStep(technology_flow_signature);
144  const DesignFlowStepRef technology_design_flow_step =
145  technology_flow_step ?
146  design_flow_graph->CGetDesignFlowStepInfo(technology_flow_step)->design_flow_step :
147  technology_flow_step_factory->CreateTechnologyFlowStep(TechnologyFlowStep_Type::WRITE_TECHNOLOGY);
148  relationship.insert(technology_design_flow_step);
149  }
150  break;
151  }
153  {
154  break;
155  }
157  {
158  break;
159  }
160  default:
161  THROW_UNREACHABLE("");
162  }
163 }
164 
166 {
168 }
169 
170 std::string GenerateFuList::GetSignature() const
171 {
173 }
174 
175 std::string GenerateFuList::GetName() const
176 {
177  return ToDataFileStep::GetName();
178 }
179 
180 DesignFlowStepFactoryConstRef GenerateFuList::CGetDesignFlowStepFactory() const
181 {
183 }
184 
185 void GenerateFuList::AnalyzeCell(functional_unit* fu, const unsigned int, const std::vector<std::string>&, const size_t,
186  const std::vector<std::string>&, const size_t, const unsigned int constPort,
187  const bool is_commutative, size_t)
188 {
190  const structural_objectRef obj = fu->CM->get_circ();
191  unsigned int n_ports = GetPointer<module>(obj)->get_in_port_size();
192  if(constPort < n_ports && is_commutative && constPort > has_first_synthesis_id)
193  {
194  current_list = current_list + "," + component + "-" + fu->get_name();
195  }
196  else
197  {
198  has_first_synthesis_id = constPort;
199  if(current_list != "")
200  {
201  cells.insert(current_list);
202  }
203  current_list = component + "-" + fu->get_name();
204  }
206 }
std::string GetName() const override
Return the name of this design step.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
GenerateFuList(const generic_deviceRef _device, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
The constructor.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
void ComputeRelationships(DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
const fu_map_type & get_library_fu() const
Return the list of the resources contained into the given library.
File containing functions and utilities to support the printing of debug messagges.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
const std::vector< std::string > SplitString(const std::string &input, const std::string &separators)
Function which splits a string into tokens.
CustomOrderedSet< std::string > components_to_be_characterized
The list of components to be added to the list; if the list is empty, all the components will be adde...
RelationshipType
The relationship type.
Source must be executed to satisfy target.
The base class for design step.
const std::vector< std::string > & get_library_list() const
Return the list of the libraries.
const std::string & get_name() const override
Return the name of the operation.
DesignFlowStep_Status Exec() override
Execute the step.
CustomOrderedSet< std::string > cells
The set of list of cells.
Class specification of the manager of the technology library data structures.
This class specifies the characteristic of a particular functional unit.
std::string GetSignature() const override
Return a unified identifier of this design step.
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
unsigned int has_first_synthesis_id
The id of the first analyzed cell of a sequence of cells which differ for the position of the constan...
ToDataFileStep_Type
Autoheader include.
std::string component
The current functional unit.
Class specification of the data structures used to manage technology information. ...
Classes to describe design flow graph.
static const std::string ComputeSignature(const TechnologyFlowStep_Type technology_flow_step_type)
Compute the signature of a technology flow step.
Factory for technology flow step.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Definition: graph.hpp:1303
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory() const override
Return the factory to create this type of steps.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
Class for generating the list of functional untis to be characterized.
Wrapper of design_flow.
void AnalyzeCell(functional_unit *fu, const unsigned int prec, const std::vector< std::string > &portsize_parameters, const size_t portsize_index, const std::vector< std::string > &pipe_parameters, const size_t stage_index, const unsigned int constPort, const bool is_commutative, size_t max_lut_size) override
Analyze the single cell.
const technology_managerRef TM
Technology manager.
refcount< T > lock() const
Definition: refcount.hpp:212
DesignFlowStepFactoryConstRef CGetDesignFlowStepFactory() const override
Return the factory to create this type of steps.
This class describes all classes used to represent a structural object.
std::string GetName() const override
Return the name of this design step.
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
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.
virtual void AnalyzeFu(const technology_nodeRef f_unit)
Analyze all the cells built starting from a template.
Class implementation of the structural_manager.
Class specification of the manager for each library.
int debug_level
The debug level.
std::string current_list
The current entry for list of functional units.
library_managerRef get_library_manager(const std::string &Name) const
Return the library data structure corresponding to the given library id.
Base class for technology flow steps.
std::string GetSignature() const override
Return a unified identifier of this design step.
Step which loads device dependent technology information.

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