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 307053SN/A#ifndef __CPU_RUBYTEST_CHECKTABLE_HH__ 317053SN/A#define __CPU_RUBYTEST_CHECKTABLE_HH__ 326899SN/A 337002SN/A#include <iostream> 3411168Sandreas.hansson@arm.com#include <unordered_map> 357454SN/A#include <vector> 367002SN/A 377455SN/A#include "mem/ruby/common/Address.hh" 386899SN/A 396899SN/Aclass Check; 406899SN/Aclass RubyTester; 416899SN/A 427053SN/Aclass CheckTable 437053SN/A{ 447053SN/A public: 458932SBrad.Beckmann@amd.com CheckTable(int _num_writers, int _num_readers, RubyTester* _tester); 467053SN/A ~CheckTable(); 476899SN/A 487053SN/A Check* getRandomCheck(); 4911025Snilay@cs.wisc.edu Check* getCheck(Addr address); 506899SN/A 517053SN/A // bool isPresent(const Address& address) const; 527053SN/A // void removeCheckFromTable(const Address& address); 537053SN/A // bool isTableFull() const; 547053SN/A // Need a method to select a check or retrieve a check 556899SN/A 567053SN/A void print(std::ostream& out) const; 576899SN/A 587053SN/A private: 5911025Snilay@cs.wisc.edu void addCheck(Addr address); 606899SN/A 617053SN/A // Private copy constructor and assignment operator 627053SN/A CheckTable(const CheckTable& obj); 637053SN/A CheckTable& operator=(const CheckTable& obj); 646899SN/A 657454SN/A std::vector<Check*> m_check_vector; 6611168Sandreas.hansson@arm.com std::unordered_map<Addr, Check*> m_lookup_map; 677053SN/A 688932SBrad.Beckmann@amd.com int m_num_writers; 698932SBrad.Beckmann@amd.com int m_num_readers; 707053SN/A RubyTester* m_tester_ptr; 716899SN/A}; 726899SN/A 737053SN/Ainline std::ostream& 747053SN/Aoperator<<(std::ostream& out, const CheckTable& obj) 756899SN/A{ 767053SN/A obj.print(out); 777053SN/A out << std::flush; 787053SN/A return out; 796899SN/A} 806899SN/A 817053SN/A#endif // __CPU_RUBYTEST_CHECKTABLE_HH__ 82