MessageBuffer.cc (10986:4fbe4b0adb4d) | MessageBuffer.cc (11021:e8a6637afa4c) |
---|---|
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; --- 25 unchanged lines hidden (view full) --- 34#include "base/stl_helpers.hh" 35#include "debug/RubyQueue.hh" 36#include "mem/ruby/network/MessageBuffer.hh" 37#include "mem/ruby/system/System.hh" 38 39using namespace std; 40using m5::stl_helpers::operator<<; 41 | 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; --- 25 unchanged lines hidden (view full) --- 34#include "base/stl_helpers.hh" 35#include "debug/RubyQueue.hh" 36#include "mem/ruby/network/MessageBuffer.hh" 37#include "mem/ruby/system/System.hh" 38 39using namespace std; 40using m5::stl_helpers::operator<<; 41 |
42MessageBuffer::MessageBuffer(const string &name) 43 : m_time_last_time_size_checked(0), m_time_last_time_enqueue(0), 44 m_time_last_time_pop(0), m_last_arrival_time(0) | 42MessageBuffer::MessageBuffer(const Params *p) 43 : SimObject(p), m_recycle_latency(p->recycle_latency), 44 m_max_size(p->buffer_size), m_time_last_time_size_checked(0), 45 m_time_last_time_enqueue(0), m_time_last_time_pop(0), 46 m_last_arrival_time(0), m_strict_fifo(p->ordered), 47 m_randomization(p->randomization) |
45{ 46 m_msg_counter = 0; 47 m_consumer = NULL; 48 m_sender = NULL; 49 m_receiver = NULL; 50 | 48{ 49 m_msg_counter = 0; 50 m_consumer = NULL; 51 m_sender = NULL; 52 m_receiver = NULL; 53 |
51 m_ordering_set = false; 52 m_strict_fifo = true; 53 m_max_size = 0; 54 m_randomization = true; | |
55 m_size_last_time_size_checked = 0; 56 m_size_at_cycle_start = 0; 57 m_msgs_this_cycle = 0; 58 m_not_avail_count = 0; 59 m_priority_rank = 0; | 54 m_size_last_time_size_checked = 0; 55 m_size_at_cycle_start = 0; 56 m_msgs_this_cycle = 0; 57 m_not_avail_count = 0; 58 m_priority_rank = 0; |
60 m_name = name; | |
61 62 m_stall_msg_map.clear(); 63 m_input_link_id = 0; 64 m_vnet_id = 0; 65} 66 67unsigned int 68MessageBuffer::getSize() --- 70 unchanged lines hidden (view full) --- 139 time += Cycles(100 + random_mt.random(1, 15)); // 100 + [1...15] 140 } 141 return time; 142} 143 144void 145MessageBuffer::enqueue(MsgPtr message, Cycles delta) 146{ | 59 60 m_stall_msg_map.clear(); 61 m_input_link_id = 0; 62 m_vnet_id = 0; 63} 64 65unsigned int 66MessageBuffer::getSize() --- 70 unchanged lines hidden (view full) --- 137 time += Cycles(100 + random_mt.random(1, 15)); // 100 + [1...15] 138 } 139 return time; 140} 141 142void 143MessageBuffer::enqueue(MsgPtr message, Cycles delta) 144{ |
147 assert(m_ordering_set); 148 | |
149 // record current time incase we have a pop that also adjusts my size 150 if (m_time_last_time_enqueue < m_sender->curCycle()) { 151 m_msgs_this_cycle = 0; // first msg this cycle 152 m_time_last_time_enqueue = m_sender->curCycle(); 153 } 154 155 m_msg_counter++; 156 m_msgs_this_cycle++; --- 22 unchanged lines hidden (view full) --- 179 } 180 181 // Check the arrival time 182 assert(arrival_time > current_time); 183 if (m_strict_fifo) { 184 if (arrival_time < m_last_arrival_time) { 185 panic("FIFO ordering violated: %s name: %s current time: %d " 186 "delta: %d arrival_time: %d last arrival_time: %d\n", | 145 // record current time incase we have a pop that also adjusts my size 146 if (m_time_last_time_enqueue < m_sender->curCycle()) { 147 m_msgs_this_cycle = 0; // first msg this cycle 148 m_time_last_time_enqueue = m_sender->curCycle(); 149 } 150 151 m_msg_counter++; 152 m_msgs_this_cycle++; --- 22 unchanged lines hidden (view full) --- 175 } 176 177 // Check the arrival time 178 assert(arrival_time > current_time); 179 if (m_strict_fifo) { 180 if (arrival_time < m_last_arrival_time) { 181 panic("FIFO ordering violated: %s name: %s current time: %d " 182 "delta: %d arrival_time: %d last arrival_time: %d\n", |
187 *this, m_name, current_time, | 183 *this, name(), current_time, |
188 delta * m_sender->clockPeriod(), 189 arrival_time, m_last_arrival_time); 190 } 191 } 192 193 // If running a cache trace, don't worry about the last arrival checks 194 if (!RubySystem::getWarmupEnabled()) { 195 m_last_arrival_time = arrival_time; --- 155 unchanged lines hidden (view full) --- 351{ 352 ccprintf(out, "[MessageBuffer: "); 353 if (m_consumer != NULL) { 354 ccprintf(out, " consumer-yes "); 355 } 356 357 vector<MsgPtr> copy(m_prio_heap); 358 sort_heap(copy.begin(), copy.end(), greater<MsgPtr>()); | 184 delta * m_sender->clockPeriod(), 185 arrival_time, m_last_arrival_time); 186 } 187 } 188 189 // If running a cache trace, don't worry about the last arrival checks 190 if (!RubySystem::getWarmupEnabled()) { 191 m_last_arrival_time = arrival_time; --- 155 unchanged lines hidden (view full) --- 347{ 348 ccprintf(out, "[MessageBuffer: "); 349 if (m_consumer != NULL) { 350 ccprintf(out, " consumer-yes "); 351 } 352 353 vector<MsgPtr> copy(m_prio_heap); 354 sort_heap(copy.begin(), copy.end(), greater<MsgPtr>()); |
359 ccprintf(out, "%s] %s", copy, m_name); | 355 ccprintf(out, "%s] %s", copy, name()); |
360} 361 362bool 363MessageBuffer::isReady() const 364{ 365 return ((m_prio_heap.size() > 0) && 366 (m_prio_heap.front()->getLastEnqueueTime() <= m_receiver->clockEdge())); 367} --- 51 unchanged lines hidden (view full) --- 419 if (msg->functionalWrite(pkt)) { 420 num_functional_writes++; 421 } 422 } 423 } 424 425 return num_functional_writes; 426} | 356} 357 358bool 359MessageBuffer::isReady() const 360{ 361 return ((m_prio_heap.size() > 0) && 362 (m_prio_heap.front()->getLastEnqueueTime() <= m_receiver->clockEdge())); 363} --- 51 unchanged lines hidden (view full) --- 415 if (msg->functionalWrite(pkt)) { 416 num_functional_writes++; 417 } 418 } 419 } 420 421 return num_functional_writes; 422} |
423 424MessageBuffer * 425MessageBufferParams::create() 426{ 427 return new MessageBuffer(this); 428} |
|