CheckTable.hh revision 7053
16899SN/A/*
26899SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
36899SN/A * Copyright (c) 2009 Advanced Micro Devices, Inc.
46899SN/A * All rights reserved.
56899SN/A *
66899SN/A * Redistribution and use in source and binary forms, with or without
76899SN/A * modification, are permitted provided that the following conditions are
86899SN/A * met: redistributions of source code must retain the above copyright
96899SN/A * notice, this list of conditions and the following disclaimer;
106899SN/A * redistributions in binary form must reproduce the above copyright
116899SN/A * notice, this list of conditions and the following disclaimer in the
126899SN/A * documentation and/or other materials provided with the distribution;
136899SN/A * neither the name of the copyright holders nor the names of its
146899SN/A * contributors may be used to endorse or promote products derived from
156899SN/A * this software without specific prior written permission.
166899SN/A *
176899SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186899SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196899SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206899SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216899SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226899SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236899SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246899SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256899SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266899SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276899SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286899SN/A */
296899SN/A
307632SBrad.Beckmann@amd.com#ifndef __CPU_RUBYTEST_CHECKTABLE_HH__
317053SN/A#define __CPU_RUBYTEST_CHECKTABLE_HH__
326899SN/A
336899SN/A#include <iostream>
346899SN/A
357053SN/A#include "mem/gems_common/Vector.hh"
367053SN/A#include "mem/ruby/common/Global.hh"
377053SN/A
387053SN/Aclass Address;
397053SN/Aclass Check;
406899SN/Aclass RubyTester;
417053SN/Atemplate <class KEY_TYPE, class VALUE_TYPE> class Map;
426899SN/A
437053SN/Aclass CheckTable
447053SN/A{
457053SN/A  public:
467053SN/A    CheckTable(int _num_cpu_sequencers, RubyTester* _tester);
478164Snilay@cs.wisc.edu    ~CheckTable();
487053SN/A
496899SN/A    Check* getRandomCheck();
506899SN/A    Check* getCheck(const Address& address);
517053SN/A
527053SN/A    //  bool isPresent(const Address& address) const;
536899SN/A    //  void removeCheckFromTable(const Address& address);
547053SN/A    //  bool isTableFull() const;
557053SN/A    // Need a method to select a check or retrieve a check
566899SN/A
577053SN/A    void print(std::ostream& out) const;
587053SN/A
597053SN/A  private:
607053SN/A    void addCheck(const Address& address);
616899SN/A
628184Ssomayeh@cs.wisc.edu    // Private copy constructor and assignment operator
638184Ssomayeh@cs.wisc.edu    CheckTable(const CheckTable& obj);
648184Ssomayeh@cs.wisc.edu    CheckTable& operator=(const CheckTable& obj);
658184Ssomayeh@cs.wisc.edu
667053SN/A    Vector<Check*> m_check_vector;
677053SN/A    Map<Address, Check*>* m_lookup_map_ptr;
687053SN/A
697053SN/A    int m_num_cpu_sequencers;
707053SN/A    RubyTester* m_tester_ptr;
717053SN/A};
727053SN/A
737053SN/Ainline std::ostream&
747053SN/Aoperator<<(std::ostream& out, const CheckTable& obj)
756899SN/A{
766899SN/A    obj.print(out);
777053SN/A    out << std::flush;
787053SN/A    return out;
796899SN/A}
807053SN/A
816899SN/A#endif // __CPU_RUBYTEST_CHECKTABLE_HH__
827053SN/A