65 const std::vector<ModuleGenerator::parameter>& ,
66 const std::vector<ModuleGenerator::parameter>& ,
67 const std::vector<ModuleGenerator::parameter>& ,
68 const std::vector<ModuleGenerator::parameter>& )
76 const auto top = HLSMgr->get_HLS(top_id)->top;
77 const auto top_cir =
top->get_circ();
78 const auto top_mod = GetPointer<module>(top_cir);
80 const auto parameters = HLSMgr->get_parameter();
82 const auto memory_mapped_top =
parameters->getOption<
bool>(OPT_memory_mapped_top);
84 std::string signals, modules;
85 std::set<std::string> internal_ports;
86 const auto escape_keyword = [&](
const std::string&
str) -> std::string {
89 return "\\" +
str +
" ";
100 signals +=
"wire irq;\n";
101 modules +=
"assign done_port = irq;\n\n";
102 internal_ports.insert(
"irq");
109 THROW_ERROR(
"Interface type not supported for memory mapped top simulation.");
117 const auto mod_id = escape_keyword(top_mod->get_id());
118 std::string dut_body = mod_id +
" top(";
119 const auto port_count = top_mod->get_num_ports();
120 for(
auto i = 0
U; i < port_count; ++i)
122 const auto top_port = GetPointerS<port_o>(top_mod->get_positional_port(i));
123 const auto port_id = top_port->get_id();
124 if(!internal_ports.count(port_id))
127 const auto port_size = [&]() {
133 return top_port->get_kind() ==
port_vector_o_K ? (port_bitsize * top_port->get_ports_size()) : port_bitsize;
138 dut_body +=
"\n ." + escape_keyword(port_id) +
"(" + escape_keyword(port_id) +
"),";
143 out << signals <<
"\n" << modules <<
"\n" << dut_body;
Data structure representing the entire HLS information.
void * top(node_stack *head)
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...
TestbenchDUTModuleGenerator(const HLS_managerRef &HLSMgr)
#define CLOCK_PORT_NAME
standard name for ports
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Class for system verilog writing.
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
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.
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
#define GET_TYPE_SIZE(structural_obj)
Macro returning the size of the type of a structural object.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
static bool check_keyword_verilog(const std::string &word)
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
this class is used to manage the command-line or XML options.
Class implementation of the structural_manager.
Data structure definition for high-level synthesis flow.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...