RubyDirectedTester.hh revision 13799
16899SN/A/* 26899SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 37553SN/A * Copyright (c) 2009-2010 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 307553SN/A#ifndef __CPU_DIRECTEDTEST_RUBYDIRECTEDTESTER_HH__ 317553SN/A#define __CPU_DIRECTEDTEST_RUBYDIRECTEDTESTER_HH__ 326899SN/A 337055SN/A#include <iostream> 348229Snate@binkert.org#include <string> 357454SN/A#include <vector> 367055SN/A 377053SN/A#include "mem/ruby/common/DataBlock.hh" 387053SN/A#include "mem/ruby/common/SubBlock.hh" 3911017Snilay@cs.wisc.edu#include "mem/ruby/common/TypeDefines.hh" 408229Snate@binkert.org#include "mem/mem_object.hh" 418229Snate@binkert.org#include "mem/packet.hh" 427553SN/A#include "params/RubyDirectedTester.hh" 436899SN/A 447553SN/Aclass DirectedGenerator; 457553SN/A 467553SN/Aclass RubyDirectedTester : public MemObject 476899SN/A{ 487053SN/A public: 498922Swilliam.wang@arm.com class CpuPort : public MasterPort 507053SN/A { 517053SN/A private: 527553SN/A RubyDirectedTester *tester; 536899SN/A 547053SN/A public: 558854Sandreas.hansson@arm.com CpuPort(const std::string &_name, RubyDirectedTester *_tester, 569031Sandreas.hansson@arm.com PortID _id) 578965Sandreas.hansson@arm.com : MasterPort(_name, _tester, _id), tester(_tester) 587053SN/A {} 596899SN/A 607053SN/A protected: 618975Sandreas.hansson@arm.com virtual bool recvTimingResp(PacketPtr pkt); 6210713Sandreas.hansson@arm.com virtual void recvReqRetry() 638922Swilliam.wang@arm.com { panic("%s does not expect a retry\n", name()); } 647053SN/A }; 656899SN/A 667553SN/A typedef RubyDirectedTesterParams Params; 677553SN/A RubyDirectedTester(const Params *p); 687553SN/A ~RubyDirectedTester(); 696899SN/A 7013784Sgabeblack@google.com Port &getPort(const std::string &if_name, 7113784Sgabeblack@google.com PortID idx=InvalidPortID) override; 726899SN/A 738922Swilliam.wang@arm.com MasterPort* getCpuPort(int idx); 746899SN/A 7513799SAndrea.Mondelli@ucf.edu void init() override; 766899SN/A 777053SN/A void wakeup(); 786899SN/A 797553SN/A void incrementCycleCompletions() { m_requests_completed++; } 806899SN/A 817055SN/A void printStats(std::ostream& out) const {} 827053SN/A void clearStats() {} 837055SN/A void printConfig(std::ostream& out) const {} 846899SN/A 857055SN/A void print(std::ostream& out) const; 866899SN/A 877053SN/A protected: 8812129Sspwilson2@wisc.edu EventFunctionWrapper directedStartEvent; 897053SN/A 906899SN/A private: 917553SN/A void hitCallback(NodeID proc, Addr addr); 926899SN/A 937053SN/A void checkForDeadlock(); 946899SN/A 957053SN/A // Private copy constructor and assignment operator 967553SN/A RubyDirectedTester(const RubyDirectedTester& obj); 977553SN/A RubyDirectedTester& operator=(const RubyDirectedTester& obj); 986899SN/A 9911061Snilay@cs.wisc.edu uint64_t m_requests_completed; 1008950Sandreas.hansson@arm.com std::vector<MasterPort*> ports; 10111061Snilay@cs.wisc.edu uint64_t m_requests_to_complete; 1027553SN/A DirectedGenerator* generator; 1036899SN/A}; 1046899SN/A 1057553SN/A#endif // __CPU_DIRECTEDTEST_RUBYDIRECTEDTESTER_HH__ 106