port.hh revision 14185
12381SN/A/*
212342Snikos.nikoleris@arm.com * Copyright (c) 2011-2012,2015,2017 ARM Limited
38711Sandreas.hansson@arm.com * All rights reserved
48711Sandreas.hansson@arm.com *
58711Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall
68711Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual
78711Sandreas.hansson@arm.com * property including but not limited to intellectual property relating
88711Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software
98711Sandreas.hansson@arm.com * licensed hereunder.  You may use the software subject to the license
108711Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated
118711Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software,
128711Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form.
138711Sandreas.hansson@arm.com *
142381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
152381SN/A * All rights reserved.
162381SN/A *
172381SN/A * Redistribution and use in source and binary forms, with or without
182381SN/A * modification, are permitted provided that the following conditions are
192381SN/A * met: redistributions of source code must retain the above copyright
202381SN/A * notice, this list of conditions and the following disclaimer;
212381SN/A * redistributions in binary form must reproduce the above copyright
222381SN/A * notice, this list of conditions and the following disclaimer in the
232381SN/A * documentation and/or other materials provided with the distribution;
242381SN/A * neither the name of the copyright holders nor the names of its
252381SN/A * contributors may be used to endorse or promote products derived from
262381SN/A * this software without specific prior written permission.
272381SN/A *
282381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392665Ssaidi@eecs.umich.edu *
402665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski
418853Sandreas.hansson@arm.com *          Andreas Hansson
428922Swilliam.wang@arm.com *          William Wang
432381SN/A */
442381SN/A
452381SN/A/**
462381SN/A * @file
478922Swilliam.wang@arm.com * Port Object Declaration.
482381SN/A */
492381SN/A
502381SN/A#ifndef __MEM_PORT_HH__
512381SN/A#define __MEM_PORT_HH__
522381SN/A
539235Sandreas.hansson@arm.com#include "base/addr_range.hh"
542381SN/A#include "mem/packet.hh"
5514185Sgabeblack@google.com#include "mem/protocol/atomic.hh"
5614185Sgabeblack@google.com#include "mem/protocol/functional.hh"
5714185Sgabeblack@google.com#include "mem/protocol/timing.hh"
5813771Sgabeblack@google.com#include "sim/port.hh"
592381SN/A
6013892Sgabeblack@google.comclass SimObject;
613401Sktlim@umich.edu
628922Swilliam.wang@arm.com/** Forward declaration */
639294Sandreas.hansson@arm.comclass BaseSlavePort;
649294Sandreas.hansson@arm.com
659294Sandreas.hansson@arm.com/**
669294Sandreas.hansson@arm.com * A BaseMasterPort is a protocol-agnostic master port, responsible
679294Sandreas.hansson@arm.com * only for the structural connection to a slave port. The final
689294Sandreas.hansson@arm.com * master port that inherits from the base class must override the
699294Sandreas.hansson@arm.com * bind member function for the specific slave port class.
709294Sandreas.hansson@arm.com */
719294Sandreas.hansson@arm.comclass BaseMasterPort : public Port
729294Sandreas.hansson@arm.com{
7314183Sgabeblack@google.com  protected:
7414183Sgabeblack@google.com    BaseSlavePort *_baseSlavePort;
759294Sandreas.hansson@arm.com
7614183Sgabeblack@google.com    BaseMasterPort(const std::string &name, PortID id=InvalidPortID);
779294Sandreas.hansson@arm.com    virtual ~BaseMasterPort();
789294Sandreas.hansson@arm.com
799294Sandreas.hansson@arm.com  public:
809294Sandreas.hansson@arm.com    BaseSlavePort& getSlavePort() const;
819294Sandreas.hansson@arm.com};
829294Sandreas.hansson@arm.com
839294Sandreas.hansson@arm.com/**
849294Sandreas.hansson@arm.com * A BaseSlavePort is a protocol-agnostic slave port, responsible
859294Sandreas.hansson@arm.com * only for the structural connection to a master port.
869294Sandreas.hansson@arm.com */
879294Sandreas.hansson@arm.comclass BaseSlavePort : public Port
889294Sandreas.hansson@arm.com{
8914183Sgabeblack@google.com  protected:
9014183Sgabeblack@google.com    BaseMasterPort *_baseMasterPort;
919294Sandreas.hansson@arm.com
9214183Sgabeblack@google.com    BaseSlavePort(const std::string &name, PortID id=InvalidPortID);
939294Sandreas.hansson@arm.com    virtual ~BaseSlavePort();
949294Sandreas.hansson@arm.com
959294Sandreas.hansson@arm.com  public:
969294Sandreas.hansson@arm.com    BaseMasterPort& getMasterPort() const;
979294Sandreas.hansson@arm.com};
989294Sandreas.hansson@arm.com
999294Sandreas.hansson@arm.com/** Forward declaration */
1008922Swilliam.wang@arm.comclass SlavePort;
1018922Swilliam.wang@arm.com
1028922Swilliam.wang@arm.com/**
1039294Sandreas.hansson@arm.com * A MasterPort is a specialisation of a BaseMasterPort, which
1049294Sandreas.hansson@arm.com * implements the default protocol for the three different level of
1059294Sandreas.hansson@arm.com * transport functions. In addition to the basic functionality of
1069294Sandreas.hansson@arm.com * sending packets, it also has functions to receive range changes or
1079294Sandreas.hansson@arm.com * determine if the port is snooping or not.
10814183Sgabeblack@google.com *
10914183Sgabeblack@google.com * The three protocols are atomic, timing, and functional, each with its own
11014183Sgabeblack@google.com * header file.
1118922Swilliam.wang@arm.com */
11214183Sgabeblack@google.comclass MasterPort : public BaseMasterPort, public AtomicRequestProtocol,
11314183Sgabeblack@google.com    public TimingRequestProtocol, public FunctionalRequestProtocol
1148922Swilliam.wang@arm.com{
1158975Sandreas.hansson@arm.com    friend class SlavePort;
1168975Sandreas.hansson@arm.com
1178922Swilliam.wang@arm.com  private:
11814183Sgabeblack@google.com    SlavePort *_slavePort;
1198922Swilliam.wang@arm.com
12013769Sgabeblack@google.com  protected:
12114183Sgabeblack@google.com    SimObject &owner;
12213769Sgabeblack@google.com
1238922Swilliam.wang@arm.com  public:
12413892Sgabeblack@google.com    MasterPort(const std::string& name, SimObject* _owner,
12513769Sgabeblack@google.com               PortID id=InvalidPortID);
1268922Swilliam.wang@arm.com    virtual ~MasterPort();
1278922Swilliam.wang@arm.com
1289178Sandreas.hansson@arm.com    /**
1299178Sandreas.hansson@arm.com     * Bind this master port to a slave port. This also does the
1309178Sandreas.hansson@arm.com     * mirror action and binds the slave port to the master port.
1319178Sandreas.hansson@arm.com     */
13213782Sgabeblack@google.com    void bind(Port &peer) override;
1339178Sandreas.hansson@arm.com
1349178Sandreas.hansson@arm.com    /**
1359178Sandreas.hansson@arm.com     * Unbind this master port and the associated slave port.
1369178Sandreas.hansson@arm.com     */
13713782Sgabeblack@google.com    void unbind() override;
1389178Sandreas.hansson@arm.com
1398922Swilliam.wang@arm.com    /**
14014183Sgabeblack@google.com     * Determine if this master port is snooping or not. The default
14114183Sgabeblack@google.com     * implementation returns false and thus tells the neighbour we
14214183Sgabeblack@google.com     * are not snooping. Any master port that wants to receive snoop
14314183Sgabeblack@google.com     * requests (e.g. a cache connected to a bus) has to override this
14414183Sgabeblack@google.com     * function.
14514183Sgabeblack@google.com     *
14614183Sgabeblack@google.com     * @return true if the port should be considered a snooper
14714183Sgabeblack@google.com     */
14814183Sgabeblack@google.com    virtual bool isSnooping() const { return false; }
14914183Sgabeblack@google.com
15014183Sgabeblack@google.com    /**
15114183Sgabeblack@google.com     * Get the address ranges of the connected slave port.
15214183Sgabeblack@google.com     */
15314183Sgabeblack@google.com    AddrRangeList getAddrRanges() const;
15414183Sgabeblack@google.com
15514183Sgabeblack@google.com    /**
15614183Sgabeblack@google.com     * Inject a PrintReq for the given address to print the state of
15714183Sgabeblack@google.com     * that address throughout the memory system.  For debugging.
15814183Sgabeblack@google.com     */
15914183Sgabeblack@google.com    void printAddr(Addr a);
16014183Sgabeblack@google.com
16114183Sgabeblack@google.com  public:
16214183Sgabeblack@google.com    /* The atomic protocol. */
16314183Sgabeblack@google.com
16414183Sgabeblack@google.com    /**
1658948Sandreas.hansson@arm.com     * Send an atomic request packet, where the data is moved and the
1668948Sandreas.hansson@arm.com     * state is updated in zero time, without interleaving with other
1678948Sandreas.hansson@arm.com     * memory accesses.
1688948Sandreas.hansson@arm.com     *
1698948Sandreas.hansson@arm.com     * @param pkt Packet to send.
1708948Sandreas.hansson@arm.com     *
1718948Sandreas.hansson@arm.com     * @return Estimated latency of access.
1728948Sandreas.hansson@arm.com     */
1738948Sandreas.hansson@arm.com    Tick sendAtomic(PacketPtr pkt);
1748948Sandreas.hansson@arm.com
1758948Sandreas.hansson@arm.com    /**
17613845Sgabeblack@google.com     * Send an atomic request packet like above, but also request a backdoor
17713845Sgabeblack@google.com     * to the data being accessed.
17813845Sgabeblack@google.com     *
17913845Sgabeblack@google.com     * @param pkt Packet to send.
18013845Sgabeblack@google.com     * @param backdoor Can be set to a back door pointer by the target to let
18113845Sgabeblack@google.com     *        caller have direct access to the requested data.
18213845Sgabeblack@google.com     *
18313845Sgabeblack@google.com     * @return Estimated latency of access.
18413845Sgabeblack@google.com     */
18513845Sgabeblack@google.com    Tick sendAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor);
18613845Sgabeblack@google.com
18714183Sgabeblack@google.com  public:
18814183Sgabeblack@google.com    /* The functional protocol. */
18914183Sgabeblack@google.com
19013845Sgabeblack@google.com    /**
1918948Sandreas.hansson@arm.com     * Send a functional request packet, where the data is instantly
1928948Sandreas.hansson@arm.com     * updated everywhere in the memory system, without affecting the
1938948Sandreas.hansson@arm.com     * current state of any block or moving the block.
1948948Sandreas.hansson@arm.com     *
1958948Sandreas.hansson@arm.com     * @param pkt Packet to send.
1968948Sandreas.hansson@arm.com     */
19714183Sgabeblack@google.com    void sendFunctional(PacketPtr pkt) const;
19814183Sgabeblack@google.com
19914183Sgabeblack@google.com  public:
20014183Sgabeblack@google.com    /* The timing protocol. */
2018948Sandreas.hansson@arm.com
2028948Sandreas.hansson@arm.com    /**
2038975Sandreas.hansson@arm.com     * Attempt to send a timing request to the slave port by calling
2048975Sandreas.hansson@arm.com     * its corresponding receive function. If the send does not
2058975Sandreas.hansson@arm.com     * succeed, as indicated by the return value, then the sender must
20610713Sandreas.hansson@arm.com     * wait for a recvReqRetry at which point it can re-issue a
2078975Sandreas.hansson@arm.com     * sendTimingReq.
2088975Sandreas.hansson@arm.com     *
2098975Sandreas.hansson@arm.com     * @param pkt Packet to send.
2108975Sandreas.hansson@arm.com     *
2118975Sandreas.hansson@arm.com     * @return If the send was succesful or not.
2128975Sandreas.hansson@arm.com    */
2138975Sandreas.hansson@arm.com    bool sendTimingReq(PacketPtr pkt);
2148948Sandreas.hansson@arm.com
2158948Sandreas.hansson@arm.com    /**
21612342Snikos.nikoleris@arm.com     * Check if the slave can handle a timing request.
21712342Snikos.nikoleris@arm.com     *
21812342Snikos.nikoleris@arm.com     * If the send cannot be handled at the moment, as indicated by
21912342Snikos.nikoleris@arm.com     * the return value, then the sender will receive a recvReqRetry
22012342Snikos.nikoleris@arm.com     * at which point it can re-issue a sendTimingReq.
22112342Snikos.nikoleris@arm.com     *
22212342Snikos.nikoleris@arm.com     * @param pkt Packet to send.
22312342Snikos.nikoleris@arm.com     *
22412342Snikos.nikoleris@arm.com     * @return If the send was succesful or not.
22512342Snikos.nikoleris@arm.com     */
22612342Snikos.nikoleris@arm.com    bool tryTiming(PacketPtr pkt) const;
22712342Snikos.nikoleris@arm.com
22812342Snikos.nikoleris@arm.com    /**
2298975Sandreas.hansson@arm.com     * Attempt to send a timing snoop response packet to the slave
2308975Sandreas.hansson@arm.com     * port by calling its corresponding receive function. If the send
2318975Sandreas.hansson@arm.com     * does not succeed, as indicated by the return value, then the
23210713Sandreas.hansson@arm.com     * sender must wait for a recvRetrySnoop at which point it can
23310713Sandreas.hansson@arm.com     * re-issue a sendTimingSnoopResp.
2348975Sandreas.hansson@arm.com     *
2358975Sandreas.hansson@arm.com     * @param pkt Packet to send.
2368948Sandreas.hansson@arm.com     */
2378975Sandreas.hansson@arm.com    bool sendTimingSnoopResp(PacketPtr pkt);
2388922Swilliam.wang@arm.com
2398922Swilliam.wang@arm.com    /**
2409087Sandreas.hansson@arm.com     * Send a retry to the slave port that previously attempted a
24110713Sandreas.hansson@arm.com     * sendTimingResp to this master port and failed. Note that this
24210713Sandreas.hansson@arm.com     * is virtual so that the "fake" snoop response port in the
24310713Sandreas.hansson@arm.com     * coherent crossbar can override the behaviour.
2449087Sandreas.hansson@arm.com     */
24510713Sandreas.hansson@arm.com    virtual void sendRetryResp();
2469087Sandreas.hansson@arm.com
2478975Sandreas.hansson@arm.com  protected:
2489087Sandreas.hansson@arm.com    /**
2498975Sandreas.hansson@arm.com     * Called to receive an address range change from the peer slave
2509325Sandreas.hansson@arm.com     * port. The default implementation ignores the change and does
2518975Sandreas.hansson@arm.com     * nothing. Override this function in a derived class if the owner
2529325Sandreas.hansson@arm.com     * needs to be aware of the address ranges, e.g. in an
2538975Sandreas.hansson@arm.com     * interconnect component like a bus.
2548975Sandreas.hansson@arm.com     */
2558975Sandreas.hansson@arm.com    virtual void recvRangeChange() { }
25614183Sgabeblack@google.com
25714183Sgabeblack@google.com    /**
25814183Sgabeblack@google.com     * Default implementations.
25914183Sgabeblack@google.com     */
26014183Sgabeblack@google.com    Tick
26114183Sgabeblack@google.com    recvAtomicSnoop(PacketPtr pkt) override
26214183Sgabeblack@google.com    {
26314183Sgabeblack@google.com        panic("%s was not expecting an atomic snoop request\n", name());
26414183Sgabeblack@google.com        return 0;
26514183Sgabeblack@google.com    }
26614183Sgabeblack@google.com
26714183Sgabeblack@google.com    void
26814183Sgabeblack@google.com    recvFunctionalSnoop(PacketPtr pkt) override
26914183Sgabeblack@google.com    {
27014183Sgabeblack@google.com        panic("%s was not expecting a functional snoop request\n", name());
27114183Sgabeblack@google.com    }
27214183Sgabeblack@google.com
27314183Sgabeblack@google.com    void
27414183Sgabeblack@google.com    recvTimingSnoopReq(PacketPtr pkt) override
27514183Sgabeblack@google.com    {
27614183Sgabeblack@google.com        panic("%s was not expecting a timing snoop request.\n", name());
27714183Sgabeblack@google.com    }
27814183Sgabeblack@google.com
27914183Sgabeblack@google.com    void
28014183Sgabeblack@google.com    recvRetrySnoopResp() override
28114183Sgabeblack@google.com    {
28214183Sgabeblack@google.com        panic("%s was not expecting a snoop retry.\n", name());
28314183Sgabeblack@google.com    }
2842381SN/A};
2852381SN/A
2868922Swilliam.wang@arm.com/**
2878922Swilliam.wang@arm.com * A SlavePort is a specialisation of a port. In addition to the
2888922Swilliam.wang@arm.com * basic functionality of sending packets to its master peer, it also
2898922Swilliam.wang@arm.com * has functions specific to a slave, e.g. to send range changes
2908922Swilliam.wang@arm.com * and get the address ranges that the port responds to.
29114183Sgabeblack@google.com *
29214183Sgabeblack@google.com * The three protocols are atomic, timing, and functional, each with its own
29314183Sgabeblack@google.com * header file.
2948922Swilliam.wang@arm.com */
29514183Sgabeblack@google.comclass SlavePort : public BaseSlavePort, public AtomicResponseProtocol,
29614183Sgabeblack@google.com    public TimingResponseProtocol, public FunctionalResponseProtocol
2978922Swilliam.wang@arm.com{
2988975Sandreas.hansson@arm.com    friend class MasterPort;
2998975Sandreas.hansson@arm.com
3008922Swilliam.wang@arm.com  private:
3018922Swilliam.wang@arm.com    MasterPort* _masterPort;
30213845Sgabeblack@google.com    bool defaultBackdoorWarned;
3038922Swilliam.wang@arm.com
30413769Sgabeblack@google.com  protected:
30513892Sgabeblack@google.com    SimObject& owner;
30613769Sgabeblack@google.com
3078922Swilliam.wang@arm.com  public:
30813892Sgabeblack@google.com    SlavePort(const std::string& name, SimObject* _owner,
30913769Sgabeblack@google.com              PortID id=InvalidPortID);
3108922Swilliam.wang@arm.com    virtual ~SlavePort();
3118922Swilliam.wang@arm.com
3128922Swilliam.wang@arm.com    /**
3139088Sandreas.hansson@arm.com     * Find out if the peer master port is snooping or not.
3149088Sandreas.hansson@arm.com     *
3159088Sandreas.hansson@arm.com     * @return true if the peer master port is snooping
3169088Sandreas.hansson@arm.com     */
3179088Sandreas.hansson@arm.com    bool isSnooping() const { return _masterPort->isSnooping(); }
3189088Sandreas.hansson@arm.com
3199088Sandreas.hansson@arm.com    /**
3208922Swilliam.wang@arm.com     * Called by the owner to send a range change
3218922Swilliam.wang@arm.com     */
32214183Sgabeblack@google.com    void
32314183Sgabeblack@google.com    sendRangeChange() const
32414183Sgabeblack@google.com    {
32514183Sgabeblack@google.com        fatal_if(!_masterPort,
32614183Sgabeblack@google.com                "%s cannot sendRangeChange() without master port.", name());
32710413SCurtis.Dunham@arm.com        _masterPort->recvRangeChange();
32810413SCurtis.Dunham@arm.com    }
3298922Swilliam.wang@arm.com
3308922Swilliam.wang@arm.com    /**
3318922Swilliam.wang@arm.com     * Get a list of the non-overlapping address ranges the owner is
3328922Swilliam.wang@arm.com     * responsible for. All slave ports must override this function
3338922Swilliam.wang@arm.com     * and return a populated list with at least one item.
3348922Swilliam.wang@arm.com     *
3358922Swilliam.wang@arm.com     * @return a list of ranges responded to
3368922Swilliam.wang@arm.com     */
3379090Sandreas.hansson@arm.com    virtual AddrRangeList getAddrRanges() const = 0;
3388975Sandreas.hansson@arm.com
33913782Sgabeblack@google.com    /**
34013782Sgabeblack@google.com     * We let the master port do the work, so these don't do anything.
34113782Sgabeblack@google.com     */
34213782Sgabeblack@google.com    void unbind() override {}
34313782Sgabeblack@google.com    void bind(Port &peer) override {}
34413782Sgabeblack@google.com
34514183Sgabeblack@google.com  public:
34614183Sgabeblack@google.com    /* The atomic protocol. */
34714183Sgabeblack@google.com
34814183Sgabeblack@google.com    /**
34914183Sgabeblack@google.com     * Send an atomic snoop request packet, where the data is moved
35014183Sgabeblack@google.com     * and the state is updated in zero time, without interleaving
35114183Sgabeblack@google.com     * with other memory accesses.
35214183Sgabeblack@google.com     *
35314183Sgabeblack@google.com     * @param pkt Snoop packet to send.
35414183Sgabeblack@google.com     *
35514183Sgabeblack@google.com     * @return Estimated latency of access.
35614183Sgabeblack@google.com     */
35714183Sgabeblack@google.com    Tick
35814183Sgabeblack@google.com    sendAtomicSnoop(PacketPtr pkt)
35914183Sgabeblack@google.com    {
36014183Sgabeblack@google.com        return AtomicResponseProtocol::sendSnoop(_masterPort, pkt);
36114183Sgabeblack@google.com    }
36214183Sgabeblack@google.com
36314183Sgabeblack@google.com  public:
36414183Sgabeblack@google.com    /* The functional protocol. */
36514183Sgabeblack@google.com
36614183Sgabeblack@google.com    /**
36714183Sgabeblack@google.com     * Send a functional snoop request packet, where the data is
36814183Sgabeblack@google.com     * instantly updated everywhere in the memory system, without
36914183Sgabeblack@google.com     * affecting the current state of any block or moving the block.
37014183Sgabeblack@google.com     *
37114183Sgabeblack@google.com     * @param pkt Snoop packet to send.
37214183Sgabeblack@google.com     */
37314183Sgabeblack@google.com    void
37414183Sgabeblack@google.com    sendFunctionalSnoop(PacketPtr pkt) const
37514183Sgabeblack@google.com    {
37614183Sgabeblack@google.com        FunctionalResponseProtocol::sendSnoop(_masterPort, pkt);
37714183Sgabeblack@google.com    }
37814183Sgabeblack@google.com
37914183Sgabeblack@google.com  public:
38014183Sgabeblack@google.com    /* The timing protocol. */
38114183Sgabeblack@google.com
38214183Sgabeblack@google.com    /**
38314183Sgabeblack@google.com     * Attempt to send a timing response to the master port by calling
38414183Sgabeblack@google.com     * its corresponding receive function. If the send does not
38514183Sgabeblack@google.com     * succeed, as indicated by the return value, then the sender must
38614183Sgabeblack@google.com     * wait for a recvRespRetry at which point it can re-issue a
38714183Sgabeblack@google.com     * sendTimingResp.
38814183Sgabeblack@google.com     *
38914183Sgabeblack@google.com     * @param pkt Packet to send.
39014183Sgabeblack@google.com     *
39114183Sgabeblack@google.com     * @return If the send was succesful or not.
39214183Sgabeblack@google.com    */
39314183Sgabeblack@google.com    bool
39414183Sgabeblack@google.com    sendTimingResp(PacketPtr pkt)
39514183Sgabeblack@google.com    {
39614183Sgabeblack@google.com        return TimingResponseProtocol::sendResp(_masterPort, pkt);
39714183Sgabeblack@google.com    }
39814183Sgabeblack@google.com
39914183Sgabeblack@google.com    /**
40014183Sgabeblack@google.com     * Attempt to send a timing snoop request packet to the master port
40114183Sgabeblack@google.com     * by calling its corresponding receive function. Snoop requests
40214183Sgabeblack@google.com     * always succeed and hence no return value is needed.
40314183Sgabeblack@google.com     *
40414183Sgabeblack@google.com     * @param pkt Packet to send.
40514183Sgabeblack@google.com     */
40614183Sgabeblack@google.com    void
40714183Sgabeblack@google.com    sendTimingSnoopReq(PacketPtr pkt)
40814183Sgabeblack@google.com    {
40914183Sgabeblack@google.com        TimingResponseProtocol::sendSnoopReq(_masterPort, pkt);
41014183Sgabeblack@google.com    }
41114183Sgabeblack@google.com
41214183Sgabeblack@google.com    /**
41314183Sgabeblack@google.com     * Send a retry to the master port that previously attempted a
41414183Sgabeblack@google.com     * sendTimingReq to this slave port and failed.
41514183Sgabeblack@google.com     */
41614183Sgabeblack@google.com    void
41714183Sgabeblack@google.com    sendRetryReq()
41814183Sgabeblack@google.com    {
41914183Sgabeblack@google.com        TimingResponseProtocol::sendRetryReq(_masterPort);
42014183Sgabeblack@google.com    }
42114183Sgabeblack@google.com
42214183Sgabeblack@google.com    /**
42314183Sgabeblack@google.com     * Send a retry to the master port that previously attempted a
42414183Sgabeblack@google.com     * sendTimingSnoopResp to this slave port and failed.
42514183Sgabeblack@google.com     */
42614183Sgabeblack@google.com    void
42714183Sgabeblack@google.com    sendRetrySnoopResp()
42814183Sgabeblack@google.com    {
42914183Sgabeblack@google.com        TimingResponseProtocol::sendRetrySnoopResp(_masterPort);
43014183Sgabeblack@google.com    }
43114183Sgabeblack@google.com
4328975Sandreas.hansson@arm.com  protected:
4338975Sandreas.hansson@arm.com    /**
4349178Sandreas.hansson@arm.com     * Called by the master port to unbind. Should never be called
4359178Sandreas.hansson@arm.com     * directly.
4369178Sandreas.hansson@arm.com     */
43713782Sgabeblack@google.com    void slaveUnbind();
4389178Sandreas.hansson@arm.com
4399178Sandreas.hansson@arm.com    /**
4409178Sandreas.hansson@arm.com     * Called by the master port to bind. Should never be called
4419178Sandreas.hansson@arm.com     * directly.
4429178Sandreas.hansson@arm.com     */
44313782Sgabeblack@google.com    void slaveBind(MasterPort& master_port);
4449178Sandreas.hansson@arm.com
4459178Sandreas.hansson@arm.com    /**
44614183Sgabeblack@google.com     * Default implementations.
4478975Sandreas.hansson@arm.com     */
44814183Sgabeblack@google.com    Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override;
4498975Sandreas.hansson@arm.com
45014183Sgabeblack@google.com    bool
45114183Sgabeblack@google.com    tryTiming(PacketPtr pkt) override
45214183Sgabeblack@google.com    {
45312342Snikos.nikoleris@arm.com        panic("%s was not expecting a %s\n", name(), __func__);
45412342Snikos.nikoleris@arm.com    }
45512342Snikos.nikoleris@arm.com
45614183Sgabeblack@google.com    bool
45714183Sgabeblack@google.com    recvTimingSnoopResp(PacketPtr pkt) override
4588975Sandreas.hansson@arm.com    {
4598975Sandreas.hansson@arm.com        panic("%s was not expecting a timing snoop response\n", name());
4608975Sandreas.hansson@arm.com    }
4618922Swilliam.wang@arm.com};
4628922Swilliam.wang@arm.com
46314183Sgabeblack@google.cominline Tick
46414183Sgabeblack@google.comMasterPort::sendAtomic(PacketPtr pkt)
46514183Sgabeblack@google.com{
46614183Sgabeblack@google.com    return AtomicRequestProtocol::send(_slavePort, pkt);
46714183Sgabeblack@google.com}
46814183Sgabeblack@google.com
46914183Sgabeblack@google.cominline Tick
47014183Sgabeblack@google.comMasterPort::sendAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor)
47114183Sgabeblack@google.com{
47214183Sgabeblack@google.com    return AtomicRequestProtocol::sendBackdoor(_slavePort, pkt, backdoor);
47314183Sgabeblack@google.com}
47414183Sgabeblack@google.com
47514183Sgabeblack@google.cominline void
47614183Sgabeblack@google.comMasterPort::sendFunctional(PacketPtr pkt) const
47714183Sgabeblack@google.com{
47814183Sgabeblack@google.com    return FunctionalRequestProtocol::send(_slavePort, pkt);
47914183Sgabeblack@google.com}
48014183Sgabeblack@google.com
48114183Sgabeblack@google.cominline bool
48214183Sgabeblack@google.comMasterPort::sendTimingReq(PacketPtr pkt)
48314183Sgabeblack@google.com{
48414183Sgabeblack@google.com    return TimingRequestProtocol::sendReq(_slavePort, pkt);
48514183Sgabeblack@google.com}
48614183Sgabeblack@google.com
48714183Sgabeblack@google.cominline bool
48814183Sgabeblack@google.comMasterPort::tryTiming(PacketPtr pkt) const
48914183Sgabeblack@google.com{
49014183Sgabeblack@google.com    return TimingRequestProtocol::trySend(_slavePort, pkt);
49114183Sgabeblack@google.com}
49214183Sgabeblack@google.com
49314183Sgabeblack@google.cominline bool
49414183Sgabeblack@google.comMasterPort::sendTimingSnoopResp(PacketPtr pkt)
49514183Sgabeblack@google.com{
49614183Sgabeblack@google.com    return TimingRequestProtocol::sendSnoopResp(_slavePort, pkt);
49714183Sgabeblack@google.com}
49814183Sgabeblack@google.com
49914183Sgabeblack@google.cominline void
50014183Sgabeblack@google.comMasterPort::sendRetryResp()
50114183Sgabeblack@google.com{
50214183Sgabeblack@google.com    TimingRequestProtocol::sendRetryResp(_slavePort);
50314183Sgabeblack@google.com}
50414183Sgabeblack@google.com
5052381SN/A#endif //__MEM_PORT_HH__
506