tport.cc revision 9662
12914Ssaidi@eecs.umich.edu/* 28856Sandreas.hansson@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 * 142914Ssaidi@eecs.umich.edu * Copyright (c) 2006 The Regents of The University of Michigan 152914Ssaidi@eecs.umich.edu * All rights reserved. 162914Ssaidi@eecs.umich.edu * 172914Ssaidi@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 182914Ssaidi@eecs.umich.edu * modification, are permitted provided that the following conditions are 192914Ssaidi@eecs.umich.edu * met: redistributions of source code must retain the above copyright 202914Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 212914Ssaidi@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 222914Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 232914Ssaidi@eecs.umich.edu * documentation and/or other materials provided with the distribution; 242914Ssaidi@eecs.umich.edu * neither the name of the copyright holders nor the names of its 252914Ssaidi@eecs.umich.edu * contributors may be used to endorse or promote products derived from 262914Ssaidi@eecs.umich.edu * this software without specific prior written permission. 272914Ssaidi@eecs.umich.edu * 282914Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292914Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302914Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312914Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322914Ssaidi@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332914Ssaidi@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342914Ssaidi@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352914Ssaidi@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362914Ssaidi@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372914Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382914Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392914Ssaidi@eecs.umich.edu * 402914Ssaidi@eecs.umich.edu * Authors: Ali Saidi 418856Sandreas.hansson@arm.com * Andreas Hansson 422914Ssaidi@eecs.umich.edu */ 432914Ssaidi@eecs.umich.edu 448708Sandreas.hansson@arm.com#include "mem/mem_object.hh" 452914Ssaidi@eecs.umich.edu#include "mem/tport.hh" 462914Ssaidi@eecs.umich.edu 478914Sandreas.hansson@arm.comSimpleTimingPort::SimpleTimingPort(const std::string& _name, 488914Sandreas.hansson@arm.com MemObject* _owner) : 499097Sandreas.hansson@arm.com QueuedSlavePort(_name, _owner, queueImpl), queueImpl(*_owner, *this) 505740Snate@binkert.org{ 515740Snate@binkert.org} 525740Snate@binkert.org 534490Sstever@eecs.umich.eduvoid 544490Sstever@eecs.umich.eduSimpleTimingPort::recvFunctional(PacketPtr pkt) 554490Sstever@eecs.umich.edu{ 568914Sandreas.hansson@arm.com if (!queue.checkFunctional(pkt)) { 578914Sandreas.hansson@arm.com // do an atomic access and throw away the returned latency 583296Ssaidi@eecs.umich.edu recvAtomic(pkt); 594929Sstever@gmail.com } 603091Sstever@eecs.umich.edu} 613091Sstever@eecs.umich.edu 623091Sstever@eecs.umich.edubool 638975Sandreas.hansson@arm.comSimpleTimingPort::recvTimingReq(PacketPtr pkt) 643091Sstever@eecs.umich.edu{ 659063SAli.Saidi@ARM.com /// @todo temporary hack to deal with memory corruption issue until 669063SAli.Saidi@ARM.com /// 4-phase transactions are complete. Remove me later 679063SAli.Saidi@ARM.com for (int x = 0; x < pendingDelete.size(); x++) 689063SAli.Saidi@ARM.com delete pendingDelete[x]; 699063SAli.Saidi@ARM.com pendingDelete.clear(); 709063SAli.Saidi@ARM.com 719662Sandreas.hansson@arm.com // the SimpleTimingPort should not be used anywhere where there is 729662Sandreas.hansson@arm.com // a need to deal with inhibited packets 739662Sandreas.hansson@arm.com if (pkt->memInhibitAsserted()) 749662Sandreas.hansson@arm.com panic("SimpleTimingPort should never see an inhibited request\n"); 754670Sstever@eecs.umich.edu 764626Sstever@eecs.umich.edu bool needsResponse = pkt->needsResponse(); 773091Sstever@eecs.umich.edu Tick latency = recvAtomic(pkt); 783175Srdreslin@umich.edu // turn packet around to go back to requester if response expected 794626Sstever@eecs.umich.edu if (needsResponse) { 804670Sstever@eecs.umich.edu // recvAtomic() should already have turned packet into 814670Sstever@eecs.umich.edu // atomic response 824626Sstever@eecs.umich.edu assert(pkt->isResponse()); 839163Sandreas.hansson@arm.com schedTimingResp(pkt, curTick() + latency); 844626Sstever@eecs.umich.edu } else { 859063SAli.Saidi@ARM.com /// @todo nominally we should just delete the packet here. 869063SAli.Saidi@ARM.com /// Until 4-phase stuff we can't because the sending 879063SAli.Saidi@ARM.com /// cache is still relying on it 889063SAli.Saidi@ARM.com pendingDelete.push_back(pkt); 893309Srdreslin@umich.edu } 904670Sstever@eecs.umich.edu 913091Sstever@eecs.umich.edu return true; 923091Sstever@eecs.umich.edu} 93