Check.hh revision 6899
110259SAndrew.Bardsley@arm.com
212113Sjose.marinho@arm.com/*
310259SAndrew.Bardsley@arm.com * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
410259SAndrew.Bardsley@arm.com * Copyright (c) 2009 Advanced Micro Devices, Inc.
510259SAndrew.Bardsley@arm.com * All rights reserved.
610259SAndrew.Bardsley@arm.com *
710259SAndrew.Bardsley@arm.com * Redistribution and use in source and binary forms, with or without
810259SAndrew.Bardsley@arm.com * modification, are permitted provided that the following conditions are
910259SAndrew.Bardsley@arm.com * met: redistributions of source code must retain the above copyright
1010259SAndrew.Bardsley@arm.com * notice, this list of conditions and the following disclaimer;
1110259SAndrew.Bardsley@arm.com * redistributions in binary form must reproduce the above copyright
1210259SAndrew.Bardsley@arm.com * notice, this list of conditions and the following disclaimer in the
1310259SAndrew.Bardsley@arm.com * documentation and/or other materials provided with the distribution;
1410259SAndrew.Bardsley@arm.com * neither the name of the copyright holders nor the names of its
1510259SAndrew.Bardsley@arm.com * contributors may be used to endorse or promote products derived from
1610259SAndrew.Bardsley@arm.com * this software without specific prior written permission.
1710259SAndrew.Bardsley@arm.com *
1810259SAndrew.Bardsley@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1910259SAndrew.Bardsley@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2010259SAndrew.Bardsley@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2110259SAndrew.Bardsley@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2210259SAndrew.Bardsley@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2310259SAndrew.Bardsley@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2410259SAndrew.Bardsley@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2510259SAndrew.Bardsley@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2610259SAndrew.Bardsley@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2710259SAndrew.Bardsley@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2810259SAndrew.Bardsley@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2910259SAndrew.Bardsley@arm.com */
3010259SAndrew.Bardsley@arm.com
3110259SAndrew.Bardsley@arm.com#ifndef CHECK_H
3210259SAndrew.Bardsley@arm.com#define CHECK_H
3310259SAndrew.Bardsley@arm.com
3410259SAndrew.Bardsley@arm.com#include "mem/ruby/common/Global.hh"
3510259SAndrew.Bardsley@arm.com#include "mem/ruby/common/Address.hh"
3610259SAndrew.Bardsley@arm.com#include "mem/ruby/system/NodeID.hh"
3710259SAndrew.Bardsley@arm.com#include "mem/protocol/TesterStatus.hh"
3810259SAndrew.Bardsley@arm.com#include "mem/protocol/AccessModeType.hh"
3910259SAndrew.Bardsley@arm.com#include "cpu/rubytest/RubyTester.hh"
4010259SAndrew.Bardsley@arm.comclass SubBlock;
4110259SAndrew.Bardsley@arm.com
4210259SAndrew.Bardsley@arm.comconst int CHECK_SIZE_BITS = 2;
4310259SAndrew.Bardsley@arm.comconst int CHECK_SIZE = (1<<CHECK_SIZE_BITS);
4410259SAndrew.Bardsley@arm.com
4510259SAndrew.Bardsley@arm.comclass Check {
4610259SAndrew.Bardsley@arm.compublic:
4710259SAndrew.Bardsley@arm.com  // Constructors
4810259SAndrew.Bardsley@arm.com  Check(const Address& address,
4910259SAndrew.Bardsley@arm.com        const Address& pc,
5010259SAndrew.Bardsley@arm.com        int _num_cpu_sequencer,
5110259SAndrew.Bardsley@arm.com        RubyTester* _tester);
5210259SAndrew.Bardsley@arm.com
5311800Sbrandon.potter@amd.com  // Default Destructor
5411800Sbrandon.potter@amd.com  //~Check();
5510259SAndrew.Bardsley@arm.com
5610259SAndrew.Bardsley@arm.com  // Public Methods
5710259SAndrew.Bardsley@arm.com
5810259SAndrew.Bardsley@arm.com  void initiate(); // Does Action or Check or nether
5910259SAndrew.Bardsley@arm.com  void performCallback(NodeID proc, SubBlock* data);
6010905Sandreas.sandberg@arm.com  const Address& getAddress() { return m_address; }
6110259SAndrew.Bardsley@arm.com  void changeAddress(const Address& address);
6210259SAndrew.Bardsley@arm.com
6310259SAndrew.Bardsley@arm.com  void print(ostream& out) const;
6410259SAndrew.Bardsley@arm.comprivate:
6510259SAndrew.Bardsley@arm.com  // Private Methods
6610259SAndrew.Bardsley@arm.com  void initiatePrefetch();
6710259SAndrew.Bardsley@arm.com  void initiateAction();
6810259SAndrew.Bardsley@arm.com  void initiateCheck();
6910259SAndrew.Bardsley@arm.com
7010259SAndrew.Bardsley@arm.com  void pickValue();
7110259SAndrew.Bardsley@arm.com  void pickInitiatingNode();
7210259SAndrew.Bardsley@arm.com
7310259SAndrew.Bardsley@arm.com  void debugPrint();
7410259SAndrew.Bardsley@arm.com
7510259SAndrew.Bardsley@arm.com  // Using default copy constructor and assignment operator
7610259SAndrew.Bardsley@arm.com  //  Check(const Check& obj);
7710259SAndrew.Bardsley@arm.com  //  Check& operator=(const Check& obj);
7810259SAndrew.Bardsley@arm.com
7910259SAndrew.Bardsley@arm.com  // Data Members (m_ prefix)
8010464SAndreas.Sandberg@ARM.com  TesterStatus m_status;
8110259SAndrew.Bardsley@arm.com  uint8 m_value;
8210259SAndrew.Bardsley@arm.com  int m_store_count;
8310259SAndrew.Bardsley@arm.com  NodeID m_initiatingNode;
8410259SAndrew.Bardsley@arm.com  Address m_address;
8510259SAndrew.Bardsley@arm.com  Address m_pc;
8610259SAndrew.Bardsley@arm.com  AccessModeType m_access_mode;
8710259SAndrew.Bardsley@arm.com  int m_num_cpu_sequencers;
8810259SAndrew.Bardsley@arm.com  RubyTester* m_tester_ptr;
8910259SAndrew.Bardsley@arm.com};
9010259SAndrew.Bardsley@arm.com
9110259SAndrew.Bardsley@arm.com// Output operator declaration
9210259SAndrew.Bardsley@arm.comostream& operator<<(ostream& out, const Check& obj);
9310259SAndrew.Bardsley@arm.com
9410259SAndrew.Bardsley@arm.com// ******************* Definitions *******************
9510259SAndrew.Bardsley@arm.com
9610259SAndrew.Bardsley@arm.com// Output operator definition
9710259SAndrew.Bardsley@arm.comextern inline
9810259SAndrew.Bardsley@arm.comostream& operator<<(ostream& out, const Check& obj)
9910259SAndrew.Bardsley@arm.com{
10010259SAndrew.Bardsley@arm.com  obj.print(out);
10110259SAndrew.Bardsley@arm.com  out << flush;
10210259SAndrew.Bardsley@arm.com  return out;
10310259SAndrew.Bardsley@arm.com}
10410259SAndrew.Bardsley@arm.com
10510259SAndrew.Bardsley@arm.com#endif //CHECK_H
10610259SAndrew.Bardsley@arm.com