59 unsigned int function_id,
vertex ,
61 const std::vector<ModuleGenerator::parameter>& ,
62 const std::vector<ModuleGenerator::parameter>& ,
63 const std::vector<ModuleGenerator::parameter>& ,
64 const std::vector<ModuleGenerator::parameter>& )
72 const auto arg_name = mod_cir->
get_id().substr(
sizeof(
"if_axis_") - 1
U, std::string::npos);
74 const auto top_bh = HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper();
75 const auto top_fname = top_bh->GetMangledFunctionName();
76 const auto top_fnode = HLSMgr->get_tree_manager()->CGetTreeReindex(function_id);
78 const auto& iface_attrs = HLSMgr->module_arch->GetArchitecture(top_fname)->ifaces.at(arg_name);
80 const auto if_alignment = iface_attrs.at(FunctionArchitecture::iface_alignment);
81 const auto if_ndir = if_dir == port_o::IN ? port_o::OUT : port_o::IN;
82 const auto port_prefix = (if_dir == port_o::IN ?
"s_axis_" :
"m_axis_") + arg_name;
83 std::string np_library = mod_cir->
get_id() +
" index";
84 std::string ip_components;
85 const auto add_port_parametric = [&](
const std::string& suffix,
port_o::port_direction dir,
unsigned port_size) {
86 const auto port_name = port_prefix + suffix;
89 np_library +=
" " + port_name;
91 add_port_parametric(
"_TDATA", if_ndir, 1
U);
92 add_port_parametric(
"_TVALID", if_ndir, 0
U);
93 add_port_parametric(
"_TREADY", if_dir, 0
U);
94 out <<
"localparam BITSIZE_data=BITSIZE_" << port_prefix <<
"_TDATA;\n";
96 if(if_dir == port_o::IN)
98 ip_components =
"TestbenchFifoRead";
99 out <<
"assign tb_done_port = 1'b1;\n\n" 100 <<
"TestbenchFifoRead #(.index(index),\n" 101 <<
" .CHECK_ACK(1),\n" 102 <<
" .BITSIZE_dout(BITSIZE_data)) fifo_read(.clock(clock),\n" 103 <<
" .setup_port(setup_port),\n" 104 <<
" .done_port(done_port),\n" 105 <<
" .empty_n(" << port_prefix <<
"_TVALID),\n" 106 <<
" .read(" << port_prefix <<
"_TREADY),\n" 107 <<
" .dout(" << port_prefix <<
"_TDATA));\n";
109 else if(if_dir == port_o::OUT)
111 ip_components =
"TestbenchFifoWrite";
112 out <<
"wire _full_n;\n" 113 <<
"assign " << port_prefix <<
"_TREADY = _full_n;\n" 114 <<
"assign tb_done_port = ~_full_n;\n\n" 115 <<
"TestbenchFifoWrite #(.index(index),\n" 116 <<
" .BITSIZE_din(BITSIZE_data)) fifo_write(.clock(clock),\n" 117 <<
" .setup_port(setup_port),\n" 118 <<
" .done_port(done_port),\n" 119 <<
" .full_n(_full_n),\n" 120 <<
" .write(" << port_prefix <<
"_TVALID),\n" 121 <<
" .din(" << port_prefix <<
"_TDATA));\n";
Data structure representing the entire HLS information.
refcount< structural_type_descriptor > structural_type_descriptorRef
RefCount type definition of the structural_type_descriptor class structure.
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.
static std::string GetString(enum port_direction)
void InternalExec(std::ostream &out, structural_objectRef mod, unsigned int function_id, vertex op_v, const HDLWriter_Language language, const std::vector< ModuleGenerator::parameter > &_p, const std::vector< ModuleGenerator::parameter > &_ports_in, const std::vector< ModuleGenerator::parameter > &_ports_out, const std::vector< ModuleGenerator::parameter > &_ports_inout) final
port_direction
Enumerative type describing the direction of a port.
TestbenchAxisModuleGenerator(const HLS_managerRef &HLSMgr)
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
static void add_NP_functionality(structural_objectRef cir, NP_functionality::NP_functionaly_type dt, std::string functionality_description)
Add a not-parsed functionality.
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
static port_direction to_port_direction(const std::string &val)
Convert a string into the corresponding port_direction enumerative type.
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.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
This file collects some utility functions.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Class implementation of the structural_manager.
static tree_nodeConstRef GetFunctionReturnType(const tree_nodeConstRef &function, bool void_as_null=true)
Return the return type of a function.
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.