PandA-2024.02
hls_flow_step_factory.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 
42 #include "BB_based_stg.hpp"
43 #include "CTestbenchExecution.hpp"
44 #include "CallGraphUnfolding.hpp"
45 #include "FSM_NI_SSA_liveness.hpp"
46 #include "Parameter.hpp"
49 #include "WB4_interface.hpp"
50 #include "add_library.hpp"
51 #include "allocation.hpp"
52 #include "call_graph_manager.hpp"
53 #include "cdfc_module_binding.hpp"
55 #include "classic_datapath.hpp"
58 #include "control_flow_checker.hpp"
59 #include "controller_cs.hpp"
60 #include "cs_interface.hpp"
61 #include "custom_set.hpp"
62 #include "datapath_cs.hpp"
63 #include "datapath_parallel_cs.hpp"
64 #include "dbgPrintHelper.hpp"
65 #include "design_flow_step.hpp"
66 #include "dominator_allocation.hpp"
67 #include "dry_run_evaluation.hpp"
68 #include "easy_module_binding.hpp"
69 #include "evaluation.hpp"
70 #include "fsm_controller.hpp"
72 #include "generate_hdl.hpp"
76 #include "hls_synthesis_flow.hpp"
77 #include "initialize_hls.hpp"
80 #include "memory.hpp"
81 #include "minimal_interface.hpp"
84 #include "pipeline_controller.hpp"
85 #include "port_swapping.hpp"
87 #include "scheduling.hpp"
89 #include "standard_hls.hpp"
90 #include "string_manipulation.hpp"
91 #include "synthesis_evaluation.hpp"
92 #include "test_vector_parser.hpp"
93 #include "testbench_generation.hpp"
94 #include "top_entity.hpp"
95 #include "top_entity_cs.hpp"
97 #include "tree_manager.hpp"
98 #include "unique_binding.hpp"
100 #include "values_scheme.hpp"
102 #include "virtual_hls.hpp"
104 #include "write_hls_summary.hpp"
105 
106 #if HAVE_TASTE
110 #endif
111 
112 #if HAVE_FROM_PRAGMA_BUILT
113 #include "omp_allocation.hpp"
118 #endif
119 
120 #if HAVE_ILP_BUILT
121 #include "sdc_scheduling.hpp"
122 #endif
123 
124 #if HAVE_VCD_BUILT
125 #include "HWDiscrepancyAnalysis.hpp"
126 #include "HWPathComputation.hpp"
127 #include "VcdSignalSelection.hpp"
128 #include "vcd_utility.hpp"
129 #endif
130 
131 #include "config_HAVE_ILP_BUILT.hpp"
132 
133 #include <string>
134 #include <utility>
135 
136 HLSFlowStepFactory::HLSFlowStepFactory(const DesignFlowManagerConstRef _design_flow_manager,
137  const HLS_managerRef _HLS_mgr, const ParameterConstRef _parameters)
138  : DesignFlowStepFactory(_design_flow_manager, _parameters), HLS_mgr(_HLS_mgr)
139 {
140  debug_level = parameters->get_class_debug_level(GET_CLASS(*this));
141 }
142 
144 
145 const std::string HLSFlowStepFactory::GetPrefix() const
146 {
147  return "HLS";
148 }
149 
152  const HLSFlowStepSpecializationConstRef hls_flow_step_specialization) const
153 {
155  "-->Creating step " +
156  (funId ? HLSFunctionStep::ComputeSignature(type, hls_flow_step_specialization, funId) :
157  HLS_step::ComputeSignature(type, hls_flow_step_specialization)) +
158  " (" + HLS_step::EnumToName(type) + ")");
159  DesignFlowStepRef design_flow_step = DesignFlowStepRef();
160  switch(type)
161  {
163  {
164  design_flow_step = DesignFlowStepRef(
165  new add_library(parameters, HLS_mgr, funId, design_flow_manager.lock(), hls_flow_step_specialization));
166  break;
167  }
169  {
170  design_flow_step = DesignFlowStepRef(new allocation(parameters, HLS_mgr, funId, design_flow_manager.lock()));
171  break;
172  }
174  {
175  design_flow_step = DesignFlowStepRef(new BB_based_stg(parameters, HLS_mgr, funId, design_flow_manager.lock()));
176  break;
177  }
179  {
181  break;
182  }
184  {
185  design_flow_step = DesignFlowStepRef(new cdfc_module_binding(
186  parameters, HLS_mgr, funId, design_flow_manager.lock(), hls_flow_step_specialization));
187  break;
188  }
190  {
191  design_flow_step =
193  break;
194  }
196  {
197  design_flow_step =
199  break;
200  }
202  {
203  design_flow_step = DesignFlowStepRef(new datapath_cs(parameters, HLS_mgr, funId, design_flow_manager.lock(),
205  break;
206  }
208  {
209  design_flow_step = DesignFlowStepRef(new datapath_parallel_cs(
211  break;
212  }
214  {
215  design_flow_step =
217  break;
218  }
220  {
221  design_flow_step =
223  break;
224  }
226  {
227  design_flow_step =
229  break;
230  }
232  {
233  design_flow_step = DesignFlowStepRef(
234  new CTestbenchExecution(parameters, HLS_mgr, design_flow_manager.lock(), hls_flow_step_specialization));
235  break;
236  }
238  {
239  design_flow_step =
241  break;
242  }
244  {
245  design_flow_step =
247  break;
248  }
250  {
251  design_flow_step = DesignFlowStepRef(new mem_dominator_allocation(
252  parameters, HLS_mgr, design_flow_manager.lock(), hls_flow_step_specialization));
253  break;
254  }
256  {
257  design_flow_step = DesignFlowStepRef(new mem_dominator_allocation_cs(
258  parameters, HLS_mgr, design_flow_manager.lock(), hls_flow_step_specialization,
260  break;
261  }
263  {
265  break;
266  }
268  {
269  design_flow_step =
271  break;
272  }
274  {
275  design_flow_step = DesignFlowStepRef(new parametric_list_based(
276  parameters, HLS_mgr, funId, design_flow_manager.lock(), hls_flow_step_specialization));
277  break;
278  }
280  {
282  break;
283  }
285  {
286  design_flow_step =
288  break;
289  }
291  {
292  design_flow_step = DesignFlowStepRef(new controller_cs(parameters, HLS_mgr, funId, design_flow_manager.lock(),
294  break;
295  }
297  {
298  design_flow_step =
300  break;
301  }
303  {
305  break;
306  }
307 #if HAVE_SIMULATION_WRAPPER_BUILT
309  {
310  design_flow_step =
312  break;
313  }
314 #endif
316  {
317  design_flow_step =
319  break;
320  }
321 #if HAVE_TASTE
322  case HLSFlowStep_Type::GENERATE_TASTE_HDL_ARCHITECTURE:
323  {
324  design_flow_step =
326  break;
327  }
328  case HLSFlowStep_Type::GENERATE_TASTE_SYNTHESIS_SCRIPT:
329  {
330  design_flow_step =
332  break;
333  }
334 #endif
336  {
337  design_flow_step =
339  break;
340  }
342  {
343  design_flow_step =
345  break;
346  }
348  {
350  break;
351  }
353  {
354  design_flow_step =
356  break;
357  }
359  {
360  design_flow_step =
362  break;
363  }
365  {
366  design_flow_step = DesignFlowStepRef(new cs_interface(parameters, HLS_mgr, funId, design_flow_manager.lock()));
367  break;
368  }
370  {
371  design_flow_step =
373  break;
374  }
376  {
377  design_flow_step =
379  break;
380  }
382  {
383  design_flow_step =
385  break;
386  }
387 #if HAVE_FROM_PRAGMA_BUILT
388  case HLSFlowStep_Type::OMP_ALLOCATION:
389  {
390  design_flow_step =
392  break;
393  }
394 #endif
395 #if HAVE_FROM_PRAGMA_BUILT
397  {
398  design_flow_step =
400  break;
401  }
402 #endif
403 #if HAVE_FROM_PRAGMA_BUILT
404  case HLSFlowStep_Type::OMP_FOR_WRAPPER_CS_SYNTHESIS_FLOW:
405  {
406  design_flow_step = DesignFlowStepRef(
408  break;
409  }
410 #endif
411 #if HAVE_FROM_PRAGMA_BUILT
412  case HLSFlowStep_Type::OMP_FUNCTION_ALLOCATION:
413  {
414  design_flow_step =
416  break;
417  }
418 #endif
419 #if HAVE_FROM_PRAGMA_BUILT
420  case HLSFlowStep_Type::OMP_FUNCTION_ALLOCATION_CS:
421  {
422  design_flow_step =
424  break;
425  }
426 #endif
428  {
429  design_flow_step =
431  break;
432  }
434  {
435  design_flow_step =
437  break;
438  }
440  {
441  design_flow_step = DesignFlowStepRef(
443  break;
444  }
445 #if HAVE_ILP_BUILT
446  case HLSFlowStep_Type::SDC_SCHEDULING:
447  {
448  design_flow_step = DesignFlowStepRef(
449  new SDCScheduling(parameters, HLS_mgr, funId, design_flow_manager.lock(), hls_flow_step_specialization));
450  break;
451  }
452 #endif
453  case HLSFlowStep_Type::SIMULATION_EVALUATION:
454  {
455  design_flow_step =
457  break;
458  }
460  {
461  design_flow_step = DesignFlowStepRef(new standard_hls(parameters, HLS_mgr, funId, design_flow_manager.lock()));
462  break;
463  }
464 #if HAVE_LIBRARY_CHARACTERIZATION_BUILT
465  case HLSFlowStep_Type::SYNTHESIS_EVALUATION:
466  {
468  break;
469  }
470 #endif
471 #if HAVE_TASTE
472  case HLSFlowStep_Type::TASTE_INTERFACE_GENERATION:
473  {
474  design_flow_step =
476  break;
477  }
478 #endif
480  {
482  break;
483  }
485  {
487  break;
488  }
490  {
491  design_flow_step = DesignFlowStepRef(new top_entity(parameters, HLS_mgr, funId, design_flow_manager.lock()));
492  break;
493  }
494 
496  {
497  design_flow_step = DesignFlowStepRef(new top_entity_cs(parameters, HLS_mgr, funId, design_flow_manager.lock(),
499  break;
500  }
501 
503  {
504  design_flow_step =
507  break;
508  }
510  {
511  design_flow_step =
513  break;
514  }
516  {
517  design_flow_step =
519  break;
520  }
522  {
523  design_flow_step =
525  break;
526  }
528  {
529  design_flow_step =
531  break;
532  }
533 #if HAVE_VCD_BUILT
534  case HLSFlowStep_Type::VCD_SIGNAL_SELECTION:
535  {
537  break;
538  }
539  case HLSFlowStep_Type::VCD_UTILITY:
540  {
542  break;
543  }
544 #endif
546  {
547  design_flow_step = DesignFlowStepRef(new virtual_hls(parameters, HLS_mgr, funId, design_flow_manager.lock()));
548  break;
549  }
551  {
552  design_flow_step =
554  break;
555  }
557  {
558  design_flow_step =
560  break;
561  }
563  {
564  design_flow_step = DesignFlowStepRef(new weighted_clique_register(
565  parameters, HLS_mgr, funId, design_flow_manager.lock(), hls_flow_step_specialization));
566  break;
567  }
569  {
571  break;
572  }
574  {
575  THROW_UNREACHABLE("");
576  break;
577  }
578  default:
579  THROW_UNREACHABLE("HLSFlowStep algorithm not supported");
580  }
581  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Created step " + design_flow_step->GetName());
582  return design_flow_step;
583 }
584 
586  const CustomUnorderedSet<std::pair<HLSFlowStep_Type, HLSFlowStepSpecializationConstRef>>& hls_flow_steps) const
587 {
588  const CallGraphManagerConstRef call_graph_manager = HLS_mgr->CGetCallGraphManager();
589  DesignFlowStepSet ret;
590 
591  for(const auto& hls_flow_step : hls_flow_steps)
592  {
594  "-->Creating step " + HLS_step::EnumToName(hls_flow_step.first));
595  switch(hls_flow_step.first)
596  {
607 #if HAVE_SIMULATION_WRAPPER_BUILT
609 #endif
615 #if HAVE_VCD_BUILT
616  case HLSFlowStep_Type::VCD_SIGNAL_SELECTION:
617  case HLSFlowStep_Type::VCD_UTILITY:
618 #endif
620 
621  {
622  ret.insert(CreateHLSFlowStep(hls_flow_step.first, 0, hls_flow_step.second));
623  break;
624  }
642 #if HAVE_TASTE
643  case HLSFlowStep_Type::GENERATE_TASTE_HDL_ARCHITECTURE:
644  case HLSFlowStep_Type::GENERATE_TASTE_SYNTHESIS_SCRIPT:
645 #endif
652 #if HAVE_FROM_PRAGMA_BUILT
653  case HLSFlowStep_Type::OMP_ALLOCATION:
654 #endif
655 #if HAVE_FROM_PRAGMA_BUILT
657 #endif
658 #if HAVE_FROM_PRAGMA_BUILT
659  case HLSFlowStep_Type::OMP_FOR_WRAPPER_CS_SYNTHESIS_FLOW:
660 #endif
661 #if HAVE_FROM_PRAGMA_BUILT
662  case HLSFlowStep_Type::OMP_FUNCTION_ALLOCATION:
663 #endif
664 #if HAVE_FROM_PRAGMA_BUILT
665  case HLSFlowStep_Type::OMP_FUNCTION_ALLOCATION_CS:
666 #endif
670 #if HAVE_ILP_BUILT
671  case HLSFlowStep_Type::SDC_SCHEDULING:
672 #endif
673 #if HAVE_SIMULATION_WRAPPER_BUILT
674  case HLSFlowStep_Type::SIMULATION_EVALUATION:
675 #endif
677 #if HAVE_LIBRARY_CHARACTERIZATION_BUILT
678  case HLSFlowStep_Type::SYNTHESIS_EVALUATION:
679 #endif
680 #if HAVE_TASTE
681  case HLSFlowStep_Type::TASTE_INTERFACE_GENERATION:
682 #endif
694  default:
695  THROW_UNREACHABLE("Step not expected: " + HLS_step::EnumToName(hls_flow_step.first));
696  }
698  "<--Created step " + HLS_step::EnumToName(hls_flow_step.first));
699  }
700  return ret;
701 }
702 
704  const std::pair<HLSFlowStep_Type, HLSFlowStepSpecializationConstRef>& hls_flow_step) const
705 {
707  hls_flow_steps.insert(hls_flow_step);
708  return CreateHLSFlowSteps(hls_flow_steps);
709 }
710 
711 const DesignFlowStepSet
713  const HLSFlowStepSpecializationConstRef hls_flow_step_specialization) const
714 {
715  const std::pair<HLSFlowStep_Type, HLSFlowStepSpecializationConstRef> hls_flow_step(type,
716  hls_flow_step_specialization);
717  return CreateHLSFlowSteps(hls_flow_step);
718 }
719 
721  const std::pair<HLSFlowStep_Type, HLSFlowStepSpecializationConstRef>& hls_flow_step) const
722 {
723  return *CreateHLSFlowSteps(hls_flow_step).cbegin();
724 }
725 
726 const DesignFlowStepRef
728  const HLSFlowStepSpecializationConstRef hls_flow_step_specialization) const
729 {
730  return *CreateHLSFlowSteps(type, hls_flow_step_specialization).cbegin();
731 }
Class to compute evaluations about high-level synthesis.
static const std::string ComputeSignature(const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization)
Compute the signature of a hls flow step.
Definition: hls_step.cpp:116
const HLS_managerRef HLS_mgr
The HLS manager.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
const ParameterConstRef parameters
The set of input parameters.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
Module binding based on the analysis of the control data flow chained graph.
const DesignFlowStepSet CreateHLSFlowSteps(const CustomUnorderedSet< std::pair< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef >> &hls_flow_steps) const
Create the frontend design flow steps.
File containing functions and utilities to support the printing of debug messagges.
Base class for all the controller creation algorithms.
This step adds the current module to the technology library.
Wrapper used to generate simulation scripts.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Weighted clique covering register allocation procedure.
Proxy class calling the bit value analysis just before the hls_bit_value step taking into account the...
Class to generate interface for taste architecture.
Header class for the creation of the classical FSM controller.
Base class for the top entity creation.
Base class for usual datapath creation.
Generate HDL testbench for the top-level kernel testing.
superclass include
HLSFlowStepFactory(const DesignFlowManagerConstRef design_flow_manager, const HLS_managerRef _HLS_mgr, const ParameterConstRef parameters)
Constructor.
Module for the generation of the top WB4 component.
static std::string ComputeSignature(const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization, const unsigned int function_id)
Compute the signature of a hls flow step.
Class containing the chordal coloring algorithm implementation.
Auxiliary methods for manipulating string.
Definition of the class to create the structural description of a function.
#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.
static std::string EnumToName(const HLSFlowStep_Type hls_flow_step_type)
Given a HLS flow step type, return the name of the type.
Definition: hls_step.cpp:134
Base class for all scheduling algorithms.
Base class for step of design flow.
Classical synthesis flow.
Class to allocate memories in HLS based on dominators.
Class generating the top WB4 module.
Definition of the class to create the structural description for body loop of openmp for...
Class specification of the register allocation algorithms based on chordal algorithm.
Class managing the module allocation.
HLSFlowStep_Type
Definition: hls_step.hpp:95
Step which intializes hls data structur.
Class to allocate function in HLS based on dominators.
Wrapper used to generate synthesis script for taste.
redefinition of set to manage ordered/unordered structures
base class include
chaining computation starting from the results of the scheduling step
Class definition of the sdc scheduling.
superclass include
Construction of top entity memory mapped interface.
Definition of the class to create the structural description of the component.
Class managing list based scheduling algorithms.
Class to generate minimal interfaces for high-level synthesis.
This wrapper collects all the methods used by the High-level synthesis classes to retrieve informatio...
Definition: allocation.hpp:102
Class specification of values scheme for the storage value insertion phase.
Class to dump hls summary.
Class definition of the list_based structure.
refcount< T > lock() const
Definition: refcount.hpp:212
Class used to generate HDL files.
Class specification of a coloring based register allocation algorithm.
superclass include
Superclass include.
refcount< DesignFlowStep > DesignFlowStepRef
Header class for the creation of a shift register controlling a pipeline.
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
int debug_level
The debug level.
Class specification of unique binding register allocation algorithm.
Class to generate the interface for the context switch project.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
const std::string GetPrefix() const override
Return the prefix of the steps created by the factory.
Class to generate WB4 interfaces for high-level synthesis.
~HLSFlowStepFactory() override
Destructor.
Basic HLS flow.
Wrapper used to generate synthesis scripts.
Class to allocate function in HLS based on dominators and openmp information.
this class is used to manage the command-line or XML options.
Composed pass to wrap function and memory dominator allocation.
Base class specification for register allocation algorithm based on a compatibility graph...
liveness analysis exploiting the SSA form of the IR
Class managing the module allocation.
Wrapper to call graph.
Class to manage mux-based interconnections based on the FSM controller.
This package is used by all HLS packages to manage resource constraints and characteristics.
Build a wrapper layer on the top entity implementing the momory mapped interface. ...
Class generating taste interfaces.
Superclass include.
Class managing the connection binding of datapath.
Class generating minimal interfaces.
Partial module binding based on simple conditions.
Implementation of the class to generate the top HDL taste architecture.
Implementation of the port swapping algorithm described in the following paper: Hao Cong...
Class to create a unique binding.
This package is used by all HLS packages to manage resource constraints and characteristics.
Datastructure to represent memory information in high-level synthesis.
DesignFlowStepRef CreateHLSFlowStep(const HLSFlowStep_Type hls_flow_step_type, const unsigned int funId, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization=HLSFlowStepSpecializationConstRef()) const
Create a scheduling design flow step.
Class specification of the manager of the tree structures extracted from the raw file.

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