87 #define CST_STR_BAMBU_TESTBENCH "bambu_testbench" 89 #define SETUP_PORT_NAME "setup_port" 92 const DesignFlowManagerConstRef _design_flow_manager)
95 _HLSMgr->get_HLS_device()->get_technology_manager(), _parameters)),
98 output_directory(
parameters->getOption<
std::string>(OPT_output_directory) +
"/simulation/"),
108 switch(relationship_type)
140 switch(relationship_type)
144 const auto c_backend_factory =
174 const auto top_symbols =
parameters->getOption<std::vector<std::string>>(OPT_top_functions_names);
175 THROW_ASSERT(top_symbols.size() == 1,
"Expected single top function name");
176 const auto top_fnode =
HLSMgr->get_tree_manager()->GetFunction(top_symbols.front());
178 cir = top_hls->top->get_circ();
180 mod = GetPointer<const module>(
cir);
190 const auto tb_cir = tb_top->
get_circ();
191 const auto tb_mod = GetPointerS<module>(tb_cir);
193 THROW_ASSERT(src->
get_kind() == dest->get_kind(),
"Port with different types cannot be connected.");
194 const auto sig_id =
"sig_" + dest->get_id();
195 auto sig = tb_cir->find_member(sig_id,
signal_o_K, tb_cir);
198 sig = tb_top->
add_sign(sig_id, tb_cir, dest->get_typeRef());
207 tb_mod->set_description(
"Testbench top component");
209 tb_mod->set_authors(
"Component automatically generated by bambu");
216 GetPointerS<port_o>(clock_port)->set_is_clock(
true);
218 const auto TechM =
HLSMgr->get_HLS_device()->get_technology_manager();
219 const auto std_lib_manager = TechM->get_library_manager(
LIBRARY_STD);
224 const auto top_id = [&]() {
225 const auto top_symbols =
parameters->getOption<std::vector<std::string>>(OPT_top_functions_names);
226 THROW_ASSERT(top_symbols.size() == 1,
"Expected single top function name");
227 const auto top_fnode =
HLSMgr->get_tree_manager()->GetFunction(top_symbols.front());
230 const auto top_fb =
HLSMgr->CGetFunctionBehavior(top_id);
231 const auto top_bh = top_fb->CGetBehavioralHelper();
242 tb_fsm->
SetParameter(
"RESFILE",
"\"\"" +
parameters->getOption<std::string>(OPT_simulation_output) +
"\"\"");
243 tb_fsm->SetParameter(
"RESET_ACTIVE",
parameters->getOption<
bool>(OPT_reset_level) ?
"1" :
"0");
244 tb_fsm->SetParameter(
"CLOCK_PERIOD",
"2.0");
245 tb_fsm->SetParameter(
"MAX_SIM_CYCLES",
parameters->getOption<std::string>(OPT_max_sim_cycles));
255 std::list<structural_objectRef> if_modules;
265 tb_mem->
SetParameter(
"QUEUE_SIZE",
STR(
HLSMgr->get_parameter()->getOption<
unsigned int>(OPT_tb_queue_size)));
274 bp_port_tb->type_resize(
STD_GET_SIZE(oe_port->get_typeRef()));
290 THROW_ERROR(
"Testbench generation for selected interface type is not yet supported.");
292 tb_mem->
SetParameter(
"MEM_DELAY_READ",
parameters->getOption<std::string>(OPT_bram_high_latency) ==
"_3" ?
294 parameters->getOption<std::string>(OPT_bram_high_latency) ==
"_4" ?
296 parameters->getOption<std::string>(OPT_mem_delay_read));
300 std::to_string(top_bh->GetParameters().size() + (top_bh->GetFunctionReturnType(top_id) != 0)));
301 if_modules.push_back(tb_mem);
304 if(
parameters->getOption<
bool>(OPT_memory_mapped_top))
306 const std::string if_suffix =
308 const auto master_port_module =
"TestbenchArgMap" + if_suffix;
310 std::list<structural_objectRef> master_ports;
311 for(
const auto& par : top_bh->GetParameters())
318 "---Interface: " +
STR(par_bitsize) +
"-bits memory mapped at " +
319 STR(par_symbol->get_address()));
323 master_port->SetParameter(
"bitsize",
STR(par_bitsize));
324 master_port->SetParameter(
"tgt_addr",
STR(par_symbol->get_address()));
326 master_ports.push_back(master_port);
338 "---Interface: " +
STR(return_bitsize) +
"-bits memory mapped at " +
339 STR(return_symbol->get_address()));
341 "master_return_port",
"TestbenchReturnMap" + if_suffix,
LIBRARY_STD, tb_cir, TechM);
343 master_port->SetParameter(
"bitsize",
STR(return_bitsize));
344 master_port->SetParameter(
"tgt_addr",
STR(return_symbol->get_address()));
355 master_ports.push_back(master_port);
359 const auto start_symbol =
HLSMgr->Rmem->get_symbol(top_id, top_id);
361 "start_master",
"TestbenchStartMap" + if_suffix,
LIBRARY_STD, tb_cir, TechM);
362 master_start->
SetParameter(
"tgt_addr",
STR(start_symbol->get_address()));
363 master_ports.push_back(master_start);
365 if_modules.insert(if_modules.end(), master_ports.begin(), master_ports.end());
366 if(master_ports.size())
368 const auto master_mod = GetPointerS<module>(master_ports.front());
372 for(
const auto& master_port : master_ports)
386 master_ports.push_front(tb_mem);
387 for(
unsigned int i = 0; i < master_mod->get_out_port_size(); ++i)
389 const auto out_port = master_mod->get_out_port(i);
390 if(!GetPointerS<const port_o>(
out_port)->get_is_memory())
396 const auto merge_out = GetPointerS<module>(bus_merger)->get_out_port(0);
398 THROW_ASSERT(dut_port,
"Port " +
out_port->get_id() +
" not found in module " + dut->get_path());
399 add_internal_connection(merge_out, dut_port);
400 const auto merge_port = GetPointerS<module>(bus_merger)->get_in_port(0);
401 const auto merge_port_o = GetPointerS<port_o>(merge_port);
402 merge_port_o->add_n_ports(static_cast<unsigned int>(master_ports.size()), merge_port);
403 merge_port_o->type_resize(
STD_GET_SIZE(dut_port->get_typeRef()));
405 for(
const auto& master_port : master_ports)
407 const auto m_port = master_port->find_member(
out_port->get_id(),
port_o_K, master_port);
408 THROW_ASSERT(m_port,
"Port " +
out_port->get_id() +
" not found in module " + master_port->get_id());
409 m_port->type_resize(
STD_GET_SIZE(dut_port->get_typeRef()));
411 tb_top->
add_sign(
"sig_" +
out_port->get_id() +
"_" +
STR(k), tb_cir, dut_port->get_typeRef());
423 const auto func_arch =
HLSMgr->module_arch->GetArchitecture(top_bh->GetMangledFunctionName());
425 for(
const auto&
arg : top_bh->GetParameters())
428 const auto& parm_attrs = func_arch->parms.at(arg_name);
429 const auto& bundle_name = parm_attrs.at(FunctionArchitecture::parm_bundle);
430 const auto& iface_attrs = func_arch->ifaces.at(bundle_name);
433 iface_attrs.find(FunctionArchitecture::iface_direction) == iface_attrs.end())
439 const auto arg_port = dut->find_member(arg_name,
port_o_K, dut);
440 const auto arg_interface = iface_attrs.at(FunctionArchitecture::iface_mode);
442 if(arg_interface ==
"default")
444 const auto arg_port_dir = GetPointer<port_o>(arg_port)->get_port_direction();
450 if_modules.push_back(if_port);
453 THROW_ASSERT(arg_port,
"Top level interface is missing port for argument '" + arg_name +
"'");
454 const auto val_port = if_port->find_member(
"val_port",
port_o_K, if_port);
455 add_internal_connection(val_port, arg_port);
457 else if(arg_interface ==
"m_axi")
460 "---Interface: " + arg_interface +
" (bundle: " + bundle_name +
")");
461 const auto axim_bundle_name =
"if_m_axi_" + bundle_name;
462 const auto axim_bundle = tb_cir->find_member(axim_bundle_name +
"_fu",
component_o_K, tb_cir);
467 axim_bundle_name +
"_fu", axim_bundle_name,
LIBRARY_STD, tb_cir, TechM);
468 if_modules.push_back(if_port);
473 if_modules.push_back(if_port);
476 THROW_ASSERT(arg_port,
"Top level interface is missing port for argument '" + arg_name +
"'");
477 const auto val_port = if_port->find_member(
"val_port",
port_o_K, if_port);
478 add_internal_connection(val_port, arg_port);
483 "---Interface: " + arg_interface +
" " +
484 iface_attrs.at(FunctionArchitecture::iface_direction) +
485 (bundle_name != arg_name ? (
" (bundle: " + bundle_name +
")") :
""));
486 const auto if_port_name =
"if_" + arg_interface +
"_" + bundle_name;
487 const auto if_port_bundle = tb_cir->find_member(if_port_name +
"_fu",
component_o_K, tb_cir);
495 if_modules.push_back(if_port);
507 if_modules.push_back(if_port);
510 const auto val_port = if_port->find_member(
"val_port",
port_o_K, if_port);
511 add_internal_connection(val_port, return_port);
516 add_internal_connection(fsm_start, dut_start);
521 const auto has_dataflow =
522 std::any_of(
HLSMgr->module_arch->begin(),
HLSMgr->module_arch->end(), [](
const auto& fsymbol_arch) {
523 return fsymbol_arch.second->attrs.find(FunctionArchitecture::func_dataflow) !=
524 fsymbol_arch.second->attrs.end();
529 std::vector<structural_objectRef> tb_done_ports;
530 for(
const auto& if_obj : if_modules)
532 const auto tb_done_port = if_obj->find_member(
"tb_done_port",
port_o_K, if_obj);
536 "---Considering testbench done port form " + if_obj->get_path());
537 tb_done_ports.push_back(tb_done_port);
540 if(tb_done_ports.size())
545 const auto tb_done_out = GetPointerS<module>(tb_done)->get_out_port(0);
547 const auto merge_port = GetPointerS<module>(tb_done)->get_in_port(0);
548 const auto merge_port_o = GetPointerS<port_o>(merge_port);
549 merge_port_o->add_n_ports(static_cast<unsigned int>(tb_done_ports.size()), merge_port);
552 for(
const auto& tb_done_port : tb_done_ports)
555 tb_top->
add_sign(
"sig_tb_done_" + std::to_string(i), tb_cir, tb_done_port->get_typeRef());
565 const auto tb_done_port = GetPointerS<module>(done_or)->get_out_port(0);
567 const auto merge_port = GetPointerS<module>(done_or)->get_in_port(0);
568 const auto merge_port_o = GetPointerS<port_o>(merge_port);
569 merge_port_o->add_n_ports(2
U, merge_port);
571 add_internal_connection(merge_port_o->get_port(0
U), dut_done);
573 const auto sig = tb_top->
add_sign(
"sig_tb_done_port", tb_cir, tb_done_out->get_typeRef());
579 dut_done = tb_done_port;
586 add_internal_connection(fsm_reset, dut_reset);
588 add_internal_connection(fsm_done, dut_done);
591 for(
const auto& if_obj : if_modules)
594 const auto if_mod = GetPointerS<module>(if_obj);
595 for(
unsigned i = 0; i < if_mod->get_in_port_size(); ++i)
597 const auto in_port = if_mod->get_in_port(i);
598 if(GetPointerS<port_o>(
in_port)->get_connections_size())
606 "---" +
in_port->get_path() +
" <-> " + clock_port->get_path());
612 "---" +
in_port->get_path() +
" <-> " + fsm_reset->get_path());
613 add_internal_connection(
in_port, fsm_reset);
618 "---" +
in_port->get_path() +
" <-> " + fsm_setup->get_path());
619 add_internal_connection(
in_port, fsm_setup);
623 const auto dut_port = dut->find_member(
in_port->get_id(),
port_o_K, dut);
627 "---" +
in_port->get_path() +
" <-> " + dut_port->get_path());
628 add_internal_connection(
in_port, dut_port);
630 else if(GetPointerS<port_o>(
in_port)->get_is_memory())
633 "---Memory port " +
in_port->get_id() +
" not present in DUT module " + dut->get_path());
642 for(
unsigned i = 0; i < if_mod->get_out_port_size(); ++i)
644 const auto out_port = if_mod->get_out_port(i);
645 if(GetPointerS<port_o>(
out_port)->get_connections_size())
654 "---" +
out_port->get_path() +
" <-> " + dut_port->get_path());
655 add_internal_connection(
out_port, dut_port);
657 else if(GetPointerS<port_o>(
out_port)->get_is_memory())
660 "---Memory port " +
out_port->get_id() +
" not present in DUT module " + dut->get_path());
672 const auto is_sim_verilator =
parameters->getOption<std::string>(OPT_simulator) ==
"VERILATOR";
674 std::list<std::string> hdl_files, aux_files;
675 const std::list<structural_objectRef> tb_circuits = {tb_cir};
676 HDLMgr.
hdl_gen(tb_filename, tb_circuits, hdl_files, aux_files,
true);
677 THROW_ASSERT(hdl_files.size() == 1,
"Expected single testbench file");
678 THROW_ASSERT(aux_files.size() <= 1,
"Expected at most a single testbench aux file");
681 HLSMgr->aux_files.push_back(hdl_files.front());
682 HLSMgr->RSim->filename_bench = aux_files.front();
686 HLSMgr->RSim->filename_bench = hdl_files.front();
689 std::ifstream bambu_tb(
HLSMgr->RSim->filename_bench);
690 std::ofstream bambu_tb_dpi(
HLSMgr->RSim->filename_bench +
".dpi");
694 bambu_tb_dpi <<
"// verilator lint_off BLKANDNBLK\n" 695 <<
"// verilator lint_off BLKSEQ\n\n";
698 bambu_tb_dpi <<
"`timescale 1ns / 1ps\n" 699 <<
"// CONSTANTS DECLARATION\n" 700 <<
"`define MAX_COMMENT_LENGTH 1000\n" 705 bambu_tb_dpi <<
"`define NDEBUG\n\n";
710 typedef longint unsigned ptr_t; 712 typedef int unsigned ptr_t; 716 bambu_tb_dpi << bambu_tb.rdbuf(); 721 tb_writer->write_comment(
"MODULE DECLARATION\n");
722 tb_writer->write(
"module " CST_STR_BAMBU_TESTBENCH
"(" CLOCK_PORT_NAME ");\n");
724 tb_writer->write(
"\ninput " CLOCK_PORT_NAME
";\n\n");
726 tb_writer->write(
"initial\n");
728 tb_writer->write(
"begin\n");
731 tb_writer->write(
"`ifndef VERILATOR\n");
732 tb_writer->write_comment(
"VCD file generation\n");
734 tb_writer->write(
"$dumpfile(\"" + vcd_output_filename +
"\");\n");
735 const auto dumpvars_discrepancy =
737 if(dumpvars_discrepancy)
739 tb_writer->write(
"`ifdef GENERATE_VCD_DISCREPANCY\n");
740 const auto simulator_supports_dumpvars_directive =
741 parameters->getOption<std::string>(OPT_simulator) ==
"MODELSIM" ||
742 parameters->getOption<std::string>(OPT_simulator) ==
"ICARUS" ||
743 parameters->getOption<std::string>(OPT_simulator) ==
"XSIM";
744 if(!simulator_supports_dumpvars_directive ||
745 (static_cast<HDLWriter_Language>(
parameters->getOption<
unsigned int>(OPT_writer_language)) ==
747 HLSMgr->RDiscr->selected_vcd_signals.empty())
749 tb_writer->write(
"`define GENERATE_VCD\n");
751 #if HAVE_FROM_DISCREPANCY_BUILT 754 for(
const auto& sig_scope :
HLSMgr->RDiscr->selected_vcd_signals)
768 for(
const auto& signame : sig_scope.second)
770 tb_writer->write(
"$dumpvars(1, " + sigscope + signame +
");\n");
775 tb_writer->write(
"`else\n");
778 tb_writer->write(
"`ifdef GENERATE_VCD\n");
779 tb_writer->write(
"$dumpvars;\n");
780 tb_writer->write(
"`endif\n");
781 if(dumpvars_discrepancy)
783 tb_writer->write(
"`endif\n");
785 tb_writer->write(
"`endif\n");
788 tb_writer->write(
"end\n\n");
790 tb_writer->write(tb_cir->get_id() +
" system(." CLOCK_PORT_NAME
"(" CLOCK_PORT_NAME
"));\n\n");
793 tb_writer->write(
"endmodule\n\n");
795 tb_writer->write(
"`ifndef VERILATOR\n");
796 tb_writer->write(
"module clocked_" CST_STR_BAMBU_TESTBENCH
";\n");
798 tb_writer->write(
"parameter HALF_CLOCK_PERIOD=1.0;\n");
799 tb_writer->write(
"\nreg " CLOCK_PORT_NAME
";\n");
800 tb_writer->write(
"initial " CLOCK_PORT_NAME
" = 1;\n");
801 tb_writer->write(
"always # HALF_CLOCK_PERIOD " CLOCK_PORT_NAME
" = !" CLOCK_PORT_NAME
";\n\n");
802 tb_writer->write(CST_STR_BAMBU_TESTBENCH
" bambu_testbench(." CLOCK_PORT_NAME
"(" CLOCK_PORT_NAME
"));\n\n");
804 tb_writer->write(
"endmodule\n");
805 tb_writer->write(
"`endif\n\n");
807 bambu_tb_dpi << tb_writer->WriteString();
811 bambu_tb_dpi <<
"// verilator lint_on BLKANDNBLK\n";
812 bambu_tb_dpi <<
"// verilator lint_on BLKSEQ\n";
815 std::filesystem::remove(
HLSMgr->RSim->filename_bench);
816 std::filesystem::rename(
HLSMgr->RSim->filename_bench +
".dpi",
HLSMgr->RSim->filename_bench);
818 if(
parameters->getOption<std::string>(OPT_simulator) ==
"VERILATOR")
830 std::ofstream os(filename, std::ios::out);
834 PP(os,
"#include <memory>\n");
836 PP(os,
"#include <verilated.h>\n");
838 PP(os,
"#if VM_TRACE\n");
839 PP(os,
"# include <verilated_vcd_c.h>\n");
842 PP(os,
"#include \"Vbambu_testbench.h\"\n");
845 PP(os,
"static vluint64_t CLOCK_PERIOD = 2;\n");
846 PP(os,
"static vluint64_t HALF_CLOCK_PERIOD = CLOCK_PERIOD/2;\n");
848 PP(os,
"vluint64_t main_time = 0;\n");
850 PP(os,
"double sc_time_stamp () {return main_time;}\n");
852 PP(os,
"int main (int argc, char **argv, char **env)\n");
854 PP(os,
"Verilated::commandArgs(argc, argv);\n");
855 PP(os,
"Verilated::debug(0);\n");
857 "const std::unique_ptr<Vbambu_testbench> top{new Vbambu_testbench{\"clocked_" CST_STR_BAMBU_TESTBENCH "\"}};");
860 PP(os,
"main_time=0;\n");
861 PP(os,
"#if VM_TRACE\n");
862 PP(os,
"Verilated::traceEverOn(true);\n");
863 PP(os,
"const std::unique_ptr<VerilatedVcdC> tfp{new VerilatedVcdC};\n");
864 PP(os,
"top->trace (tfp.get(), 99);\n");
865 PP(os,
"tfp->set_time_unit(\"p\");\n");
866 PP(os,
"tfp->set_time_resolution(\"p\");\n");
870 PP(os,
"while (!Verilated::gotFinish())\n");
873 PP(os,
"top->eval();\n");
874 PP(os,
"#if VM_TRACE\n");
875 PP(os,
"tfp->dump (main_time);\n");
877 PP(os,
"main_time += HALF_CLOCK_PERIOD;\n");
879 PP(os,
"#if VM_TRACE\n");
880 PP(os,
"tfp->dump (main_time);\n");
881 PP(os,
"tfp->close();\n");
883 PP(os,
"top->final();\n");
885 PP(os,
"return 0;\n");
894 std::vector<std::string> init_els;
905 if(init_node && (!GetPointer<const constructor>(
GET_CONST_NODE(init_node)) ||
906 GetPointerS<const constructor>(
GET_CONST_NODE(init_node))->list_of_idx_valu.size()))
922 init_els.insert(init_els.end(), num_elements, std::string(data_bitsize,
'0'));
927 init_els.push_back(std::string(data_bitsize,
'0'));
937 std::stringstream init_bits;
938 std::ofstream useless;
939 unsigned long long vec_size = 0, elts_size = 0;
941 const auto bitsize_align = GetPointer<const type_node>(
GET_CONST_NODE(var_type))->algn;
942 THROW_ASSERT((bitsize_align % 8) == 0,
"Alignement is not byte aligned.");
945 std::ofstream init_dat(dat_filename, std::ios::binary);
946 while(!init_bits.eof())
948 std::string bitstring;
949 init_bits >> bitstring;
950 THROW_ASSERT(bitstring.size() % 8 == 0,
"Memory word initializer is not aligned");
953 for(i = bitstring.size(); i >= 8; i -= 8)
956 for(
size_t k = 0;
k < 8; ++
k)
958 byteval = byteval |
static_cast<char>((bitstring.at(i -
k - 1
U) !=
'0') <<
k);
960 init_dat.put(byteval);
963 unsigned long long bytes =
static_cast<unsigned long long>(init_dat.tellp());
964 THROW_ASSERT((bytes % (bitsize_align / 8)) == 0,
"Memory initalization bytes not aligned");
void add_connection(structural_objectRef src, structural_objectRef dest)
Create a connection between a source structural object and a destination structural object...
void ComputeRelationships(DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
const HLS_managerRef HLSMgr
information about all the HLS synthesis
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;.
Factory class to create c backend.
refcount< structural_type_descriptor > structural_type_descriptorRef
RefCount type definition of the structural_type_descriptor class structure.
std::string capitalize(const std::string &str)
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.
bool HasToBeExecuted() const override
Check if this step has actually to be executed.
Structure representing the most relevant information about the type of a structural object...
const std::string & get_id() const
Return the identifier associated with the structural_object.
const std::string c_testbench_basename
const tree_nodeRef CGetTreeReindex(const unsigned int i) const
Return a tree_reindex wrapping the i-th tree_node.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
#define GENERATED_LICENSE
static std::string GetString(enum port_direction)
const structural_objectRef get_circ() const
Get a reference to circ field.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
Datastructure to represent a memory symbol in HLS.
mathematical utility function not provided by standard libraries
static unsigned long long generate_init_file(const std::string &dat_filename, const tree_managerConstRef TreeM, unsigned int var, const memoryRef mem)
Generate HDL testbench for the top-level kernel testing.
This class manages the circuit structures.
static std::vector< std::string > print_var_init(const tree_managerConstRef TreeM, unsigned int var, const memoryRef mem)
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.
std::string hdl_testbench_basename
testbench basename
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...
static unsigned long long GetArrayElementSize(const tree_nodeConstRef &node)
Return the size (in bits) of the base element of the array.
Definition of hash function for EdgeDescriptor.
void Initialize() override
Initialize the step (i.e., like a constructor, but executed just before exec.
Class specification of the manager of the technology library data structures.
#define CST_STR_BAMBU_TESTBENCH
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 ...
static void write_init(const tree_managerConstRef TreeM, tree_nodeRef var_node, tree_nodeRef init_node, std::vector< std::string > &init_file, const memoryRef mem, unsigned long long element_precision)
Simple class used to drive the backend in order to be able to print c source code.
#define STR(s)
Macro which performs a lexical_cast to a string.
#define CLOCK_PORT_NAME
standard name for ports
static void fill_array_ref_memory(std::ostream &init_file_a, std::ostream &init_file_b, unsigned int ar, unsigned long long &vec_size, unsigned long long &elts_size, const memoryRef mem, tree_managerConstRef TM, bool is_sds, unsigned long long bitsize_align)
fill the memory of the array ref
static bool IsArrayType(const tree_nodeConstRef &type)
Return true if treenode is an array.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
static unsigned long long Size(const tree_nodeConstRef &tn)
Return the size of a tree object.
void set_top_info(const std::string &id, const technology_managerRef &LM, const std::string &Library="")
static const uint32_t k[]
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
Class specification of the data structures used to manage technology information. ...
const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > ComputeHLSRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
static structural_objectRef add_port(const std::string &id, port_o::port_direction pdir, structural_objectRef owner, structural_type_descriptorRef type_descr, unsigned int treenode=0)
Create a new port.
Classes to describe design flow graph.
Target must be reexecuted.
#define LIBRARY_STD
standard library where all built-in ports are defined.
DesignFlowStep_Status Exec() override
Execute the step.
TestbenchGeneration(const ParameterConstRef parameters, const HLS_managerRef _HLSMgr, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
const Wrefcount< const DesignFlowManager > design_flow_manager
The design flow manager.
#define GET_CONST_NODE(t)
void SetParameter(const std::string &name, const std::string &value)
Set a parameter value.
virtual enum so_kind get_kind() const =0
Virtual function used to find the real type of a structural_object instance.
Classes specification of the tree_node data structures.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
This file collects some utility functions and macros.
#define STR_CST_INIT_TIME
Constant delay for testbench initialization. It is relevant for XILINX devices.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
#define STD_OPENING_CHAR
STD include.
const std::string output_directory
output directory
void type_resize(unsigned long long new_bit_size)
Just resize the size of the bits of the object.
Data structure definition for HLS constraints.
constants used in testbench generation
#define HIERARCHY_SEPARATOR
This file collects some utility functions.
void ComputeRelationships(DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override
Compute the relationships of a step with other steps.
structural_objectRef add_module_from_technology_library(const std::string &id, const std::string &fu_name, const std::string &library_name, const structural_objectRef owner, const technology_managerConstRef TM)
Create a new object starting from a library component.
refcount< T > lock() const
Very simple pretty printer functor.
Utility header to access wishbone technology library.
std::string id_type
Original type id of the structural object.
#define STD_CLOSING_CHAR
Special closing character used to close the current nested level.
This class describes all classes used to represent a structural object.
const structural_type_descriptorRef & get_typeRef() const
Return the type descriptor of the structural_object.
Class specification of the tree_reindex support class.
static structural_objectRef add_sign(std::string id, structural_objectRef owner, structural_type_descriptorRef sign_type, unsigned int treenode=0)
Create a new signal.
#define OUTPUT_LEVEL_VERY_PEDANTIC
verbose debugging print is performed.
Data structure used to store the functional-unit binding of the vertexes.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
static tree_nodeConstRef CGetType(const tree_nodeConstRef &node)
Return the treenode of the type of node.
HDL writer base class used to specify the interface of the different language writers.
It collects all the common strings covering PandA copyrights issues.
this class is used to manage the command-line or XML options.
Class implementation of the structural_manager.
std::string write_verilator_testbench() const
Write the verilator testbench.
Class specification of the manager for each library.
#define MOUT_OE_PORT_NAME
#define MOUT_BACK_PRESSURE_PORT_NAME
int debug_level
The debug level.
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
refcount< const HLSFlowStepSpecialization > HLSFlowStepSpecializationConstRef
const refcount definition of the class
#define GET_INDEX_CONST_NODE(t)
void create_generic_module(const std::string &fu_name, vertex ve, const FunctionBehaviorConstRef FB, const std::string &libraryId, const std::string &new_fu_name)
static bool IsPointerType(const tree_nodeConstRef &type)
Return true if treenode index is a pointer.
Data structure definition for high-level synthesis flow.
static tree_nodeConstRef GetFunctionReturnType(const tree_nodeConstRef &function, bool void_as_null=true)
Return the return type of a function.
#define GENERATED_COPYRIGHT
Datastructure to represent memory information in high-level synthesis.
Class specification of the manager of the tree structures extracted from the raw file.
static unsigned long long GetArrayTotalSize(const tree_nodeConstRef &node)
Return the total number of elements of the the base type in the array.
HLS specialization of generic_device.
A brief description of the C++ Header File.
#define DEBUG_LEVEL_MINIMUM
minimum debugging print is performed.
#define STD_GET_SIZE(structural_obj)
Macro returning the size of a type.
#define STR_CST_testbench_generation_basename
The basename of the testbench files.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...