SimpleNetwork.cc (9274:ba635023d4bb) | SimpleNetwork.cc (9302:c2e70a9bc340) |
---|---|
1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 313 unchanged lines hidden (view full) --- 322 out << "[SimpleNetwork]"; 323} 324 325SimpleNetwork * 326SimpleNetworkParams::create() 327{ 328 return new SimpleNetwork(this); 329} | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 313 unchanged lines hidden (view full) --- 322 out << "[SimpleNetwork]"; 323} 324 325SimpleNetwork * 326SimpleNetworkParams::create() 327{ 328 return new SimpleNetwork(this); 329} |
330 331/* 332 * The simple network has an array of switches. These switches have buffers 333 * that need to be accessed for functional reads and writes. Also the links 334 * between different switches have buffers that need to be accessed. 335 */ 336bool 337SimpleNetwork::functionalRead(Packet *pkt) 338{ 339 for (unsigned int i = 0; i < m_switch_ptr_vector.size(); i++) { 340 if (m_switch_ptr_vector[i]->functionalRead(pkt)) { 341 return true; 342 } 343 } 344 345 for (unsigned int i = 0; i < m_buffers_to_free.size(); ++i) { 346 if (m_buffers_to_free[i]->functionalRead(pkt)) { 347 return true; 348 } 349 } 350 351 return false; 352} 353 354uint32_t 355SimpleNetwork::functionalWrite(Packet *pkt) 356{ 357 uint32_t num_functional_writes = 0; 358 359 for (unsigned int i = 0; i < m_switch_ptr_vector.size(); i++) { 360 num_functional_writes += m_switch_ptr_vector[i]->functionalWrite(pkt); 361 } 362 363 for (unsigned int i = 0; i < m_buffers_to_free.size(); ++i) { 364 num_functional_writes += m_buffers_to_free[i]->functionalWrite(pkt); 365 } 366 return num_functional_writes; 367} |
|