Check.hh revision 6899
1 2/* 3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 4 * Copyright (c) 2009 Advanced Micro Devices, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are 9 * met: redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer; 11 * redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution; 14 * neither the name of the copyright holders nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#ifndef CHECK_H 32#define CHECK_H 33 34#include "mem/ruby/common/Global.hh" 35#include "mem/ruby/common/Address.hh" 36#include "mem/ruby/system/NodeID.hh" 37#include "mem/protocol/TesterStatus.hh" 38#include "mem/protocol/AccessModeType.hh" 39#include "cpu/rubytest/RubyTester.hh" 40class SubBlock; 41 42const int CHECK_SIZE_BITS = 2; 43const int CHECK_SIZE = (1<<CHECK_SIZE_BITS); 44 45class Check { 46public: 47 // Constructors 48 Check(const Address& address, 49 const Address& pc, 50 int _num_cpu_sequencer, 51 RubyTester* _tester); 52 53 // Default Destructor 54 //~Check(); 55 56 // Public Methods 57 58 void initiate(); // Does Action or Check or nether 59 void performCallback(NodeID proc, SubBlock* data); 60 const Address& getAddress() { return m_address; } 61 void changeAddress(const Address& address); 62 63 void print(ostream& out) const; 64private: 65 // Private Methods 66 void initiatePrefetch(); 67 void initiateAction(); 68 void initiateCheck(); 69 70 void pickValue(); 71 void pickInitiatingNode(); 72 73 void debugPrint(); 74 75 // Using default copy constructor and assignment operator 76 // Check(const Check& obj); 77 // Check& operator=(const Check& obj); 78 79 // Data Members (m_ prefix) 80 TesterStatus m_status; 81 uint8 m_value; 82 int m_store_count; 83 NodeID m_initiatingNode; 84 Address m_address; 85 Address m_pc; 86 AccessModeType m_access_mode; 87 int m_num_cpu_sequencers; 88 RubyTester* m_tester_ptr; 89}; 90 91// Output operator declaration 92ostream& operator<<(ostream& out, const Check& obj); 93 94// ******************* Definitions ******************* 95 96// Output operator definition 97extern inline 98ostream& operator<<(ostream& out, const Check& obj) 99{ 100 obj.print(out); 101 out << flush; 102 return out; 103} 104 105#endif //CHECK_H 106