Check.hh revision 8164
12SN/A/*
21762SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
32SN/A * Copyright (c) 2009 Advanced Micro Devices, Inc.
42SN/A * All rights reserved.
52SN/A *
62SN/A * Redistribution and use in source and binary forms, with or without
72SN/A * modification, are permitted provided that the following conditions are
82SN/A * met: redistributions of source code must retain the above copyright
92SN/A * notice, this list of conditions and the following disclaimer;
102SN/A * redistributions in binary form must reproduce the above copyright
112SN/A * notice, this list of conditions and the following disclaimer in the
122SN/A * documentation and/or other materials provided with the distribution;
132SN/A * neither the name of the copyright holders nor the names of its
142SN/A * contributors may be used to endorse or promote products derived from
152SN/A * this software without specific prior written permission.
162SN/A *
172SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
182SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
192SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
202SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
212SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
222SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
232SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
252SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272665Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
282760Sbinkertn@umich.edu */
292760Sbinkertn@umich.edu
302665Ssaidi@eecs.umich.edu#ifndef __CPU_RUBYTEST_CHECK_HH__
312SN/A#define __CPU_RUBYTEST_CHECK_HH__
322SN/A
332SN/A#include <iostream>
342SN/A
352SN/A#include "cpu/testers/rubytest/RubyTester.hh"
362SN/A#include "mem/protocol/RubyAccessMode.hh"
372SN/A#include "mem/protocol/TesterStatus.hh"
382SN/A#include "mem/ruby/common/Address.hh"
392SN/A#include "mem/ruby/common/Global.hh"
402SN/A#include "mem/ruby/system/NodeID.hh"
418229Snate@binkert.org
422SN/Aclass SubBlock;
438229Snate@binkert.org
444841Ssaidi@eecs.umich.educonst int CHECK_SIZE_BITS = 2;
452SN/Aconst int CHECK_SIZE = (1 << CHECK_SIZE_BITS);
466214Snate@binkert.org
472SN/Aclass Check
482738Sstever@eecs.umich.edu{
49395SN/A  public:
50237SN/A    Check(const Address& address, const Address& pc, int _num_cpu_sequencer,
514000Ssaidi@eecs.umich.edu          RubyTester* _tester);
522SN/A
53217SN/A    void initiate(); // Does Action or Check or nether
54502SN/A    void performCallback(NodeID proc, SubBlock* data);
55217SN/A    const Address& getAddress() { return m_address; }
56217SN/A    void changeAddress(const Address& address);
57237SN/A
58502SN/A    void print(std::ostream& out) const;
59217SN/A
60217SN/A  private:
616820SLisa.Hsu@amd.com    void initiatePrefetch();
626820SLisa.Hsu@amd.com    void initiateAction();
636820SLisa.Hsu@amd.com    void initiateCheck();
646820SLisa.Hsu@amd.com
65217SN/A    void pickValue();
666227Snate@binkert.org    void pickInitiatingNode();
67217SN/A
68217SN/A    void debugPrint();
694841Ssaidi@eecs.umich.edu
704841Ssaidi@eecs.umich.edu    TesterStatus m_status;
714841Ssaidi@eecs.umich.edu    uint8 m_value;
724841Ssaidi@eecs.umich.edu    int m_store_count;
737948SAli.Saidi@ARM.com    NodeID m_initiatingNode;
747948SAli.Saidi@ARM.com    Address m_address;
757948SAli.Saidi@ARM.com    Address m_pc;
767948SAli.Saidi@ARM.com    RubyAccessMode m_access_mode;
77237SN/A    int m_num_cpu_sequencers;
786227Snate@binkert.org    RubyTester* m_tester_ptr;
79217SN/A};
804841Ssaidi@eecs.umich.edu
814841Ssaidi@eecs.umich.eduinline std::ostream&
824841Ssaidi@eecs.umich.eduoperator<<(std::ostream& out, const Check& obj)
834841Ssaidi@eecs.umich.edu{
847948SAli.Saidi@ARM.com    obj.print(out);
857948SAli.Saidi@ARM.com    out << std::flush;
867948SAli.Saidi@ARM.com    return out;
877948SAli.Saidi@ARM.com}
88237SN/A
89237SN/A#endif // __CPU_RUBYTEST_CHECK_HH__
904000Ssaidi@eecs.umich.edu