Changeset 106 for trunk/modules/vci_synthetic_initator
- Timestamp:
- Oct 14, 2010, 2:58:27 PM (14 years ago)
- Location:
- trunk/modules/vci_synthetic_initator/caba
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_synthetic_initator/caba/metadata/vci_synthetic_initiator.sd
r98 r106 18 18 parameter.IntTab('vci_index'), 19 19 parameter.Int('length'), 20 parameter. Float('rho'),20 parameter.Int('rho'), 21 21 parameter.Int('depth'), 22 22 parameter.Int('xmesh'), -
trunk/modules/vci_synthetic_initator/caba/sources/include/vci_synthetic_initiator.h
r102 r106 47 47 : public soclib::caba::BaseModule 48 48 { 49 typedef sc_dt::sc_uint<40> addr_t; 50 typedef typename vci_param::fast_addr_t vci_addr_t; 49 typedef uint32_t addr_t; 51 50 typedef uint32_t data_t; 52 51 typedef uint32_t tag_t; … … 54 53 typedef uint32_t be_t; 55 54 typedef uint32_t copy_t; 56 57 // Type of the addr_t and access of the fields58 //typedef union{59 // PACKED_BITFIELD(60 // vci_addr_t srcid:vci_param::S,61 // vci_addr_t null:(8*sizeof(vci_addr_t)-(2*vci_param::S)),62 // ) normal_address;63 // PACKED_BITFIELD(64 // vci_addr_t xmin:vci_param::S,65 // vci_addr_t xmax:vci_param::S,66 // vci_addr_t ymin:vci_param::S,67 // vci_addr_t ymax:vci_param::S,68 // vci_addr_t null_:(8*sizeof(vci_addr_t)-(4*vci_param::S)),69 // vci_addr_t bc:2,70 // ) broadcast_address;71 //} addr_t;72 55 73 56 … … 85 68 }; 86 69 87 uint 64_t m_cpt_cycles; // Counter of cycles70 uint32_t m_cpt_cycles; // Counter of cycles 88 71 89 72 … … 102 85 const soclib::common::IntTab &vci_index, 103 86 const uint32_t length, // Packet length (flit numbers) 104 const float rho, // Packets ratio on the network 87 const uint32_t rho, // Packets ratio on the network 88 //const float rho, // Packets ratio on the network 105 89 const uint32_t depth, // Fifo depth 106 90 const uint32_t xmesh, … … 121 105 size_t destAdress(); 122 106 107 void printStats(); 108 109 void print_trace(); 110 123 111 private: 124 112 125 113 // Component attributes 126 114 const size_t m_length; // Number of words to write 127 const float m_rho; // Rate of packets in the network wanted 115 const size_t m_rho; // Rate of packets in the network wanted 116 //const float m_rho; // Rate of packets in the network wanted 128 117 const size_t m_depth; // Fifo depth 129 118 const size_t m_xmesh; … … 135 124 const size_t m_ymax; 136 125 const size_t m_srcid; 137 const size_t m_coord;138 126 139 127 size_t m_count; // Numbers of words sent … … 141 129 uint64_t m_start_latency1; // Start time of sending packet wanted 142 130 uint64_t m_start_latency2; // Start time of sending packet 143 float m_rhos; // Effective Rho during the simulation131 // float m_rhos; // Effective Rho during the simulation 144 132 size_t m_bc_nrsp; // Expected number of responses for a broadcast command 133 addr_t m_address_to_send; // Address to send the write command 145 134 146 135 // Fifo transmitting date to the VCI FSM 147 GenericFifo<uint 64_t> m_date_fifo;136 GenericFifo<uint32_t> m_date_fifo; 148 137 149 138 sc_signal<int> r_vci_fsm; … … 153 142 sc_signal<bool> r_broadcast_req; 154 143 155 sc_signal<addr_t> r_address_to_send; // Address to send the write command156 144 157 145 }; // end class VciSyntheticInitiator -
trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp
r102 r106 29 29 30 30 #include "../include/vci_synthetic_initiator.h" 31 #include <iostream> 31 32 32 33 … … 48 49 const soclib::common::IntTab &vci_index, 49 50 const uint32_t length, // Packet length (flit numbers) 50 const float rho, // Packets ratio on the network 51 const uint32_t rho, // Packets ratio on the network 52 // const float rho, // Packets ratio on the network 51 53 const uint32_t depth, // Fifo depth 52 54 const uint32_t xmesh, … … 66 68 67 69 m_srcid( mt.indexForId(vci_index) ), 68 m_coord(vci_index[1]),69 70 // FIFOs 70 71 m_length(length), … … 104 105 /////////////////////////////////// 105 106 { 106 size_t dest; 107 do{ 108 dest = (size_t) (rand() % (m_xmesh * m_ymesh)); 109 } while(dest == m_srcid); 110 return dest ; 107 return (size_t) (rand() % (m_xmesh * m_ymesh)) ; 111 108 } 112 109 … … 123 120 // } 124 121 122 123 ////////////////////////////////// 124 tmpl(void)::print_trace() 125 ////////////////////////////////// 126 { 127 const char* state_str[] = { "IDLE", 128 "SINGLE_SEND", 129 "SINGLE_RECEIVE", 130 "BC_SEND", 131 "BC_RECEIVE" }; 132 133 std::cout << "Vci_Synthetic_Initiator " << name() 134 << " : " << m_cpt_cycles << " cycles " 135 << " : state = " << state_str[r_vci_fsm] 136 << " Adresse to send : " << m_address_to_send << std::endl; 137 } 138 139 ////////////////////////////////// 140 tmpl(void)::printStats() 141 ////////////////////////////////// 142 { 143 std::cout << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl; 144 } 145 125 146 ////////////////////////////////// 126 147 tmpl(void)::transition() 127 148 ////////////////////////////////// 128 149 { 129 150 // RESET … … 142 163 m_npackets = 0; 143 164 165 r_broadcast_req = false; 166 144 167 return; 145 168 } … … 148 171 bool date_fifo_get = false; 149 172 173 // if (m_cpt_cycles == 0) { 174 // m_rhos = 0.0 ; 175 // } else { 176 // m_rhos = static_cast<float>(m_npackets * m_length) / static_cast<float>(m_cpt_cycles) ; 177 // } 178 179 180 150 181 switch ( r_vci_fsm.read() ) { 151 182 183 std::cout << m_cpt_cycles << " cycles, " << m_npackets << " packets sent" << std::endl; 184 //printStats(); 152 185 ////////////////// 153 186 case VCI_IDLE: … … 155 188 if (m_date_fifo.rok()){ 156 189 if (r_broadcast_req.read()){ 190 m_address_to_send = (((((((((m_xmin << 5) | m_xmax ) << 5 ) | m_ymin ) << 5 ) | m_ymax ) << 5 ) << vci_param::N-(4*5) ) | 0x3) | 0 ; 157 191 r_vci_fsm = VCI_BC_SEND ; 158 192 } else { 159 193 r_vci_fsm = VCI_SINGLE_SEND ; 160 r_address_to_send = destAdress();194 m_address_to_send = destAdress() << 32-10; 161 195 m_count = 0; 162 196 } … … 168 202 { 169 203 if (p_vci.cmdack.read()){ 170 m_count++;171 204 if (m_count == m_length-1) { 172 205 m_start_latency1 = m_date_fifo.read(); … … 175 208 } else { 176 209 r_vci_fsm = VCI_SINGLE_SEND ; 210 m_count++; 177 211 } 178 212 } … … 187 221 m_npackets++; 188 222 date_fifo_get = true; 223 m_address_to_send = 0; 189 224 r_vci_fsm = VCI_IDLE ; 190 225 } … … 194 229 case VCI_BC_SEND: 195 230 { 196 r_address_to_send = (((((((((m_xmin << 5) & m_xmax ) << 5 ) & m_ymin ) << 5 ) & m_ymax ) << 5 ) << 17 ) & 0x3) | 0 ;197 //m_address_to_send.broadcast_address.xmin = m_xmin;198 //m_address_to_send.broadcast_address.xmax = m_xmax;199 //m_address_to_send.broadcast_address.ymin = m_ymin;200 //m_address_to_send.broadcast_address.ymax = m_ymax;201 //m_address_to_send.broadcast_address.bc = 0x3;202 231 m_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin); 203 232 r_vci_fsm = VCI_BC_SEND; … … 210 239 if (m_bc_nrsp == 0) { 211 240 r_broadcast_req = false; 241 m_address_to_send = 0; 212 242 r_vci_fsm = VCI_IDLE ; 213 243 } else { … … 221 251 222 252 223 /////////////////// Filling fifo224 if( ( m_rhos < m_rho) && (rand()/RAND_MAX) ){253 /////////////////// Filling fifo 254 if( ( (uint64_t)(m_rho*m_cpt_cycles) >= (uint64_t)(m_length*m_npackets*1000)) ){ 225 255 if (m_date_fifo.wok()){ 226 256 date_fifo_put = true ; 227 257 } 228 if (!r_broadcast_req.read() && (m_cpt_cycles % m_bc_period)){ 229 r_broadcast_req = true; 258 if (m_bc_period){ 259 if (!r_broadcast_req.read() && (m_cpt_cycles % m_bc_period)){ 260 r_broadcast_req = true; 261 } 230 262 } 231 263 } … … 243 275 } 244 276 245 m_rhos = (float) ((m_npackets * m_length) / m_cpt_cycles) ;246 247 277 m_cpt_cycles++; 248 278 … … 287 317 { 288 318 p_vci.cmdval = true; 289 p_vci.address = ( vci_addr_t)(r_address_to_send.read()+ (m_count*4));319 p_vci.address = (addr_t)(m_address_to_send + (m_count*4)); 290 320 p_vci.plen = m_length*4; 291 321 p_vci.wdata = 0; … … 315 345 { 316 346 p_vci.cmdval = true; 317 p_vci.address = ( vci_addr_t) r_address_to_send.read();347 p_vci.address = (addr_t) m_address_to_send; 318 348 p_vci.plen = 4; 319 349 p_vci.wdata = 0;
Note: See TracChangeset
for help on using the changeset viewer.