ExtSlave.hh revision 11618:37b0af2c7ba8
15222Sksewell@umich.edu// Copyright (c) 2015 ARM Limited
25222Sksewell@umich.edu// All rights reserved.
35222Sksewell@umich.edu//
45222Sksewell@umich.edu// The license below extends only to copyright in the software and shall
55222Sksewell@umich.edu// not be construed as granting a license to any other intellectual
65222Sksewell@umich.edu// property including but not limited to intellectual property relating
75222Sksewell@umich.edu// to a hardware implementation of the functionality of the software
85222Sksewell@umich.edu// licensed hereunder.  You may use the software subject to the license
95222Sksewell@umich.edu// terms below provided that you ensure that this notice is replicated
105222Sksewell@umich.edu// unmodified and in its entirety in all distributions of the software,
115222Sksewell@umich.edu// modified or unmodified, in source code or in binary form.
125222Sksewell@umich.edu//
135222Sksewell@umich.edu// Redistribution and use in source and binary forms, with or without
145222Sksewell@umich.edu// modification, are permitted provided that the following conditions are
155222Sksewell@umich.edu// met: redistributions of source code must retain the above copyright
165222Sksewell@umich.edu// notice, this list of conditions and the following disclaimer;
175222Sksewell@umich.edu// redistributions in binary form must reproduce the above copyright
185222Sksewell@umich.edu// notice, this list of conditions and the following disclaimer in the
195222Sksewell@umich.edu// documentation and/or other materials provided with the distribution;
205222Sksewell@umich.edu// neither the name of the copyright holders nor the names of its
215222Sksewell@umich.edu// contributors may be used to endorse or promote products derived from
225222Sksewell@umich.edu// this software without specific prior written permission.
235222Sksewell@umich.edu//
245222Sksewell@umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
255222Sksewell@umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
265222Sksewell@umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
275222Sksewell@umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
285222Sksewell@umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
295222Sksewell@umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
305222Sksewell@umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
315222Sksewell@umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
325222Sksewell@umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
335222Sksewell@umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
345222Sksewell@umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
355222Sksewell@umich.edu
365222Sksewell@umich.edu// Copyright 2009-2014 Sandia Coporation.  Under the terms
375222Sksewell@umich.edu// of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
385222Sksewell@umich.edu// Government retains certain rights in this software.
395222Sksewell@umich.edu//
405222Sksewell@umich.edu// Copyright (c) 2009-2014, Sandia Corporation
415222Sksewell@umich.edu// All rights reserved.
425222Sksewell@umich.edu//
435222Sksewell@umich.edu// For license information, see the LICENSE file in the current directory.
445222Sksewell@umich.edu
455222Sksewell@umich.edu#ifndef EXT_SST_EXTSLAVE_HH
465222Sksewell@umich.edu#define EXT_SST_EXTSLAVE_HH
475222Sksewell@umich.edu
485222Sksewell@umich.edu#include <core/interfaces/simpleMem.h>
495222Sksewell@umich.edu
505222Sksewell@umich.edu#include <sim/sim_object.hh>
515222Sksewell@umich.edu#include <mem/packet.hh>
525222Sksewell@umich.edu#include <mem/request.hh>
535222Sksewell@umich.edu#include <mem/external_slave.hh>
545222Sksewell@umich.edu
555222Sksewell@umich.edunamespace SST {
565222Sksewell@umich.educlass Link;
575222Sksewell@umich.educlass Event;
585222Sksewell@umich.educlass MemEvent;
595222Sksewell@umich.edunamespace gem5 {
605222Sksewell@umich.edu
615222Sksewell@umich.educlass gem5Component;
625222Sksewell@umich.edu
635222Sksewell@umich.educlass ExtSlave : public ExternalSlave::Port {
645222Sksewell@umich.edu  public:
655222Sksewell@umich.edu    const std::string name;
665222Sksewell@umich.edu
675222Sksewell@umich.edu    bool
685222Sksewell@umich.edu    recvTimingSnoopResp(PacketPtr packet)
695222Sksewell@umich.edu    {
705222Sksewell@umich.edu        fatal("recvTimingSnoopResp unimplemented");
715222Sksewell@umich.edu        return false;
725222Sksewell@umich.edu    }
735222Sksewell@umich.edu
745222Sksewell@umich.edu    bool recvTimingReq(PacketPtr packet);
755222Sksewell@umich.edu
765222Sksewell@umich.edu    void recvFunctional(PacketPtr packet);
775222Sksewell@umich.edu
785222Sksewell@umich.edu    void recvRespRetry();
795222Sksewell@umich.edu
805222Sksewell@umich.edu    Tick
815222Sksewell@umich.edu    recvAtomic(PacketPtr packet)
825222Sksewell@umich.edu    {
835222Sksewell@umich.edu        fatal("recvAtomic unimplemented");
845222Sksewell@umich.edu    }
855222Sksewell@umich.edu
865222Sksewell@umich.edu    enum Phase { CONSTRUCTION, INIT, RUN };
875222Sksewell@umich.edu
885222Sksewell@umich.edu    gem5Component *comp;
895222Sksewell@umich.edu    Output &out;
905222Sksewell@umich.edu    Phase simPhase;
915222Sksewell@umich.edu
925222Sksewell@umich.edu    std::list<MemEvent*>* initPackets;
935222Sksewell@umich.edu    Link* link;
945222Sksewell@umich.edu    std::list<PacketPtr> respQ;
955222Sksewell@umich.edu    bool blocked() { return !respQ.empty(); }
965222Sksewell@umich.edu
975222Sksewell@umich.edu    typedef std::map<Event::id_type, ::Packet*> PacketMap_t;
985222Sksewell@umich.edu    PacketMap_t PacketMap; // SST Event id -> gem5 Packet*
995222Sksewell@umich.edu
1005222Sksewell@umich.edupublic:
1015222Sksewell@umich.edu    ExtSlave(gem5Component*, Output&, ExternalSlave&, std::string&);
1025222Sksewell@umich.edu    void init(unsigned phase);
1035222Sksewell@umich.edu
1045222Sksewell@umich.edu    void
1055222Sksewell@umich.edu    setup()
1065222Sksewell@umich.edu    {
1075222Sksewell@umich.edu        simPhase = RUN;
1085222Sksewell@umich.edu    }
1095222Sksewell@umich.edu
1105222Sksewell@umich.edu    void handleEvent(Event*);
1115222Sksewell@umich.edu};
1125222Sksewell@umich.edu
1135222Sksewell@umich.edu}
1145222Sksewell@umich.edu}
1155222Sksewell@umich.edu
1165222Sksewell@umich.edu#endif
1175222Sksewell@umich.edu