AbstractController.hh revision 9302
17008Snate@binkert.org/*
27008Snate@binkert.org * Copyright (c) 2009 Mark D. Hill and David A. Wood
37008Snate@binkert.org * All rights reserved.
47008Snate@binkert.org *
57008Snate@binkert.org * Redistribution and use in source and binary forms, with or without
67008Snate@binkert.org * modification, are permitted provided that the following conditions are
77008Snate@binkert.org * met: redistributions of source code must retain the above copyright
87008Snate@binkert.org * notice, this list of conditions and the following disclaimer;
97008Snate@binkert.org * redistributions in binary form must reproduce the above copyright
107008Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
117008Snate@binkert.org * documentation and/or other materials provided with the distribution;
127008Snate@binkert.org * neither the name of the copyright holders nor the names of its
137008Snate@binkert.org * contributors may be used to endorse or promote products derived from
147008Snate@binkert.org * this software without specific prior written permission.
157008Snate@binkert.org *
167008Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
177008Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
187008Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
197008Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
207008Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
217008Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
227008Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
237008Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
247008Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
257008Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
267008Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
277008Snate@binkert.org */
286285Snate@binkert.org
297039Snate@binkert.org#ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
307039Snate@binkert.org#define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
316285Snate@binkert.org
327055Snate@binkert.org#include <iostream>
337055Snate@binkert.org#include <string>
346876Ssteve.reinhardt@amd.com
359302Snilay@cs.wisc.edu#include "mem/packet.hh"
368341Snilay@cs.wisc.edu#include "mem/protocol/AccessPermission.hh"
376506Spdudnik@gmail.com#include "mem/ruby/common/Address.hh"
387055Snate@binkert.org#include "mem/ruby/common/Consumer.hh"
398436SBrad.Beckmann@amd.com#include "mem/ruby/common/DataBlock.hh"
406881SBrad.Beckmann@amd.com#include "mem/ruby/network/Network.hh"
418683Snilay@cs.wisc.edu#include "mem/ruby/recorder/CacheRecorder.hh"
427055Snate@binkert.org#include "params/RubyController.hh"
437055Snate@binkert.org#include "sim/sim_object.hh"
446285Snate@binkert.org
456285Snate@binkert.orgclass MessageBuffer;
466285Snate@binkert.orgclass Network;
476285Snate@binkert.org
487039Snate@binkert.orgclass AbstractController : public SimObject, public Consumer
497039Snate@binkert.org{
507039Snate@binkert.org  public:
516876Ssteve.reinhardt@amd.com    typedef RubyControllerParams Params;
528436SBrad.Beckmann@amd.com    AbstractController(const Params *p);
538257SBrad.Beckmann@amd.com    const Params *params() const { return (const Params *)_params; }
547039Snate@binkert.org    virtual MessageBuffer* getMandatoryQueue() const = 0;
557039Snate@binkert.org    virtual const int & getVersion() const = 0;
567055Snate@binkert.org    virtual const std::string toString() const = 0;  // returns text version of
577055Snate@binkert.org                                                     // controller type
587055Snate@binkert.org    virtual const std::string getName() const = 0;   // return instance name
597039Snate@binkert.org    virtual void blockOnQueue(Address, MessageBuffer*) = 0;
607039Snate@binkert.org    virtual void unblock(Address) = 0;
617039Snate@binkert.org    virtual void initNetworkPtr(Network* net_ptr) = 0;
628531Snilay@cs.wisc.edu    virtual AccessPermission getAccessPermission(const Address& addr) = 0;
638531Snilay@cs.wisc.edu    virtual DataBlock& getDataBlock(const Address& addr) = 0;
646285Snate@binkert.org
657055Snate@binkert.org    virtual void print(std::ostream & out) const = 0;
667055Snate@binkert.org    virtual void printStats(std::ostream & out) const = 0;
677039Snate@binkert.org    virtual void wakeup() = 0;
687055Snate@binkert.org    //  virtual void dumpStats(std::ostream & out) = 0;
697039Snate@binkert.org    virtual void clearStats() = 0;
708683Snilay@cs.wisc.edu    virtual void recordCacheTrace(int cntrl, CacheRecorder* tr) = 0;
718683Snilay@cs.wisc.edu    virtual Sequencer* getSequencer() const = 0;
729302Snilay@cs.wisc.edu
739302Snilay@cs.wisc.edu    //! These functions are used by ruby system to read/write the message
749302Snilay@cs.wisc.edu    //! queues that exist with in the controller.
759302Snilay@cs.wisc.edu    //! The boolean return value indicates if the read was performed
769302Snilay@cs.wisc.edu    //! successfully.
779302Snilay@cs.wisc.edu    virtual bool functionalReadBuffers(PacketPtr&) = 0;
789302Snilay@cs.wisc.edu    //! The return value indicates the number of messages written with the
799302Snilay@cs.wisc.edu    //! data from the packet.
809302Snilay@cs.wisc.edu    virtual uint32_t functionalWriteBuffers(PacketPtr&) = 0;
816285Snate@binkert.org};
826285Snate@binkert.org
837039Snate@binkert.org#endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
84