PandA-2024.02
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
conn_binding Class Reference

Class managing the interconnection binding. More...

#include <conn_binding.hpp>

Inheritance diagram for conn_binding:
Inheritance graph
[legend]
Collaboration diagram for conn_binding:
Collaboration graph
[legend]

Data Structures

struct  ConnectionSorter
 definition of the connection implementations More...
 
struct  ConnectionTarget
 definition of target of a connection More...
 

Public Types

using direction_type = enum { IN=0, OUT }
 direction port identifier More...
 
using type_t = enum { STG=0 }
 type of the data-structure More...
 
using connection = std::tuple< generic_objRef, generic_objRef, unsigned int, unsigned int >
 connection between two objects (<src, tgt, tgt_port, tgt_port_index>) More...
 
using conn_implementation_map = std::map< connection, connection_objRef, ConnectionSorter >
 
using const_param = std::tuple< std::string, std::string >
 definition of the key to deal with constant parameters More...
 
using ConnectionSources = std::map< generic_objRef, CustomOrderedSet< data_transfer >, GenericObjSorter >
 definition of sources of a connection More...
 

Public Member Functions

 conn_binding (const BehavioralHelperConstRef BH, const ParameterConstRef parameters)
 Constructor. More...
 
virtual ~conn_binding ()
 Destructor. More...
 
generic_objRef bind_port (unsigned int var, direction_type dir)
 Bind variable to a port object. More...
 
generic_objRef bind_command_port (const vertex &ver, direction_type dir, unsigned int mode, const OpGraphConstRef g)
 Bind vertex to a command port object. More...
 
generic_objRef bind_selector_port (direction_type dir, unsigned int mode, const vertex &cond, const OpGraphConstRef data)
 
generic_objRef bind_selector_port (direction_type dir, unsigned int mode, const generic_objRef elem, unsigned int op)
 
generic_objRef get_port (unsigned int var, direction_type dir)
 Returns reference to generic object associated to a given variable, for a specific port direction. More...
 
virtual void print () const
 Function that prints the interconnection binding. More...
 
void add_data_transfer (const generic_objRef op1, const generic_objRef op2, unsigned int operand, unsigned int port_index, data_transfer data)
 Adds a data transfer between two objects. More...
 
void AddConnectionCB (const generic_objRef op1, const generic_objRef op2, unsigned int operand, unsigned int port_index, connection_objRef conn)
 Creates a connection between two objects. More...
 
const std::map< ConnectionTarget, ConnectionSources > & get_data_transfers () const
 Returns the map containing all the data transfers. More...
 
unsigned long long determine_bit_level_mux () const
 Returns the number of bit-level multiplexers. More...
 
const std::map< unsigned int, Selectors > & GetSelectors () const
 
void add_sparse_logic (const generic_objRef so)
 
virtual void add_to_SM (const HLS_managerRef HLSMgr, const hlsRef HLS, const structural_managerRef SM)
 Add the interconnection to the structural representation of the datapath. More...
 
generic_objRef get_constant_obj (const std::string &value, const std::string &param, unsigned int precision)
 
const std::map< const_param, generic_objRef > & get_constant_objs () const
 
void cleanInternals ()
 

Static Public Member Functions

static conn_bindingRef create_conn_binding (const HLS_managerRef _HLSMgr, const hlsRef _HLS, const BehavioralHelperConstRef _BH, const ParameterConstRef _parameters)
 factory method to create the right conn_binding depending on the flow More...
 

Protected Attributes

const ParameterConstRef parameters
 The set of input parameters. More...
 
int debug_level
 control the verbosity during the debugging More...
 

Private Types

using Selectors = std::map< std::pair< generic_objRef, unsigned int >, generic_objRef, GenericObjUnsignedIntSorter >
 selector ports More...
 

Private Member Functions

void specialise_mux (const generic_objRef mux, unsigned int bits_tgt) const
 Specialize a multiplexer according to the type of the variables crossing it. More...
 
void mux_connection (const hlsRef HLS, const structural_managerRef SM)
 Add the mux-based interconnection. More...
 
void add_sparse_logic_dp (const hlsRef HLS, const structural_managerRef SM, const HLS_managerRef HLSMgr)
 Add sparse logic to the datapath. More...
 
void add_command_ports (const HLS_managerRef HLSMgr, const hlsRef HLS, const structural_managerRef SM)
 Add signals from/to controller. More...
 
virtual void mux_allocation (const hlsRef HLS, const structural_managerRef SM, structural_objectRef src, structural_objectRef tgt, connection_objRef conn)
 Add multiplexers to the structural representation of the datapath. More...
 
void add_datapath_connection (const technology_managerRef TM, const structural_managerRef SM, const structural_objectRef src, const structural_objectRef port_tgt, unsigned int conn_type)
 Add a data converter, if needed, between two objects of the structural representation of the datapath. More...
 
bool check_pv_allconnected (structural_objectRef port_i)
 check if a port vector has its port bounded to something More...
 

Private Attributes

int output_level
 control the output verbosity More...
 
const BehavioralHelperConstRef BH
 reference to the behavioral helper associated with the specification More...
 
std::map< vertex, std::map< unsigned int, generic_objRef > > activation_ports
 map between a vertex and the corresponding activation signal More...
 
std::map< unsigned int, generic_objRefinput_ports
 map between input port variable and generic object More...
 
std::map< unsigned int, generic_objRefoutput_ports
 map between output port variable and generic object More...
 
std::map< const_param, generic_objRefconstant_values
 constant values More...
 
std::map< std::string, structural_objectRefconverters
 data type converters More...
 
std::map< std::pair< vertex, unsigned int >, generic_objRefcommand_input_ports
 map between command input port (operation vertex and command type) and generic object More...
 
std::map< vertex, generic_objRefcommand_output_ports
 map between output port variable and generic object More...
 
std::map< unsigned int, Selectorsselectors
 
CustomOrderedSet< generic_objRef, GenericObjSortersparse_logic
 set containing all the sparse logic contained into the datapath More...
 
std::map< ConnectionTarget, ConnectionSourcesconn_variables
 map between the input of the unit and the corresponding incoming connections. More...
 
conn_implementation_map conn_implementation
 map between the connection <src, tgt, tgt_port, tgt_port_index> and the corresponding object More...
 

Static Private Attributes

static unsigned unique_id = 0
 

Detailed Description

Class managing the interconnection binding.

Definition at line 78 of file conn_binding.hpp.

Member Typedef Documentation

◆ conn_implementation_map

Definition at line 107 of file conn_binding.hpp.

◆ connection

using conn_binding::connection = std::tuple<generic_objRef, generic_objRef, unsigned int, unsigned int>

connection between two objects (<src, tgt, tgt_port, tgt_port_index>)

Definition at line 88 of file conn_binding.hpp.

◆ ConnectionSources

definition of sources of a connection

Definition at line 137 of file conn_binding.hpp.

◆ const_param

using conn_binding::const_param = std::tuple<std::string, std::string>

definition of the key to deal with constant parameters

Definition at line 111 of file conn_binding.hpp.

◆ direction_type

using conn_binding::direction_type = enum { IN = 0, OUT }

direction port identifier

Definition at line 82 of file conn_binding.hpp.

◆ Selectors

selector ports

Definition at line 180 of file conn_binding.hpp.

◆ type_t

using conn_binding::type_t = enum { STG = 0 }

type of the data-structure

Definition at line 85 of file conn_binding.hpp.

Constructor & Destructor Documentation

◆ conn_binding()

conn_binding::conn_binding ( const BehavioralHelperConstRef  BH,
const ParameterConstRef  parameters 
)

Constructor.

Definition at line 89 of file conn_binding.cpp.

Referenced by create_conn_binding().

Here is the caller graph for this function:

◆ ~conn_binding()

conn_binding::~conn_binding ( )
virtualdefault

Destructor.

Referenced by create_conn_binding().

Here is the caller graph for this function:

Member Function Documentation

◆ add_command_ports()

void conn_binding::add_command_ports ( const HLS_managerRef  HLSMgr,
const hlsRef  HLS,
const structural_managerRef  SM 
)
private

Add signals from/to controller.

define the type for boolean command signals

check for start port

if elem is a functional unit and has more than one operation, add a selector for each operation (e.g. selector_LOAD_1...)

no port selector means that functional units can implement different operations without using a selector (i.e., it has several alias operation)

output signals to the controller for condition evaluation

Definition at line 952 of file conn_binding.cpp.

References structural_manager::add_connection(), structural_manager::add_module_from_technology_library(), structural_manager::add_port(), structural_manager::add_sign(), hls::allocation_information, BH, bind_selector_port(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpNodeInfo(), generic_obj::COMMAND_PORT, generic_obj::CONNECTION_ELEMENT, debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, FunctionBehavior::DFG, DONE_PORT_NAME, structural_object::find_member(), generic_obj::FUNCTIONAL_UNIT, hls::functionId, fu_binding::get(), fu_binding::get_assign(), structural_manager::get_circ(), AllocationInformation::get_fu(), structural_object::get_id(), fu_binding::get_index(), structural_object::get_kind(), StateTransitionGraphManager::get_mu_ctrls(), GET_NAME, structural_object::get_owner(), structural_object::get_path(), get_port(), generic_obj::get_string(), generic_obj::get_structural_obj(), generic_obj::get_type(), GET_TYPE, hls::HLS_D, INDENT_DBG_MEX, index, generic_obj::MULTI_UNBOUNDED_OBJ, tree_helper::NormalizeTypename(), hls::operations, OR_GATE_STD, port_o_K, port_vector_o_K, hls::Rconn, generic_obj::REGISTER, hls::Rfu, selectors, START_PORT_NAME, hls::STG, STR, THROW_ASSERT, THROW_ERROR, top(), TYPE_EXTERNAL, unique_id, and WENABLE_PORT_NAME.

Referenced by add_to_SM().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_data_transfer()

void conn_binding::add_data_transfer ( const generic_objRef  op1,
const generic_objRef  op2,
unsigned int  operand,
unsigned int  port_index,
data_transfer  data 
)

Adds a data transfer between two objects.

Parameters
op1is reference to first object
op2is reference to second object
operandis i-th operand for second object, where first one is connected
port_indexis i-th port associated with the operand (different from 0 when multi-channels components are considered)
datais the data to be transferred

Definition at line 150 of file conn_binding.cpp.

References conn_variables.

Referenced by mux_connection_binding::connect_to_registers(), mux_connection_binding::create_connections(), and mux_connection_binding::create_single_conn().

Here is the caller graph for this function:

◆ add_datapath_connection()

void conn_binding::add_datapath_connection ( const technology_managerRef  TM,
const structural_managerRef  SM,
const structural_objectRef  src,
const structural_objectRef  port_tgt,
unsigned int  conn_type 
)
private

◆ add_sparse_logic()

void conn_binding::add_sparse_logic ( const generic_objRef  so)
inline

Definition at line 327 of file conn_binding.hpp.

References add_to_SM(), cleanInternals(), create_conn_binding(), get_constant_obj(), get_constant_objs(), param, and symmetry::value.

Referenced by mux_connection_binding::add_conversion(), mux_connection_binding::create_connections(), and mux_connection_binding::determine_connection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_sparse_logic_dp()

void conn_binding::add_sparse_logic_dp ( const hlsRef  HLS,
const structural_managerRef  SM,
const HLS_managerRef  HLSMgr 
)
private

◆ add_to_SM()

void conn_binding::add_to_SM ( const HLS_managerRef  HLSMgr,
const hlsRef  HLS,
const structural_managerRef  SM 
)
virtual

Add the interconnection to the structural representation of the datapath.

add command ports

add sparse logic

up to now, circuit is general about interconnections. Now, proper interconnection architecture will be executed

Reimplemented in conn_binding_cs, and ParallelMemoryConnBinding.

Definition at line 268 of file conn_binding.cpp.

References add_command_ports(), structural_manager::add_connection(), structural_manager::add_constant(), structural_manager::add_sign(), add_sparse_logic_dp(), check_pv_allconnected(), debug_level, DEBUG_LEVEL_VERBOSE, structural_manager::get_circ(), structural_object::get_kind(), get_port(), GET_TYPE_SIZE, INDENT_DBG_MEX, mux_connection(), MUX_INTERCONNECTION_BINDING, hls::Param, port_o_K, port_vector_o_K, sign, STR, and THROW_ASSERT.

Referenced by add_sparse_logic(), ParallelMemoryConnBinding::add_to_SM(), conn_binding_cs::add_to_SM(), and classic_datapath::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddConnectionCB()

void conn_binding::AddConnectionCB ( const generic_objRef  op1,
const generic_objRef  op2,
unsigned int  operand,
unsigned int  port_index,
connection_objRef  conn 
)

Creates a connection between two objects.

Parameters
op1is reference to first object
op2is reference to second object
operandis i-th operand for second object, where first one is connected
port_indexis i-th port associated with the operand (different from 0 when multi-channels components are considered)
connis the reference to the implemented connection

Definition at line 162 of file conn_binding.cpp.

References conn_implementation, debug_level, DEBUG_LEVEL_VERY_PEDANTIC, generic_obj::get_string(), INDENT_DBG_MEX, and STR.

Referenced by mux_connection_binding::input_logic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bind_command_port()

generic_objRef conn_binding::bind_command_port ( const vertex ver,
conn_binding::direction_type  dir,
unsigned int  mode,
const OpGraphConstRef  g 
)

Bind vertex to a command port object.

Parameters
veris the vertex to be associated to the port
diris the direction to be associated to the port
modeis command mode (as defined into commandport_obj::command_type)
gis graph where vertex ver is stored

Definition at line 197 of file conn_binding.cpp.

References command_input_ports, command_output_ports, commandport_obj::get_mode_string(), GET_NAME, and THROW_ERROR.

Referenced by mux_connection_binding::create_connections().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bind_port()

generic_objRef conn_binding::bind_port ( unsigned int  var,
conn_binding::direction_type  dir 
)

Bind variable to a port object.

Parameters
varis the variable to be associated to the port
diris the direction to be associated to the port

Definition at line 171 of file conn_binding.cpp.

References BH, input_ports, output_ports, and THROW_ERROR.

Referenced by conn_binding_creator::add_parameter_ports().

Here is the caller graph for this function:

◆ bind_selector_port() [1/2]

generic_objRef conn_binding::bind_selector_port ( conn_binding::direction_type  dir,
unsigned int  mode,
const vertex cond,
const OpGraphConstRef  data 
)

◆ bind_selector_port() [2/2]

generic_objRef conn_binding::bind_selector_port ( conn_binding::direction_type  dir,
unsigned int  mode,
const generic_objRef  elem,
unsigned int  op 
)

Definition at line 226 of file conn_binding.cpp.

References commandport_obj::get_mode_string(), generic_obj::get_string(), selectors, and STR.

Here is the call graph for this function:

◆ check_pv_allconnected()

bool conn_binding::check_pv_allconnected ( structural_objectRef  port_i)
private

check if a port vector has its port bounded to something

Parameters
port_i
Returns
true in case all ports are bounded to something, false otherwise.

Definition at line 253 of file conn_binding.cpp.

References get_port().

Referenced by add_to_SM().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanInternals()

void conn_binding::cleanInternals ( )

Definition at line 1303 of file conn_binding.cpp.

References command_input_ports, command_output_ports, and conn_variables.

Referenced by add_sparse_logic(), and mux_connection_binding::InternalExec().

Here is the caller graph for this function:

◆ create_conn_binding()

conn_bindingRef conn_binding::create_conn_binding ( const HLS_managerRef  _HLSMgr,
const hlsRef  _HLS,
const BehavioralHelperConstRef  _BH,
const ParameterConstRef  _parameters 
)
static

factory method to create the right conn_binding depending on the flow

Parameters
_HLSMgr
_HLS
_BH
_parameters
Returns

Definition at line 97 of file conn_binding.cpp.

References conn_binding(), hls::functionId, and ~conn_binding().

Referenced by add_sparse_logic(), and mux_connection_binding::create_connections().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ determine_bit_level_mux()

unsigned long long conn_binding::determine_bit_level_mux ( ) const

Returns the number of bit-level multiplexers.

Definition at line 928 of file conn_binding.cpp.

References conn_implementation.

Referenced by mux_connection_binding::InternalExec().

Here is the caller graph for this function:

◆ get_constant_obj()

generic_objRef conn_binding::get_constant_obj ( const std::string &  value,
const std::string &  param,
unsigned int  precision 
)

Definition at line 750 of file conn_binding.cpp.

References constant_values, and THROW_ASSERT.

Referenced by add_sparse_logic(), and mux_connection_binding::determine_connection().

Here is the caller graph for this function:

◆ get_constant_objs()

const std::map< conn_binding::const_param, generic_objRef > & conn_binding::get_constant_objs ( ) const

Definition at line 762 of file conn_binding.cpp.

References constant_values.

Referenced by classic_datapath::add_ports(), and add_sparse_logic().

Here is the caller graph for this function:

◆ get_data_transfers()

const std::map< conn_binding::ConnectionTarget, conn_binding::ConnectionSources > & conn_binding::get_data_transfers ( ) const

Returns the map containing all the data transfers.

Definition at line 157 of file conn_binding.cpp.

References conn_variables.

Referenced by mux_connection_binding::mux_interconnection().

Here is the caller graph for this function:

◆ get_port()

generic_objRef conn_binding::get_port ( unsigned int  var,
conn_binding::direction_type  dir 
)

Returns reference to generic object associated to a given variable, for a specific port direction.

Parameters
varis variable associated with the port
diris port direction
Returns
reference to the generic object of the port associated to given variable, into given direction

Definition at line 134 of file conn_binding.cpp.

References input_ports, output_ports, THROW_ASSERT, and THROW_ERROR.

Referenced by add_command_ports(), classic_datapath::add_ports(), ParallelMemoryConnBinding::add_to_SM(), fu_binding::add_to_SM(), add_to_SM(), check_pv_allconnected(), conn_binding_cs::instantiate_suspension_component(), and mux_connection().

Here is the caller graph for this function:

◆ GetSelectors()

const std::map<unsigned int, Selectors>& conn_binding::GetSelectors ( ) const
inline

Definition at line 322 of file conn_binding.hpp.

References selectors.

Referenced by ControllerCreatorBaseStep::add_command_ports(), top_entity::add_command_signals(), and fsm_controller::create_state_machine().

Here is the caller graph for this function:

◆ mux_allocation()

void conn_binding::mux_allocation ( const hlsRef  HLS,
const structural_managerRef  SM,
structural_objectRef  src,
structural_objectRef  tgt,
connection_objRef  conn 
)
privatevirtual

◆ mux_connection()

void conn_binding::mux_connection ( const hlsRef  HLS,
const structural_managerRef  SM 
)
private

◆ print()

void conn_binding::print ( ) const
virtual

Function that prints the interconnection binding.

Definition at line 910 of file conn_binding.cpp.

References conn_implementation, generic_obj::get_string(), INDENT_OUT_MEX, output_level, OUTPUT_LEVEL_VERY_PEDANTIC, str, and STR.

Referenced by mux_connection_binding::InternalExec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ specialise_mux()

void conn_binding::specialise_mux ( const generic_objRef  mux,
unsigned int  bits_tgt 
) const
private

Specialize a multiplexer according to the type of the variables crossing it.

Parameters
muxis the multiplexer
bits_tgtis the bitwidth of the target port

specializing multiplexer ports

Definition at line 529 of file conn_binding.cpp.

References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, module::get_in_port(), module::get_out_port(), structural_object::get_path(), generic_obj::get_structural_obj(), INDENT_DBG_MEX, max, STR, and structural_object::type_resize().

Referenced by mux_allocation().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ activation_ports

std::map<vertex, std::map<unsigned int, generic_objRef> > conn_binding::activation_ports
private

map between a vertex and the corresponding activation signal

Definition at line 156 of file conn_binding.hpp.

Referenced by bind_selector_port().

◆ BH

const BehavioralHelperConstRef conn_binding::BH
private

reference to the behavioral helper associated with the specification

Definition at line 153 of file conn_binding.hpp.

Referenced by add_command_ports(), and bind_port().

◆ command_input_ports

std::map<std::pair<vertex, unsigned int>, generic_objRef> conn_binding::command_input_ports
private

map between command input port (operation vertex and command type) and generic object

Definition at line 171 of file conn_binding.hpp.

Referenced by bind_command_port(), and cleanInternals().

◆ command_output_ports

std::map<vertex, generic_objRef> conn_binding::command_output_ports
private

map between output port variable and generic object

Definition at line 174 of file conn_binding.hpp.

Referenced by bind_command_port(), and cleanInternals().

◆ conn_implementation

conn_implementation_map conn_binding::conn_implementation
private

map between the connection <src, tgt, tgt_port, tgt_port_index> and the corresponding object

Definition at line 197 of file conn_binding.hpp.

Referenced by AddConnectionCB(), determine_bit_level_mux(), mux_connection(), and print().

◆ conn_variables

std::map<ConnectionTarget, ConnectionSources> conn_binding::conn_variables
private

map between the input of the unit and the corresponding incoming connections.

The key <tgt, tgt_port, tgt_port_index> is the target of the connection, while the value is a set of pairs <src, variable>

Definition at line 194 of file conn_binding.hpp.

Referenced by add_data_transfer(), cleanInternals(), and get_data_transfers().

◆ constant_values

std::map<const_param, generic_objRef> conn_binding::constant_values
private

constant values

Definition at line 165 of file conn_binding.hpp.

Referenced by get_constant_obj(), and get_constant_objs().

◆ converters

std::map<std::string, structural_objectRef> conn_binding::converters
private

data type converters

Definition at line 168 of file conn_binding.hpp.

Referenced by add_datapath_connection().

◆ debug_level

int conn_binding::debug_level
protected

◆ input_ports

std::map<unsigned int, generic_objRef> conn_binding::input_ports
private

map between input port variable and generic object

Definition at line 159 of file conn_binding.hpp.

Referenced by bind_port(), and get_port().

◆ output_level

int conn_binding::output_level
private

control the output verbosity

Definition at line 149 of file conn_binding.hpp.

Referenced by print().

◆ output_ports

std::map<unsigned int, generic_objRef> conn_binding::output_ports
private

map between output port variable and generic object

Definition at line 162 of file conn_binding.hpp.

Referenced by bind_port(), and get_port().

◆ parameters

const ParameterConstRef conn_binding::parameters
protected

The set of input parameters.

Definition at line 142 of file conn_binding.hpp.

Referenced by ParallelMemoryConnBinding::add_to_SM().

◆ selectors

std::map<unsigned int, Selectors> conn_binding::selectors
private

Definition at line 182 of file conn_binding.hpp.

Referenced by add_command_ports(), bind_selector_port(), and GetSelectors().

◆ sparse_logic

CustomOrderedSet<generic_objRef, GenericObjSorter> conn_binding::sparse_logic
private

set containing all the sparse logic contained into the datapath

Definition at line 188 of file conn_binding.hpp.

Referenced by add_sparse_logic_dp().

◆ unique_id

unsigned conn_binding::unique_id = 0
staticprivate

Definition at line 199 of file conn_binding.hpp.

Referenced by add_command_ports().


The documentation for this class was generated from the following files:

Generated on Mon Feb 12 2024 13:03:48 for PandA-2024.02 by doxygen 1.8.13