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_CHECK_HH__
317053SN/A#define __CPU_RUBYTEST_CHECK_HH__
326899SN/A
337055SN/A#include <iostream>
347055SN/A
357632SBrad.Beckmann@amd.com#include "cpu/testers/rubytest/RubyTester.hh"
367053SN/A#include "mem/ruby/common/Address.hh"
3714184Sgabeblack@google.com#include "mem/ruby/protocol/RubyAccessMode.hh"
3814184Sgabeblack@google.com#include "mem/ruby/protocol/TesterStatus.hh"
397053SN/A
406899SN/Aclass SubBlock;
416899SN/A
426899SN/Aconst int CHECK_SIZE_BITS = 2;
437053SN/Aconst int CHECK_SIZE = (1 << CHECK_SIZE_BITS);
446899SN/A
457053SN/Aclass Check
467053SN/A{
477053SN/A  public:
4811025Snilay@cs.wisc.edu    Check(Addr address, Addr pc, int _num_writers,
498932SBrad.Beckmann@amd.com          int _num_readers, RubyTester* _tester);
506899SN/A
517053SN/A    void initiate(); // Does Action or Check or nether
5210302Snilay@cs.wisc.edu    void performCallback(NodeID proc, SubBlock* data, Cycles curTime);
5311025Snilay@cs.wisc.edu    Addr getAddress() const { return m_address; }
5411025Snilay@cs.wisc.edu    void changeAddress(Addr address);
556899SN/A
567055SN/A    void print(std::ostream& out) const;
576899SN/A
587053SN/A  private:
598184Ssomayeh@cs.wisc.edu    void initiateFlush();
607053SN/A    void initiatePrefetch();
617053SN/A    void initiateAction();
627053SN/A    void initiateCheck();
636899SN/A
647053SN/A    void pickValue();
657053SN/A    void pickInitiatingNode();
666899SN/A
677053SN/A    void debugPrint();
686899SN/A
697053SN/A    TesterStatus m_status;
709208Snilay@cs.wisc.edu    uint8_t m_value;
717053SN/A    int m_store_count;
727053SN/A    NodeID m_initiatingNode;
7311025Snilay@cs.wisc.edu    Addr m_address;
7411025Snilay@cs.wisc.edu    Addr m_pc;
758164Snilay@cs.wisc.edu    RubyAccessMode m_access_mode;
768932SBrad.Beckmann@amd.com    int m_num_writers;
778932SBrad.Beckmann@amd.com    int m_num_readers;
787053SN/A    RubyTester* m_tester_ptr;
796899SN/A};
806899SN/A
817055SN/Ainline std::ostream&
827055SN/Aoperator<<(std::ostream& out, const Check& obj)
836899SN/A{
847053SN/A    obj.print(out);
857055SN/A    out << std::flush;
867053SN/A    return out;
876899SN/A}
886899SN/A
897053SN/A#endif // __CPU_RUBYTEST_CHECK_HH__
90