Check.hh revision 7053
112839Sgabeblack@google.com/*
212839Sgabeblack@google.com * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
312839Sgabeblack@google.com * Copyright (c) 2009 Advanced Micro Devices, Inc.
412839Sgabeblack@google.com * All rights reserved.
512839Sgabeblack@google.com *
612839Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
712839Sgabeblack@google.com * modification, are permitted provided that the following conditions are
812839Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
912839Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
1012839Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1112839Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1212839Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1312839Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1412839Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1512839Sgabeblack@google.com * this software without specific prior written permission.
1612839Sgabeblack@google.com *
1712839Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1812839Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1912839Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2012839Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2112839Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2212839Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2312839Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2412839Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2512839Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2612839Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2712839Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2812839Sgabeblack@google.com */
2912839Sgabeblack@google.com
3012839Sgabeblack@google.com#ifndef __CPU_RUBYTEST_CHECK_HH__
3112993Sgabeblack@google.com#define __CPU_RUBYTEST_CHECK_HH__
3212993Sgabeblack@google.com
3312993Sgabeblack@google.com#include "cpu/rubytest/RubyTester.hh"
3413288Sgabeblack@google.com#include "mem/protocol/AccessModeType.hh"
3513288Sgabeblack@google.com#include "mem/protocol/TesterStatus.hh"
3613288Sgabeblack@google.com#include "mem/ruby/common/Address.hh"
3713288Sgabeblack@google.com#include "mem/ruby/common/Global.hh"
3813129Sgabeblack@google.com#include "mem/ruby/system/NodeID.hh"
3912993Sgabeblack@google.com
4012839Sgabeblack@google.comclass SubBlock;
4112839Sgabeblack@google.com
4212993Sgabeblack@google.comconst int CHECK_SIZE_BITS = 2;
4312993Sgabeblack@google.comconst int CHECK_SIZE = (1 << CHECK_SIZE_BITS);
4412993Sgabeblack@google.com
4512993Sgabeblack@google.comclass Check
4612993Sgabeblack@google.com{
4712993Sgabeblack@google.com  public:
4812993Sgabeblack@google.com    Check(const Address& address, const Address& pc, int _num_cpu_sequencer,
4912993Sgabeblack@google.com          RubyTester* _tester);
5012993Sgabeblack@google.com
5112993Sgabeblack@google.com    void initiate(); // Does Action or Check or nether
5212993Sgabeblack@google.com    void performCallback(NodeID proc, SubBlock* data);
5312993Sgabeblack@google.com    const Address& getAddress() { return m_address; }
5412993Sgabeblack@google.com    void changeAddress(const Address& address);
5512993Sgabeblack@google.com
5612993Sgabeblack@google.com    void print(ostream& out) const;
5712993Sgabeblack@google.com
5812993Sgabeblack@google.com  private:
5912993Sgabeblack@google.com    void initiatePrefetch();
6012993Sgabeblack@google.com    void initiateAction();
6112993Sgabeblack@google.com    void initiateCheck();
6212993Sgabeblack@google.com
6312993Sgabeblack@google.com    void pickValue();
6412993Sgabeblack@google.com    void pickInitiatingNode();
6512993Sgabeblack@google.com
6612993Sgabeblack@google.com    void debugPrint();
6712993Sgabeblack@google.com
6812993Sgabeblack@google.com    TesterStatus m_status;
6913131Sgabeblack@google.com    uint8 m_value;
7012993Sgabeblack@google.com    int m_store_count;
7113131Sgabeblack@google.com    NodeID m_initiatingNode;
7212993Sgabeblack@google.com    Address m_address;
7313194Sgabeblack@google.com    Address m_pc;
7413194Sgabeblack@google.com    AccessModeType m_access_mode;
7512993Sgabeblack@google.com    int m_num_cpu_sequencers;
7612993Sgabeblack@google.com    RubyTester* m_tester_ptr;
7713207Sgabeblack@google.com};
7812993Sgabeblack@google.com
7912993Sgabeblack@google.cominline ostream&
8013207Sgabeblack@google.comoperator<<(ostream& out, const Check& obj)
8112993Sgabeblack@google.com{
8212993Sgabeblack@google.com    obj.print(out);
8313207Sgabeblack@google.com    out << flush;
8412993Sgabeblack@google.com    return out;
8512993Sgabeblack@google.com}
8613207Sgabeblack@google.com
8712993Sgabeblack@google.com#endif // __CPU_RUBYTEST_CHECK_HH__
8812993Sgabeblack@google.com