RubyPort.cc (6882:898047a3672c) | RubyPort.cc (6893:9cdf9b65d946) |
---|---|
1 2/* 3 * Copyright (c) 2009 Advanced Micro Devices, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31#include "mem/ruby/system/RubyPort.hh" 32#include "mem/ruby/slicc_interface/AbstractController.hh" 33 34uint16_t RubyPort::m_num_ports = 0; 35 36RubyPort::RequestMap RubyPort::pending_cpu_requests; 37 38RubyPort::RubyPort(const Params *p) | 1 2/* 3 * Copyright (c) 2009 Advanced Micro Devices, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 22 unchanged lines hidden (view full) --- 31#include "mem/ruby/system/RubyPort.hh" 32#include "mem/ruby/slicc_interface/AbstractController.hh" 33 34uint16_t RubyPort::m_num_ports = 0; 35 36RubyPort::RequestMap RubyPort::pending_cpu_requests; 37 38RubyPort::RubyPort(const Params *p) |
39 : MemObject(p), 40 funcMemPort(csprintf("%s-funcmem_port", name()), this) | 39 : MemObject(p) |
41{ 42 m_version = p->version; 43 assert(m_version != -1); 44 | 40{ 41 m_version = p->version; 42 assert(m_version != -1); 43 |
44 physmem = p->physmem; 45 |
|
45 m_controller = NULL; 46 m_mandatory_q_ptr = NULL; 47 48 m_port_id = m_num_ports++; 49 m_request_cnt = 0; 50 m_hit_callback = ruby_hit_callback; 51 pio_port = NULL; | 46 m_controller = NULL; 47 m_mandatory_q_ptr = NULL; 48 49 m_port_id = m_num_ports++; 50 m_request_cnt = 0; 51 m_hit_callback = ruby_hit_callback; 52 pio_port = NULL; |
53 physMemPort = NULL; |
|
52 assert(m_num_ports <= 2048); // see below for reason 53} 54 55void RubyPort::init() 56{ 57 assert(m_controller != NULL); 58 m_mandatory_q_ptr = m_controller->getMandatoryQueue(); 59} --- 8 unchanged lines hidden (view full) --- 68 // ensure there is only one pio port 69 // 70 assert(pio_port == NULL); 71 72 pio_port = new PioPort(csprintf("%s-pio-port%d", name(), idx), 73 this); 74 75 return pio_port; | 54 assert(m_num_ports <= 2048); // see below for reason 55} 56 57void RubyPort::init() 58{ 59 assert(m_controller != NULL); 60 m_mandatory_q_ptr = m_controller->getMandatoryQueue(); 61} --- 8 unchanged lines hidden (view full) --- 70 // ensure there is only one pio port 71 // 72 assert(pio_port == NULL); 73 74 pio_port = new PioPort(csprintf("%s-pio-port%d", name(), idx), 75 this); 76 77 return pio_port; |
76 } else if (if_name == "funcmem_port") { 77 return &funcMemPort; | 78 } else if (if_name == "physMemPort") { 79 // 80 // RubyPort should only have one port to physical memory 81 // 82 assert (physMemPort == NULL); 83 84 physMemPort = new M5Port(csprintf("%s-physMemPort", name()), 85 this); 86 87 return physMemPort; 88 } else if (if_name == "functional") { 89 // 90 // Calls for the functional port only want to access functional memory. 91 // Therefore, directly pass these calls ports to physmem. 92 // 93 assert(physmem != NULL); 94 return physmem->getPort(if_name, idx); |
78 } 79 return NULL; 80} 81 82RubyPort::PioPort::PioPort(const std::string &_name, 83 RubyPort *_port) 84 : SimpleTimingPort(_name, _port) 85{ --- 157 unchanged lines hidden (view full) --- 243RubyPort::M5Port::hitCallback(PacketPtr pkt) 244{ 245 246 bool needsResponse = pkt->needsResponse(); 247 248 DPRINTF(MemoryAccess, "Hit callback needs response %d\n", 249 needsResponse); 250 | 95 } 96 return NULL; 97} 98 99RubyPort::PioPort::PioPort(const std::string &_name, 100 RubyPort *_port) 101 : SimpleTimingPort(_name, _port) 102{ --- 157 unchanged lines hidden (view full) --- 260RubyPort::M5Port::hitCallback(PacketPtr pkt) 261{ 262 263 bool needsResponse = pkt->needsResponse(); 264 265 DPRINTF(MemoryAccess, "Hit callback needs response %d\n", 266 needsResponse); 267 |
251 ruby_port->funcMemPort.sendFunctional(pkt); | 268 ruby_port->physMemPort->sendAtomic(pkt); |
252 253 // turn packet around to go back to requester if response expected 254 if (needsResponse) { | 269 270 // turn packet around to go back to requester if response expected 271 if (needsResponse) { |
255 // recvAtomic() should already have turned packet into | 272 // sendAtomic() should already have turned packet into |
256 // atomic response 257 assert(pkt->isResponse()); 258 DPRINTF(MemoryAccess, "Sending packet back over port\n"); 259 sendTiming(pkt); 260 } else { 261 delete pkt; 262 } 263 DPRINTF(MemoryAccess, "Hit callback done!\n"); --- 13 unchanged lines hidden (view full) --- 277 return true; 278} 279 280bool 281RubyPort::M5Port::isPhysMemAddress(Addr addr) 282{ 283 AddrRangeList physMemAddrList; 284 bool snoop = false; | 273 // atomic response 274 assert(pkt->isResponse()); 275 DPRINTF(MemoryAccess, "Sending packet back over port\n"); 276 sendTiming(pkt); 277 } else { 278 delete pkt; 279 } 280 DPRINTF(MemoryAccess, "Hit callback done!\n"); --- 13 unchanged lines hidden (view full) --- 294 return true; 295} 296 297bool 298RubyPort::M5Port::isPhysMemAddress(Addr addr) 299{ 300 AddrRangeList physMemAddrList; 301 bool snoop = false; |
285 ruby_port->funcMemPort.getPeerAddressRanges(physMemAddrList, snoop); | 302 ruby_port->physMemPort->getPeerAddressRanges(physMemAddrList, snoop); |
286 for(AddrRangeIter iter = physMemAddrList.begin(); 287 iter != physMemAddrList.end(); 288 iter++) { 289 if (addr >= iter->start && addr <= iter->end) { 290 DPRINTF(MemoryAccess, "Request found in %#llx - %#llx range\n", 291 iter->start, iter->end); 292 return true; 293 } 294 } | 303 for(AddrRangeIter iter = physMemAddrList.begin(); 304 iter != physMemAddrList.end(); 305 iter++) { 306 if (addr >= iter->start && addr <= iter->end) { 307 DPRINTF(MemoryAccess, "Request found in %#llx - %#llx range\n", 308 iter->start, iter->end); 309 return true; 310 } 311 } |
295 assert(isPioAddress(addr)); | |
296 return false; 297} | 312 return false; 313} |
298 299bool 300RubyPort::M5Port::isPioAddress(Addr addr) 301{ 302 AddrRangeList pioAddrList; 303 bool snoop = false; 304 if (ruby_port->pio_port == NULL) { 305 return false; 306 } 307 308 ruby_port->pio_port->getPeerAddressRanges(pioAddrList, snoop); 309 for(AddrRangeIter iter = pioAddrList.begin(); 310 iter != pioAddrList.end(); 311 iter++) { 312 if (addr >= iter->start && addr <= iter->end) { 313 DPRINTF(MemoryAccess, "Pio request found in %#llx - %#llx range\n", 314 iter->start, iter->end); 315 return true; 316 } 317 } 318 return false; 319} 320 | |