61 const std::vector<ModuleGenerator::parameter>& _p,
62 const std::vector<ModuleGenerator::parameter>& ,
63 const std::vector<ModuleGenerator::parameter>& ,
64 const std::vector<ModuleGenerator::parameter>& )
66 const auto data_bus_bitsize =
STR(HLSMgr->Rmem->get_bus_data_bitsize());
67 const auto addr_bus_bitsize =
STR(HLSMgr->get_address_bitsize());
68 const auto size_bus_bitsize =
STR(HLSMgr->Rmem->get_bus_size_bitsize());
70 out <<
" // verilator lint_off LITENDIAN\n";
71 out <<
"parameter MAX_BUFF_SIZE = 256;\n";
72 out <<
"reg [0:8*MAX_BUFF_SIZE-1] buffer_name;\n";
74 out <<
" `ifndef _SIM_HAVE_CLOG2\n";
75 out <<
" function integer log2;\n";
76 out <<
" input integer value;\n";
77 out <<
" integer temp_value;\n";
79 out <<
" temp_value = value-1;\n";
80 out <<
" for (log2=0; temp_value>0; log2=log2+1)\n";
81 out <<
" temp_value = temp_value>>1;\n";
83 out <<
" endfunction\n";
86 out <<
" `ifdef _SIM_HAVE_CLOG2\n";
87 out <<
" parameter nbits_buffer = $clog2(MAX_BUFF_SIZE);\n";
89 out <<
" parameter nbits_buffer = log2(MAX_BUFF_SIZE);\n";
92 std::string sensitivity;
93 for(
auto i = 0
U; i < _p.size(); i++)
95 sensitivity +=
" or " + _p[i].name;
98 std::string modes =
"in2";
100 std::string flags_string =
"(" + modes +
" & " +
STR(O_RDWR) +
") != 0 && (" + modes +
" & " +
STR(O_APPEND) +
101 ") ? \"a+b\" : ((" + modes +
" & " +
STR(O_RDWR) +
") != 0 ? \"r+b\" : ((" + modes +
102 " & " +
STR(O_WRONLY) +
") != 0 && (" + modes +
" & " +
STR(O_APPEND) +
") ? \"ab\" : (" +
103 modes +
" & " +
STR(O_WRONLY) +
") != 0 ? \"wb\" : \"rb\"" +
"))";
106 " reg [nbits_buffer-1:0] _present_index;\n" 107 " reg [nbits_buffer-1:0] _next_index;\n" 108 " reg [BITSIZE_Mout_addr_ram-1:0] _present_pointer;\n" 109 " reg [BITSIZE_Mout_addr_ram-1:0] _next_pointer;\n" 111 " wire mem_done_port;\n" 112 " reg signed [BITSIZE_out1-1:0] temp_out1;\n" 114 " parameter [1:0] S_0 = 2'd0,\n" 118 " reg [3:0] _present_state;\n" 119 " reg [3:0] _next_state;\n" 120 " reg [63:0] data1;\n" 121 " reg [7:0] data1_size;\n" 131 " reg mem_start_port;\n" 132 " reg mem_sel_LOAD;\n" 133 " MEMORY_CTRL_P1N #(.BITSIZE_in1(" +
134 data_bus_bitsize +
"), .BITSIZE_in2(" + addr_bus_bitsize +
"), .BITSIZE_in3(" + size_bus_bitsize +
135 "), .BITSIZE_in4(1), .BITSIZE_out1(" + data_bus_bitsize +
136 "), .BITSIZE_Min_oe_ram(BITSIZE_Min_oe_ram), .PORTSIZE_Min_oe_ram(PORTSIZE_Min_oe_ram), " 137 ".BITSIZE_Min_we_ram(BITSIZE_Min_we_ram), .PORTSIZE_Min_we_ram(PORTSIZE_Min_we_ram), " 138 ".BITSIZE_Mout_oe_ram(BITSIZE_Mout_oe_ram), .PORTSIZE_Mout_oe_ram(PORTSIZE_Mout_oe_ram), " 139 ".BITSIZE_Mout_we_ram(BITSIZE_Mout_we_ram), .PORTSIZE_Mout_we_ram(PORTSIZE_Mout_we_ram), " 140 ".BITSIZE_M_DataRdy(BITSIZE_M_DataRdy), .PORTSIZE_M_DataRdy(PORTSIZE_M_DataRdy), " 141 ".BITSIZE_Min_addr_ram(BITSIZE_Min_addr_ram), .PORTSIZE_Min_addr_ram(PORTSIZE_Min_addr_ram), " 142 ".BITSIZE_Mout_addr_ram(BITSIZE_Mout_addr_ram), .PORTSIZE_Mout_addr_ram(PORTSIZE_Mout_addr_ram), " 143 ".BITSIZE_M_Rdata_ram(BITSIZE_M_Rdata_ram), .PORTSIZE_M_Rdata_ram(PORTSIZE_M_Rdata_ram), " 144 ".BITSIZE_Min_Wdata_ram(BITSIZE_Min_Wdata_ram), .PORTSIZE_Min_Wdata_ram(PORTSIZE_Min_Wdata_ram), " 145 ".BITSIZE_Mout_Wdata_ram(BITSIZE_Mout_Wdata_ram), .PORTSIZE_Mout_Wdata_ram(PORTSIZE_Mout_Wdata_ram), " 146 ".BITSIZE_Min_data_ram_size(BITSIZE_Min_data_ram_size), " 147 ".PORTSIZE_Min_data_ram_size(PORTSIZE_Min_data_ram_size), " 148 ".BITSIZE_Mout_data_ram_size(BITSIZE_Mout_data_ram_size), " 149 ".PORTSIZE_Mout_data_ram_size(PORTSIZE_Mout_data_ram_size), .BITSIZE_access_allowed(BITSIZE_access_allowed), " 150 ".PORTSIZE_access_allowed(PORTSIZE_access_allowed), .BITSIZE_access_request(BITSIZE_access_request), " 151 ".PORTSIZE_access_request(PORTSIZE_access_request)) MEMORY_CTRL_P1N_instance (.done_port(mem_done_port), " 152 ".out1(mem_out1), .Mout_oe_ram(Mout_oe_ram), .Mout_we_ram(Mout_we_ram), .Mout_addr_ram(Mout_addr_ram), " 153 ".Mout_Wdata_ram(Mout_Wdata_ram), .Mout_data_ram_size(Mout_data_ram_size), .access_request(access_request), " 154 ".clock(clock), .start_port(mem_start_port), .in1(0), .in2(mem_in2), .in3(mem_in3), .in4(1), " 155 ".sel_LOAD(mem_sel_LOAD), .sel_STORE(1'b0), .Min_oe_ram(Min_oe_ram), .Min_we_ram(Min_we_ram), " 156 ".Min_addr_ram(Min_addr_ram), .M_Rdata_ram(M_Rdata_ram), .Min_Wdata_ram(Min_Wdata_ram), " 157 ".Min_data_ram_size(Min_data_ram_size), .M_DataRdy(M_DataRdy), .access_allowed(access_allowed));\n" 160 " always @(posedge clock 1RESET_EDGE)\n" 161 " if (1RESET_VALUE)\n" 163 " _present_state <= S_0;\n" 164 " _present_pointer <= {BITSIZE_Mout_addr_ram{1'b0}};\n" 165 " _present_index <= {nbits_buffer{1'b0}};\n" 169 " _present_state <= _next_state;\n" 170 " _present_pointer <= _next_pointer;\n" 171 " _present_index <= _next_index;\n" 174 " assign out1 = {1'b0,temp_out1[30:0]};" 175 " always @(_present_state or _present_pointer or _present_index or start_port or mem_done_port or Min_we_ram " 176 "or Min_oe_ram or Min_Wdata_ram or Min_addr_ram or Min_data_ram_size" +
180 " done_port = 1'b0;\n" 181 " _next_state = _present_state;\n" 182 " _next_pointer = _present_pointer;\n" 183 " _next_index = _present_index;\n" 184 " mem_sel_LOAD = 1'b0;\n" 191 " mem_start_port = 1'b0;\n" 192 " case (_present_state)\n" 196 " _next_pointer=0;\n" 197 " _next_index={nbits_buffer{1'b0}};\n" 198 " _next_state=S_1; \n" 204 " mem_in2 = in1[BITSIZE_Mout_addr_ram-1:0]+_present_pointer;\n" 205 " mem_in3 = {{BITSIZE_Mout_data_ram_size-4{1'b0}}, 4'd8};\n" 206 " mem_sel_LOAD=1'b1;\n" 207 " mem_start_port=1'b1;\n" 208 " if(mem_done_port)\n" 210 " buffer_name[_present_index*8 +:8] = mem_out1[7:0];\n" 211 " if(mem_out1[7:0] == 8'd0)\n" 212 " _next_state=S_2;\n" 214 " _next_state=S_3;\n" 219 "// synthesis translate_off\n" 220 " temp_out1 = $fopen(buffer_name, " +
223 "// synthesis translate_on\n" 224 " done_port = 1'b1;\n" 225 " _next_state=S_0;\n" 229 " if(!mem_done_port)\n" 231 " _next_pointer=_present_pointer+1'd1;\n" 232 " _next_index=_present_index+1'd1;\n" 233 " _next_state=S_1;\n" 240 out <<
" // verilator lint_on LITENDIAN\n";
Data structure representing the entire HLS information.
#define STR(s)
Macro which performs a lexical_cast to a string.
This class writes different HDL based descriptions (VHDL, Verilog, SystemC) starting from a structura...
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
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
OpenP1NModuleGenerator(const HLS_managerRef &HLSMgr)
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Datastructure to represent memory information in high-level synthesis.