AbstractController.cc (10986:4fbe4b0adb4d) | AbstractController.cc (11021:e8a6637afa4c) |
---|---|
1/* 2 * Copyright (c) 2011-2014 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; --- 27 unchanged lines hidden (view full) --- 36 37AbstractController::AbstractController(const Params *p) 38 : MemObject(p), Consumer(this), m_version(p->version), 39 m_clusterID(p->cluster_id), 40 m_masterId(p->system->getMasterId(name())), m_is_blocking(false), 41 m_number_of_TBEs(p->number_of_TBEs), 42 m_transitions_per_cycle(p->transitions_per_cycle), 43 m_buffer_size(p->buffer_size), m_recycle_latency(p->recycle_latency), | 1/* 2 * Copyright (c) 2011-2014 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; --- 27 unchanged lines hidden (view full) --- 36 37AbstractController::AbstractController(const Params *p) 38 : MemObject(p), Consumer(this), m_version(p->version), 39 m_clusterID(p->cluster_id), 40 m_masterId(p->system->getMasterId(name())), m_is_blocking(false), 41 m_number_of_TBEs(p->number_of_TBEs), 42 m_transitions_per_cycle(p->transitions_per_cycle), 43 m_buffer_size(p->buffer_size), m_recycle_latency(p->recycle_latency), |
44 memoryPort(csprintf("%s.memory", name()), this, ""), 45 m_responseFromMemory_ptr(new MessageBuffer()) | 44 memoryPort(csprintf("%s.memory", name()), this, "") |
46{ | 45{ |
47 // Set the sender pointer of the response message buffer from the 48 // memory controller. 49 // This pointer is used for querying for the current time. 50 m_responseFromMemory_ptr->setSender(this); 51 m_responseFromMemory_ptr->setReceiver(this); 52 m_responseFromMemory_ptr->setOrdering(false); 53 | |
54 if (m_version == 0) { 55 // Combine the statistics from all controllers 56 // of this particular type. 57 Stats::registerDumpCallback(new StatsCallback(this)); 58 } 59} 60 61void 62AbstractController::init() 63{ 64 params()->ruby_system->registerAbstractController(this); 65 m_delayHistogram.init(10); 66 uint32_t size = Network::getNumberOfVirtualNetworks(); 67 for (uint32_t i = 0; i < size; i++) { 68 m_delayVCHistogram.push_back(new Stats::Histogram()); 69 m_delayVCHistogram[i]->init(10); 70 } | 46 if (m_version == 0) { 47 // Combine the statistics from all controllers 48 // of this particular type. 49 Stats::registerDumpCallback(new StatsCallback(this)); 50 } 51} 52 53void 54AbstractController::init() 55{ 56 params()->ruby_system->registerAbstractController(this); 57 m_delayHistogram.init(10); 58 uint32_t size = Network::getNumberOfVirtualNetworks(); 59 for (uint32_t i = 0; i < size; i++) { 60 m_delayVCHistogram.push_back(new Stats::Histogram()); 61 m_delayVCHistogram[i]->init(10); 62 } |
63 if (getMemoryQueue()) { 64 getMemoryQueue()->setSender(this); 65 } |
|
71} 72 73void 74AbstractController::resetStats() 75{ 76 m_delayHistogram.reset(); 77 uint32_t size = Network::getNumberOfVirtualNetworks(); 78 for (uint32_t i = 0; i < size; i++) { --- 214 unchanged lines hidden (view full) --- 293 memoryPort.sendFunctional(pkt); 294} 295 296int 297AbstractController::functionalMemoryWrite(PacketPtr pkt) 298{ 299 int num_functional_writes = 0; 300 | 66} 67 68void 69AbstractController::resetStats() 70{ 71 m_delayHistogram.reset(); 72 uint32_t size = Network::getNumberOfVirtualNetworks(); 73 for (uint32_t i = 0; i < size; i++) { --- 214 unchanged lines hidden (view full) --- 288 memoryPort.sendFunctional(pkt); 289} 290 291int 292AbstractController::functionalMemoryWrite(PacketPtr pkt) 293{ 294 int num_functional_writes = 0; 295 |
301 // Check the message buffer that runs from the memory to the controller. 302 num_functional_writes += m_responseFromMemory_ptr->functionalWrite(pkt); 303 | |
304 // Check the buffer from the controller to the memory. 305 if (memoryPort.checkFunctional(pkt)) { 306 num_functional_writes++; 307 } 308 309 // Update memory itself. 310 memoryPort.sendFunctional(pkt); 311 return num_functional_writes + 1; 312} 313 314void 315AbstractController::recvTimingResp(PacketPtr pkt) 316{ | 296 // Check the buffer from the controller to the memory. 297 if (memoryPort.checkFunctional(pkt)) { 298 num_functional_writes++; 299 } 300 301 // Update memory itself. 302 memoryPort.sendFunctional(pkt); 303 return num_functional_writes + 1; 304} 305 306void 307AbstractController::recvTimingResp(PacketPtr pkt) 308{ |
309 assert(getMemoryQueue()); |
|
317 assert(pkt->isResponse()); 318 319 std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(clockEdge()); 320 (*msg).m_Addr.setAddress(pkt->getAddr()); 321 (*msg).m_Sender = m_machineID; 322 323 SenderState *s = dynamic_cast<SenderState *>(pkt->senderState); 324 (*msg).m_OriginalRequestorMachId = s->id; --- 8 unchanged lines hidden (view full) --- 333 RubySystem::getBlockSizeBytes()); 334 } else if (pkt->isWrite()) { 335 (*msg).m_Type = MemoryRequestType_MEMORY_WB; 336 (*msg).m_MessageSize = MessageSizeType_Writeback_Control; 337 } else { 338 panic("Incorrect packet type received from memory controller!"); 339 } 340 | 310 assert(pkt->isResponse()); 311 312 std::shared_ptr<MemoryMsg> msg = std::make_shared<MemoryMsg>(clockEdge()); 313 (*msg).m_Addr.setAddress(pkt->getAddr()); 314 (*msg).m_Sender = m_machineID; 315 316 SenderState *s = dynamic_cast<SenderState *>(pkt->senderState); 317 (*msg).m_OriginalRequestorMachId = s->id; --- 8 unchanged lines hidden (view full) --- 326 RubySystem::getBlockSizeBytes()); 327 } else if (pkt->isWrite()) { 328 (*msg).m_Type = MemoryRequestType_MEMORY_WB; 329 (*msg).m_MessageSize = MessageSizeType_Writeback_Control; 330 } else { 331 panic("Incorrect packet type received from memory controller!"); 332 } 333 |
341 m_responseFromMemory_ptr->enqueue(msg); | 334 getMemoryQueue()->enqueue(msg); |
342 delete pkt; 343} 344 345bool 346AbstractController::MemoryPort::recvTimingResp(PacketPtr pkt) 347{ 348 controller->recvTimingResp(pkt); 349 return true; 350} 351 352AbstractController::MemoryPort::MemoryPort(const std::string &_name, 353 AbstractController *_controller, 354 const std::string &_label) 355 : QueuedMasterPort(_name, _controller, reqQueue, snoopRespQueue), 356 reqQueue(*_controller, *this, _label), 357 snoopRespQueue(*_controller, *this, _label), 358 controller(_controller) 359{ 360} | 335 delete pkt; 336} 337 338bool 339AbstractController::MemoryPort::recvTimingResp(PacketPtr pkt) 340{ 341 controller->recvTimingResp(pkt); 342 return true; 343} 344 345AbstractController::MemoryPort::MemoryPort(const std::string &_name, 346 AbstractController *_controller, 347 const std::string &_label) 348 : QueuedMasterPort(_name, _controller, reqQueue, snoopRespQueue), 349 reqQueue(*_controller, *this, _label), 350 snoopRespQueue(*_controller, *this, _label), 351 controller(_controller) 352{ 353} |