Deleted Added
sdiff udiff text old ( 8856:241ee47b0dc6 ) new ( 8914:8c3bd7bea667 )
full compact
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 27 unchanged lines hidden (view full) ---

36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Authors: Ali Saidi
41 * Andreas Hansson
42 */
43
44#include "mem/mem_object.hh"
45#include "mem/tport.hh"
46
47SimpleTimingPort::SimpleTimingPort(const std::string& _name,
48 MemObject* _owner) :
49 QueuedPort(_name, _owner, queue), queue(*_owner, *this)
50{
51}
52
53void
54SimpleTimingPort::recvFunctional(PacketPtr pkt)
55{
56 assert(pkt->isRequest());
57 if (!queue.checkFunctional(pkt)) {
58 // do an atomic access and throw away the returned latency
59 recvAtomic(pkt);
60 }
61}
62
63bool
64SimpleTimingPort::recvTiming(PacketPtr pkt)
65{
66 if (pkt->memInhibitAsserted()) {
67 // snooper will supply based on copy of packet
68 // still target's responsibility to delete packet
69 delete pkt;
70 return true;
71 }
72
73 bool needsResponse = pkt->needsResponse();
74 Tick latency = recvAtomic(pkt);
75 // turn packet around to go back to requester if response expected
76 if (needsResponse) {
77 // recvAtomic() should already have turned packet into
78 // atomic response
79 assert(pkt->isResponse());
80 queue.schedSendTiming(pkt, curTick() + latency);
81 } else {
82 delete pkt;
83 }
84
85 return true;
86}