62 unsigned int function_id,
vertex ,
64 const std::vector<ModuleGenerator::parameter>& ,
65 const std::vector<ModuleGenerator::parameter>& ,
66 const std::vector<ModuleGenerator::parameter>& ,
67 const std::vector<ModuleGenerator::parameter>& )
75 const auto arg_name = mod_cir->
get_id().substr(
sizeof(
"if_array_") - 1
U, std::string::npos);
77 const auto top_bh = HLSMgr->CGetFunctionBehavior(function_id)->CGetBehavioralHelper();
78 const auto top_fname = top_bh->GetMangledFunctionName();
79 const auto& iface_attrs = HLSMgr->module_arch->GetArchitecture(top_fname)->ifaces.at(arg_name);
81 const auto n_channels = HLSMgr->get_parameter()->getOption<
unsigned int>(OPT_channels_number);
83 std::string np_library = mod_cir->
get_id() +
" index WRITE_DELAY READ_DELAY";
86 const auto port_name = arg_name +
"_" + name +
STR(idx);
89 np_library +=
" " + port_name;
92 std::vector<std::string> ce, we, address, d, q;
93 for(
unsigned i = 0; i < n_channels; ++i)
95 address.push_back(add_port_parametric(i,
"address", port_o::IN, 1
U));
96 ce.push_back(add_port_parametric(i,
"ce", port_o::IN, 0
U));
97 if(if_dir != port_o::IN)
99 we.push_back(add_port_parametric(i,
"we", port_o::IN, 0
U));
100 d.push_back(add_port_parametric(i,
"d", port_o::IN, 1
U));
104 we.push_back(
"1'b0");
105 d.push_back(
"{BITSIZE_dq{1'b0}}");
107 if(if_dir != port_o::OUT)
109 q.push_back(add_port_parametric(i,
"q", port_o::OUT, 1
U));
114 out <<
"localparam CHANNELS_NUMBER=" << n_channels <<
",\n" 115 <<
" BITSIZE_address=BITSIZE_" << arg_name <<
"_address0,\n" 116 <<
" BITSIZE_dq=BITSIZE_" << arg_name << (if_dir == port_o::IN ?
"_q0" :
"_d0") <<
";\n\n";
118 out <<
"TestbenchArrayImpl #(.index(index),\n" 119 <<
" .WRITE_DELAY(WRITE_DELAY),\n" 120 <<
" .READ_DELAY(READ_DELAY),\n" 121 <<
" .PORTSIZE_address(CHANNELS_NUMBER),\n" 122 <<
" .BITSIZE_address(BITSIZE_address),\n" 123 <<
" .PORTSIZE_ce(CHANNELS_NUMBER),\n" 124 <<
" .PORTSIZE_we(CHANNELS_NUMBER),\n" 125 <<
" .PORTSIZE_d(CHANNELS_NUMBER),\n" 126 <<
" .BITSIZE_d(BITSIZE_dq),\n" 127 <<
" .PORTSIZE_q(CHANNELS_NUMBER),\n" 128 <<
" .BITSIZE_q(BITSIZE_dq)) array_impl(.clock(clock),\n" 129 <<
" .setup_port(setup_port),\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.
mathematical utility function not provided by standard libraries
#define STR(s)
Macro which performs a lexical_cast to a string.
port_direction
Enumerative type describing the direction of a port.
#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.
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
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
This file collects some utility functions and macros.
This file collects some utility functions.
TestbenchArrayModuleGenerator(const HLS_managerRef &HLSMgr)
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
this class is used to manage the command-line or XML options.
std::string container_to_string(_InputIt first, _InputIt last, const std::string &separator, bool trim_empty=true)
Class implementation of the structural_manager.
A brief description of the C++ Header File.