CheckTable.hh revision 7002
12SN/A
21762SN/A/*
32SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
42SN/A * Copyright (c) 2009 Advanced Micro Devices, Inc.
52SN/A * All rights reserved.
62SN/A *
72SN/A * Redistribution and use in source and binary forms, with or without
82SN/A * modification, are permitted provided that the following conditions are
92SN/A * met: redistributions of source code must retain the above copyright
102SN/A * notice, this list of conditions and the following disclaimer;
112SN/A * redistributions in binary form must reproduce the above copyright
122SN/A * notice, this list of conditions and the following disclaimer in the
132SN/A * documentation and/or other materials provided with the distribution;
142SN/A * neither the name of the copyright holders nor the names of its
152SN/A * contributors may be used to endorse or promote products derived from
162SN/A * this software without specific prior written permission.
172SN/A *
182SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
192SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
202SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
212SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
222SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
232SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
242SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
252SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
262SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
272665SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
282665SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
292SN/A */
302SN/A
312SN/A#ifndef CHECKTABLE_H
322SN/A#define CHECKTABLE_H
336214Snate@binkert.org
342SN/A#include <iostream>
352SN/A
362SN/A#include "mem/ruby/common/Global.hh"
376214Snate@binkert.org#include "mem/gems_common/Vector.hh"
386214Snate@binkert.org
392SN/Aclass Address;
402SN/Aclass Check;
412SN/Aclass RubyTester;
422SN/Atemplate <class KEY_TYPE, class VALUE_TYPE> class Map;
435543SN/A
442SN/Aclass CheckTable {
455543SN/Apublic:
462SN/A  // Constructors
472SN/A  CheckTable(int _num_cpu_sequencers, RubyTester* _tester);
482SN/A
492SN/A  // Destructor
502SN/A  ~CheckTable();
512SN/A
522SN/A  // Public Methods
532SN/A
542SN/A  Check* getRandomCheck();
552SN/A  Check* getCheck(const Address& address);
562SN/A
572SN/A  //  bool isPresent(const Address& address) const;
586712Snate@binkert.org  //  void removeCheckFromTable(const Address& address);
592SN/A  //  bool isTableFull() const;
605600SN/A  // Need a method to select a check or retrieve a check
612667SN/A
622130SN/A  void print(std::ostream& out) const;
632130SN/Aprivate:
642130SN/A  // Private Methods
652130SN/A  void addCheck(const Address& address);
662130SN/A
672130SN/A  // Private copy constructor and assignment operator
682130SN/A  CheckTable(const CheckTable& obj);
692130SN/A  CheckTable& operator=(const CheckTable& obj);
702438SN/A
712438SN/A  // Data Members (m_ prefix)
726221Snate@binkert.org  Vector<Check*> m_check_vector;
736221Snate@binkert.org  Map<Address, Check*>* m_lookup_map_ptr;
746221Snate@binkert.org
756221Snate@binkert.org  int m_num_cpu_sequencers;
766221Snate@binkert.org  RubyTester* m_tester_ptr;
776221Snate@binkert.org};
786214Snate@binkert.org
79// Output operator declaration
80std::ostream& operator<<(std::ostream& out, const CheckTable& obj);
81
82// ******************* Definitions *******************
83
84// Output operator definition
85extern inline
86std::ostream& operator<<(std::ostream& out, const CheckTable& obj)
87{
88  obj.print(out);
89  out << std::flush;
90  return out;
91}
92
93#endif //CHECKTABLE_H
94