75 const DesignFlowManagerConstRef _design_flow_manager,
77 :
top_entity(_parameters, _HLSMgr, _funId, _design_flow_manager, _hls_flow_step_type)
88 switch(relationship_type)
115 std::string module_name = function_name;
116 const auto top_functions =
HLSMgr->CGetCallGraphManager()->GetRootFunctions();
117 bool is_top = top_functions.find(
funId) != top_functions.end();
120 module_name =
"_" + function_name;
148 GetPointer<module>(circuit)->set_description(
"Top component for " + function_name);
150 GetPointer<module>(circuit)->set_authors(
"Component automatically generated by bambu");
154 THROW_ASSERT(datapath_circuit,
"Missing datapath circuit");
157 std::string parallel_controller_model =
"__controller_parallel";
158 std::string parallel_controller_name =
"__controller_parallel";
159 std::string par_ctrl_library =
HLS->
HLS_D->get_technology_manager()->get_library(parallel_controller_model);
162 circuit,
HLS->
HLS_D->get_technology_manager());
166 THROW_ASSERT(controller_circuit,
"Missing controller circuit");
172 GetPointer<module>(circuit)->add_internal_object(datapath_circuit);
180 GetPointer<port_o>(clock_obj)->set_is_clock(
true);
213 THROW_ASSERT(done_obj,
"Done port not added in the top component");
215 THROW_ASSERT(controller_done,
"Done signal not found in the controller");
224 std::string delay_unit;
225 auto reset_type =
parameters->getOption<std::string>(OPT_reset_type);
226 if(reset_type ==
"sync")
248 GetPointer<module>(delay_gate)->get_in_port(2)->get_typeRef());
249 SM->
add_connection(GetPointer<module>(delay_gate)->get_in_port(2), done_signal_in);
252 "done_delayed_REG_signal_out", circuit, GetPointer<module>(delay_gate)->get_out_port(0)->get_typeRef());
253 SM->
add_connection(GetPointer<module>(delay_gate)->get_out_port(0), done_signal_out);
265 this->
add_ports(circuit, clock_obj, reset_obj);
283 const auto listLoops = FB->
CGetLoops()->GetList();
284 for(
const auto& loop : listLoops)
286 if(loop->GetId() != 0)
288 n = loop->upper_bound;
293 auto loopBW = 1ull +
ceil_log2(static_cast<unsigned long long>(n));
298 for(
const auto& loop : listLoops)
300 if(loop->GetId() != 0)
302 THROW_ASSERT(loop->upper_bound_tn,
"unexpected condition");
318 const auto listLoops = FB->
CGetLoops()->GetList();
319 for(
const auto& loop : listLoops)
321 if(loop->GetId() != 0)
323 n = loop->upper_bound;
332 GetPointer<module>(
SM->
get_circ())->add_internal_object(constant);
335 THROW_ASSERT(controller_Loop_Iter,
"unexpected condition");
341 for(
const auto& loop : listLoops)
343 if(loop->GetId() != 0)
345 std::string name_Loop_Upper_Bound = BH->
PrintVariable(loop->upper_bound_tn->index);
349 THROW_ASSERT(controller_Loop_Iter,
"unexpected condition");
359 unsigned long long loopBW)
361 auto num_kernel =
parameters->getOption<
unsigned int>(OPT_num_accelerators);
364 GetPointer<port_o>(controller_done_request)->add_n_ports(num_kernel, controller_done_request);
367 GetPointer<port_o>(controller_done_port)->add_n_ports(num_kernel, controller_done_port);
370 GetPointer<port_o>(controller_start_port)->add_n_ports(num_kernel, controller_start_port);
373 GetPointer<port_o>(controller_request)->type_resize(loopBW);
376 GetPointer<port_o>(controller_LoopIteration)->type_resize(loopBW);
385 auto num_slots =
parameters->getOption<
unsigned int>(OPT_num_accelerators);
static void propagate_memory_parameters(const structural_objectRef src, const structural_managerRef tgt)
Propagates the memory parameters from the source (innermost) module to the target (outermost) one...
void add_connection(structural_objectRef src, structural_objectRef dest)
Create a connection between a source structural object and a destination structural object...
structural_managerRef SM
reference to the resulting circuit
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
const HLS_managerRef HLSMgr
information about all the HLS synthesis
Data structure representing the entire HLS information.
refcount< structural_type_descriptor > structural_type_descriptorRef
RefCount type definition of the structural_type_descriptor class structure.
File containing functions and utilities to support the printing of debug messagges.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
structural_managerRef datapath
Store the datapath description.
Structure representing the most relevant information about the type of a structural object...
#define GET_CLASS(obj)
Macro returning the actual type of an object.
void connect_loop_iter(const structural_objectRef circuit, unsigned long long loopBW)
std::string get_function_name() const
Return the name of the function.
void resize_controller_parallel(structural_objectRef controller_circuit, unsigned long long loopBW)
resize_controller_parallel
#define GENERATED_LICENSE
const structural_objectRef get_circ() const
Get a reference to circ field.
void set_owner(const structural_objectRef new_owner)
set the owner of the structural object
RelationshipType
The relationship type.
Source must be executed to satisfy target.
mathematical utility function not provided by standard libraries
const unsigned int funId
identifier of the function to be processed (0 means that it is a global step)
This class manages the circuit structures.
const HLS_deviceRef HLS_D
reference to the information representing the target for the synthesis
void add_ports(structural_objectRef circuit, structural_objectRef clock_port, structural_objectRef reset_port)
Adds the input/output ports to the circuit.
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...
Class specification of the manager of the technology library data structures.
#define STR(s)
Macro which performs a lexical_cast to a string.
#define CLOCK_PORT_NAME
standard name for ports
structural_managerRef top
Store the top description.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
T ceil_log2(T x)
Return the smallest n such that 2**n >= X.
static unsigned long long Size(const tree_nodeConstRef &tn)
Return the size of a tree object.
void set_top_info(const std::string &id, const technology_managerRef &LM, const std::string &Library="")
Class specification of the data structures used to manage technology information. ...
static structural_objectRef add_port(const std::string &id, port_o::port_direction pdir, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port.
DesignFlowStep_Status InternalExec() override
Add selector and suspension.
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.
Target must be reexecuted.
#define flipflop_AR
flipflop with asynchronous reset
redefinition of set to manage ordered/unordered structures
#define LIBRARY_STD
standard library where all built-in ports are defined.
void set_black_box(bool bb)
Set the black box property associated with the structural_object.
~top_entity_parallel_cs() override
Destructor.
const BehavioralHelperConstRef CGetBehavioralHelper() const
Returns the helper associated with the function.
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
std::string PrintVariable(unsigned int var) const
Print the name of the variable associated to the index.
refcount< structural_manager > structural_managerRef
RefCount type definition of the structural_manager class structure.
This file collects some utility functions.
structural_objectRef add_module_from_technology_library(const std::string &id, const std::string &fu_name, const std::string &library_name, const structural_objectRef owner, const technology_managerConstRef TM)
Create a new object starting from a library component.
bool registered_done_port
true when the done port is registered
This class describes all classes used to represent a structural object.
static structural_objectRef add_sign(std::string id, structural_objectRef owner, structural_type_descriptorRef sign_type, unsigned int treenode=0)
Create a new signal.
hlsRef HLS
HLS data structure of the function to be analyzed.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
const LoopsConstRef CGetLoops() const
Return the loops.
interface of loops finding algorithm
It collects all the common strings covering PandA copyrights issues.
void connect_port_parallel(const structural_objectRef circuit, unsigned long long loopBW)
connect_port_parallel connect datapath and controller
Class implementation of the structural_manager.
int debug_level
The debug level.
refcount< const HLSFlowStepSpecialization > HLSFlowStepSpecializationConstRef
const refcount definition of the class
This class describes a constant value.
unsigned long long BW_loop_iter(const structural_objectRef circuit)
top_entity_parallel_cs(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type _hls_flow_step_type)
behavior include
#define flipflop_SR
flipflop with synchronous reset
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
Data structure definition for high-level synthesis flow.
#define GENERATED_COPYRIGHT
Datastructure to represent memory information in high-level synthesis.
HLS specialization of generic_device.
void set_type(const structural_type_descriptorRef &s)
Set the type of the structural_object.
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 ...