59 const std::vector<ModuleGenerator::parameter>& ,
60 const std::vector<ModuleGenerator::parameter>& ,
61 const std::vector<ModuleGenerator::parameter>& ,
62 const std::vector<ModuleGenerator::parameter>& )
64 out <<
" // verilator lint_off LITENDIAN\n";
65 out <<
"parameter MAX_BUFF_SIZE = 256;\n";
66 out <<
"reg [0:8*MAX_BUFF_SIZE-1] buffer_name;\n";
67 out <<
"reg [0:8*MAX_BUFF_SIZE-1] buffer_name_old;\n";
69 out <<
" `ifndef _SIM_HAVE_CLOG2\n";
70 out <<
" function integer log2;\n";
71 out <<
" input integer value;\n";
72 out <<
" integer temp_value;\n";
74 out <<
" temp_value = value-1;\n";
75 out <<
" for (log2=0; temp_value>0; log2=log2+1)\n";
76 out <<
" temp_value = temp_value>>1;\n";
78 out <<
" endfunction\n";
81 out <<
" `ifdef _SIM_HAVE_CLOG2\n";
82 out <<
" parameter nbits_buffer = $clog2(MAX_BUFF_SIZE);\n";
84 out <<
" parameter nbits_buffer = log2(MAX_BUFF_SIZE);\n";
87 std::string modes =
"in2";
89 std::string flags_string =
"(" + modes +
" & " +
STR(O_RDWR) +
") != 0 && (" + modes +
" & " +
STR(O_APPEND) +
90 ") ? \"a+b\" : ((" + modes +
" & " +
STR(O_RDWR) +
") != 0 ? \"r+b\" : ((" + modes +
91 " & " +
STR(O_WRONLY) +
") != 0 && (" + modes +
" & " +
STR(O_APPEND) +
") ? \"ab\" : (" +
92 modes +
" & " +
STR(O_WRONLY) +
") != 0 ? \"wb\" : \"rb\"" +
"))";
95 " reg [nbits_buffer-1:0] _present_index;\n" 96 " reg [nbits_buffer-1:0] _next_index;\n" 97 " reg [BITSIZE_Mout_addr_ram-1:0] _present_pointer;\n" 98 " reg [BITSIZE_Mout_addr_ram-1:0] _next_pointer;\n" 100 " reg signed [BITSIZE_out1-1:0] temp_out1;\n" 101 " reg Mout_oe_ram;\n" 102 " reg Mout_we_ram;\n" 103 " reg [BITSIZE_Mout_addr_ram-1:0] Mout_addr_ram;\n" 104 " reg [BITSIZE_Mout_Wdata_ram-1:0] Mout_Wdata_ram;\n" 105 " reg [BITSIZE_Mout_data_ram_size-1:0] Mout_data_ram_size;\n" 106 " reg active_request;\n" 107 " reg active_request_now;\n" 108 " reg active_request_next;\n" 109 " reg M_DataRdy_reg;\n" 110 " reg [BITSIZE_M_Rdata_ram-1:0]M_Rdata_ram_reg;\n" 112 " parameter [1:0] S_0 = 2'd0,\n" 115 " reg [1:0] _present_state 1INIT_ZERO_VALUE;\n" 116 " reg [1:0] _next_state;\n" 117 " reg [63:0] data1;\n" 118 " reg [7:0] data1_size;\n" 120 " assign out1 = {1'b0,temp_out1[30:0]};\n" 121 " always @(posedge clock 1RESET_EDGE)\n" 123 " if (1RESET_VALUE)\n" 125 " active_request <= 0;\n" 129 " active_request <= active_request_next;\n" 132 " always @(posedge clock 1RESET_EDGE)\n" 133 " if (1RESET_VALUE)\n" 135 " _present_state <= S_0;\n" 136 " _present_pointer <= {BITSIZE_Mout_addr_ram{1'b0}};\n" 137 " _present_index <= {nbits_buffer{1'b0}};\n" 138 " buffer_name_old <= {8*MAX_BUFF_SIZE{1'b0}};\n" 139 " M_DataRdy_reg <= 0;\n" 140 " M_Rdata_ram_reg <= 0;\n" 144 " _present_state <= _next_state;\n" 145 " _present_pointer <= _next_pointer;\n" 146 " _present_index <= _next_index;\n" 147 " buffer_name_old <= buffer_name;\n" 148 " M_DataRdy_reg <= M_DataRdy;\n" 149 " M_Rdata_ram_reg <= M_Rdata_ram;\n" 154 " Mout_we_ram = Min_we_ram;\n" 155 " Mout_Wdata_ram = Min_Wdata_ram;\n" 156 " Mout_oe_ram = Min_oe_ram;\n" 157 " Mout_addr_ram = Min_addr_ram;\n" 158 " Mout_data_ram_size = Min_data_ram_size;\n" 159 " Mout_oe_ram = Min_oe_ram;\n" 160 " Mout_addr_ram = Min_addr_ram;\n" 161 " Mout_data_ram_size = Min_data_ram_size;\n" 162 " done_port = 1'b0;\n" 163 " _next_state = _present_state;\n" 164 " _next_pointer = _present_pointer;\n" 165 " _next_index = _present_index;\n" 166 " active_request_next = 1'b0;\n" 167 " active_request_now = 1'b0;\n" 168 " buffer_name = buffer_name_old;\n" 169 " case (_present_state)\n" 173 " _next_pointer = 0;\n" 174 " _next_index = {nbits_buffer{1'b0}};\n" 175 " _next_state = S_1; \n" 176 " active_request_next = 1'b1;\n" 177 " buffer_name = 0; \n" 178 " _next_pointer = 0;\n" 179 " _next_index = {nbits_buffer{1'b0}};\n" 180 " _next_state = S_1; \n" 181 " active_request_next = 1'b1;\n" 182 " buffer_name = 0; \n" 186 " if(M_DataRdy_reg)\n" 188 " buffer_name[_present_index*8 +:8] = M_Rdata_ram_reg[7:0];\n" 189 " if(M_Rdata_ram_reg[7:0] == 8'd0)\n" 190 " _next_state = S_2;\n" 193 " _next_state = S_1;\n" 194 " _next_pointer = _present_pointer+1'd1;\n" 195 " _next_index = _present_index+1'd1;\n" 196 " active_request_now = 1'b1;\n" 199 " Mout_addr_ram[BITSIZE_Mout_addr_ram-1:0] = (in1[BITSIZE_Mout_addr_ram-1:0] + _next_pointer) & " 200 "{BITSIZE_Mout_addr_ram{active_request || active_request_now}};\n" 201 " Mout_data_ram_size = {{BITSIZE_Mout_data_ram_size-4{1'b0}}, 4'd8} & " 202 "{BITSIZE_Mout_data_ram_size{active_request || active_request_now}};\n" 203 " Mout_oe_ram = active_request || active_request_now;\n" 207 "// synthesis translate_off\n" 208 " temp_out1 = $fopen(buffer_name, " +
211 "// synthesis translate_on\n" 212 " done_port = 1'b1;\n" 213 " _next_state = S_0;\n" 219 out <<
" // verilator lint_on LITENDIAN\n";
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
OpenModuleGenerator(const HLS_managerRef &HLSMgr)
#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.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...