48 #include "config_HAVE_ASSERTS.hpp" 49 #include "config_HAVE_EXPERIMENTAL.hpp" 50 #include "config_HAVE_FLOPOCO.hpp" 51 #include "config_PACKAGE_BUGREPORT.hpp" 52 #include "config_PACKAGE_NAME.hpp" 53 #include "config_PACKAGE_VERSION.hpp" 69 #include <boost/tokenizer.hpp> 74 #include <boost/algorithm/string.hpp> 75 #include <boost/algorithm/string/case_conv.hpp> 102 TM(_device->get_technology_manager()),
104 flopo_wrap(new
flopoco_wrapper(_parameters->getOption<int>(OPT_debug_level),
105 _device->get_parameter<
std::string>(
"family"))),
109 debug_level(_parameters->get_class_debug_level(
GET_CLASS(*this)))
117 TM(_device->get_technology_manager()),
119 flopo_wrap(new
flopoco_wrapper(_parameters->getOption<int>(OPT_debug_level),
120 _device->get_parameter<
std::string>(
"family"))),
130 const std::list<structural_objectRef>& components,
131 std::list<std::string>& aux_files)
const 135 writer->write_comment(std::string(
"\n"));
136 writer->write_comment(std::string(
"Politecnico di Milano\n"));
137 writer->write_comment(std::string(
"Code created using ") + PACKAGE_NAME +
" - " +
parameters->PrintVersion() +
141 writer->write_comment(
parameters->getOption<std::string>(OPT_program_name) +
142 " executed with: " +
parameters->getOption<std::string>(OPT_cat_args) +
"\n");
145 writer->write_comment(
"\n");
146 writer->write_comment(std::string(
"Send any bug to: ") + PACKAGE_BUGREPORT +
"\n");
147 writer->WriteLicense();
150 writer->write_header();
154 for(
const auto& c : components)
169 if(std::find(aux_files.begin(), aux_files.end(), filename_HDL) == aux_files.end())
171 aux_files.push_back(filename_HDL);
178 if(std::find(aux_files.begin(), aux_files.end(), filename_HDL) == aux_files.end())
180 aux_files.push_back(filename_HDL);
186 if(std::find(aux_files.begin(), aux_files.end(), filename_HDL) == aux_files.end())
188 aux_files.push_back(filename_HDL);
194 if(std::find(aux_files.begin(), aux_files.end(), filename_HDL) == aux_files.end())
196 aux_files.push_back(filename_HDL);
205 std::string library =
TM->get_library(c->get_typeRef()->id_type);
211 "---Component " + c->get_typeRef()->id_type +
" is in library " + library);
213 if(GetPointer<functional_unit>(tn))
215 THROW_ASSERT(GetPointer<functional_unit>(tn)->CM, tn->get_name());
216 obj = GetPointer<functional_unit>(tn)->CM->get_circ();
218 else if(GetPointer<functional_unit_template>(tn))
221 obj = GetPointer<functional_unit>(FU)->CM->get_circ();
231 auto filename_ext =
GetPath(filename + writer->get_extension());
232 writer->WriteFile(filename_ext);
238 std::list<std::string>& hdl_files, std::list<std::string>& aux_files,
bool tb)
241 !tb &&
parameters->IsParameter(
"enable-multifiles") &&
parameters->GetParameter<
bool>(
"enable-multifiles");
266 std::map<HDLWriter_Language, std::list<structural_objectRef>> component_language;
267 for(
const auto& component : components)
269 auto*
mod = GetPointer<module>(component);
272 unsigned int n_elements =
mod->get_internal_objects_size();
282 component_language[language].push_back(component);
289 component_language[language].push_back(component);
294 if(!
parameters->getOption<
bool>(OPT_mixed_design))
296 THROW_ERROR(
"VHDL implementation of " + component->get_path() +
" is not available");
298 #if HAVE_EXPERIMENTAL 301 const auto module_type =
mod->get_typeRef()->id_type;
302 const auto fu = GetPointer<functional_unit>(
TM->get_fu(module_type,
TM->get_library(module_type)));
303 if(module_type.find(
"gimple_asm") == std::string::npos and
304 module_type.find(
"__builtin_trap") == std::string::npos and
305 module_type.find(
"return_value_mm_register") == std::string::npos and
306 module_type.find(
"notify_caller_minimal") == std::string::npos and
307 module_type.find(
"memory_mapped_register") == std::string::npos and
308 module_type.find(
"status_register") == std::string::npos and
309 module_type.find(
"__builtin_wait_call") == std::string::npos and
310 module_type.find(
"PROXY_CTRL") == std::string::npos and
311 module_type.find(
"PRINTF") == std::string::npos and
312 module_type.find(
"trunc_") == std::string::npos and
313 module_type.find(
"__builtin_memstore") == std::string::npos and module_type !=
"ui_mult_expr_FU" and
314 module_type !=
"mult_expr_FU" and module_type.find(
"ADDRESS_DECODING_LOGIC") == std::string::npos and
315 module_type.find(
"BRAM") == std::string::npos and module_type !=
"STD_N21_BYTEMUX" and
316 module_type !=
"STD_LIVE_VALUE_TABLE" and module_type.find(
"MEMORY_CTRL") == std::string::npos and
317 module_type !=
"register_SARSE" and module_type.find(
"DISTRAM") == std::string::npos and
318 (not fu or (fu->memory_type ==
"" or fu->memory_ctrl_type ==
"")))
330 if(!
parameters->getOption<
bool>(OPT_mixed_design))
332 THROW_ERROR(
"Verilog implementation of " + component->get_path() +
" is not available");
336 THROW_WARNING(component->get_path() +
" is available only in VHDL");
352 for(
auto l = component_language.begin(); l != component_language.end(); ++l)
354 if(language == l->first)
361 for(
const auto& c : component_language[l->first])
363 std::list<structural_objectRef> singletonList;
364 singletonList.push_back(c);
367 aux_files.push_back(generated_filename);
372 std::string generated_filename =
write_components(filename, l->first, component_language[l->first], aux_files);
373 aux_files.push_back(generated_filename);
381 auto counter = component_language[language].size();
382 for(
const auto& c : component_language[language])
385 std::list<structural_objectRef> singletonList;
386 singletonList.push_back(c);
395 hdl_files.push_back(generated_filename);
399 aux_files.push_back(generated_filename);
405 std::string complete_filename =
write_components(filename, language, component_language[language], aux_files);
407 hdl_files.push_back(complete_filename);
411 const std::string flopoco_common = flopo_wrap->writeVHDLcommon();
413 if(flopoco_common !=
"")
415 aux_files.push_back(flopoco_common);
421 std::list<std::string>& hdl_files, std::list<std::string>& aux_files,
bool tb)
424 " compute the list of components for which a structural description exists");
426 std::list<structural_objectRef> list_of_com;
427 for(
const auto& cir : cirs)
431 if(list_of_com.empty())
434 for(
const auto& cir : cirs)
436 THROW_ASSERT(GetPointer<module>(cir),
"Expected a component or a channel");
437 THROW_ASSERT(GetPointer<module>(cir)->get_NP_functionality(),
"Structural empty description received");
459 THROW_ASSERT(_target,
"structural_objectRef must exist");
470 auto* mod_inst = GetPointer<module>(cir);
471 THROW_ASSERT(mod_inst,
"Expected a component or a channel");
482 std::list<structural_objectRef>& list_of_com)
const 489 auto*
mod = GetPointer<module>(cir);
490 unsigned int n_elements =
mod->get_internal_objects_size();
491 for(
unsigned int i = 0; i < n_elements; i++)
493 switch(
mod->get_internal_object(i)->get_kind())
498 if(!
mod->get_internal_object(i)->get_black_box() &&
517 std::string(
mod->get_internal_object(i)->get_kind_text()));
520 const auto NPF =
mod->get_NP_functionality();
524 const auto ip_cores_list = string_to_container<std::vector<std::string>>(ip_cores,
",");
525 for(
const auto& ip_core : ip_cores_list)
527 const auto ip_core_vec = string_to_container<std::vector<std::string>>(ip_core,
":");
528 if(ip_core_vec.size() < 1 || ip_core_vec.size() > 2)
530 THROW_ERROR(
"Malformed IP component definition \"" + ip_core +
"\"");
532 std::string library, component_name;
533 if(ip_core_vec.size() == 2)
535 library = ip_core_vec[0];
536 component_name = ip_core_vec[1];
540 component_name = ip_core_vec[0];
541 library =
TM->get_library(component_name);
543 const auto tn =
TM->get_fu(component_name, library);
547 core_cir = GetPointer<functional_unit>(tn)->CM->get_circ();
550 GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU))
552 core_cir = GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU)->CM->get_circ();
560 auto fo = std::find_if(list_of_com.begin(), list_of_com.end(),
find_eq_module(
nullptr, core_cir));
561 if(fo == list_of_com.end())
563 list_of_com.push_back(core_cir);
567 auto fo = std::find_if(list_of_com.begin(), list_of_com.end(),
find_eq_module(
nullptr, cir));
568 if(fo == list_of_com.end())
570 list_of_com.push_back(cir);
591 auto* p = GetPointer<port_o>(po);
595 po_owner = po_owner->get_owner();
597 for(
unsigned int j = 0; j < p->get_connections_size(); j++)
599 if(p->get_connection(j)->get_kind() ==
signal_o_K and
600 (p->get_connection(j)->get_owner() == po_owner or
602 p->get_connection(j)->get_owner()->get_owner() == po_owner)))
606 writer->write_comment(
"io-signal post fix\n");
609 writer->write_io_signal_post_fix(po, p->get_connection(j));
611 if(p->get_connection(j)->get_kind() ==
constant_o_K and p->get_connection(j)->get_owner() == po_owner)
615 writer->write_comment(
"io-signal post fix\n");
618 writer->write_io_signal_post_fix(po, p->get_connection(j));
627 auto* p = GetPointer<port_o>(po);
628 THROW_ASSERT(p,
"Expected a port; got something different");
630 for(
unsigned int j = 0; j < p->get_connections_size(); j++)
632 if(p->get_connection(j)->get_kind() ==
signal_vector_o_K and p->get_connection(j)->get_owner() == po_owner)
636 writer->write_comment(
"io-signal post fix\n");
639 writer->write_io_signal_post_fix_vector(po, p->get_connection(j));
641 if(p->get_connection(j)->get_kind() ==
constant_o_K and p->get_connection(j)->get_owner() == po_owner)
649 std::list<std::string>& aux_files)
const 652 const module*
mod = GetPointer<module>(cir);
653 THROW_ASSERT(mod,
"Expected a module got something of different");
667 writer->write_comment(
"Author(s): " + mod->
get_authors() +
"\n");
668 writer->write_comment(
"License: " + mod->
get_license() +
"\n");
671 writer->write_library_declaration(cir);
673 writer->write_module_declaration(cir);
675 writer->write_module_parametrization_decl(cir);
677 writer->write_port_decl_header();
683 writer->write_comment(
"IN\n");
692 writer->write_port_declaration(mod->
get_in_port(i),
true);
696 writer->write_port_declaration(mod->
get_in_port(i),
false);
705 writer->write_comment(
"OUT\n");
710 writer->write_port_declaration(mod->
get_out_port(i),
true);
714 writer->write_port_declaration(mod->
get_out_port(i),
false);
722 writer->write_comment(
"INOUT\n");
739 writer->write_comment(
"Ports\n");
744 writer->write_port_declaration(mod->
get_gen_port(i),
true);
748 writer->write_port_declaration(mod->
get_gen_port(i),
false);
753 writer->write_port_decl_tail();
756 writer->write_module_internal_declaration(cir);
763 writer->write_comment(
"Component and signal declarations\n");
765 std::list<std::pair<std::string, structural_objectRef>> cs;
766 for(
unsigned int i = 0; i < n_elements; i++)
800 writer->write_signal_declaration(c.second);
806 writer->write_module_definition_begin(cir);
810 for(
unsigned int i = 0; i < n_elements; i++)
839 writer->WriteBuiltin(obj);
846 auto* mod_inst = GetPointer<module>(obj);
847 bool first_port_analyzed =
false;
850 if(writer->has_output_prefix())
852 if(mod_inst->get_out_port_size())
856 for(
unsigned int i = 0; i < mod_inst->get_out_port_size(); i++)
859 "-->Writing port binding of " + mod_inst->get_out_port(i)->get_id());
860 if(mod_inst->get_out_port(i)->get_kind() ==
port_o_K)
863 GetPointer<port_o>(mod_inst->get_out_port(i))->find_bounded_object(cir);
867 "<--Skipped " + mod_inst->get_out_port(i)->get_path());
870 writer->write_port_binding(mod_inst->get_out_port(i), object_bounded, first_port_analyzed);
874 writer->write_vector_port_binding(mod_inst->get_out_port(i), first_port_analyzed);
876 first_port_analyzed =
true;
878 "<--Written port binding of " + mod_inst->get_out_port(i)->get_id());
883 if(mod_inst->get_in_port_size())
887 for(
unsigned int i = 0; i < mod_inst->get_in_port_size(); i++)
890 "-->Writing port binding of " + mod_inst->get_in_port(i)->get_id());
891 if(mod_inst->get_in_port(i)->get_kind() ==
port_o_K)
894 GetPointer<port_o>(mod_inst->get_in_port(i))->find_bounded_object(cir);
896 "---Bounded object is " +
897 (object_bounded ? object_bounded->
get_path() :
"nothing"));
898 writer->write_port_binding(mod_inst->get_in_port(i), object_bounded, first_port_analyzed);
902 writer->write_vector_port_binding(mod_inst->get_in_port(i), first_port_analyzed);
904 first_port_analyzed =
true;
906 "<--Written port binding of " + mod_inst->get_in_port(i)->get_id());
910 if(mod_inst->get_in_out_port_size())
914 for(
unsigned int i = 0; i < mod_inst->get_in_out_port_size(); i++)
916 if(mod_inst->get_in_out_port(i)->get_kind() ==
port_o_K)
919 GetPointer<port_o>(mod_inst->get_in_out_port(i))->find_bounded_object();
924 writer->write_port_binding(mod_inst->get_in_out_port(i), object_bounded, first_port_analyzed);
928 writer->write_vector_port_binding(mod_inst->get_in_out_port(i), first_port_analyzed);
930 first_port_analyzed =
true;
934 if(mod_inst->get_gen_port_size())
937 for(
unsigned int i = 0; i < mod_inst->get_gen_port_size(); i++)
939 if(mod_inst->get_gen_port(i)->get_kind() ==
port_o_K)
941 writer->write_port_binding(mod_inst->get_gen_port(i),
942 GetPointer<port_o>(mod_inst->get_gen_port(i))->find_bounded_object(),
943 first_port_analyzed);
947 writer->write_vector_port_binding(mod_inst->get_gen_port(i), first_port_analyzed);
949 first_port_analyzed =
true;
952 if(!writer->has_output_prefix())
954 if(mod_inst->get_out_port_size())
957 for(
unsigned int i = 0; i < mod_inst->get_out_port_size(); i++)
959 if(mod_inst->get_out_port(i)->get_kind() ==
port_o_K)
962 GetPointer<port_o>(mod_inst->get_out_port(i))->find_bounded_object();
967 writer->write_port_binding(mod_inst->get_out_port(i), object_bounded, first_port_analyzed);
971 writer->write_vector_port_binding(mod_inst->get_out_port(i), first_port_analyzed);
973 first_port_analyzed =
true;
978 writer->write_module_instance_end(obj);
996 auto* pv = GetPointer<port_o>(mod->
get_in_port(i));
997 for(
unsigned int k = 0;
k < pv->get_ports_size();
k++)
1016 for(
unsigned int k = 0;
k < pv->get_ports_size();
k++)
1035 for(
unsigned int k = 0;
k < pv->get_ports_size();
k++)
1052 "Cannot exist both FSM and fsm_cs for the same function");
1053 std::string fsm_desc;
1071 std::vector<std::string> ip_cores_list = string_to_container<std::vector<std::string>>(ip_cores,
",");
1072 for(
const auto& ip_core : ip_cores_list)
1074 std::vector<std::string> ip_core_vec = string_to_container<std::vector<std::string>>(ip_core,
":");
1075 if(ip_core_vec.size() < 1 or ip_core_vec.size() > 2)
1077 THROW_ERROR(
"Malformed IP component definition \"" + ip_core +
"\"");
1079 std::string library, component_name;
1080 if(ip_core_vec.size() == 2)
1082 library = ip_core_vec[0];
1083 component_name = ip_core_vec[1];
1087 component_name = ip_core_vec[0];
1088 library =
TM->get_library(component_name);
1094 core_cir = GetPointer<functional_unit>(tn)->CM->get_circ();
1097 GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU))
1099 core_cir = GetPointer<functional_unit>(GetPointer<functional_unit_template>(tn)->FU)->CM->get_circ();
1105 writer->write_component_declaration(core_cir);
1108 writer->write_NP_functionalities(cir);
1116 writer->write_module_definition_end(cir);
1126 auto* mod_inst = GetPointer<module>(cir);
1127 unsigned long long int mod_size_in = 0, mod_size_out = 0;
1128 for(
unsigned int i = 0; i < mod_inst->get_in_port_size(); i++)
1131 if(mod_size_in <
STD_GET_SIZE(mod_inst->get_in_port(i)->get_typeRef()))
1133 mod_size_in =
STD_GET_SIZE(mod_inst->get_in_port(i)->get_typeRef());
1136 for(
unsigned int i = 0; i < mod_inst->get_out_port_size(); i++)
1139 if(mod_size_out <
STD_GET_SIZE(mod_inst->get_out_port(i)->get_typeRef()))
1141 mod_size_out =
STD_GET_SIZE(mod_inst->get_out_port(i)->get_typeRef());
1150 "Creating " + mod_type +
", named " + mod_name +
" whose size is " +
STR(mod_size_in) +
"|" +
1152 std::string pipe_parameter;
1157 flopo_wrap->add_FU(mod_type, static_cast<unsigned int>(mod_size_in), static_cast<unsigned int>(mod_size_out),
1158 mod_name, pipe_parameter);
1159 std::string created_file;
1160 flopo_wrap->writeVHDL(mod_name, static_cast<unsigned int>(mod_size_in), static_cast<unsigned int>(mod_size_out),
1161 pipe_parameter, created_file);
1162 aux_files.push_back(created_file);
1164 THROW_ERROR(
"Floating point based HLS requires --enable-flopoco at configuration time");
1169 const std::string& behav)
const 1171 std::vector<std::string> SplitVec =
SplitString(behav,
";");
1172 THROW_ASSERT(SplitVec.size(),
"Expected at least one behavioral description");
1174 for(
auto& i : SplitVec)
1176 std::vector<std::string> SplitVec2 =
SplitString(i,
"=");
1177 THROW_ASSERT(SplitVec2.size() == 2,
"Expected two operands");
1178 writer->write_assign(SplitVec2[0], SplitVec2[1]);
1183 const std::string& fsm_desc_i)
const 1187 std::string fsm_desc = fsm_desc_i;
1188 boost::algorithm::erase_all(fsm_desc,
"\n");
1190 std::vector<std::string> SplitVec =
SplitString(fsm_desc,
";");
1191 THROW_ASSERT(SplitVec.size() > 2,
"Expected more than one ';' in the FSM specification (the first is the reset)");
1193 using tokenizer = boost::tokenizer<boost::char_separator<char>>;
1194 boost::char_separator<char> sep(
" ",
nullptr);
1196 std::list<std::string> list_of_states;
1197 auto it_end = SplitVec.cend();
1198 auto it = SplitVec.cbegin();
1199 tokenizer first_line_tokens(*it, sep);
1200 tokenizer::iterator tok_iter = first_line_tokens.begin();
1204 THROW_ASSERT(tok_iter != first_line_tokens.end(),
"Wrong FSM description: expected the reset port name");
1208 THROW_ASSERT(tok_iter != first_line_tokens.end(),
"Wrong FSM description: expected the start port name");
1212 THROW_ASSERT(tok_iter != first_line_tokens.end(),
"Wrong FSM description: expected the clock port name");
1216 THROW_ASSERT(tok_iter == first_line_tokens.end(),
"Wrong FSM description: unexpetcted tokens" + *tok_iter);
1220 std::map<unsigned int, std::map<std::string, std::set<unsigned int>>> bypass_signals;
1223 std::vector<std::string> BypassVec =
SplitString(*it,
":");
1224 for(
const auto& assign : BypassVec)
1226 std::vector<std::string> AssignPair =
SplitString(assign,
"=");
1227 THROW_ASSERT(AssignPair.size() == 2,
"malformed FSM description " +
STR(AssignPair.size()));
1228 auto out =
static_cast<unsigned>(std::stoul(AssignPair.at(0)));
1229 std::vector<std::string> inStateVec =
SplitString(AssignPair.at(1),
",");
1230 for(
const auto& inState : inStateVec)
1232 std::vector<std::string> StateInsPair =
SplitString(inState,
">");
1233 THROW_ASSERT(StateInsPair.size() == 2,
"malformed FSM description " +
STR(StateInsPair.size()));
1234 std::vector<std::string> inVec =
SplitString(StateInsPair.at(1),
"<");
1235 for(
const auto& in : inVec)
1237 auto in_val =
static_cast<unsigned>(std::stoul(in));
1238 bypass_signals[out][StateInsPair.at(0)].insert(in_val);
1246 for(; it + 1 != it_end; ++it)
1248 tokenizer
tokens(*it, sep);
1255 "reset state and first state has to be the same " + reset_state +
" : " + fsm_desc);
1259 if(
device->has_parameter(
"vendor"))
1261 vendor =
device->get_parameter<std::string>(
"vendor");
1262 boost::algorithm::to_lower(vendor);
1264 bool one_hot_encoding =
false;
1265 if(
parameters->getOption<std::string>(OPT_fsm_encoding) ==
"one-hot")
1267 one_hot_encoding =
true;
1269 else if(
parameters->getOption<std::string>(OPT_fsm_encoding) ==
"auto" && vendor ==
"xilinx" &&
1270 list_of_states.size() < 256)
1272 one_hot_encoding =
true;
1275 if(
device->has_parameter(
"vendor"))
1277 family =
device->get_parameter<std::string>(
"family");
1278 boost::algorithm::to_lower(family);
1281 const auto is_yosys = family.find(
"yosys") != std::string::npos;
1283 writer->write_state_declaration(cir, list_of_states, reset_port, reset_state, one_hot_encoding);
1287 writer->write_module_definition_begin(cir);
1291 writer->write_present_state_update(cir, reset_state, reset_port, clock_port,
1292 parameters->getOption<std::string>(OPT_reset_type),
1297 if(
parameters->IsParameter(
"multi-proc-fsm") and
parameters->GetParameter<
int>(
"multi-proc-fsm") == 1)
1299 const auto mod = GetPointer<module>(cir);
1300 const auto n_outs =
mod->get_out_port_size();
1301 for(
unsigned int output_index = 0; output_index <= n_outs; output_index++)
1311 writer->write_transition_output_functions(
false, output_index, cir, reset_state, reset_port, start_port,
1312 clock_port, first, end, is_yosys, bypass_signals);
1317 writer->write_transition_output_functions(
true, 0, cir, reset_state, reset_port, start_port, clock_port, first,
1318 end, is_yosys, bypass_signals);
1326 if(dynamic_cast<const VHDL_writer*>(writer))
1328 if(ret.find(
"__") != std::string::npos or ret.front() ==
'_' or ret.back() ==
'_' or writer->
check_keyword(ret))
1330 return "\\" + ret +
"\\";
1337 else if(dynamic_cast<const verilog_writer*>(writer))
1339 if((ret[0] >=
'0' && ret[0] <=
'9') || (ret.find(
'.') != std::string::npos) ||
1340 (ret.find(
'[') != std::string::npos) || (ret.find(
']') != std::string::npos))
1342 return "\\" + ret +
" ";
1346 return "\\" + ret +
" ";
1348 else if(ret ==
"array")
1368 auto*
mod = GetPointer<module>(cir);
1372 unsigned long long int mod_size_in = 0;
1373 for(
unsigned int i = 0; i <
mod->get_in_port_size(); i++)
1381 res = res +
"_" +
STR(mod_size_in);
1382 unsigned long long int mod_size_out = 0;
1383 for(
unsigned int i = 0; i <
mod->get_out_port_size(); i++)
1391 res = res +
"_" +
STR(mod_size_out);
static std::string get_mod_typename(const language_writer *lan, const structural_objectRef &cir)
Returns the module typename taking into account even the flopoco customizations.
#define PRESENT_STATE_PORT_NAME
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
Data structure representing the entire HLS information.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
static std::string convert_to_identifier(const language_writer *writer, const std::string &id)
Converts a generic string to a language compliant identifier.
void write_fsm(const language_writerRef writer, const structural_objectRef &cir, const std::string &fsm_desc) const
Writes a mealy/moore finite state machine behavioral description.
File containing functions and utilities to support the printing of debug messagges.
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;.
#define NEXT_STATE_PORT_NAME
void hdl_gen(const std::string &filename, const std::list< structural_objectRef > &cirs, std::list< std::string > &hdl_files, std::list< std::string > &aux_files, bool tb)
Generates HDL code.
HDL_manager(const HLS_managerRef _HLSMgr, const generic_deviceRef device, const ParameterConstRef parameters)
Constructor.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
const std::string & get_id() const
Return the identifier associated with the structural_object.
const std::string get_copyright() const
Return the copyright associated with the module.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
const std::vector< std::string > SplitString(const std::string &input, const std::string &separators)
Function which splits a string into tokens.
unsigned int get_out_port_size() const
Return the number of output ports.
This class defines the methods to write VHDL descriptions.
std::string get_NP_functionality(NP_functionaly_type type) const
Return the description provided the type.
exceptions managed by PandA
static language_writerRef create_writer(HDLWriter_Language language, const technology_managerConstRef TM, const ParameterConstRef parameters)
Creates the specialization of the writer based on the desired language.
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...
Definition of hash function for EdgeDescriptor.
void write_flopoco_module(const structural_objectRef &cir, std::list< std::string > &aux_files) const
Writes the FloPoCo module description to a VHDL file.
unsigned int get_internal_objects_size() const
Return the number of internal objects.
Class specification of the manager of the technology library data structures.
const std::string get_description() const
Return the description associated with the module.
redefinition of map to manage ordered/unordered structures
#define GET_TYPE_NAME(structural_obj)
Macro returning the string name of a type.
unsigned int get_gen_port_size() const
Return the number of generic ports.
#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
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
~HDL_manager()
Destructor.
const int debug_level
The debug level.
static std::string GetCurrentTimeStamp()
Return a timestamp of the current time.
const language_writer * lan
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 write_module(const language_writerRef writer, const structural_objectRef cir, std::list< std::string > &aux_files) const
Writes the module description.
Class for system verilog writing.
const HLS_managerRef HLSMgr
The high level synthesis manager.
static const uint32_t k[]
void get_post_order_structural_components(const structural_objectRef cir, std::list< structural_objectRef > &list_of_com) const
Returns the list of components that have a structural-based description.
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.
const NP_functionalityRef & get_NP_functionality() const
Return the alternative functionalities.
const structural_objectRef get_out_port(unsigned int n) const
Return the ith output port.
virtual bool check_keyword(const std::string &id) const =0
redefinition of set to manage ordered/unordered structures
virtual enum tec_kind get_kind() const =0
Virtual function used to find the real type of a technology_nodeinstance.
utility function used to read files.
const structural_objectRef get_gen_port(unsigned int n) const
Return the ith generic port.
bool is_fsm(const structural_objectRef &cir) const
Returns true if the module has a FSM description associated with, false otherwise.
virtual enum so_kind get_kind() const =0
Virtual function used to find the real type of a structural_object instance.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
const structural_objectRef target
const ParameterConstRef parameters
The set of input parameters.
const generic_deviceRef device
reference to the target device
unsigned int get_in_port_size() const
Return the number of input ports.
Main class for wrapping the FloPoCo code generator.
bool operator()(const structural_objectRef &el)
void io_signal_fix_ith(const language_writerRef writer, const structural_objectRef po, bool &lspf) const
Writes signal port connection post fix.
This class describes all classes used to represent a structural object.
std::string GetPath(std::filesystem::path path)
const structural_objectRef get_owner() const
Return the owner.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
HDL writer base class used to specify the interface of the different language writers.
Used to test if a component has been already inserted into the component list.
#define DEBUG_LEVEL_PARANOIC
paranoid level debugging print is performed.
bool get_black_box() const
Return the black box property.
this class is used to manage the command-line or XML options.
NP_functionaly_type
functionality type descriptors.
const std::string get_license() const
Return the license of the functional description of the module.
Wrapper to FloPoCo for VHDL code generation.
const structural_objectRef get_in_out_port(unsigned int n) const
Return the ith input-output port.
Not parsed functionality manager.
find_eq_module(const language_writer *_lan, const structural_objectRef &_target)
Class implementation of the structural_manager.
unsigned counter[N_THREADS]
Generic device description.
const technology_managerConstRef TM
reference to the class containing all the technology information
std::string write_components(const std::string &filename, const HDLWriter_Language language, const std::list< structural_objectRef > &components, std::list< std::string > &aux_files) const
Generates the HDL description for the given components in the specified language. ...
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
const std::string get_authors() const
Return the authors of the functional description of the module.
bool exist_NP_functionality(NP_functionaly_type type) const
Return true in case there exist a functionaly of the given type.
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
void write_behavioral(const language_writerRef writer, const structural_objectRef &cir, const std::string &behav) const
Writes the behavioral description associated with the component.
This class describes a generic module.
void io_signal_fix_ith_vector(const language_writerRef writer, const structural_objectRef po, bool &lspf) const
unsigned int get_in_out_port_size() const
Return the number of output ports.
#define STD_GET_SIZE(structural_obj)
Macro returning the size of a type.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...