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 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) |
48{ 49 m_msg_counter = 0; 50 m_consumer = NULL; 51 m_sender = NULL; 52 m_receiver = NULL; 53 |
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; |
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{ |
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", |
183 *this, name(), current_time, |
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>()); |
355 ccprintf(out, "%s] %s", copy, name()); |
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} |