Changeset 126 for trunk/modules/vci_synthetic_initator
- Timestamp:
- Jan 13, 2011, 2:02:45 PM (14 years ago)
- Location:
- trunk/modules/vci_synthetic_initator/caba/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_synthetic_initator/caba/sources/include/vci_synthetic_initiator.h
r124 r126 127 127 const size_t m_ymax; 128 128 const size_t m_srcid; 129 static const int tab_size = 1 << vci_param::T; 129 130 130 s ize_t m_count; // Numbers of words sent131 s ize_t m_npackets; // Total number of packets already sent132 uint64_t m_start_latency1; // Start time of sending packet wanted133 uint64_t m_start_latency2; // Start time of sending packet134 uint64_t m_latency1; // Average latency wanted135 uint64_t m_latency2; // Average latency136 addr_t m_address_to_send; // Address to send the write command137 uint32_t m_local_seed;138 int m_id_to_send;131 sc_signal<size_t> r_count; // Numbers of words sent 132 sc_signal<size_t> r_npackets; // Total number of packets already sent 133 sc_signal<uint64_t> r_start_latency1; // Start time of sending packet wanted 134 sc_signal<uint64_t> r_start_latency2; // Start time of sending packet 135 sc_signal<uint64_t> r_latency1; // Average latency wanted 136 sc_signal<uint64_t> r_latency2; // Average latency 137 sc_signal<addr_t> r_address_to_send; // Address to send the write command 138 sc_signal<uint32_t> r_local_seed; 139 sc_signal<int> r_id_to_send; 139 140 140 uint64_t m_start_latency_bc;141 uint64_t m_latency_bc;142 uint64_t m_nb_bc;141 sc_signal<uint64_t> r_start_latency_bc; 142 sc_signal<uint64_t> r_latency_bc; 143 sc_signal<uint64_t> r_nb_bc; 143 144 144 static const int tab_size = 1 << vci_param::T;145 145 // Fifo transmitting date to the VCI FSM 146 146 GenericFifo<uint32_t> m_date_fifo; -
trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp
r125 r126 83 83 m_ymax(ymax), 84 84 m_date_fifo("m_date_fifo", depth), 85 m_local_seed(m_srcid), 86 r_cmd_fsm("r_cmd_fsm") 87 { 85 r_count ("r_count"), 86 r_npackets ("r_npackets"), 87 r_start_latency1 ("r_start_latency1"), 88 r_start_latency2 ("r_start_latency2"), 89 r_latency1 ("r_latency1"), 90 r_latency2 ("r_latency2"), 91 r_address_to_send ("r_address_to_send"), 92 r_local_seed ("r_local_seed"), 93 r_id_to_send ("r_id_to_send"), 94 r_start_latency_bc("r_start_latency_bc"), 95 r_latency_bc ("r_latency_bc"), 96 r_nb_bc ("r_nb_bc"), 97 r_cmd_fsm("r_cmd_fsm"), 98 r_bc_rsp_fsm("r_bc_rsp_fsm"), 99 r_index("r_index"), 100 r_broadcast_req("r_broadcast_req"), 101 r_broadcast_rsp("r_broadcast_rsp"), 102 r_bc_nrsp("r_bc_nrsp") 103 //r_req_id("r_req_id") 104 { 88 105 89 106 r_req_id = new sc_signal<uint64_t>*[tab_size]; … … 144 161 << " : state_cmd_fsm = " << state_cmd_str[r_cmd_fsm] 145 162 << " : state_rsp_fsm = " << state_bc_rsp_str[r_bc_rsp_fsm] 146 << " Adresse to send : " << std::hex << m_address_to_send163 << " Adresse to send : " << std::hex << r_address_to_send.read() 147 164 << " Number of broadcast to receive : " << std::dec << r_bc_nrsp.read() 148 << " Number of packets sent : " << std::dec << m_npackets << " " << m_id_to_send<< std::endl;165 << " Number of packets sent : " << std::dec << r_npackets.read() << " " << r_id_to_send.read() << std::endl; 149 166 for(int i = 0; i < (1<<vci_param::T) ; i++){ 150 167 std::cout << "ID : " << i << " " << (uint64_t)(r_req_id[i][0].read()) << " " << (uint64_t)(r_req_id[i][1].read()) << std::endl; … … 156 173 ////////////////////////////////// 157 174 { 158 std::cout << name() << " : "<< std::dec << m_cpt_cycles << " cycles, " << m_npackets<< " packets sent" << std::endl;159 std::cout << ((double) m_latency1/(double)m_npackets) << " | " << ((double)m_latency2/(double)m_npackets) << std::endl;175 std::cout << name() << " : "<< std::dec << m_cpt_cycles << " cycles, " << r_npackets.read() << " packets sent" << std::endl; 176 std::cout << ((double)r_latency1.read()/(double)r_npackets.read()) << " | " << ((double)r_latency2.read()/(double)r_npackets.read()) << std::endl; 160 177 if(m_bc_period) 161 std::cout << ((double) m_latency_bc/(double)m_nb_bc) << std::endl;178 std::cout << ((double)r_latency_bc.read()/(double)r_nb_bc.read()) << std::endl; 162 179 } 163 180 … … 182 199 183 200 // Initializing the stats 184 m_latency1 = 0 ;185 m_latency2 = 0 ;201 r_latency1 = 0 ; 202 r_latency2 = 0 ; 186 203 // Activity counters 187 204 m_cpt_cycles = 0; 188 m_npackets = 0;189 205 190 m_start_latency_bc = 0;191 m_latency_bc = 0;192 m_nb_bc = 0;193 m_id_to_send = -1;206 r_start_latency_bc = 0; 207 r_latency_bc = 0; 208 r_nb_bc = 0; 209 r_id_to_send = -1; 194 210 195 211 r_broadcast_req = false; … … 198 214 199 215 r_bc_nrsp = 0; 216 r_count = 0; 217 r_npackets = 0; 218 r_start_latency1 = 0; 219 r_start_latency2 = 0; 220 r_address_to_send = 0; 221 r_local_seed = (uint32_t)m_srcid; 222 223 r_latency_bc = 0; 200 224 201 225 for(int i = 0; i < tab_size; i++){ … … 220 244 if (m_date_fifo.rok()){ 221 245 if (r_broadcast_req.read() && !r_broadcast_rsp.read()){ 222 m_address_to_send = 0x3 | (0x7c1f << vci_param::N-20) ;246 r_address_to_send = 0x3 | (0x7c1f << vci_param::N-20) ; 223 247 r_cmd_fsm = VCI_BC_SEND ; 224 248 } else { 225 m_id_to_send = -1;249 r_id_to_send = -1; 226 250 for(int i = 0; i < tab_size; i++){ 227 251 if(r_req_id[i][0].read() == 0){ 228 m_id_to_send = i; 229 //r_req_id[i][0] = m_date_fifo.read(); 230 //r_req_id[i][1] = m_cpt_cycles; 252 r_id_to_send = i; 231 253 break; 232 254 } 233 255 } 234 if( m_id_to_send== -1){256 if(r_id_to_send.read() == -1){ 235 257 r_cmd_fsm = VCI_IDLE ; 236 258 break; … … 239 261 } 240 262 #ifdef DETERMINISTIC 241 m_address_to_send = destAdress(&m_local_seed) << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh)); 263 uint32_t m_local_seed = r_local_seed.read(); 264 r_address_to_send = destAdress(&m_local_seed) << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh)); 265 r_local_seed = m_local_seed; 242 266 #else 243 m_address_to_send = destAdress() << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh));267 r_address_to_send = destAdress() << (vci_param::N)-(soclib::common::uint32_log2((uint32_t)m_xmesh)+soclib::common::uint32_log2((uint32_t)m_ymesh)); 244 268 #endif 245 m_count = 0;269 r_count = 0; 246 270 } 247 271 } … … 252 276 { 253 277 if (p_vci.cmdack.read()){ 254 if (m_count == m_length-1) { 255 //r_req_id[m_id_to_send][0] = (uint64_t)(m_date_fifo.read()); 256 r_req_id[m_id_to_send][0] = m_date_fifo.read(); 257 r_req_id[m_id_to_send][1] = m_cpt_cycles; 278 if (r_count.read() == m_length-1) { 279 r_req_id[r_id_to_send.read()][0] = (uint64_t)(m_date_fifo.read()); 280 r_req_id[r_id_to_send.read()][1] = m_cpt_cycles; 258 281 //std::cout << name () << " FIFO " << m_date_fifo.read() << std::endl; 259 282 date_fifo_get = true; 260 m_npackets++;283 r_npackets = r_npackets.read() + 1; 261 284 r_cmd_fsm = VCI_IDLE ; 262 285 } else { 263 286 r_cmd_fsm = VCI_SINGLE_SEND ; 264 m_count++;287 r_count = r_count.read() + 1; 265 288 } 266 289 } … … 272 295 if (p_vci.rspval.read()) { 273 296 r_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin) ; 274 m_start_latency_bc = m_cpt_cycles;297 r_start_latency_bc = m_cpt_cycles; 275 298 r_broadcast_rsp = true; 276 299 date_fifo_get = true; … … 297 320 r_broadcast_req = false; 298 321 r_broadcast_rsp = false; 299 m_address_to_send= 0;300 m_latency_bc = m_latency_bc + (m_cpt_cycles - m_start_latency_bc);301 m_nb_bc++;322 //r_address_to_send.read() = 0; 323 r_latency_bc = r_latency_bc.read() + (m_cpt_cycles - r_start_latency_bc.read()); 324 r_nb_bc = r_nb_bc.read() + 1; 302 325 r_bc_rsp_fsm = BC_RSP_IDLE ; 303 326 } else { … … 312 335 if(p_vci.rspval.read()){ 313 336 if((int)(p_vci.pktid.read()) == 0){ 314 m_latency1 = m_latency1 + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][0].read()); 315 m_latency2 = m_latency2 + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][1].read()); 316 //m_npackets++; 337 r_latency1 = r_latency1.read() + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][0].read()); 338 r_latency2 = r_latency2.read() + (m_cpt_cycles - r_req_id[(int)(p_vci.rtrdid.read())][1].read()); 317 339 r_req_id[(int)(p_vci.rtrdid.read())][0] = 0; 318 340 r_req_id[(int)(p_vci.rtrdid.read())][1] = 0; … … 322 344 323 345 /////////////////// Filling fifo 324 if( ( (uint64_t)(m_rho*m_cpt_cycles) > (uint64_t)(m_length* m_npackets*1000)) ){346 if( ( (uint64_t)(m_rho*m_cpt_cycles) > (uint64_t)(m_length*r_npackets.read()*1000)) ){ 325 347 if (m_date_fifo.wok()){ 326 348 date_fifo_put = true ; … … 387 409 { 388 410 p_vci.cmdval = true; 389 p_vci.address = (addr_t)( m_address_to_send + (m_count*4));411 p_vci.address = (addr_t)(r_address_to_send.read() + (r_count.read()*4)); 390 412 p_vci.plen = m_length*4; 391 413 p_vci.wdata = 0; 392 p_vci.trdid = m_id_to_send;393 if ( m_count== m_length - 1 ) {414 p_vci.trdid = r_id_to_send.read(); 415 if (r_count.read() == m_length - 1 ) { 394 416 p_vci.eop = true; 395 417 } else { … … 402 424 { 403 425 p_vci.cmdval = true; 404 p_vci.address = (addr_t) m_address_to_send;426 p_vci.address = (addr_t) r_address_to_send.read(); 405 427 p_vci.plen = 4; 406 428 p_vci.wdata = 0;
Note: See TracChangeset
for help on using the changeset viewer.