CheckTable.hh revision 7455
113627Sjavier.bueno@metempsy.com/* 213627Sjavier.bueno@metempsy.com * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 313627Sjavier.bueno@metempsy.com * Copyright (c) 2009 Advanced Micro Devices, Inc. 413627Sjavier.bueno@metempsy.com * All rights reserved. 513627Sjavier.bueno@metempsy.com * 613627Sjavier.bueno@metempsy.com * Redistribution and use in source and binary forms, with or without 713627Sjavier.bueno@metempsy.com * modification, are permitted provided that the following conditions are 813627Sjavier.bueno@metempsy.com * met: redistributions of source code must retain the above copyright 913627Sjavier.bueno@metempsy.com * notice, this list of conditions and the following disclaimer; 1013627Sjavier.bueno@metempsy.com * redistributions in binary form must reproduce the above copyright 1113627Sjavier.bueno@metempsy.com * notice, this list of conditions and the following disclaimer in the 1213627Sjavier.bueno@metempsy.com * documentation and/or other materials provided with the distribution; 1313627Sjavier.bueno@metempsy.com * neither the name of the copyright holders nor the names of its 1413627Sjavier.bueno@metempsy.com * contributors may be used to endorse or promote products derived from 1513627Sjavier.bueno@metempsy.com * this software without specific prior written permission. 1613627Sjavier.bueno@metempsy.com * 1713627Sjavier.bueno@metempsy.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1813627Sjavier.bueno@metempsy.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1913627Sjavier.bueno@metempsy.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2013627Sjavier.bueno@metempsy.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2113627Sjavier.bueno@metempsy.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2213627Sjavier.bueno@metempsy.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2313627Sjavier.bueno@metempsy.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2413627Sjavier.bueno@metempsy.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2513627Sjavier.bueno@metempsy.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2613627Sjavier.bueno@metempsy.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2713627Sjavier.bueno@metempsy.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2813627Sjavier.bueno@metempsy.com */ 2913627Sjavier.bueno@metempsy.com 3013627Sjavier.bueno@metempsy.com#ifndef __CPU_RUBYTEST_CHECKTABLE_HH__ 3113627Sjavier.bueno@metempsy.com#define __CPU_RUBYTEST_CHECKTABLE_HH__ 3213627Sjavier.bueno@metempsy.com 3313627Sjavier.bueno@metempsy.com#include <iostream> 3413627Sjavier.bueno@metempsy.com#include <vector> 3513627Sjavier.bueno@metempsy.com 3613627Sjavier.bueno@metempsy.com#include "base/hashmap.hh" 3713627Sjavier.bueno@metempsy.com#include "mem/ruby/common/Address.hh" 3813627Sjavier.bueno@metempsy.com#include "mem/ruby/common/Global.hh" 3913627Sjavier.bueno@metempsy.com 4013627Sjavier.bueno@metempsy.comclass Check; 4113627Sjavier.bueno@metempsy.comclass RubyTester; 4213627Sjavier.bueno@metempsy.com 4313627Sjavier.bueno@metempsy.comclass CheckTable 4413627Sjavier.bueno@metempsy.com{ 4513627Sjavier.bueno@metempsy.com public: 4613627Sjavier.bueno@metempsy.com CheckTable(int _num_cpu_sequencers, RubyTester* _tester); 4713627Sjavier.bueno@metempsy.com ~CheckTable(); 4813627Sjavier.bueno@metempsy.com 4913627Sjavier.bueno@metempsy.com Check* getRandomCheck(); 5013627Sjavier.bueno@metempsy.com Check* getCheck(const Address& address); 5113627Sjavier.bueno@metempsy.com 5213627Sjavier.bueno@metempsy.com // bool isPresent(const Address& address) const; 5313627Sjavier.bueno@metempsy.com // void removeCheckFromTable(const Address& address); 5413627Sjavier.bueno@metempsy.com // bool isTableFull() const; 5513627Sjavier.bueno@metempsy.com // Need a method to select a check or retrieve a check 5613627Sjavier.bueno@metempsy.com 5713627Sjavier.bueno@metempsy.com void print(std::ostream& out) const; 5813627Sjavier.bueno@metempsy.com 5913627Sjavier.bueno@metempsy.com private: 6013627Sjavier.bueno@metempsy.com void addCheck(const Address& address); 6113627Sjavier.bueno@metempsy.com 6213627Sjavier.bueno@metempsy.com // Private copy constructor and assignment operator 6313627Sjavier.bueno@metempsy.com CheckTable(const CheckTable& obj); 6413627Sjavier.bueno@metempsy.com CheckTable& operator=(const CheckTable& obj); 6513627Sjavier.bueno@metempsy.com 6613627Sjavier.bueno@metempsy.com std::vector<Check*> m_check_vector; 6713627Sjavier.bueno@metempsy.com m5::hash_map<Address, Check*> m_lookup_map; 6813627Sjavier.bueno@metempsy.com 6913627Sjavier.bueno@metempsy.com int m_num_cpu_sequencers; 7013627Sjavier.bueno@metempsy.com RubyTester* m_tester_ptr; 7113627Sjavier.bueno@metempsy.com}; 7213627Sjavier.bueno@metempsy.com 7313627Sjavier.bueno@metempsy.cominline std::ostream& 7413627Sjavier.bueno@metempsy.comoperator<<(std::ostream& out, const CheckTable& obj) 7513627Sjavier.bueno@metempsy.com{ 7613627Sjavier.bueno@metempsy.com obj.print(out); 7713627Sjavier.bueno@metempsy.com out << std::flush; 7813627Sjavier.bueno@metempsy.com return out; 7913627Sjavier.bueno@metempsy.com} 8013627Sjavier.bueno@metempsy.com 8113627Sjavier.bueno@metempsy.com#endif // __CPU_RUBYTEST_CHECKTABLE_HH__ 8213627Sjavier.bueno@metempsy.com