71 const DesignFlowManagerConstRef _design_flow_manager,
73 :
minimal_interface(_parameters, _HLSMgr, _funId, _design_flow_manager, _hls_flow_step_type)
87 std::string module_name = wrappedObj->
get_id() +
"_wb4_interface";
92 SM_wb4_interface->
set_top_info(module_name, module_type);
99 GetPointer<module>(interfaceObj)->add_internal_object(wrappedObj);
101 GetPointer<module>(interfaceObj)
102 ->set_description(
"WB4 interface for top component: " + wrappedObj->
get_typeRef()->
id_type);
104 GetPointer<module>(interfaceObj)->set_authors(
"Component automatically generated by bambu");
117 HLS->
top = SM_wb4_interface;
124 const auto behavioral_helper = function_behavior->CGetBehavioralHelper();
127 auto data_bus_bitsize =
HLSMgr->Rmem->get_bus_data_bitsize();
128 for(
const auto& function_parameter : function_parameters)
137 return data_bus_bitsize;
142 auto addr_bus_bitsize =
HLSMgr->get_address_bitsize();
143 auto allocated_space =
HLSMgr->Rmem->get_max_address();
144 unsigned int parameter_addr_bit = 1;
145 while(allocated_space >>= 1)
147 ++parameter_addr_bit;
150 return std::max(parameter_addr_bit, addr_bus_bitsize);
210 "WB4 Interface portA = " + portA->
get_path() +
" portB = " + portB->
get_path());
231 else if(!signA && signB)
235 else if(!signB && signA)
239 else if(signA && signB)
311 bool is_slave =
false, is_master =
false;
312 bool only_mm_parameters_allocated =
313 HLSMgr->Rmem->get_allocated_parameters_memory() ==
HLSMgr->Rmem->get_allocated_internal_memory();
315 if(S_data_ram_size_port && S_Wdata_ram_port && S_addr_ram_port && S_we_ram_port && S_oe_ram_port &&
316 Sout_DataRdy_port && Sout_Rdata_ram_port)
320 else if(!S_data_ram_size_port && !S_Wdata_ram_port && !S_addr_ram_port && !S_we_ram_port && !S_oe_ram_port &&
321 !Sout_DataRdy_port && !Sout_Rdata_ram_port)
330 if(Mout_data_ram_size_port && Mout_Wdata_ram_port && Mout_addr_ram_port && Mout_we_ram_port && Mout_oe_ram_port &&
331 M_DataRdy_port && M_Rdata_ram_port)
335 else if(!Mout_data_ram_size_port && !Mout_Wdata_ram_port && !Mout_addr_ram_port && !Mout_we_ram_port &&
336 !Mout_oe_ram_port && !M_DataRdy_port && !M_Rdata_ram_port)
346 if(
HLSMgr->Rmem->get_max_address() >
parameters->getOption<
unsigned long long int>(OPT_base_address))
348 THROW_ERROR(
"Internal memory addresses overlap with the external addresses: change the base address value with " 388 auto* in_portReWe = GetPointer<port_o>(port_objReWe);
389 in_portReWe->add_n_ports(2, port_objReWe);
398 notGateSTB->find_member(
"in1",
port_o_K, notGateSTB));
404 auto* in_portAndSTB = GetPointer<port_o>(port_objAndSTB);
405 in_portAndSTB->add_n_ports(2, port_objAndSTB);
419 interfaceObj,
HLS->
HLS_D->get_technology_manager());
422 GetPointer<port_o>(arcAddress)->set_type(addr_type);
426 GetPointer<port_o>(arcBase)->set_type(addr_type);
430 GetPointer<port_o>(arcMaxAddress)->set_type(addr_type);
436 GetPointer<port_o>(constBaseAddressOut1)->set_type(addr_type);
437 constBaseAddress->
SetParameter(
"value", baseAddressParameter +
" + " +
445 GetPointer<port_o>(constMaxAddressOut1)->set_type(addr_type);
446 constMaxAddress->
SetParameter(
"value", baseAddressParameter +
" + " +
459 if(!only_mm_parameters_allocated)
464 auto* in_portControl = GetPointer<port_o>(port_objControl);
465 in_portControl->add_n_ports(2, port_objControl);
469 in_portControl->get_port(1));
475 const auto memory_allocation_policy =
HLSMgr->CGetFunctionBehavior(
funId)->GetMemoryAllocationPolicy();
476 const auto Has_extern_allocated_data =
477 ((
HLSMgr->Rmem->get_memory_address() -
HLSMgr->base_address) > 0 &&
479 (
HLSMgr->Rmem->has_unknown_addresses() &&
482 if(Has_extern_allocated_data)
484 signControl_delayed = signControl;
491 interfaceObj,
HLS->
HLS_D->get_technology_manager());
505 interfaceObj,
HLS->
HLS_D->get_technology_manager());
508 auto* in_portControl_delayed = GetPointer<port_o>(port_objControl_delayed);
509 in_portControl_delayed->add_n_ports(2, port_objControl_delayed);
512 "notInternal_delayed", SM->
get_circ(), in_portControl_delayed->get_port(0)->
get_typeRef());
516 SM->
add_connection(signNotInternal_delayed, in_portControl_delayed->get_port(0));
520 signControl_delayed =
533 auto* in_portStbCyc = GetPointer<port_o>(port_objStbCyc);
534 in_portStbCyc->add_n_ports(2, port_objStbCyc);
541 in_portAndSTB->get_port(0),
"StbCyc");
559 THROW_ASSERT(((is_master && is_slave) && ((signControl && signControl_delayed) || only_mm_parameters_allocated)) ||
560 (!(is_master && is_slave) && !signControl && !signControl_delayed),
561 "If we have both master and slave we need control signals for multiplexers");
570 auto* in_portWeICS = GetPointer<port_o>(port_objWeICS);
571 in_portWeICS->add_n_ports(3, port_objWeICS);
574 in_portWeICS->get_port(0));
576 in_portWeICS->get_port(1));
578 in_portWeICS->get_port(2));
588 auto* in_portReICS = GetPointer<port_o>(port_objReICS);
589 in_portReICS->add_n_ports(3, port_objReICS);
597 in_portReICS->get_port(1));
599 in_portReICS->get_port(2));
603 if(only_mm_parameters_allocated)
614 HLS->
HLS_D->get_technology_manager());
625 HLS->
HLS_D->get_technology_manager());
654 if(only_mm_parameters_allocated)
664 HLS->
HLS_D->get_technology_manager());
667 GetPointer<port_o>(wDataMuxIn1)->set_type(data_type);
670 GetPointer<port_o>(wDataMuxIn2)->set_type(data_type);
673 GetPointer<port_o>(wDataMuxOut1)->set_type(data_type);
700 if(only_mm_parameters_allocated)
710 HLS->
HLS_D->get_technology_manager());
713 GetPointer<port_o>(rDataMuxIn1)->set_type(data_type);
716 GetPointer<port_o>(rDataMuxIn2)->set_type(data_type);
719 GetPointer<port_o>(rDataMuxOut1)->set_type(data_type);
745 interfaceObj,
HLS->
HLS_D->get_technology_manager());
748 GetPointer<port_o>(dRSCIn)->set_type(drs_type);
751 GetPointer<port_o>(dRSCOut)->set_type(sel_type);
768 GetPointer<port_o>(selCOut)->set_type(drs_type);
771 GetPointer<port_o>(selCIn)->set_type(sel_type);
780 if(only_mm_parameters_allocated)
787 "Mout_data_ram_size->get_typeRef() != S_data_ram_size->get_typeRef()");
791 HLS->
HLS_D->get_technology_manager());
794 GetPointer<port_o>(dRSMuxIn1)->set_type(drs_type);
796 GetPointer<port_o>(dRSMuxIn2)->set_type(drs_type);
798 GetPointer<port_o>(dRSMuxOut1)->set_type(drs_type);
829 GetPointer<module>(addressFilterAddrIS)
830 ->SetParameter(
"MAX_ADDRESS",
834 GetPointer<port_o>(afAddrISIn1)->set_type(addr_type);
837 GetPointer<port_o>(afAddrISOut1)->set_type(addr_type);
844 if(only_mm_parameters_allocated)
853 HLS->
HLS_D->get_technology_manager());
856 GetPointer<port_o>(addrMuxIn1)->set_type(addr_type);
859 GetPointer<port_o>(addrMuxIn2)->set_type(addr_type);
862 GetPointer<port_o>(addrMuxOut1)->set_type(addr_type);
885 auto* in_portAndAckOS = GetPointer<port_o>(port_objAndAckOS);
886 in_portAndAckOS->add_n_ports(3, port_objAndAckOS);
889 in_portAndAckOS->get_port(1));
892 in_portAndAckOS->get_port(2));
900 if(only_mm_parameters_allocated)
911 interfaceObj,
HLS->
HLS_D->get_technology_manager());
914 in_portAndAckOS->get_port(0),
"Sout_DataRdyToWb");
922 interfaceObj,
HLS->
HLS_D->get_technology_manager());
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...
const HLS_managerRef HLSMgr
information about all the HLS synthesis
#define ADDRESS_FILTER_WB
Data structure representing the entire HLS information.
WB4_interface(const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type=HLSFlowStep_Type::WB4_INTERFACE_GENERATION)
Constructor.
static std::string name_function(const tree_managerConstRef &tm, const unsigned int index)
Return the name of the function.
#define WB_DATIM_PORT_NAME
refcount< structural_type_descriptor > structural_type_descriptorRef
RefCount type definition of the structural_type_descriptor class structure.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
void connect_with_signal(structural_managerRef SM, structural_objectRef portA, structural_objectRef portB)
Structure representing the most relevant information about the type of a structural object...
const std::string & get_id() const
Return the identifier associated with the structural_object.
~WB4_interface() override
Destructor.
#define GENERATED_LICENSE
Definition of the class representing a generic C application.
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
const unsigned int funId
identifier of the function to be processed (0 means that it is a global step)
#define WB_DATIS_PORT_NAME
This class manages the circuit structures.
const HLS_deviceRef HLS_D
reference to the information representing the target for the synthesis
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...
void connect_with_signal_name(structural_managerRef SM, structural_objectRef portA, structural_objectRef portB, std::string signalName)
unsigned int get_addr_bus_bitsize()
Class specification of the manager of the technology library data structures.
all objects that need to be stored in memory are allocated on an external memory
#define STR(s)
Macro which performs a lexical_cast to a string.
static void add_memory_parameter(const structural_managerRef SM, const std::string &name, const std::string &value)
Adds the given memory parameter to the corresponding object.
#define WB_CYCOM_PORT_NAME
static bool check_type(structural_type_descriptorRef src_type, structural_type_descriptorRef dest_type)
Check if two type descriptors are consistent.
#define CLOCK_PORT_NAME
standard name for ports
structural_managerRef top
Store the top description.
void build_WB4_bus_interface(structural_managerRef SM)
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
#define WB_DATOS_PORT_NAME
static unsigned long long Size(const tree_nodeConstRef &tn)
Return the size of a tree object.
unsigned long long get_data_bus_bitsize()
#define WB_STBIS_PORT_NAME
#define DATARAMSIZE_CONVERTER_WB
void set_top_info(const std::string &id, const technology_managerRef &LM, const std::string &Library="")
all global variables, static variables and strings are allocated on BRAMs
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
Class specification of the data structures used to manage technology information. ...
const std::string get_path() const
Return a unique identifier of the structural object.
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.
#define LIBRARY_STD
standard library where all built-in ports are defined.
#define ADDRESS_RANGE_CHECKER_WB
void SetParameter(const std::string &name, const std::string &value)
Set a parameter value.
#define WB_WEIS_PORT_NAME
virtual enum so_kind get_kind() const =0
Virtual function used to find the real type of a structural_object instance.
#define WB_STBOM_PORT_NAME
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
Base class to allocate memories in high-level synthesis.
#define WB_SELIS_PORT_NAME
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
#define WB_SELOM_PORT_NAME
#define WB_ACKIM_PORT_NAME
refcount< structural_manager > structural_managerRef
RefCount type definition of the structural_manager class structure.
Data structure definition for HLS constraints.
This file collects some utility functions.
#define WB_CYCIS_PORT_NAME
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.
DesignFlowStep_Status InternalExec() override
Execute the step.
#define GET_TYPE_SIZE(structural_obj)
Macro returning the size of the type of a structural object.
Utility header to access wishbone technology library.
std::string id_type
Original type id of the structural object.
This class describes all classes used to represent a structural object.
const structural_type_descriptorRef & get_typeRef() const
Return the type descriptor of the structural_object.
void set_id(const std::string &s)
Set the identifier associated with the 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.
#define NOT_INTERNAL_COMPONENT
hlsRef HLS
HLS data structure of the function to be analyzed.
void build_WB4_complete_logic(structural_managerRef SM, structural_objectRef wrappedObj, structural_objectRef interfaceObj)
#define WB_DATOM_PORT_NAME
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Class to generate WB4 interfaces for high-level synthesis.
DesignFlowStep_Status InternalExec() override
Execute the step.
It collects all the common strings covering PandA copyrights issues.
this class is used to manage the command-line or XML options.
unsigned int functionId
this is the identifier of the function to be implemented
#define WB_ADDRIS_PORT_NAME
Class implementation of the structural_manager.
int debug_level
The debug level.
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
#define OUTPUT_LEVEL_VERBOSE
verbose debugging print is performed.
#define WB_WEOM_PORT_NAME
Class generating minimal interfaces.
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
#define WB_ACKOS_PORT_NAME
Data structure definition for high-level synthesis flow.
#define GENERATED_COPYRIGHT
Datastructure to represent memory information in high-level synthesis.
Class specification of the manager of the tree structures extracted from the raw file.
HLS specialization of generic_device.
#define WB_ADDROM_PORT_NAME
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...