mem_object.hh revision 4762
12381SN/A/*
22381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
32381SN/A * All rights reserved.
42381SN/A *
52381SN/A * Redistribution and use in source and binary forms, with or without
62381SN/A * modification, are permitted provided that the following conditions are
72381SN/A * met: redistributions of source code must retain the above copyright
82381SN/A * notice, this list of conditions and the following disclaimer;
92381SN/A * redistributions in binary form must reproduce the above copyright
102381SN/A * notice, this list of conditions and the following disclaimer in the
112381SN/A * documentation and/or other materials provided with the distribution;
122381SN/A * neither the name of the copyright holders nor the names of its
132381SN/A * contributors may be used to endorse or promote products derived from
142381SN/A * this software without specific prior written permission.
152381SN/A *
162381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski
292381SN/A */
302381SN/A
312381SN/A/**
322381SN/A * @file
332982Sstever@eecs.umich.edu * Base Memory Object declaration.
342381SN/A */
352381SN/A
362381SN/A#ifndef __MEM_MEM_OBJECT_HH__
372381SN/A#define __MEM_MEM_OBJECT_HH__
382381SN/A
394762Snate@binkert.org#include "mem/port.hh"
404762Snate@binkert.org#include "params/MemObject.hh"
412381SN/A#include "sim/sim_object.hh"
422381SN/A
432381SN/A/**
442381SN/A * The base MemoryObject class, allows for an accesor function to a
452381SN/A * simobj that returns the Port.
462381SN/A */
472394SN/Aclass MemObject : public SimObject
482381SN/A{
492381SN/A  public:
504762Snate@binkert.org    typedef MemObjectParams Params;
514762Snate@binkert.org    MemObject(const Params *params);
522463SN/A    MemObject(const std::string &name);
532394SN/A
544762Snate@binkert.org    const Params *
554762Snate@binkert.org    params() const
564762Snate@binkert.org    {
574762Snate@binkert.org        return dynamic_cast<const Params *>(_params);
584762Snate@binkert.org    }
594762Snate@binkert.org
602394SN/A  public:
612381SN/A    /** Additional function to return the Port of a memory object. */
622738Sstever@eecs.umich.edu    virtual Port *getPort(const std::string &if_name, int idx = -1) = 0;
634190Ssaidi@eecs.umich.edu
644190Ssaidi@eecs.umich.edu    /** Tell object that this port is about to disappear, so it should remove it
654190Ssaidi@eecs.umich.edu     * from any structures that it's keeping it in. */
664190Ssaidi@eecs.umich.edu    virtual void deletePortRefs(Port *p) ;
672381SN/A};
682381SN/A
692381SN/A#endif //__MEM_MEM_OBJECT_HH__
70