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
443091Sstever@eecs.umich.edu#ifndef __MEM_TPORT_HH__
453091Sstever@eecs.umich.edu#define __MEM_TPORT_HH__
463091Sstever@eecs.umich.edu
472914Ssaidi@eecs.umich.edu/**
482914Ssaidi@eecs.umich.edu * @file
493091Sstever@eecs.umich.edu *
503091Sstever@eecs.umich.edu * Declaration of SimpleTimingPort.
512914Ssaidi@eecs.umich.edu */
522914Ssaidi@eecs.umich.edu
538914Sandreas.hansson@arm.com#include "mem/qport.hh"
542914Ssaidi@eecs.umich.edu
5513892Sgabeblack@google.comclass SimObject;
5613892Sgabeblack@google.com
573091Sstever@eecs.umich.edu/**
588914Sandreas.hansson@arm.com * The simple timing port uses a queued port to implement
598975Sandreas.hansson@arm.com * recvFunctional and recvTimingReq through recvAtomic. It is always a
608914Sandreas.hansson@arm.com * slave port.
613091Sstever@eecs.umich.edu */
628922Swilliam.wang@arm.comclass SimpleTimingPort : public QueuedSlavePort
632914Ssaidi@eecs.umich.edu{
648914Sandreas.hansson@arm.com
659097Sandreas.hansson@arm.com  private:
669097Sandreas.hansson@arm.com
679097Sandreas.hansson@arm.com    /**
689097Sandreas.hansson@arm.com     * The packet queue used to store outgoing responses. Note that
699097Sandreas.hansson@arm.com     * the queue is made private and that we avoid overloading the
709097Sandreas.hansson@arm.com     * name used in the QueuedSlavePort. Access is provided through
719097Sandreas.hansson@arm.com     * the queue reference in the base class.
729097Sandreas.hansson@arm.com     */
7310713Sandreas.hansson@arm.com    RespPacketQueue queueImpl;
749097Sandreas.hansson@arm.com
752914Ssaidi@eecs.umich.edu  protected:
764490Sstever@eecs.umich.edu
773091Sstever@eecs.umich.edu    /** Implemented using recvAtomic(). */
783349Sbinkertn@umich.edu    void recvFunctional(PacketPtr pkt);
793091Sstever@eecs.umich.edu
803091Sstever@eecs.umich.edu    /** Implemented using recvAtomic(). */
818975Sandreas.hansson@arm.com    bool recvTimingReq(PacketPtr pkt);
823091Sstever@eecs.umich.edu
838914Sandreas.hansson@arm.com    virtual Tick recvAtomic(PacketPtr pkt) = 0;
843091Sstever@eecs.umich.edu
859063SAli.Saidi@ARM.com    /**
8611190Sandreas.hansson@arm.com     * Upstream caches need this packet until true is returned, so
8711190Sandreas.hansson@arm.com     * hold it for deletion until a subsequent call
889063SAli.Saidi@ARM.com     */
8911190Sandreas.hansson@arm.com    std::unique_ptr<Packet> pendingDelete;
909063SAli.Saidi@ARM.com
912914Ssaidi@eecs.umich.edu  public:
924490Sstever@eecs.umich.edu
938914Sandreas.hansson@arm.com    /**
948914Sandreas.hansson@arm.com     * Create a new SimpleTimingPort that relies on a packet queue to
958975Sandreas.hansson@arm.com     * hold responses, and implements recvTimingReq and recvFunctional
968914Sandreas.hansson@arm.com     * through calls to recvAtomic. Once a request arrives, it is
978914Sandreas.hansson@arm.com     * passed to recvAtomic, and in the case of a timing access any
988914Sandreas.hansson@arm.com     * response is scheduled to be sent after the delay of the atomic
998914Sandreas.hansson@arm.com     * operation.
1008914Sandreas.hansson@arm.com     *
1018914Sandreas.hansson@arm.com     * @param name port name
1028914Sandreas.hansson@arm.com     * @param owner structural owner
1038914Sandreas.hansson@arm.com     */
10413892Sgabeblack@google.com    SimpleTimingPort(const std::string& name, SimObject* owner);
1058856Sandreas.hansson@arm.com
1068914Sandreas.hansson@arm.com    virtual ~SimpleTimingPort() { }
1078914Sandreas.hansson@arm.com
1082914Ssaidi@eecs.umich.edu};
1092914Ssaidi@eecs.umich.edu
1102914Ssaidi@eecs.umich.edu#endif // __MEM_TPORT_HH__
111