CheckTable.hh revision 8932:1b2c17565ac8
12381SN/A/* 210405Sandreas.hansson@arm.com * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 38711SN/A * Copyright (c) 2009 Advanced Micro Devices, Inc. 48711SN/A * All rights reserved. 58711SN/A * 68711SN/A * Redistribution and use in source and binary forms, with or without 78711SN/A * modification, are permitted provided that the following conditions are 88711SN/A * met: redistributions of source code must retain the above copyright 98711SN/A * notice, this list of conditions and the following disclaimer; 108711SN/A * redistributions in binary form must reproduce the above copyright 118711SN/A * notice, this list of conditions and the following disclaimer in the 128711SN/A * documentation and/or other materials provided with the distribution; 138711SN/A * neither the name of the copyright holders nor the names of its 142381SN/A * contributors may be used to endorse or promote products derived from 152381SN/A * this software without specific prior written permission. 162381SN/A * 172381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282381SN/A */ 292381SN/A 302381SN/A#ifndef __CPU_RUBYTEST_CHECKTABLE_HH__ 312381SN/A#define __CPU_RUBYTEST_CHECKTABLE_HH__ 322381SN/A 332381SN/A#include <iostream> 342381SN/A#include <vector> 352381SN/A 362381SN/A#include "base/hashmap.hh" 372381SN/A#include "mem/ruby/common/Address.hh" 382381SN/A#include "mem/ruby/common/Global.hh" 392665SN/A 402665SN/Aclass Check; 412772SN/Aclass RubyTester; 428715SN/A 438922SN/Aclass CheckTable 442381SN/A{ 452381SN/A public: 462381SN/A CheckTable(int _num_writers, int _num_readers, RubyTester* _tester); 472982SN/A ~CheckTable(); 4810405Sandreas.hansson@arm.com 492381SN/A Check* getRandomCheck(); 502381SN/A Check* getCheck(const Address& address); 5110405Sandreas.hansson@arm.com 5210405Sandreas.hansson@arm.com // bool isPresent(const Address& address) const; 532381SN/A // void removeCheckFromTable(const Address& address); 549291SN/A // bool isTableFull() const; 552381SN/A // Need a method to select a check or retrieve a check 569235SN/A 5710656Sandreas.hansson@arm.com void print(std::ostream& out) const; 586215SN/A 592381SN/A private: 6010405Sandreas.hansson@arm.com void addCheck(const Address& address); 619712SN/A 622381SN/A // Private copy constructor and assignment operator 639036SN/A CheckTable(const CheckTable& obj); 6410405Sandreas.hansson@arm.com CheckTable& operator=(const CheckTable& obj); 6510405Sandreas.hansson@arm.com 6610405Sandreas.hansson@arm.com std::vector<Check*> m_check_vector; 6710405Sandreas.hansson@arm.com m5::hash_map<Address, Check*> m_lookup_map; 689036SN/A 6910405Sandreas.hansson@arm.com int m_num_writers; 709036SN/A int m_num_readers; 719036SN/A RubyTester* m_tester_ptr; 7210405Sandreas.hansson@arm.com}; 732381SN/A 749031SN/Ainline std::ostream& 759036SN/Aoperator<<(std::ostream& out, const CheckTable& obj) 762381SN/A{ 779091SN/A obj.print(out); 7810405Sandreas.hansson@arm.com out << std::flush; 7910405Sandreas.hansson@arm.com return out; 8010405Sandreas.hansson@arm.com} 8110405Sandreas.hansson@arm.com 8210405Sandreas.hansson@arm.com#endif // __CPU_RUBYTEST_CHECKTABLE_HH__ 8310405Sandreas.hansson@arm.com