tport.cc revision 11793
12810SN/A/* 212724Snikos.nikoleris@arm.com * Copyright (c) 2012 ARM Limited 38856Sandreas.hansson@arm.com * All rights reserved. 48856Sandreas.hansson@arm.com * 58856Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall 68856Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual 78856Sandreas.hansson@arm.com * property including but not limited to intellectual property relating 88856Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software 98856Sandreas.hansson@arm.com * licensed hereunder. You may use the software subject to the license 108856Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated 118856Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software, 128856Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form. 138856Sandreas.hansson@arm.com * 142810SN/A * Copyright (c) 2006 The Regents of The University of Michigan 152810SN/A * All rights reserved. 162810SN/A * 172810SN/A * Redistribution and use in source and binary forms, with or without 182810SN/A * modification, are permitted provided that the following conditions are 192810SN/A * met: redistributions of source code must retain the above copyright 202810SN/A * notice, this list of conditions and the following disclaimer; 212810SN/A * redistributions in binary form must reproduce the above copyright 222810SN/A * notice, this list of conditions and the following disclaimer in the 232810SN/A * documentation and/or other materials provided with the distribution; 242810SN/A * neither the name of the copyright holders nor the names of its 252810SN/A * contributors may be used to endorse or promote products derived from 262810SN/A * this software without specific prior written permission. 272810SN/A * 282810SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292810SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302810SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312810SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322810SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332810SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342810SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352810SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362810SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372810SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382810SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392810SN/A * 402810SN/A * Authors: Ali Saidi 4112724Snikos.nikoleris@arm.com * Andreas Hansson 422810SN/A */ 432810SN/A 442810SN/A#include "mem/tport.hh" 452810SN/A 462810SN/A#include "mem/mem_object.hh" 472810SN/A 482810SN/ASimpleTimingPort::SimpleTimingPort(const std::string& _name, 4911486Snikos.nikoleris@arm.com MemObject* _owner) : 5011486Snikos.nikoleris@arm.com QueuedSlavePort(_name, _owner, queueImpl), queueImpl(*_owner, *this) 5112724Snikos.nikoleris@arm.com{ 5212724Snikos.nikoleris@arm.com} 538232Snate@binkert.org 5412724Snikos.nikoleris@arm.comvoid 5513222Sodanrc@yahoo.com.brSimpleTimingPort::recvFunctional(PacketPtr pkt) 5612724Snikos.nikoleris@arm.com{ 5711486Snikos.nikoleris@arm.com if (!respQueue.checkFunctional(pkt)) { 5812724Snikos.nikoleris@arm.com // do an atomic access and throw away the returned latency 5912724Snikos.nikoleris@arm.com recvAtomic(pkt); 6012724Snikos.nikoleris@arm.com } 6113352Snikos.nikoleris@arm.com} 6212724Snikos.nikoleris@arm.com 6312724Snikos.nikoleris@arm.combool 6412724Snikos.nikoleris@arm.comSimpleTimingPort::recvTimingReq(PacketPtr pkt) 6512724Snikos.nikoleris@arm.com{ 662810SN/A // the SimpleTimingPort should not be used anywhere where there is 672810SN/A // a need to deal with snoop responses and their flow control 682810SN/A // requirements 698856Sandreas.hansson@arm.com if (pkt->cacheResponding()) 708856Sandreas.hansson@arm.com panic("SimpleTimingPort should never see packets with the " 718856Sandreas.hansson@arm.com "cacheResponding flag set\n"); 728922Swilliam.wang@arm.com 7312084Sspwilson2@wisc.edu bool needsResponse = pkt->needsResponse(); 7412084Sspwilson2@wisc.edu Tick latency = recvAtomic(pkt); 758856Sandreas.hansson@arm.com // turn packet around to go back to requester if response expected 768856Sandreas.hansson@arm.com if (needsResponse) { 774475SN/A // recvAtomic() should already have turned packet into 7811053Sandreas.hansson@arm.com // atomic response 795034SN/A assert(pkt->isResponse()); 8012724Snikos.nikoleris@arm.com schedTimingResp(pkt, curTick() + latency); 8112724Snikos.nikoleris@arm.com } else { 8211377Sandreas.hansson@arm.com // queue the packet for deletion 8311377Sandreas.hansson@arm.com pendingDelete.reset(pkt); 8412724Snikos.nikoleris@arm.com } 8512724Snikos.nikoleris@arm.com 8612724Snikos.nikoleris@arm.com return true; 8713352Snikos.nikoleris@arm.com} 8812724Snikos.nikoleris@arm.com