ExtSlave.hh revision 11617:a51ae096ca25
15643Sgblack@eecs.umich.edu// Copyright (c) 2015 ARM Limited
25643Sgblack@eecs.umich.edu// All rights reserved.
35643Sgblack@eecs.umich.edu//
45643Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall
55643Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual
65643Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating
75643Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software
85643Sgblack@eecs.umich.edu// licensed hereunder.  You may use the software subject to the license
95643Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated
105643Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software,
115643Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form.
125643Sgblack@eecs.umich.edu//
135643Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
145643Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are
155643Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright
165643Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
175643Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
185643Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
195643Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution;
205643Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its
215643Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
225643Sgblack@eecs.umich.edu// this software without specific prior written permission.
235643Sgblack@eecs.umich.edu//
245643Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
255643Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
265643Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
275643Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
285643Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
295643Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
305643Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3111793Sbrandon.potter@amd.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3211793Sbrandon.potter@amd.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
336138Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
345651Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
358746Sgblack@eecs.umich.edu
368232Snate@binkert.org// Copyright 2009-2014 Sandia Coporation.  Under the terms
375657Sgblack@eecs.umich.edu// of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
385643Sgblack@eecs.umich.edu// Government retains certain rights in this software.
395643Sgblack@eecs.umich.edu//
405643Sgblack@eecs.umich.edu// Copyright (c) 2009-2014, Sandia Corporation
415643Sgblack@eecs.umich.edu// All rights reserved.
429805Sstever@gmail.com//
439808Sstever@gmail.com// For license information, see the LICENSE file in the current directory.
449805Sstever@gmail.com
455643Sgblack@eecs.umich.edu#ifndef EXT_SST_EXTSLAVE_HH
467913SBrad.Beckmann@amd.com#define EXT_SST_EXTSLAVE_HH
477913SBrad.Beckmann@amd.com
487913SBrad.Beckmann@amd.com#include <sst/core/component.h>
497913SBrad.Beckmann@amd.com#include <sst/core/output.h>
507913SBrad.Beckmann@amd.com#include <sst/core/interfaces/simpleMem.h>
516136Sgblack@eecs.umich.edu
525643Sgblack@eecs.umich.edu#include <sim/sim_object.hh>
535643Sgblack@eecs.umich.edu#include <mem/packet.hh>
545653Sgblack@eecs.umich.edu#include <mem/request.hh>
555653Sgblack@eecs.umich.edu#include <mem/external_slave.hh>
565653Sgblack@eecs.umich.edu
575653Sgblack@eecs.umich.edunamespace SST {
585827Sgblack@eecs.umich.educlass Link;
595653Sgblack@eecs.umich.educlass Event;
605643Sgblack@eecs.umich.educlass MemEvent;
615643Sgblack@eecs.umich.edunamespace gem5 {
627913SBrad.Beckmann@amd.com
637913SBrad.Beckmann@amd.comclass gem5Component;
647913SBrad.Beckmann@amd.com
657913SBrad.Beckmann@amd.comclass ExtSlave : public ExternalSlave::Port {
667913SBrad.Beckmann@amd.com  public:
679807Sstever@gmail.com    const std::string name;
687913SBrad.Beckmann@amd.com
699805Sstever@gmail.com    bool
709807Sstever@gmail.com    recvTimingSnoopResp(PacketPtr packet)
717913SBrad.Beckmann@amd.com    {
727913SBrad.Beckmann@amd.com        fatal("recvTimingSnoopResp unimplemented");
739805Sstever@gmail.com        return false;
749805Sstever@gmail.com    }
759805Sstever@gmail.com
769805Sstever@gmail.com    bool recvTimingReq(PacketPtr packet);
779805Sstever@gmail.com
789805Sstever@gmail.com    void recvFunctional(PacketPtr packet);
799805Sstever@gmail.com
809805Sstever@gmail.com    void recvRespRetry();
819805Sstever@gmail.com
829805Sstever@gmail.com    Tick
839805Sstever@gmail.com    recvAtomic(PacketPtr packet)
849805Sstever@gmail.com    {
859805Sstever@gmail.com        fatal("recvAtomic unimplemented");
869805Sstever@gmail.com    }
879805Sstever@gmail.com
889805Sstever@gmail.com    enum Phase { CONSTRUCTION, INIT, RUN };
899805Sstever@gmail.com
909805Sstever@gmail.com    gem5Component *comp;
915643Sgblack@eecs.umich.edu    Output &out;
9211144Sjthestness@gmail.com    Phase simPhase;
9311144Sjthestness@gmail.com
9411144Sjthestness@gmail.com    std::list<MemEvent*>* initPackets;
9511144Sjthestness@gmail.com    Link* link;
9611144Sjthestness@gmail.com    std::list<PacketPtr> respQ;
9711144Sjthestness@gmail.com    bool blocked() { return !respQ.empty(); }
9811144Sjthestness@gmail.com
9911144Sjthestness@gmail.com    typedef std::map<Event::id_type, ::Packet*> PacketMap_t;
10011144Sjthestness@gmail.com    PacketMap_t PacketMap; // SST Event id -> gem5 Packet*
1015643Sgblack@eecs.umich.edu
1025643Sgblack@eecs.umich.edupublic:
1035643Sgblack@eecs.umich.edu    ExtSlave(gem5Component*, Output&, ExternalSlave&, std::string&);
1045643Sgblack@eecs.umich.edu    void init(unsigned phase);
1055643Sgblack@eecs.umich.edu
1065643Sgblack@eecs.umich.edu    void
1075643Sgblack@eecs.umich.edu    setup()
1085643Sgblack@eecs.umich.edu    {
1095643Sgblack@eecs.umich.edu        simPhase = RUN;
1105643Sgblack@eecs.umich.edu    }
1115643Sgblack@eecs.umich.edu
1125643Sgblack@eecs.umich.edu    void handleEvent(Event*);
1135643Sgblack@eecs.umich.edu};
1145643Sgblack@eecs.umich.edu
1155898Sgblack@eecs.umich.edu}
1169805Sstever@gmail.com}
1175643Sgblack@eecs.umich.edu
1185643Sgblack@eecs.umich.edu#endif
1195643Sgblack@eecs.umich.edu