44 #include "config_HAVE_ASSERTS.hpp" 45 #include "config_HAVE_TECHNOLOGY_BUILT.hpp" 46 #include "config_RELEASE.hpp" 68 #include <boost/algorithm/string/replace.hpp> 69 #include <boost/iterator/iterator_facade.hpp> 70 #include <boost/iterator/iterator_traits.hpp> 78 inline std::string
legalize(
const std::string&
id)
87 "REAL",
"USER",
"VECTOR_BOOL",
"VECTOR_INT",
88 "VECTOR_UINT",
"VECTOR_REAL",
"VECTOR_USER",
"UNKNOWN"};
92 for(
int i = 0; i <
UNKNOWN; i++)
107 std::string type_string;
187 os <<
"Bool {" <<
id_type <<
"} ";
197 os <<
"Int {" <<
id_type <<
"} ";
202 os <<
"size=" <<
size <<
" ";
208 os <<
"Unsigned Int {" <<
id_type <<
"} ";
213 os <<
"size=" <<
size <<
" ";
221 os <<
"Real {" <<
id_type <<
"} ";
226 os <<
"size=" <<
size <<
" ";
231 os <<
"User type {" <<
id_type <<
"} ";
236 os <<
"size=" <<
size <<
" ";
257 os <<
"size=" <<
size <<
" ";
268 os <<
"size=" <<
size <<
" ";
279 os <<
"size=" <<
size <<
" ";
290 os <<
"size=" <<
size <<
" ";
294 os <<
"Other type {" <<
id_type <<
"} ";
312 if(_vector_size == 0)
314 if(type_name ==
"bool")
319 else if(type_name ==
"int")
324 else if(type_name ==
"unsigned int")
329 else if(type_name ==
"float")
334 else if(type_name ==
"double")
339 else if(type_name ==
"long double")
344 else if(type_name ==
"long long double")
356 if(type_name ==
"bool")
361 else if(type_name ==
"int")
366 else if(type_name ==
"unsigned int")
371 else if(type_name ==
"float")
376 else if(type_name ==
"double")
381 else if(type_name ==
"long double")
386 else if(type_name ==
"long long double")
400 unsigned int type_index = helper->
get_type(index);
406 const unsigned int unqualified_type = helper->
GetUnqualified(type_index);
407 if(unqualified_type == 0)
425 const auto element_type = helper->
GetElements(type_index);
426 const auto element_size = helper->
get_size(element_type);
433 else if(helper->
is_int(element_type))
441 else if(helper->
is_real(element_type))
453 const auto element_type = helper->
GetElements(type_index);
454 const auto element_size = helper->
get_size(element_type);
461 else if(helper->
is_int(element_type))
469 else if(helper->
is_real(element_type))
485 else if(helper->
is_int(index))
493 else if(helper->
is_real(index))
530 (src_type->
id_type.find(
"tlm_fifo<") != std::string::npos &&
531 (dest_type->
id_type.find(
"tlm_blocking_put_if<") != std::string::npos ||
532 dest_type->
id_type.find(
"tlm_blocking_get_if<") != std::string::npos)) ||
533 (dest_type->
id_type.find(
"tlm_fifo<") != std::string::npos &&
534 (src_type->
id_type.find(
"tlm_blocking_put_if<") != std::string::npos ||
535 src_type->
id_type.find(
"tlm_blocking_get_if<") != std::string::npos))
544 src_type->
print(std::cout);
545 dest_type->
print(std::cout);
590 black_box(o ? o->black_box : black_box_DEFAULT),
605 #if HAVE_TECHNOLOGY_BUILT 608 if(std::find(attribute_list.begin(), attribute_list.end(), name) == attribute_list.end())
610 attribute_list.push_back(name);
612 attributes[name] = attribute;
615 attributeRef structural_object::get_attribute(
const std::string& name)
const 617 THROW_ASSERT(attributes.find(name) != attributes.end(),
"attribute " + name +
" does not exist");
618 return attributes.find(name)->second;
621 const std::vector<std::string>& structural_object::get_attribute_list()
const 623 return attribute_list;
683 "BOOL only supports single bit values: " + std::to_string(new_bit_size) +
" - " +
get_path());
696 std::to_string(new_bit_size));
729 if(
type->
size < new_bit_size * new_vec_size)
731 type->
size = new_bit_size * new_vec_size;
743 std::to_string(new_bit_size) +
"(" +
STR(new_vec_size) +
")");
759 #if HAVE_TECHNOLOGY_BUILT 760 dest->attribute_list = attribute_list;
761 dest->attributes = attributes;
798 " New default: " + default_value);
813 ret[default_parameter.first] = default_parameter.second;
817 ret[parameter.first] = parameter.second;
822 #if HAVE_TECHNOLOGY_BUILT 829 return GetPointer<functional_unit>(tn)->CM->get_circ();
832 GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU))
834 return GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU)->CM->get_circ();
844 const std::string& name)
const 846 const auto module_type = get_generic_object(TM);
847 const auto default_value = module_type->GetDefaultParameter(name);
848 if(default_value.substr(0, 2) ==
"\"\"" and default_value.substr(default_value.size() - 2, 2) ==
"\"\"")
852 if(default_value.front() ==
'\"' and default_value.back() ==
'\"')
854 const auto content_string = default_value.substr(1, default_value.size() - 2);
855 for(
const auto character : content_string)
857 if(character !=
'0' and character !=
'1')
864 if(std::regex_search(default_value, std::regex(
"^\\d+\\.\\d+$")))
868 if(default_value.front() >=
'0' and default_value.front() <=
'9')
872 if(default_value ==
"-1")
879 return GetPointer<const module>(GetPointer<const module>(
get_owner())->get_generic_object(TM))
880 ->get_parameter_type(TM, name);
908 bool has_structural_type_descriptor =
false;
911 for(
const auto& iter : list)
913 const auto* EnodeC = GetPointer<const xml_element>(iter);
923 has_structural_type_descriptor =
true;
926 else if(EnodeC->get_name() ==
"parameter")
942 "A structural object has to have a type." + std::to_string(Enode->
get_line()));
967 WRITE_XNVM2(
"name", default_parameter.first, Enode_parameter);
973 #if HAVE_TECHNOLOGY_BUILT 981 os <<
"SO: " <<
id <<
" {" <<
type <<
"}";
1008 aligment(port_interface_alignment_DEFAULT),
1009 is_var_args(is_var_args_DEFAULT),
1010 is_clock(is_clock_DEFAULT),
1011 is_extern(is_extern_DEFAULT),
1012 is_global(is_global_DEFAULT),
1013 is_reverse(is_reverse_DEFAULT),
1014 is_memory(is_memory_DEFAULT),
1015 is_slave(is_slave_DEFAULT),
1016 is_master(is_master_DEFAULT),
1017 is_data_bus(is_data_bus_DEFAULT),
1018 is_addr_bus(is_addr_bus_DEFAULT),
1019 is_size_bus(is_size_bus_DEFAULT),
1020 is_tag_bus(is_tag_bus_DEFAULT),
1021 is_doubled(is_doubled_DEFAULT),
1022 is_halved(is_halved_DEFAULT),
1023 is_critical(is_critical_DEFAULT),
1025 port_type(_port_type)
1027 #if HAVE_TECHNOLOGY_BUILT 1028 std::string direction;
1031 direction =
"input";
1035 direction =
"output";
1037 attributeRef dir_attribute(
new attribute(attribute::STRING, direction));
1038 add_attribute(
"direction", dir_attribute);
1049 get_path() +
": port cannot be connected to an object of type: " + std::string(s->
get_kind_text()));
1052 if(connected_object.lock() == s)
1059 s->
get_owner() == connected_object.lock()->get_owner()),
1060 "The port " +
get_path() +
" can have only one signal. " + s->
get_path() +
" and " +
1061 connected_object.lock()->get_path());
1063 connected_objects.push_back(s);
1072 if((*del).lock() == s)
1093 if((*del).lock() == s)
1109 "Multiple signal connected to the same port: " +
get_path());
1110 sigObj = connected_object.lock();
1119 bool existing =
false;
1122 auto del_curr = del;
1124 if(del_curr->lock() == new_conn)
1128 else if(del_curr->lock() == old_conn)
1130 removed.insert(del_curr);
1139 auto deli = removed.begin();
1140 for(; deli != removed.end(); ++deli)
1149 if(connected_object.lock() == old_conn)
1151 connected_object = new_conn;
1176 for(
const auto& p :
ports)
1357 "The owner of the port_vector has to have an owner " +
get_id());
1360 unsigned int port_count = 0;
1375 if(connected_object.lock()->get_kind() ==
port_o_K || connected_object.lock()->get_kind() ==
signal_o_K ||
1378 if(connected_object.lock()->get_owner()->get_kind() ==
port_vector_o_K and
1379 connected_object.lock()->get_owner()->get_owner() != f_owner)
1383 if((connected_object.lock()->get_owner()->get_kind() !=
port_vector_o_K and
1384 connected_object.lock()->get_owner() != f_owner))
1389 else if(connected_object.lock()->get_owner()->get_kind() ==
port_vector_o_K ||
1392 if(connected_object.lock()->get_owner()->get_owner() != f_owner)
1400 if(connected_object.lock()->get_owner() == _owner->
get_owner())
1402 res = connected_object.lock();
1405 else if((connected_object.lock()->get_owner()->get_kind() ==
port_vector_o_K ||
1407 (connected_object.lock()->get_owner()->get_owner() == _owner->
get_owner() ||
1408 connected_object.lock()->get_owner()->get_owner() == _owner->
get_owner()->get_owner()))
1410 res = connected_object.lock();
1413 else if(connected_object.lock()->get_kind() ==
constant_o_K)
1415 res = connected_object.lock();
1428 for(
const auto& connected_object : connected_objects)
1430 INDENT_DBG_MEX(0, 0,
"---" + connected_object.lock()->get_path());
1445 auto* conn = GetPointer<signal_o>(
key);
1446 for(
unsigned int k = 0;
k < conn->get_connected_objects_size();
k++)
1448 if(conn->get_port(
k)->get_id() ==
get_id())
1464 for(
const auto& port :
ports)
1466 if(port->get_id() == key->
get_id())
1500 if(connected_object.lock()->get_kind() == _type && connected_object.lock()->get_id() == _id &&
1501 connected_object.lock()->get_owner() == _owner)
1503 return connected_object.lock();
1506 for(
const auto& port :
ports)
1508 if(port->get_id() == _id && port->get_owner() == _owner)
1530 GetPointer<port_o>(dest)->
dir =
dir;
1531 GetPointer<port_o>(dest)->
end =
end;
1532 GetPointer<port_o>(dest)->
pi =
pi;
1551 if(GetPointer<port_o>(dest)->ports.size() ==
ports.size())
1554 for(
const auto& i :
ports)
1561 else if(GetPointer<port_o>(dest)->
ports.size() == 0)
1563 for(
const auto& i :
ports)
1567 GetPointer<port_o>(dest)->ports.push_back(port);
1570 else if(
ports.size() != 0)
1573 " sizeDST=" +
STR(GetPointer<port_o>(dest)->ports.size()));
1575 GetPointer<port_o>(dest)->
lsb =
lsb;
1604 std::string dir_string;
1610 std::string pi_string;
1687 for(
const auto& iter : list)
1689 const auto* EnodeC = GetPointer<const xml_element>(iter);
1696 THROW_ASSERT(
CE_XVM(
dir, EnodeC),
"Port has to have a direction." + std::to_string(EnodeC->get_line()));
1697 std::string dir_string;
1700 "port and port_vector objects has to have the same direction");
1702 obj->
xload(EnodeC, obj, CM);
1703 ports.push_back(obj);
1704 auto _id =
static_cast<unsigned>(std::stoul(obj->
get_id()));
1723 for(i = 0; i < port_direction::UNKNOWN; i++)
1725 if(val ==
GetString(static_cast<port_direction>(i)))
1736 for(i = 0; i <= port_interface::PI_DEFAULT; i++)
1738 if(val ==
GetString(static_cast<port_interface>(i)))
1751 std::string tlm_directionality;
1753 if(id_type.find(
"put_if", 0) != std::string::npos)
1755 tlm_directionality =
"->";
1757 else if(id_type.find(
"get_if", 0) != std::string::npos)
1759 tlm_directionality =
"<-";
1761 else if(id_type.find(
"transport_if", 0) != std::string::npos)
1763 tlm_directionality =
"<->";
1767 tlm_directionality =
"--";
1769 if(tlm_directionality !=
"--")
1776 if(
pi != port_interface::PI_DEFAULT)
1849 for(
auto& port :
ports)
1851 port->xwrite(Enode);
1855 #if HAVE_TECHNOLOGY_BUILT 1863 for(
const auto& o : attribute_list)
1866 attr->xwrite(pin_node, o);
1876 if(
pi != port_interface::PI_DEFAULT)
1890 os << connected_object.lock()->get_path() +
"-" +
convert_so_short(connected_object.lock()->get_kind()) <<
" ";
1892 if(connected_objects.size())
1899 PP(os,
"[Ports:\n");
1901 for(
const auto& port :
ports)
1917 THROW_ERROR(
"Events do not have associated any structural object");
1956 THROW_ERROR(
"data objects do not have associated any structural object");
2008 return static_cast<unsigned int>(
parameters.size());
2070 parameter->copy(obj);
2098 if(parameter->get_id() == _id)
2109 if(i->get_id() == _id)
2155 for(
const auto& iter : list)
2157 const auto* EnodeC = GetPointer<const xml_element>(iter);
2165 obj->xload(EnodeC, obj, CM);
2171 obj->xload(EnodeC, obj, CM);
2185 parameter->xwrite(Enode);
2202 PP(os,
"ACTION:\n");
2207 PP(os,
"Method/procedure Parameters:\n");
2211 parameter->print(os);
2218 PP(os,
"Sensitivity List:\n");
2224 os <<
"Scope " <<
scope <<
" ";
2225 os << (action_type !=
SERVICE ?
"PROCESS" :
"SERVICE");
2253 "constant can be connected only to ports and signals, but not to " + std::string(p->
get_kind_text()));
2257 if(connected_object.lock() == p)
2262 connected_objects.push_back(p);
2293 if(connected_object.lock()->get_kind() == _type && connected_object.lock()->get_id() == _id &&
2294 connected_object.lock()->get_owner() == _owner)
2296 return connected_object.lock();
2323 auto* conn = GetPointer<signal_o>(
key);
2324 for(
unsigned int k = 0;
k < conn->get_connected_objects_size();
k++)
2326 if(conn->get_port(
k)->get_id() ==
get_id())
2360 std::string id_string;
2387 PP(os,
"CONSTANT:\n");
2390 PP(os,
"Value: " +
value +
"; ");
2397 os << connected_object.lock()->get_path() +
"-" +
convert_so_short(connected_object.lock()->get_kind()) <<
" ";
2399 if(connected_objects.size())
2424 THROW_ASSERT(GetPointer<port_o>(p),
"A port is expected");
2427 if(connected_object.lock() == p)
2432 connected_objects.push_back(p);
2450 THROW_ASSERT(GetPointer<port_o>(s),
"A port is expected");
2454 if((*del).lock() == s)
2475 if((*del).lock() == s)
2488 if((*del).lock() == new_conn)
2498 if((*del_old).lock() == old_conn)
2512 if(connected_object.lock() == old_conn)
2514 connected_object = new_conn;
2518 THROW_ASSERT(GetPointer<port_o>(connected_object.lock()),
"Expected port");
2541 if(GetPointer<port_o>((*it).lock()))
2543 auto* port = GetPointer<port_o>((*it).lock());
2544 if(port->get_port_direction() == port_o::IN || port->get_port_direction() == port_o::IO)
2553 if(GetPointer<port_o>((*it).lock()))
2555 auto* port = GetPointer<port_o>((*it).lock());
2556 if(port->get_port_direction() == port_o::OUT || port->get_port_direction() == port_o::IO)
2563 if(in_port && out_port)
2570 if(GetPointer<port_o>((*it).lock()))
2572 auto* first_port = GetPointer<port_o>((*it).lock());
2576 if(GetPointer<port_o>((*it2).lock()))
2578 auto* second_port = GetPointer<port_o>((*it2).lock());
2580 if(first_owner == second_owner->get_owner() || second_owner == first_owner->get_owner())
2601 if(connected_object.lock()->get_id() == _id && connected_object.lock()->get_owner() == _owner)
2603 return connected_object.lock();
2612 if(signal->get_id() == _id && signal->get_owner() == _owner)
2647 GetPointer<signal_o>(dest)->signals_.push_back(sig);
2649 GetPointer<signal_o>(dest)->
lsb =
lsb;
2671 ->find_isomorphic(key->
get_owner()->get_owner())
2678 return get_owner()->find_isomorphic(key);
2692 if(signal->get_id() == key->
get_id())
2718 std::string _id =
get_id();
2719 if(_id.find(
'\\') != std::string::npos)
2727 std::string
base = _id;
2728 boost::replace_all(base,
"\\",
"");
2729 base = base.substr(0, base.find_first_of(
'['));
2730 std::string element = _id;
2731 element = element.substr(element.find_first_of(
'[') + 1, element.size());
2732 element = element.substr(0, element.find_first_of(
']'));
2737 THROW_ASSERT(pv,
"port vector " + base +
" not found");
2739 THROW_ASSERT(p,
"port element " + element +
" not found");
2740 GetPointer<signal_o>(_owner)->
add_port(p);
2741 GetPointer<port_o>(p)->add_connection(_owner);
2749 for(
const auto& iter : list)
2751 const auto* EnodeC = GetPointer<const xml_element>(iter);
2759 obj->
xload(EnodeC, obj, CM);
2761 auto sig_id =
static_cast<unsigned>(std::stoul(obj->
get_id()));
2787 signal->xwrite(Enode);
2793 PP(os,
"SIGNAL:\n");
2801 os << connected_object.lock()->get_path() +
"-" +
convert_so_short(connected_object.lock()->get_kind()) <<
" ";
2803 if(connected_objects.size())
2810 PP(os,
"[Signals:\n");
2825 THROW_ASSERT(_owner.
get() ==
this,
"owner and this has to be the same object");
2830 for(
unsigned int i = 0; i < n_signals; i++)
2834 p->
set_id(std::to_string(i));
2857 return static_cast<unsigned int>(
signals_.size());
2862 last_position_port(0),
2864 is_generated(
false),
2865 multi_unit_multiplicity(0),
2866 keep_hierarchy(
false)
2924 THROW_ASSERT((GetPointer<port_o>(p) && GetPointer<port_o>(p)->get_port_direction() == port_o::IN),
2925 "The parameter p is not an input port");
2941 return static_cast<unsigned int>(
in_ports.size());
2947 THROW_ASSERT((GetPointer<port_o>(p) && GetPointer<port_o>(p)->get_port_direction() == port_o::OUT),
2948 "The parameter p is not an output port");
2963 return static_cast<unsigned int>(
out_ports.size());
2969 THROW_ASSERT((GetPointer<port_o>(p) && GetPointer<port_o>(p)->get_port_direction() == port_o::IO),
2970 "The parameter p is not an input-output port");
2991 THROW_ASSERT((GetPointer<port_o>(p) && GetPointer<port_o>(p)->get_port_direction() == port_o::GEN),
2992 "The parameter p is not a generic port");
3007 return static_cast<unsigned int>(
gen_ports.size());
3012 auto num_port =
static_cast<unsigned int>(
positional_map.size());
3016 if(l.second->get_id() == _id)
3025 std::map<unsigned int, structural_objectRef> _positional_map =
positional_map;
3026 positional_map.clear();
3027 for(
auto& l : _positional_map)
3029 if(l.first == num_port)
3033 if(l.first < num_port)
3035 positional_map[l.first] = l.second;
3039 positional_map[l.first - 1] = l.second;
3044 if(GetPointer<port_o>(port)->get_port_direction() == port_o::IN)
3047 for(
unsigned int i = 0; i <
in_ports.size(); i++)
3064 if(GetPointer<port_o>(port)->get_port_direction() == port_o::OUT)
3067 for(
unsigned int i = 0; i <
out_ports.size(); i++)
3084 if(GetPointer<port_o>(port)->get_port_direction() == port_o::IO)
3105 if(GetPointer<port_o>(port)->get_port_direction() == port_o::GEN)
3108 for(
unsigned int i = 0; i <
gen_ports.size(); i++)
3288 return static_cast<unsigned int>(
local_data.size());
3314 structural_objectRef _owner, std::vector<std::pair<std::string, structural_objectRef>>& computed_parameters)
const 3316 std::vector<std::string>
param;
3318 auto it_end = param.end();
3319 for(
auto it = param.begin(); it != it_end; ++it)
3322 computed_parameters.push_back(std::make_pair(*it, obj));
3329 THROW_ASSERT(_owner && _owner.get() ==
this,
"owner mismatch");
3351 if(in_out_port->get_id() == _id)
3358 if(gen_port->get_id() == _id)
3415 if(i->get_id() == _id)
3426 if(i->get_id() == _id)
3437 if(list_of_proces->get_id() == _id)
3439 return list_of_proces;
3444 if(i->get_id() == _id)
3459 unsigned int currPort = 0;
3461 for(currPort = 0; currPort < inPortSize; currPort++)
3463 if(GetPointer<port_o>(
get_in_port(currPort))->get_is_var_args())
3510 dir = GetPointer<port_o>(port)->get_port_direction();
3515 dir = GetPointer<port_o>(port)->get_port_direction();
3520 THROW_ERROR(
"Not expected object type: " + std::string(port->get_kind_text()));
3542 case port_o::TLM_IN:
3543 case port_o::TLM_INOUT:
3544 case port_o::TLM_OUT:
3545 case port_o::UNKNOWN:
3562 switch(int_obj->get_kind())
3593 THROW_ERROR(
"Not expected type: " + std::string(int_obj->get_kind_text()));
3604 std::vector<structural_objectRef> ports;
3607 ports.push_back(int_obj);
3608 for(
unsigned int p = 0; p < GetPointer<port_o>(int_obj)->get_ports_size(); p++)
3610 ports.push_back(GetPointer<port_o>(int_obj)->get_port(p));
3615 ports.push_back(int_obj);
3617 for(
const auto& port_obj : ports)
3621 " - copying the connections of port: " << port_obj->get_path());
3622 const port_o* port = GetPointer<port_o>(port_obj);
3623 for(
unsigned int c = 0; c < port->get_connections_size(); c++)
3626 std::string connected_path = conn_obj->
get_path();
3627 if(connected_path.find(scope +
"/") == std::string::npos)
3637 GetPointer<signal_o>(dest_obj)->add_port(dest_port);
3650 GetPointer<port_o>(dest_obj)->add_connection(dest_port);
3656 GetPointer<constant_o>(dest_obj)->add_connection(dest_port);
3663 " - adding connection between " << dest_port->
get_path() <<
" and " 3665 GetPointer<port_o>(dest_port)->add_connection(dest_obj);
3675 " - copying the connections of constant: " << int_obj->
get_path());
3676 const constant_o* constant = GetPointer<constant_o>(int_obj);
3677 for(
unsigned int i = 0; i < constant->get_connected_objects_size(); i++)
3680 std::string connected_path = conn_obj->
get_path();
3681 if(connected_path.find(scope +
"/") == std::string::npos)
3701 if(GetPointer<port_o>(dest_obj))
3703 GetPointer<port_o>(dest_obj)->add_connection(dest_el);
3711 " - adding connection between " << dest_el->
get_path() <<
" and " << dest_obj->
get_path());
3712 GetPointer<constant_o>(dest_el)->add_connection(dest_obj);
3719 std::vector<structural_objectRef> signal_objs;
3722 for(
unsigned int p = 0; p < GetPointer<signal_o>(int_obj)->get_signals_size(); p++)
3724 signal_objs.push_back(GetPointer<signal_o>(int_obj)->get_signal(p));
3727 signal_objs.push_back(int_obj);
3728 for(
const auto& signal_obj : signal_objs)
3732 " - copying the connections of signal: " << signal_obj->get_path());
3733 const signal_o* sig = GetPointer<signal_o>(signal_obj);
3734 for(
unsigned int c = 0; c < sig->get_connected_objects_size(); c++)
3737 std::string connected_path = conn_obj->
get_path();
3738 if(connected_path.find(scope +
"/") == std::string::npos)
3760 GetPointer<port_o>(dest_obj)->add_connection(signal_el);
3767 " - adding connection between " << signal_el->
get_path() <<
" and " 3769 GetPointer<signal_o>(signal_el)->add_port(dest_obj);
3776 THROW_ERROR(
"Copy of bus connections is not yet supported");
3781 THROW_ERROR(
"Copy of bus connections is not yet supported");
3814 for(
const auto&
in_port : in_ports)
3842 for(
const auto&
out_port : out_ports)
3865 if(in_out_port->get_id() == key->
get_id())
3870 for(
const auto& in_out_port : in_out_ports)
3876 if(key->
get_owner()->get_id() != in_out_port->get_id())
3893 if(gen_port->get_id() == key->
get_id())
3901 case port_o::TLM_IN:
3902 case port_o::TLM_INOUT:
3903 case port_o::TLM_OUT:
3904 case port_o::UNKNOWN:
3953 return it->second->find_isomorphic(key);
3979 std::vector<std::string> connections;
3981 for(
const auto& itC : listC)
3983 const auto* EnodeCC = GetPointer<const xml_element>(itC);
3988 if(EnodeCC->get_name() ==
"connected_objects")
3991 auto it_end = Alist.end();
3992 for(
auto it = Alist.begin(); it != it_end; ++it)
3994 connections.push_back((*it)->get_value());
4006 std::map<structural_objectRef, std::vector<std::string>> connections;
4011 for(
const auto& iter : list)
4013 const auto* EnodeC = GetPointer<const xml_element>(iter);
4018 if(!EnodeC or EnodeC->get_name() ==
"parameter")
4026 THROW_ASSERT(
CE_XVM(dir, EnodeC),
"Port has to have a direction." + std::to_string(EnodeC->get_line()));
4027 std::string dir_string;
4034 obj->
xload(EnodeC, obj, CM);
4041 obj->
xload(EnodeC, obj, CM);
4043 for(
const auto& iterC : listC)
4045 const auto* EnodeCC = GetPointer<const xml_element>(iterC);
4050 std::string id_string;
4079 case port_o::TLM_IN:
4080 case port_o::TLM_INOUT:
4081 case port_o::TLM_OUT:
4082 case port_o::UNKNOWN:
4093 obj->
xload(EnodeC, obj, CM);
4100 obj->
xload(EnodeC, obj, CM);
4108 obj->
xload(EnodeC, obj, CM);
4111 for(
const auto& iterC : listC)
4113 const auto* EnodeCC = GetPointer<const xml_element>(iterC);
4118 std::string id_string;
4128 obj->
xload(EnodeC, obj, CM);
4136 obj->
xload(EnodeC, obj, CM);
4143 obj->
xload(EnodeC, obj, CM);
4150 obj->
xload(EnodeC, obj, CM);
4157 obj->
xload(EnodeC, obj, CM);
4158 GetPointer<module>(_owner)->
add_event(obj);
4164 obj->
xload(EnodeC, obj, CM);
4165 if(GetPointer<action_o>(obj)->get_process_nservice())
4185 THROW_WARNING(
"description is missing for " + EnodeC->get_name());
4198 THROW_WARNING(
"copyright is missing for " + EnodeC->get_name());
4211 THROW_WARNING(
"authors are missing for " + EnodeC->get_name());
4224 THROW_WARNING(
"license is missing for " + EnodeC->get_name());
4237 THROW_WARNING(
"specialization identifier is missing for " + EnodeC->get_name());
4250 THROW_WARNING(
"multi_unit_multiplicity identifier is missing for " + EnodeC->get_name());
4254 std::string multi_unit_multiplicitySTR = text->
get_content();
4264 THROW_WARNING(
"keep_hierarchy identifier is missing for " + EnodeC->get_name());
4268 std::string keep_hierarchySTR = text->
get_content();
4270 keep_hierarchy =
static_cast<bool>(std::stoi(keep_hierarchySTR));
4275 THROW_ERROR(
"Internal object not yet supported: " + EnodeC->get_name());
4280 const std::string& scope =
get_path();
4282 for(
auto& connection : connections)
4284 obj = connection.first;
4286 const std::vector<std::string>& conns = connection.second;
4289 <<
"): " << conns.size());
4290 for(
const auto& conn : conns)
4293 if(conn.find(scope +
"/") == std::string::npos)
4297 std::string connected_path = conn;
4298 connected_path = connected_path.substr(scope.size() + 1, connected_path.size());
4301 " * Connected to " + connected_path <<
": " << elements.size());
4303 if(elements.size() == 1)
4308 GetPointer<constant_o>(connnected_object)->add_connection(obj);
4313 GetPointer<signal_o>(connnected_object)->add_port(obj);
4318 GetPointer<port_o>(connnected_object)->add_connection(obj);
4322 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4325 else if(elements.size() == 2)
4331 if((connnected_object = connnected_object->find_member(elements[1],
port_o_K, connnected_object)))
4333 GetPointer<port_o>(connnected_object)->add_connection(obj);
4337 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4342 if((connnected_object = connnected_object->find_member(elements[1],
port_o_K, connnected_object)))
4344 GetPointer<port_o>(connnected_object)->add_connection(obj);
4348 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4353 if((connnected_object = connnected_object->find_member(elements[1],
signal_o_K, connnected_object)))
4355 GetPointer<signal_o>(connnected_object)->add_port(obj);
4359 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4364 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4367 else if(elements.size() == 3)
4372 if((connnected_object = connnected_object->find_member(elements[1],
port_vector_o_K, connnected_object)))
4374 if((connnected_object = connnected_object->find_member(elements[2],
port_o_K, connnected_object)))
4376 GetPointer<port_o>(connnected_object)->add_connection(obj);
4380 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4385 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4390 THROW_ERROR(
"Connected object " + connected_path +
" cannot be found");
4395 THROW_ERROR(
"Not supported connected size: " + std::to_string(elements.size()));
4397 THROW_ASSERT(connnected_object,
"Connected object not correctly identified: " + conn);
4399 " - Identified connection with " + connnected_object->get_path());
4400 if(GetPointer<constant_o>(obj))
4402 GetPointer<constant_o>(obj)->add_connection(connnected_object);
4404 else if(GetPointer<port_o>(obj))
4406 GetPointer<port_o>(obj)->add_connection(connnected_object);
4408 else if(GetPointer<signal_o>(obj))
4410 GetPointer<signal_o>(obj)->add_port(connnected_object);
4469 in_out_port->xwrite(rootnode);
4477 gen_port->xwrite(rootnode);
4484 internal_object->xwrite(rootnode);
4492 i->xwrite(rootnode);
4500 i->xwrite(rootnode);
4508 list_of_proces->xwrite(rootnode);
4516 i->xwrite(rootnode);
4526 #if HAVE_TECHNOLOGY_BUILT 4529 structural_object::xwrite_attributes(rootnode, tn);
4535 in_port->xwrite_attributes(rootnode, tn);
4542 out_port->xwrite_attributes(rootnode, tn);
4549 in_out_port->xwrite_attributes(rootnode, tn);
4557 PP(os,
"MODULE:\n");
4562 for(
unsigned int i = 0; i <
in_ports.size(); i++)
4564 os <<
"In " << i + 1 <<
") " <<
in_ports[i];
4569 for(
unsigned int i = 0; i <
out_ports.size(); i++)
4571 os <<
"Out " << i + 1 <<
") " <<
out_ports[i];
4584 for(
unsigned int i = 0; i <
gen_ports.size(); i++)
4586 os <<
"GenP " << i + 1 <<
") " <<
gen_ports[i];
4600 for(
unsigned int i = 0; i <
local_data.size(); i++)
4602 os <<
"D " << i + 1 <<
") " <<
local_data[i];
4644 THROW_ASSERT(GetPointer<port_o>(port),
"Expected a port_o object");
4645 THROW_ASSERT(GetPointer<port_o>(port)->get_port_direction() != pdir,
"No need to change the direction");
4646 std::string _id = port->
get_id();
4647 if(GetPointer<port_o>(port)->get_port_direction() == port_o::IN)
4650 for(
unsigned int i = 0; i <
in_ports.size(); i++)
4666 else if(pdir == port_o::IN)
4671 if(GetPointer<port_o>(port)->get_port_direction() == port_o::OUT)
4674 for(
unsigned int i = 0; i <
out_ports.size(); i++)
4690 else if(pdir == port_o::OUT)
4695 if(GetPointer<port_o>(port)->get_port_direction() == port_o::IO)
4715 else if(pdir == port_o::IO)
4720 if(GetPointer<port_o>(port)->get_port_direction() == port_o::GEN)
4723 for(
unsigned int i = 0; i <
gen_ports.size(); i++)
4739 else if(pdir == port_o::GEN)
4744 GetPointer<port_o>(port)->set_port_direction(pdir);
4756 NP_descriptions->add_NP_functionality(
4793 #if HAVE_TECHNOLOGY_BUILT 4796 module::xwrite_attributes(rootnode, tn);
4823 THROW_ASSERT(GetPointer<port_o>(p),
"A port is expected");
4852 if(connected_object.lock()->get_id() == _id && connected_object.lock()->get_owner() == _owner)
4854 return connected_object.lock();
4881 GetPointer<channel_o>(dest)->
add_interface(it->first, it->second);
4904 return get_owner()->find_isomorphic(key);
4936 for(
const auto& iter : list)
4938 const auto* EnodeC = GetPointer<const xml_element>(iter);
4943 if(EnodeC->get_name() ==
"impl_interfaces")
4946 auto it_end = Alist.end();
4947 for(
auto it = Alist.begin(); it != it_end; ++it)
4949 impl_interfaces[
static_cast<unsigned>(std::stoul((*it)->get_name().substr(2)))] = (*it)->get_value();
4963 WRITE_XNVM2(
"II" + std::to_string(it->first), it->second, Enode_II);
4972 #if HAVE_TECHNOLOGY_BUILT 4975 module::xwrite_attributes(rootnode, tn);
4986 PP(os,
"List of the interfaces:\n");
4990 os <<
" @(" << impl_interface.first <<
") " << impl_interface.second;
4995 os << connected_object.lock()->get_path() +
"-" +
convert_so_short(connected_object.lock()->get_kind()) <<
" ";
5018 return static_cast<unsigned int>(
connections.size());
5037 if(connection.lock()->get_id() == _id && connection.lock()->get_owner() == _owner)
5039 return connection.lock();
5078 PP(os,
"BUS CONNECTION:\n");
5083 PP(os,
"List of connections:\n");
5087 os << connection.lock()->get_path() +
"-" +
convert_so_short(connection.lock()->get_kind()) <<
" ";
5095 THROW_ASSERT(_owner.
get() ==
this,
"owner and this has to be the same object");
5096 THROW_ASSERT(n_ports != PARAMETRIC_PORT,
"a number of port different from PARAMETRIC_PORT is expected");
5099 unsigned int currentPortNumber = this->get_ports_size();
5100 for(
unsigned int i = 0; i < n_ports; i++)
5104 p->
set_id(std::to_string(currentPortNumber + i));
5120 return static_cast<unsigned int>(ports.size());
5134 unsigned long long bus_data_bitsize,
unsigned long long bus_tag_bitsize,
5137 const auto bus_bitsize = GetPointer<port_o>(port)->get_is_data_bus() ? bus_data_bitsize :
5138 GetPointer<port_o>(port)->get_is_addr_bus() ? bus_addr_bitsize :
5139 GetPointer<port_o>(port)->get_is_size_bus() ? bus_size_bitsize :
5140 GetPointer<port_o>(port)->get_is_tag_bus() ? bus_tag_bitsize :
5147 for(
auto pi = 0
U; pi < GetPointer<port_o>(port)->get_ports_size(); ++
pi)
5149 const auto port_d = GetPointer<port_o>(port)->get_port(
pi);
5150 port_d->type_resize(bus_bitsize);
5163 "---Specializing port " + port->
get_path() +
" " +
STR(bitsize_variable));
5166 THROW_ASSERT(GetPointer<port_o>(port)->get_ports_size(),
5167 "Number of ports not specialized for " + port->
get_path());
5168 for(
unsigned int pi = 0; pi < GetPointer<port_o>(port)->get_ports_size(); ++
pi)
5179 "---Specializing port " + port->
get_path() +
" " +
STR(bitsize_variable) +
":" +
STR(n_elements));
5182 THROW_ASSERT(GetPointer<port_o>(port)->get_ports_size(),
"Number of ports not specialized");
5183 for(
unsigned int pi = 0; pi < GetPointer<port_o>(port)->get_ports_size(); ++
pi)
5186 port_d->
type_resize(bitsize_variable, n_elements);
5195 if(GetPointer<port_o>(port_i)->get_port_interface() != port_o::port_interface::PI_DEFAULT)
5197 GetPointer<port_o>(cir_port)->set_port_interface(GetPointer<port_o>(port_i)->get_port_interface());
5199 if(GetPointer<port_o>(port_i)->get_port_alignment() != port_interface_alignment_DEFAULT)
5201 GetPointer<port_o>(cir_port)->set_port_alignment(GetPointer<port_o>(port_i)->get_port_alignment());
5203 if(GetPointer<port_o>(port_i)->get_is_extern())
5205 GetPointer<port_o>(cir_port)->set_is_extern(
true);
5207 if(GetPointer<port_o>(port_i)->get_is_global())
5209 GetPointer<port_o>(cir_port)->set_is_global(
true);
5211 if(GetPointer<port_o>(port_i)->get_is_memory())
5213 GetPointer<port_o>(cir_port)->set_is_memory(
true);
5215 if(GetPointer<port_o>(port_i)->get_is_slave())
5217 GetPointer<port_o>(cir_port)->set_is_slave(
true);
5219 if(GetPointer<port_o>(port_i)->get_is_master())
5221 GetPointer<port_o>(cir_port)->set_is_master(
true);
5223 if(GetPointer<port_o>(port_i)->get_is_data_bus())
5225 GetPointer<port_o>(cir_port)->set_is_data_bus(
true);
5227 if(GetPointer<port_o>(port_i)->get_is_addr_bus())
5229 GetPointer<port_o>(cir_port)->set_is_addr_bus(
true);
5231 if(GetPointer<port_o>(port_i)->get_is_size_bus())
5233 GetPointer<port_o>(cir_port)->set_is_size_bus(
true);
5235 if(GetPointer<port_o>(port_i)->get_is_tag_bus())
5237 GetPointer<port_o>(cir_port)->set_is_tag_bus(
true);
5239 if(GetPointer<port_o>(port_i)->get_is_doubled())
5241 GetPointer<port_o>(cir_port)->set_is_doubled(
true);
5243 if(GetPointer<port_o>(port_i)->get_is_halved())
5245 GetPointer<port_o>(cir_port)->set_is_halved(
true);
5249 #define __TO_STRING_HELPER(r, data, elem) {data::elem, BOOST_PP_STRINGIZE(elem)}, 5250 #define TO_STRING(enum_type, elem_list) \ 5251 static const std::unordered_map<enum enum_type, std::string> to_string = { \ 5252 BOOST_PP_SEQ_FOR_EACH(__TO_STRING_HELPER, enum_type, elem_list)} 5257 return to_string.at(v);
5263 return to_string.at(v);
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
void set_is_doubled(bool c)
set the is_doubled attribute.
void remove_connection(structural_objectRef s)
remove a connection (signal/port) from this
void print(std::ostream &os) const override
Print the bus_connection_o (for debug purpose)
void substitute_connection(structural_objectRef old_conn, structural_objectRef new_conn)
bool is_reverse
when true the port is dumped as [0:msb-1] instead of [msb-1:0]
virtual unsigned long long get_size(unsigned int var) const
Return the size in bit of a C object.
std::vector< structural_objectRef > list_of_event
List of event associated with the module.
virtual bool is_a_complex(unsigned int index) const
Return true if index is a variable or a type of type complex.
void set_action_type(process_type at)
Set the type of the action.
static const bool is_addr_bus_DEFAULT
void remove_internal_object(structural_objectRef s)
void copy(structural_objectRef dest) const override
Perform a copy of the module.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
void remove_port(const std::string &id)
remove a port from the module
std::vector< structural_objectRef > local_data
List of local data associated with the module.
void set_description(const std::string &d)
Set the description associated with the module.
unsigned int get_ports_size() const
Return the number of ports.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
std::string get_bus_bundle() const
Returns the bus bundle identifier, if any.
static const char * s_typeNames[]
store the names of the enumerative s_type.
void copy(structural_objectRef dest) const override
Perform a copy of the component.
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.
void xwrite(xml_element *rootnode) override=0
Add a structural_object to an xml tree.
This class describes a generic data declaration object.
refcount< NP_functionality > NP_functionalityRef
RefCount type definition of the connection class structure.
void set_is_global(bool c)
set the is_global attribute.
const structural_objectRef get_internal_object(unsigned int n) const
Return the ith internal objects.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
const std::string & get_interface(unsigned int t) const
Return the interface with a given treenode.
void set_is_var_args(bool c)
set the is var_args attribute.
void set_port_size(unsigned int dim)
Set port size.
unsigned int get_connected_objects_size() const
Return the number of ports associated with the connection.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
bool get_is_memory() const
return true if the port is a memory port
Structure representing the most relevant information about the type of a structural object...
const structural_objectRef get_signal(unsigned int n) const
Return the ith port of the vector.
void set_multi_unit_multiplicity(unsigned int value)
set_multi_unit_multiplicity
const std::string & get_id() const
Return the identifier associated with the structural_object.
bool get_is_addr_bus() const
return true if the port works as an address bus
structural_objectRef find_bounded_object(const structural_objectConstRef f_owner=structural_objectConstRef()) const
Find the object bounded to the port.
std::vector< structural_objectRef > signals_
The list of signals associated with the vector of signals.
bool get_critical() const
return if the component is critical or not
std::map< std::string, structural_objectRef > index_channels
index for channels this table is used to quickly search internal channels used by find_member and fin...
Simple pretty print functor.
so_kind
Enumerative type for structural object classes, it is used with get_kind() function to know the actua...
char base
This version is stamped on May 10, 2016.
std::list< xml_attribute * > attribute_list
const structural_objectRef get_port(unsigned int n) const
Return the ith port of the vector.
void set_generated()
set the component as generated
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
void set_scope(const std::string &sc)
Set the scope of the action.
bus_connection_o(int debug_level, const structural_objectRef o)
Constructor.
static std::string GetString(enum port_direction)
std::string description
Store the module description.
This class describes a port associated with a component or a channel.
const std::vector< std::string > SplitString(const std::string &input, const std::string &separators)
Function which splits a string into tokens.
std::string get_kind_text() const override
return the name of the class as a string.
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
unsigned int get_service_size() const
Return the number of services.
static const bool black_box_DEFAULT
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
bool is_a_vector(unsigned int variable) const
Return true if index is a variable or a type of type vector.
This class describes a generic channel.
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
bool is_critical
when true the signal is involved into the critical path of the netlist
static const bool is_memory_DEFAULT
unsigned int get_out_port_size() const
Return the number of output ports.
void set_owner(const structural_objectRef new_owner)
set the owner of the structural object
bool get_critical() const
return if the component is critical or not
bool is_data_bus
when true the port is a data bus
void set_is_extern(bool c)
set the is_extern attribute.
void set_license(const std::string &l)
Set the license associated with the module.
std::string specialized
when non empty it defines with respect what module has been specialized
void set_is_tag_bus(bool c)
set the is_tag_bus attribute.
void add_event_to_sensitivity(structural_objectRef e)
Add an event to the sensitivity list of the action.
std::vector< structural_objectRef > list_of_service
List of services associated with the module.
std::map< std::string, structural_objectRef > index_bus_connections
index for bus_connections this table is used to quickly search internal bus_connections used by find_...
CustomOrderedMap< T, U > CustomMap
void print(std::ostream &os) const override
Print the component (for debug purpose)
exceptions managed by PandA
port_direction dir
direction of a port
bool get_is_halved() const
return true if the port has a halved size w.r.t the precision
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
const structural_objectRef get_in_port(unsigned int n) const
Return the ith input port.
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...
virtual std::string print_type(unsigned int type, bool global=false, bool print_qualifiers=false, bool print_storage=false, unsigned int var=0, const var_pp_functorConstRef vppf=var_pp_functorConstRef(), const std::string &prefix="", const std::string &tail="") const
Print a type and its variable in case var is not zero.
void add_port(structural_objectRef p)
Bind the connection object with a port.
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
bool is_connected(structural_objectRef s) const
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
void copy(structural_objectRef dest) const override
Perform a copy of the data.
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
Definition of hash function for EdgeDescriptor.
void remove_port(structural_objectRef s)
remove the connection of this signal with a port
bool is_critical
when true the port is involved into the critical path of the netlist
void copy(structural_objectRef dest) const override
Perform a copy of the action.
void set_bus_bundle(const std::string &name)
Sets the bus bundle identifier.
std::vector< structural_objectRef > in_out_ports
Input-output ports of this module.
void print(std::ostream &os) const override
Print the constant value (for debug purpose)
void set_treenode(unsigned int n)
Set the treenode id associated with the structural_object.
unsigned int get_internal_objects_size() const
Return the number of internal objects.
xml_text_node * add_child_text(const std::string &content)
Append a new text node.
unsigned int get_connected_objects_size() const
Return the number of ports associated with the connection.
bool get_is_var_args() const
return true if the port is a var_args
This class describes a generic systemC action.
Class specification of the manager of the technology library data structures.
structural_type_descriptorRef type
The description of the type.
virtual bool is_an_array(unsigned int variable) const
Return true if index is a variable or a type of type array.
void add_connection(structural_objectRef p)
Bind the element object with a port/signal.
std::vector< structural_objectRef > gen_ports
generic ports of this module
unsigned int get_event_size() const
Return the number of events.
bool is_size_bus
when true the port is a size bus
std::map< std::string, structural_objectRef > index_constants
index for constants this table is used to quickly search internal constants used by find_member and f...
#define PORT_DIRECTION_ENUM
void set_fun_id(unsigned int id)
Function that set the function with the action.
std::string legalize(const std::string &id)
void copy(structural_objectRef dest) const override
Perform a copy of the channel.
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override=0
Load a structural_object starting from an xml file.
std::string convert_so_short(so_kind in) const
Convert a so_kind in a short string.
const structural_objectRef get_parameter(unsigned int n) const
Return the ith input parameter.
virtual bool is_unsigned(unsigned int index) const
Return true if index is a variable or a type of type unsigned int.
bool is_halved
when true the port has a halfed size
unsigned int get_multi_unit_multiplicity() const
get_multi_unit_multiplicity
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
void set_critical()
set the port as critical with respect to the timing path
data_o(int debug_level, const structural_objectRef o)
Constructor.
unsigned int get_gen_port_size() const
Return the number of generic ports.
const structural_objectRef get_process(unsigned int n) const
Return the ith process.
std::string GetParameter(std::string name) const
Get the value associated to parameter if it has been associated; if it has not specified returns the ...
so_kind port_type
port type
void copy(structural_objectRef dest) const override
Perform a copy of the event.
unsigned int get_signals_size() const
Return the number of ports.
void set_is_data_bus(bool c)
set the is_data attribute.
virtual void xwrite(xml_element *Enode)
Add a structural_object to an xml tree.
#define THROW_WARNING(str_expr)
helper function used to throw a warning in a standard way: though it uses PRINT_DBG_MEX, the debug level used is such that the message is always printed
static const bool is_master_DEFAULT
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
static const bool is_extern_DEFAULT
static const char * process_typeNames[]
Redefinition of get_kind_text()
s_type type
The type of the port or the signal.
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
port_direction
Enumerative type describing the direction of a port.
bool get_is_size_bus() const
return true if the port works as a size bus
bool is_extern
when true the port is an extern port
static const bool is_reverse_DEFAULT
unsigned long long size
The size of the object (in bit). The objects having a size are: ports, signals, channels, data, and actions.
std::map< unsigned int, std::string > impl_interfaces
List of the interfaces associated with the channel.
unsigned int function_id
The index of the function which represents the behavior.
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
virtual bool is_a_pointer(unsigned int variable) const
Return true if index is a variable or a type of type pointer.
std::string copyright
Store the copyright description.
static bool check_type(structural_type_descriptorRef src_type, structural_type_descriptorRef dest_type)
Check if two type descriptors are consistent.
virtual void AddParameter(const std::string &name, const std::string &default_value)
Add a parameter.
bool is_connected(structural_objectRef s) const
std::string id
Identifier for this component.
std::vector< structural_objectRef > parameters
The method procedure parameter.
bool is_addr_bus
when true the port is an address bus
const structural_objectRef get_event(unsigned int n) const
Return the ith event.
unsigned int get_local_data_size() const
Return the number of local data.
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
enum so_kind get_kind() const override
return the type of the class
#define PORT_INTERFACE_ENUM
#define ASSERT_PARAMETER(parameter)
virtual std::string get_kind_text() const =0
Virtual function used to get the string name of a structural_object instance.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
void set_is_slave(bool c)
set the is_slave attribute.
static const bool is_size_bus_DEFAULT
const structural_objectRef get_port(unsigned int n) const
Return the ith port bounded to the connection.
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
bool is_generated
when true the component has been internally generated
void set_port_alignment(unsigned int algn)
Set the port interface alignment.
bool get_is_extern() const
return true if the port is extern
s_type
Define the possible type of a structural object.
void set_is_clock(bool c)
set the is clock attribute.
bool is_var_args() const
True if one of the ports of the module has the attribute is_var_args=true.
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
void xload(const xml_element *Enode)
Load a NP_functionality starting from an xml file.
const structural_objectRef get_connection(unsigned int n) const
Return a connection.
structural_objectRef get_connection(unsigned int idx) const
Return the ith element bounded to the connection.
static const unsigned int vector_size_DEFAULT
unsigned int get_parameters_size() const
Return the number of the parameters.
void set_is_memory(bool c)
set the is_memory attribute.
static const uint32_t k[]
std::string GetDefaultParameter(std::string name) const
Get the value associated to parameter if it has been associate; It throws an exception if it has not ...
void add_out_port(structural_objectRef p)
Add an output port.
std::vector< Wrefcount< structural_object > > connected_objects
List of ports bound to the signal object.
#define TO_STRING(enum_type, elem_list)
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
port_endianess
Enumerative type describing the endianess of a port; NONE means that it has not been specified yet...
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.
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
unsigned int get_treenode() const
Return the treenode id associated with the structural_object.
void get_NP_library_parameters(structural_objectRef owner, std::vector< std::pair< std::string, structural_objectRef >> ¶meters) const
Return the list of object that can be parametrized.
bool get_keep_hierarchy() const
get_keep_hierarchy
const NP_functionalityRef & get_NP_functionality() const
Return the alternative functionalities.
static port_direction to_port_direction(const std::string &val)
Convert a string into the corresponding port_direction enumerative type.
port_interface
Enum type describing if the port is associated with a specific interface type.
std::vector< Wrefcount< structural_object > > connected_objects
List of ports bounded by the channel object.
void print(std::ostream &os) const override
Print the signal (for debug purpose)
unsigned int get_sensitivity_size() const
Return tha size of the sensitivity list.
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
static bool resize_if_busport(unsigned long long bus_size_bitsize, unsigned long long bus_addr_bitsize, unsigned long long bus_data_bitsize, unsigned long long bus_tag_bitsize, structural_objectRef port)
auxiliary function used to resize the bus ports with respect to their associated bus size ...
#define LOAD_XVFM(variable, node, field)
LOAD XML Value for field Macro. Set a variable starting from an XML value. Conversion is performed if...
unsigned int treenode
Treenode id of the type.
const structural_objectRef get_out_port(unsigned int n) const
Return the ith output port.
std::vector< structural_objectRef > action_sensitivity
Sensitivity list.
bool get_reverse() const
Returns if the port as to be printed in a reverse mode.
structural_objectRef get_positional_port(unsigned int index) const
return a port of the module given its position
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
bool get_is_global() const
return true if the port is global
process_type
Define the possible types of a process.
static const unsigned int PARAMETRIC_SIGNAL
bool is_memory
when true the port is a memory port
virtual void print(std::ostream &os) const
Print the structural_object (for debug purpose)
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
void add_interface(unsigned int t, const std::string &_interface)
Add an interface to the object.
port_o(int debug_level, const structural_objectRef o, port_direction dir, so_kind _port_type)
Constructor.
bool is_master
when true the port is a master port
static const bool is_var_args_DEFAULT
std::vector< structural_objectRef > in_ports
input port of this module
std::string get_kind_text() const
Definition of get_kind_text()
redefinition of set to manage ordered/unordered structures
static const unsigned int treenode_DEFAULT
virtual enum tec_kind get_kind() const =0
Virtual function used to find the real type of a technology_nodeinstance.
std::map< std::string, structural_objectRef > index_signals
index for signals this table is used to quickly search internal signals used by find_member and find_...
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
void print(std::ostream &os) const
Print the Non-SystemC based functionality description (for debug purpose).
unsigned int get_num_ports() const
Return the total number of the ports.
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
unsigned int treenode
index of the treenode in the tree_manager associated with the structural object.
void add_parameter(structural_objectRef d)
Add a procedure paramenter.
bool get_is_master() const
return true if the port works as master memory port
void print(std::ostream &os) const override
Print the module (for debug purpose)
virtual bool is_int(unsigned int index) const
Return true if index is a variable or a type of type int.
channel_o(int debug_level, const structural_objectRef o)
Constructor.
bool get_is_clock() const
return true if the port is a clock
static const bool is_doubled_DEFAULT
void set_black_box(bool bb)
Set the black box property associated with the structural_object.
void add_service(structural_objectRef p)
Add a service to the module.
const structural_objectRef get_gen_port(unsigned int n) const
Return the ith generic port.
void substitute_port(structural_objectRef old_conn, structural_objectRef new_conn)
static const bool is_slave_DEFAULT
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
static void fix_port_properties(structural_objectRef port_i, structural_objectRef cir_port)
copy the port properties from port_i to cir_port
int get_line() const
Discover at what line number this node occurs in the XML file.
void SetParameter(const std::string &name, const std::string &value)
Set a parameter value.
static simple_indent PP
pretty print functor object used by all print members to indent the output of the print function...
void set_NP_functionality(NP_functionalityRef f)
Set the alternative module behavior descriptions (Non SystemC based).
virtual enum so_kind get_kind() const =0
Virtual function used to find the real type of a structural_object instance.
virtual bool is_bool(unsigned int index) const
Return true if index is a variable or a type of type bool.
void print(std::ostream &os) const override
Print the port (for debug purpose)
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
void print(std::ostream &os) const override
Print the data declaration object (for debug purpose).
This class describes a generic bus connection.
const structural_objectRef get_port(unsigned int n) const
Return the ith port bounded to the connection.
const structural_objectRef get_positional_signal(unsigned int n) const
Return the ith port of the vector with respect to lsb.
void add_port(structural_objectRef p)
Bind the connection object with a port.
unsigned int GetUnqualified(const unsigned int index) const
Return the unqualified version of a type.
unsigned int get_fun_id() const
Return the function id.
struct definition of the field attr on function_decl, field_decl, var_decl tree node.
This file collects some utility functions and macros.
#define GET_CLASS_NAME(meth)
Macro returning the name of a class.
int get_debug_level() const
void add_in_port(structural_objectRef p)
Add an input port.
std::list< xml_nodeRef > node_list
type for list of xml nodes
void xwrite(xml_element *rootnode)
Add a NP_functionality to an xml tree.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
void add_process(structural_objectRef p)
Add a process to the module.
void print(std::ostream &os) const override
Print the event (for debug purpose)
void add_connection(structural_objectRef s)
Bind this port with a signal/port.
bool get_is_doubled() const
return true if the port has a doubled size w.r.t the precision
unsigned long long get_port_size() const
Get port size.
std::string get_kind_text() const override
return the name of the class as a string.
port_interface pi
port interface type of a port
process_type action_type
The type of the action.
static const bool is_halved_DEFAULT
void xload(const xml_element *Enode, structural_type_descriptorRef owner)
Load a structural_type_descriptor starting from an xml file.
void type_resize(unsigned long long new_bit_size)
Just resize the size of the bits of the object.
void set_port_endianess(port_endianess end)
Set the endianess of the port.
bool get_generated() const
return if the component has been generated or not
void xwrite(xml_element *rootnode)
Add a structural_type_descriptor to an xml tree.
void add_internal_object(structural_objectRef c)
Add an internal component/channel/signal/bus_connection_o.
#define HIERARCHY_SEPARATOR
static const unsigned int size_DEFAULT
void set_port_interface(port_interface pi)
Set the port interface type of the port.
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
module(int debug_level, const structural_objectRef o)
Constructor.
void add_connection(structural_objectRef c)
Add a connection (e.g.
unsigned int last_position_port
store the last index of the positional binding
virtual bool is_a_struct(unsigned int variable) const
Return true if index is a variable or a type of type struct.
const structural_objectRef get_service(unsigned int n) const
Return the ith service.
void add_n_ports(unsigned int n_ports, structural_objectRef owner)
Specify the number of ports of a generic port_vector object and add its corresponding ports...
void print(std::ostream &os) const override
Print the action (for debug purpose)
port_endianess get_port_endianess() const
Return the endianess of the port.
component_o(int debug_level, const structural_objectRef o)
Constructor.
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
static const bool is_global_DEFAULT
#define WRITE_XNVM2(name, value, node)
WRITE XML Name Value Macro second version. Insert a value in an XML tree given the name of the attrib...
signal_o(int debug_level, const structural_objectRef o, so_kind _signal_type)
Constructor.
unsigned int get_in_port_size() const
Return the number of input ports.
unsigned int get_process_size() const
Return the number of internal processes.
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
std::string value
Value of this element.
This class describes a simple logic/RTL signal.
const structural_objectRef get_local_data(unsigned int n) const
Return the ith local data.
#define GET_TYPE_SIZE(structural_obj)
Macro returning the size of the type of a structural object.
refcount< T > lock() const
Very simple pretty printer functor.
NP_functionalityRef NP_descriptions
Alternative descriptions of the behavior of the module.
unsigned int lsb
least significant bit
virtual bool is_real(unsigned int index) const
Return true if index is a variable or a type of type real.
bool is_critical
when true the component is involved into the critical path of the netlist
std::string id_type
Original type id of the structural object.
void copy(structural_objectRef dest) const override
Perform a copy of the value.
const structural_objectRef get_connection(unsigned int n) const
Return connection bounded to this port.
This class describes all classes used to represent a structural object.
std::string scope
Used to identify the scope of the action (public, private or protected)
const structural_type_descriptorRef & get_typeRef() const
Return the type descriptor of the structural_object.
process_type get_action_type() const
Return the type of the action.
std::map< unsigned int, structural_objectRef > positional_map
positional map, given the index return the port in that position
static port_interface to_port_interface(const std::string &val)
Convert a string into the corresponding port_interface enumerative type.
std::string get_value() const
Return the (integer) value associated with this element.
void add_gen_port(structural_objectRef p)
Add a generic port.
bool black_box
True if the structural object is a black box (e.g., a library component).
unsigned int GetElements(const unsigned int type) const
Given an array or a vector return the element type.
#define WRITE_XNVM(variable, value, node)
WRITE XML Name Value Macro.
static const bool is_data_bus_DEFAULT
bool is_clock
when true the port is a clock port and has to be attached to a clock object
void set_id(const std::string &s)
Set the identifier associated with the structural_object.
bool is_tag_bus
when true the port is a tag bus
bool get_process_nservice() const
Return the type of the action: process (true) or services (false).
const structural_objectRef get_owner() const
Return the owner.
std::vector< structural_objectRef > ports
The list of ports associated with the port.
#define WRITE_XVM(variable, node)
WRITE XML Value Macro. Insert a value in an XML tree.
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
virtual void copy(structural_objectRef dest) const
Perform a copy of the structural object.
void set_port_direction(port_direction dir)
Set the direction of the port.
std::string license
Store some tags concerning the license type associated with the functional unit.
void set_keep_hierarchy(bool ky)
set_keep_hierarchy
int debug_level
debug level for the object
void add_n_signals(unsigned int n_signals, structural_objectRef owner)
Specify the number of ports of a generic port_vector object and add its corresponding ports...
void set_is_size_bus(bool c)
set the is_size_bus attribute.
bool ExistsParameter(std::string name) const
Check if a parameter has been specified.
bool get_critical() const
return if the component is critical or not
std::vector< Wrefcount< structural_object > > connected_objects
The list of connections associated with the port.
Wrefcount< structural_object > owner
The owner of the object.
bool get_is_tag_bus() const
return true if the port works as an tag bus
std::string get_content() const
Get the text of this content node.
void change_port_direction(structural_objectRef port, port_o::port_direction pdir)
change the direction of a port
structural_type_descriptor()
Constructor.
refcount< structural_object > structural_objectRef
RefCount type definition of the structural_object class structure.
port_interface get_port_interface() const
Return the port interface type of the port.
virtual bool is_an_union(unsigned int variable) const
Return true if index is a variable of a type of type union.
static const bool is_tag_bus_DEFAULT
unsigned int get_connections_size() const
Return the number of connections associated with the bus connection object.
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
std::string size_parameter
custom size parameter
void set_is_master(bool c)
set the is_master attribute.
event_o(int debug_level, const structural_objectRef o)
Constructor.
void add_local_data(structural_objectRef d)
Add a local data.
std::vector< Wrefcount< structural_object > > connected_objects
List of ports bounded by the constant object.
void AddParameter(const std::string &name, const std::string &default_value) override
Add a parameter.
This class describes a generic event.
#define DEBUG_PARAMETER(parameter)
macro used to solve problem of parameters used only in not-release
static const s_type type_DEFAULT
bool get_black_box() const
Return the black box property.
void set_copyright(const std::string &c)
Set the copyright associated with the module.
virtual unsigned int get_type(const unsigned int var) const
Return the type of the variable.
void set_is_addr_bus(bool c)
set the is_addr_bus attribute.
structural_objectRef find_isomorphic(const structural_objectRef key) const override
Find key in this object.
#define LOAD_XVM(variable, node)
LOAD XML Value Macro. Set a variable starting from an XML value. Conversion is performed if needed...
bool get_is_slave() const
return true if the port works as slave memory port
const structural_objectRef get_in_out_port(unsigned int n) const
Return the ith input-output port.
constant_o(int debug_level, const structural_objectRef o)
Constructor.
const structural_objectRef get_sensitivity(unsigned int n) const
Return a specific event of the sensitivity list.
Some macro used to interface with the XML library.
node_list const & get_children()
Obtain the list of child nodes.
std::vector< structural_objectRef > out_ports
output ports of this module
Not parsed functionality manager.
so_kind signal_type
port type
const std::string & get_scope() const
Return the scope of the action.
std::string bus_bundle
bus bundle
std::vector< structural_objectRef > internal_objects
internal components/channels/signals/bus_connection_os (for structural modules)
unsigned long long get_size() const
Return the size associated with this element (in bits)
Class implementation of the structural_manager.
This class describes a generic component.
bool is_slave
when true the port is a slave port
Class specification of the manager for each library.
static void resize_std_port(unsigned long long bitsize_variable, unsigned long long n_elements, int debug_level, structural_objectRef port)
auxiliary function used to resize the standard ports
static const unsigned int treenode_DEFAULT
CustomMap< std::string, std::string > parameters
Map between parameter string and related values of an instance.
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
void copy(structural_objectRef dest) const override
Perform a copy of the bus_connection_o.
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
bool is_var_args
when true the port must be specialized at runtime depending on the number of input ...
unsigned int get_connections_size() const
Return the number of connections bounded to this port.
void print(std::ostream &os) const
function that prints the class.
This class describes a constant value.
bool exist_NP_functionality(NP_functionaly_type type) const
Return true in case there exist a functionaly of the given type.
static void convert_escaped(std::string &ioString)
Convert escaped characters.
structural_objectRef find_member(const std::string &id, so_kind type, const structural_objectRef owner) const override
Return the object named id of a given type which belongs to or it is associated with the object...
CustomMap< std::string, std::string > default_parameters
Map between parameter string and its default value.
structural_object(int debug_level, const structural_objectRef o)
Constructor for the structural_object.
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
std::map< std::string, structural_objectRef > index_components
index for components this table is used to quickly search internal components used by find_member and...
bool get_is_data_bus() const
return true if the port works as a data bus
unsigned int get_port_alignment() const
Return the port interface alignment.
static const bool is_clock_DEFAULT
void set_authors(const std::string &a)
Set the authors associated with the module.
Not parsed functionality descriptor of a module.
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
virtual void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM)
Load a structural_object starting from an xml file.
This class describes a generic module.
void add_in_out_port(structural_objectRef p)
Add an input-output port.
const std::string get_name() const
Returns the name of the type descriptor.
void xload(const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override
Load a structural_object starting from an xml file.
bool is_full_connected() const
Return if signal has both input and output.
void set_is_halved(bool c)
set the is_halved attribute.
bool keep_hierarchy
when true the module has the keep_hierarchy attribute active
std::string authors
Store the list of authors.
unsigned int get_in_out_port_size() const
Return the number of output ports.
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
void set_reverse()
Sets the port as reverse.
bool is_doubled
when true the port has a doubled size
Base object for all the structural objects.
void set_critical()
set the component as critical with respect to the timing path
port_endianess end
endianess of a port
structural_objectRef get_connected_signal() const
Return the connected signal, if any.
bool is_global
when true the port is a global port
void print(std::ostream &os) const override
Print the channel (for debug purpose)
std::vector< std::string > get_connections(const xml_element *node)
port_direction get_port_direction() const
Return the direction of the port.
virtual structural_objectRef find_isomorphic(const structural_objectRef key) const =0
Find key in this object.
void xwrite(xml_element *rootnode) override
Add a structural_object to an xml tree.
CustomMap< std::string, std::string > GetParameters() const
return the whole set of parameters
std::vector< Wrefcount< structural_object > > connections
List of connections associated with the bus.
void copy(structural_objectRef dest) const override
Perform a copy of the signal.
void add_event(structural_objectRef e)
Add an event to the module.
action_o(int debug_level, const structural_objectRef o)
Constructor.
void set_critical()
set the signal as critical with respect to the timing path
static const bool is_critical_DEFAULT
unsigned long long vector_size
The number of the elements of a vector.
void copy(structural_type_descriptorRef dest)
Method that copies the contents of the current structural_type_descriptorRef into another structural_...
void set_type(const structural_type_descriptorRef &s)
Set the type of the structural_object.
std::vector< structural_objectRef > list_of_process
List of processes associated with the module.
static const unsigned port_interface_alignment_DEFAULT
unsigned int multi_unit_multiplicity
multi-unit multiplicity is the number of units implemented by this module all doing the same thing ...
void get_library_parameters(std::vector< std::string > ¶meters) const
fill a vector with the library parameters in case it there exists a LIBRARY based description...
void copy(structural_objectRef dest) const override
Perform a copy of the port.
unsigned int get_connected_objects_size() const
Return the number of ports associated with the connection.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...