CheckTable.hh revision 8932
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> 347454SN/A#include <vector> 357002SN/A 367455SN/A#include "base/hashmap.hh" 377455SN/A#include "mem/ruby/common/Address.hh" 386899SN/A#include "mem/ruby/common/Global.hh" 396899SN/A 406899SN/Aclass Check; 416899SN/Aclass RubyTester; 426899SN/A 437053SN/Aclass CheckTable 447053SN/A{ 457053SN/A public: 468932SBrad.Beckmann@amd.com CheckTable(int _num_writers, int _num_readers, RubyTester* _tester); 477053SN/A ~CheckTable(); 486899SN/A 497053SN/A Check* getRandomCheck(); 507053SN/A Check* getCheck(const Address& address); 516899SN/A 527053SN/A // bool isPresent(const Address& address) const; 537053SN/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; 586899SN/A 597053SN/A private: 607053SN/A void addCheck(const Address& address); 616899SN/A 627053SN/A // Private copy constructor and assignment operator 637053SN/A CheckTable(const CheckTable& obj); 647053SN/A CheckTable& operator=(const CheckTable& obj); 656899SN/A 667454SN/A std::vector<Check*> m_check_vector; 677455SN/A m5::hash_map<Address, Check*> m_lookup_map; 687053SN/A 698932SBrad.Beckmann@amd.com int m_num_writers; 708932SBrad.Beckmann@amd.com int m_num_readers; 717053SN/A RubyTester* m_tester_ptr; 726899SN/A}; 736899SN/A 747053SN/Ainline std::ostream& 757053SN/Aoperator<<(std::ostream& out, const CheckTable& obj) 766899SN/A{ 777053SN/A obj.print(out); 787053SN/A out << std::flush; 797053SN/A return out; 806899SN/A} 816899SN/A 827053SN/A#endif // __CPU_RUBYTEST_CHECKTABLE_HH__ 83