mem_object.hh revision 8922
12381SN/A/*
28922Swilliam.wang@arm.com * Copyright (c) 2012 ARM Limited
38922Swilliam.wang@arm.com * All rights reserved
48922Swilliam.wang@arm.com *
58922Swilliam.wang@arm.com * The license below extends only to copyright in the software and shall
68922Swilliam.wang@arm.com * not be construed as granting a license to any other intellectual
78922Swilliam.wang@arm.com * property including but not limited to intellectual property relating
88922Swilliam.wang@arm.com * to a hardware implementation of the functionality of the software
98922Swilliam.wang@arm.com * licensed hereunder.  You may use the software subject to the license
108922Swilliam.wang@arm.com * terms below provided that you ensure that this notice is replicated
118922Swilliam.wang@arm.com * unmodified and in its entirety in all distributions of the software,
128922Swilliam.wang@arm.com * modified or unmodified, in source code or in binary form.
138922Swilliam.wang@arm.com *
142381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
152381SN/A * All rights reserved.
162381SN/A *
172381SN/A * Redistribution and use in source and binary forms, with or without
182381SN/A * modification, are permitted provided that the following conditions are
192381SN/A * met: redistributions of source code must retain the above copyright
202381SN/A * notice, this list of conditions and the following disclaimer;
212381SN/A * redistributions in binary form must reproduce the above copyright
222381SN/A * notice, this list of conditions and the following disclaimer in the
232381SN/A * documentation and/or other materials provided with the distribution;
242381SN/A * neither the name of the copyright holders nor the names of its
252381SN/A * contributors may be used to endorse or promote products derived from
262381SN/A * this software without specific prior written permission.
272381SN/A *
282381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392665Ssaidi@eecs.umich.edu *
402665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski
418922Swilliam.wang@arm.com *          Andreas Hansson
422381SN/A */
432381SN/A
442381SN/A/**
452381SN/A * @file
468922Swilliam.wang@arm.com * MemObject declaration.
472381SN/A */
482381SN/A
492381SN/A#ifndef __MEM_MEM_OBJECT_HH__
502381SN/A#define __MEM_MEM_OBJECT_HH__
512381SN/A
524762Snate@binkert.org#include "mem/port.hh"
534762Snate@binkert.org#include "params/MemObject.hh"
542381SN/A#include "sim/sim_object.hh"
552381SN/A
562381SN/A/**
578922Swilliam.wang@arm.com * The MemObject class extends the SimObject with accessor functions
588922Swilliam.wang@arm.com * to get its master and slave ports.
592381SN/A */
602394SN/Aclass MemObject : public SimObject
612381SN/A{
622381SN/A  public:
634762Snate@binkert.org    typedef MemObjectParams Params;
645530Snate@binkert.org    const Params *params() const
655530Snate@binkert.org    { return dynamic_cast<const Params *>(_params); }
665530Snate@binkert.org
674762Snate@binkert.org    MemObject(const Params *params);
682394SN/A
698922Swilliam.wang@arm.com    /**
708922Swilliam.wang@arm.com     * Get a master port with a given name and index.
718922Swilliam.wang@arm.com     *
728922Swilliam.wang@arm.com     * @param if_name Port name
738922Swilliam.wang@arm.com     * @param idx Index in the case of a VectorPort
748922Swilliam.wang@arm.com     *
758922Swilliam.wang@arm.com     * @return A reference to the given port
768922Swilliam.wang@arm.com     */
778922Swilliam.wang@arm.com    virtual MasterPort& getMasterPort(const std::string& if_name,
788922Swilliam.wang@arm.com                                      int idx = -1);
798922Swilliam.wang@arm.com
808922Swilliam.wang@arm.com    /**
818922Swilliam.wang@arm.com     * Get a slave port with a given name and index.
828922Swilliam.wang@arm.com     *
838922Swilliam.wang@arm.com     * @param if_name Port name
848922Swilliam.wang@arm.com     * @param idx Index in the case of a VectorPort
858922Swilliam.wang@arm.com     *
868922Swilliam.wang@arm.com     * @return A reference to the given port
878922Swilliam.wang@arm.com     */
888922Swilliam.wang@arm.com    virtual SlavePort& getSlavePort(const std::string& if_name,
898922Swilliam.wang@arm.com                                    int idx = -1);
902381SN/A};
912381SN/A
922381SN/A#endif //__MEM_MEM_OBJECT_HH__
93