AbstractController.hh revision 9302
112SN/A/*
21762SN/A * Copyright (c) 2009 Mark D. Hill and David A. Wood
312SN/A * All rights reserved.
412SN/A *
512SN/A * Redistribution and use in source and binary forms, with or without
612SN/A * modification, are permitted provided that the following conditions are
712SN/A * met: redistributions of source code must retain the above copyright
812SN/A * notice, this list of conditions and the following disclaimer;
912SN/A * redistributions in binary form must reproduce the above copyright
1012SN/A * notice, this list of conditions and the following disclaimer in the
1112SN/A * documentation and/or other materials provided with the distribution;
1212SN/A * neither the name of the copyright holders nor the names of its
1312SN/A * contributors may be used to endorse or promote products derived from
1412SN/A * this software without specific prior written permission.
1512SN/A *
1612SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1712SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1812SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1912SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2012SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2112SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2212SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2312SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2412SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2512SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2612SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu */
282665Ssaidi@eecs.umich.edu
2912SN/A#ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
3012SN/A#define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
3112SN/A
3212SN/A#include <iostream>
3356SN/A#include <string>
348229Snate@binkert.org
3556SN/A#include "mem/packet.hh"
367676Snate@binkert.org#include "mem/protocol/AccessPermission.hh"
3712SN/A#include "mem/ruby/common/Address.hh"
3812SN/A#include "mem/ruby/common/Consumer.hh"
3912SN/A#include "mem/ruby/common/DataBlock.hh"
4012SN/A#include "mem/ruby/network/Network.hh"
4112SN/A#include "mem/ruby/recorder/CacheRecorder.hh"
4212SN/A#include "params/RubyController.hh"
4312SN/A#include "sim/sim_object.hh"
44360SN/A
45360SN/Aclass MessageBuffer;
46360SN/Aclass Network;
4712SN/A
4812SN/Aclass AbstractController : public SimObject, public Consumer
4912SN/A{
5012SN/A  public:
5112SN/A    typedef RubyControllerParams Params;
5212SN/A    AbstractController(const Params *p);
5312SN/A    const Params *params() const { return (const Params *)_params; }
5412SN/A    virtual MessageBuffer* getMandatoryQueue() const = 0;
55360SN/A    virtual const int & getVersion() const = 0;
56360SN/A    virtual const std::string toString() const = 0;  // returns text version of
57360SN/A                                                     // controller type
5812SN/A    virtual const std::string getName() const = 0;   // return instance name
5912SN/A    virtual void blockOnQueue(Address, MessageBuffer*) = 0;
6012SN/A    virtual void unblock(Address) = 0;
6112SN/A    virtual void initNetworkPtr(Network* net_ptr) = 0;
6212SN/A    virtual AccessPermission getAccessPermission(const Address& addr) = 0;
6312SN/A    virtual DataBlock& getDataBlock(const Address& addr) = 0;
6412SN/A
652420SN/A    virtual void print(std::ostream & out) const = 0;
6612SN/A    virtual void printStats(std::ostream & out) const = 0;
6712SN/A    virtual void wakeup() = 0;
6812SN/A    //  virtual void dumpStats(std::ostream & out) = 0;
692420SN/A    virtual void clearStats() = 0;
7012SN/A    virtual void recordCacheTrace(int cntrl, CacheRecorder* tr) = 0;
7112SN/A    virtual Sequencer* getSequencer() const = 0;
7212SN/A
732420SN/A    //! These functions are used by ruby system to read/write the message
7412SN/A    //! queues that exist with in the controller.
7512SN/A    //! The boolean return value indicates if the read was performed
7612SN/A    //! successfully.
7712SN/A    virtual bool functionalReadBuffers(PacketPtr&) = 0;
7812SN/A    //! The return value indicates the number of messages written with the
7912SN/A    //! data from the packet.
8012SN/A    virtual uint32_t functionalWriteBuffers(PacketPtr&) = 0;
8112SN/A};
823812Ssaidi@eecs.umich.edu
8312SN/A#endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
8412SN/A