mem_object.hh revision 9157
110448Snilay@cs.wisc.edu/*
210448Snilay@cs.wisc.edu * Copyright (c) 2012 ARM Limited
310448Snilay@cs.wisc.edu * All rights reserved
410448Snilay@cs.wisc.edu *
510448Snilay@cs.wisc.edu * The license below extends only to copyright in the software and shall
610448Snilay@cs.wisc.edu * not be construed as granting a license to any other intellectual
710448Snilay@cs.wisc.edu * property including but not limited to intellectual property relating
810448Snilay@cs.wisc.edu * to a hardware implementation of the functionality of the software
910448Snilay@cs.wisc.edu * licensed hereunder.  You may use the software subject to the license
1010448Snilay@cs.wisc.edu * terms below provided that you ensure that this notice is replicated
1110448Snilay@cs.wisc.edu * unmodified and in its entirety in all distributions of the software,
1210448Snilay@cs.wisc.edu * modified or unmodified, in source code or in binary form.
1310448Snilay@cs.wisc.edu *
1410448Snilay@cs.wisc.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan
1510448Snilay@cs.wisc.edu * All rights reserved.
1610448Snilay@cs.wisc.edu *
1710448Snilay@cs.wisc.edu * Redistribution and use in source and binary forms, with or without
1810448Snilay@cs.wisc.edu * modification, are permitted provided that the following conditions are
1910448Snilay@cs.wisc.edu * met: redistributions of source code must retain the above copyright
2010448Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer;
2110448Snilay@cs.wisc.edu * redistributions in binary form must reproduce the above copyright
2210447Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer in the
2310447Snilay@cs.wisc.edu * documentation and/or other materials provided with the distribution;
2410447Snilay@cs.wisc.edu * neither the name of the copyright holders nor the names of its
2510447Snilay@cs.wisc.edu * contributors may be used to endorse or promote products derived from
2610447Snilay@cs.wisc.edu * this software without specific prior written permission.
2710447Snilay@cs.wisc.edu *
2810447Snilay@cs.wisc.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2910447Snilay@cs.wisc.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3010447Snilay@cs.wisc.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3110447Snilay@cs.wisc.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3210447Snilay@cs.wisc.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3310447Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3410447Snilay@cs.wisc.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3510447Snilay@cs.wisc.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3610447Snilay@cs.wisc.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3710447Snilay@cs.wisc.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3810447Snilay@cs.wisc.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3910447Snilay@cs.wisc.edu *
4010447Snilay@cs.wisc.edu * Authors: Ron Dreslinski
4110447Snilay@cs.wisc.edu *          Andreas Hansson
4210447Snilay@cs.wisc.edu */
4310447Snilay@cs.wisc.edu
4410447Snilay@cs.wisc.edu/**
4510447Snilay@cs.wisc.edu * @file
4610447Snilay@cs.wisc.edu * MemObject declaration.
4710447Snilay@cs.wisc.edu */
4810447Snilay@cs.wisc.edu
4910447Snilay@cs.wisc.edu#ifndef __MEM_MEM_OBJECT_HH__
5010447Snilay@cs.wisc.edu#define __MEM_MEM_OBJECT_HH__
5110447Snilay@cs.wisc.edu
5210447Snilay@cs.wisc.edu#include "mem/port.hh"
5310447Snilay@cs.wisc.edu#include "params/MemObject.hh"
5410447Snilay@cs.wisc.edu#include "sim/clocked_object.hh"
5510447Snilay@cs.wisc.edu
5610447Snilay@cs.wisc.edu/**
5710447Snilay@cs.wisc.edu * The MemObject class extends the ClockedObject with accessor functions
5810447Snilay@cs.wisc.edu * to get its master and slave ports.
5910447Snilay@cs.wisc.edu */
6010447Snilay@cs.wisc.educlass MemObject : public ClockedObject
6110447Snilay@cs.wisc.edu{
6210447Snilay@cs.wisc.edu  public:
6310447Snilay@cs.wisc.edu    typedef MemObjectParams Params;
6410447Snilay@cs.wisc.edu    const Params *params() const
6510447Snilay@cs.wisc.edu    { return dynamic_cast<const Params *>(_params); }
6610447Snilay@cs.wisc.edu
6710447Snilay@cs.wisc.edu    MemObject(const Params *params);
6810447Snilay@cs.wisc.edu
6910447Snilay@cs.wisc.edu    /**
7010447Snilay@cs.wisc.edu     * Get a master port with a given name and index.
7110447Snilay@cs.wisc.edu     *
7210447Snilay@cs.wisc.edu     * @param if_name Port name
7310447Snilay@cs.wisc.edu     * @param idx Index in the case of a VectorPort
7410447Snilay@cs.wisc.edu     *
7510447Snilay@cs.wisc.edu     * @return A reference to the given port
7610447Snilay@cs.wisc.edu     */
7710447Snilay@cs.wisc.edu    virtual MasterPort& getMasterPort(const std::string& if_name,
7810447Snilay@cs.wisc.edu                                      int idx = -1);
7910447Snilay@cs.wisc.edu
8010447Snilay@cs.wisc.edu    /**
8110447Snilay@cs.wisc.edu     * Get a slave port with a given name and index.
8210447Snilay@cs.wisc.edu     *
8310447Snilay@cs.wisc.edu     * @param if_name Port name
8410447Snilay@cs.wisc.edu     * @param idx Index in the case of a VectorPort
8510447Snilay@cs.wisc.edu     *
8610447Snilay@cs.wisc.edu     * @return A reference to the given port
8710447Snilay@cs.wisc.edu     */
8810447Snilay@cs.wisc.edu    virtual SlavePort& getSlavePort(const std::string& if_name,
8910447Snilay@cs.wisc.edu                                    int idx = -1);
9010447Snilay@cs.wisc.edu};
9110447Snilay@cs.wisc.edu
9210447Snilay@cs.wisc.edu#endif //__MEM_MEM_OBJECT_HH__
9310447Snilay@cs.wisc.edu