ExtSlave.hh revision 11617:a51ae096ca25
114184Sgabeblack@google.com// Copyright (c) 2015 ARM Limited
214184Sgabeblack@google.com// All rights reserved.
314184Sgabeblack@google.com//
414184Sgabeblack@google.com// The license below extends only to copyright in the software and shall
514184Sgabeblack@google.com// not be construed as granting a license to any other intellectual
614184Sgabeblack@google.com// property including but not limited to intellectual property relating
714184Sgabeblack@google.com// to a hardware implementation of the functionality of the software
814184Sgabeblack@google.com// licensed hereunder.  You may use the software subject to the license
914184Sgabeblack@google.com// terms below provided that you ensure that this notice is replicated
1014184Sgabeblack@google.com// unmodified and in its entirety in all distributions of the software,
1114184Sgabeblack@google.com// modified or unmodified, in source code or in binary form.
1214184Sgabeblack@google.com//
1314184Sgabeblack@google.com// Redistribution and use in source and binary forms, with or without
1414184Sgabeblack@google.com// modification, are permitted provided that the following conditions are
1514184Sgabeblack@google.com// met: redistributions of source code must retain the above copyright
1614184Sgabeblack@google.com// notice, this list of conditions and the following disclaimer;
1714184Sgabeblack@google.com// redistributions in binary form must reproduce the above copyright
1814184Sgabeblack@google.com// notice, this list of conditions and the following disclaimer in the
1914184Sgabeblack@google.com// documentation and/or other materials provided with the distribution;
2014184Sgabeblack@google.com// neither the name of the copyright holders nor the names of its
2114184Sgabeblack@google.com// contributors may be used to endorse or promote products derived from
2214184Sgabeblack@google.com// this software without specific prior written permission.
2314184Sgabeblack@google.com//
2414184Sgabeblack@google.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2514184Sgabeblack@google.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2614184Sgabeblack@google.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2714184Sgabeblack@google.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2814184Sgabeblack@google.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2914184Sgabeblack@google.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3014184Sgabeblack@google.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3114184Sgabeblack@google.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3214184Sgabeblack@google.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3314184Sgabeblack@google.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3414184Sgabeblack@google.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3514184Sgabeblack@google.com
3614184Sgabeblack@google.com// Copyright 2009-2014 Sandia Coporation.  Under the terms
3714184Sgabeblack@google.com// of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
3814184Sgabeblack@google.com// Government retains certain rights in this software.
3914184Sgabeblack@google.com//
4014184Sgabeblack@google.com// Copyright (c) 2009-2014, Sandia Corporation
4114184Sgabeblack@google.com// All rights reserved.
4214184Sgabeblack@google.com//
4314184Sgabeblack@google.com// For license information, see the LICENSE file in the current directory.
4414184Sgabeblack@google.com
4514184Sgabeblack@google.com#ifndef EXT_SST_EXTSLAVE_HH
4614184Sgabeblack@google.com#define EXT_SST_EXTSLAVE_HH
4714184Sgabeblack@google.com
4814184Sgabeblack@google.com#include <sst/core/component.h>
4914184Sgabeblack@google.com#include <sst/core/output.h>
5014184Sgabeblack@google.com#include <sst/core/interfaces/simpleMem.h>
5114184Sgabeblack@google.com
5214184Sgabeblack@google.com#include <sim/sim_object.hh>
5314184Sgabeblack@google.com#include <mem/packet.hh>
5414184Sgabeblack@google.com#include <mem/request.hh>
5514184Sgabeblack@google.com#include <mem/external_slave.hh>
5614184Sgabeblack@google.com
5714184Sgabeblack@google.comnamespace SST {
5814184Sgabeblack@google.comclass Link;
5914184Sgabeblack@google.comclass Event;
6014184Sgabeblack@google.comclass MemEvent;
6114184Sgabeblack@google.comnamespace gem5 {
6214184Sgabeblack@google.com
6314184Sgabeblack@google.comclass gem5Component;
6414184Sgabeblack@google.com
6514184Sgabeblack@google.comclass ExtSlave : public ExternalSlave::Port {
6614184Sgabeblack@google.com  public:
6714184Sgabeblack@google.com    const std::string name;
6814184Sgabeblack@google.com
6914184Sgabeblack@google.com    bool
7014184Sgabeblack@google.com    recvTimingSnoopResp(PacketPtr packet)
7114184Sgabeblack@google.com    {
7214184Sgabeblack@google.com        fatal("recvTimingSnoopResp unimplemented");
7314184Sgabeblack@google.com        return false;
7414184Sgabeblack@google.com    }
7514184Sgabeblack@google.com
7614184Sgabeblack@google.com    bool recvTimingReq(PacketPtr packet);
7714184Sgabeblack@google.com
7814184Sgabeblack@google.com    void recvFunctional(PacketPtr packet);
7914184Sgabeblack@google.com
8014184Sgabeblack@google.com    void recvRespRetry();
8114184Sgabeblack@google.com
8214184Sgabeblack@google.com    Tick
8314184Sgabeblack@google.com    recvAtomic(PacketPtr packet)
8414184Sgabeblack@google.com    {
8514184Sgabeblack@google.com        fatal("recvAtomic unimplemented");
8614184Sgabeblack@google.com    }
8714184Sgabeblack@google.com
8814184Sgabeblack@google.com    enum Phase { CONSTRUCTION, INIT, RUN };
8914184Sgabeblack@google.com
9014184Sgabeblack@google.com    gem5Component *comp;
9114184Sgabeblack@google.com    Output &out;
9214184Sgabeblack@google.com    Phase simPhase;
9314184Sgabeblack@google.com
9414184Sgabeblack@google.com    std::list<MemEvent*>* initPackets;
9514184Sgabeblack@google.com    Link* link;
9614184Sgabeblack@google.com    std::list<PacketPtr> respQ;
9714184Sgabeblack@google.com    bool blocked() { return !respQ.empty(); }
9814184Sgabeblack@google.com
9914184Sgabeblack@google.com    typedef std::map<Event::id_type, ::Packet*> PacketMap_t;
10014184Sgabeblack@google.com    PacketMap_t PacketMap; // SST Event id -> gem5 Packet*
10114184Sgabeblack@google.com
10214184Sgabeblack@google.compublic:
10314184Sgabeblack@google.com    ExtSlave(gem5Component*, Output&, ExternalSlave&, std::string&);
10414184Sgabeblack@google.com    void init(unsigned phase);
10514184Sgabeblack@google.com
10614184Sgabeblack@google.com    void
10714184Sgabeblack@google.com    setup()
10814184Sgabeblack@google.com    {
10914184Sgabeblack@google.com        simPhase = RUN;
11014184Sgabeblack@google.com    }
11114184Sgabeblack@google.com
11214184Sgabeblack@google.com    void handleEvent(Event*);
11314184Sgabeblack@google.com};
11414184Sgabeblack@google.com
11514184Sgabeblack@google.com}
11614184Sgabeblack@google.com}
11714184Sgabeblack@google.com
11814184Sgabeblack@google.com#endif
11914184Sgabeblack@google.com