checker.cc revision 2350
112955Sgabeblack@google.com/*
212955Sgabeblack@google.com * Copyright (c) 2006 The Regents of The University of Michigan
312955Sgabeblack@google.com * All rights reserved.
412955Sgabeblack@google.com *
512955Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
612955Sgabeblack@google.com * modification, are permitted provided that the following conditions are
712955Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
812955Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
912955Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1012955Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1112955Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1212955Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1312955Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1412955Sgabeblack@google.com * this software without specific prior written permission.
1512955Sgabeblack@google.com *
1612955Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1712955Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1812955Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1912955Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2012955Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2112955Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2212955Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2312955Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2412955Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2512955Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2612955Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2712955Sgabeblack@google.com */
2812955Sgabeblack@google.com
2912955Sgabeblack@google.com#include <string>
3012955Sgabeblack@google.com
3112955Sgabeblack@google.com#include "cpu/checker/cpu.hh"
3212988Sgabeblack@google.com#include "cpu/inst_seq.hh"
3312955Sgabeblack@google.com#include "cpu/o3/alpha_dyn_inst.hh"
3412955Sgabeblack@google.com#include "cpu/o3/alpha_impl.hh"
3512955Sgabeblack@google.com#include "mem/base_mem.hh"
3612957Sgabeblack@google.com#include "sim/builder.hh"
3712957Sgabeblack@google.com#include "sim/process.hh"
3812955Sgabeblack@google.com#include "sim/sim_object.hh"
3912955Sgabeblack@google.com
4013317Sgabeblack@google.com/**
4113086Sgabeblack@google.com * Specific non-templated derived class used for SimObject configuration.
4213086Sgabeblack@google.com */
4312955Sgabeblack@google.comclass O3Checker : public Checker<RefCountingPtr<AlphaDynInst<AlphaSimpleImpl> > >
4412955Sgabeblack@google.com{
4512955Sgabeblack@google.com  public:
4612955Sgabeblack@google.com    O3Checker(Params *p)
4713303Sgabeblack@google.com        : Checker<RefCountingPtr<AlphaDynInst<AlphaSimpleImpl> > >(p)
4813303Sgabeblack@google.com    { }
4913303Sgabeblack@google.com};
5012955Sgabeblack@google.com
5113303Sgabeblack@google.com////////////////////////////////////////////////////////////////////////
5213303Sgabeblack@google.com//
5313086Sgabeblack@google.com//  CheckerCPU Simulation Object
5413303Sgabeblack@google.com//
5513303Sgabeblack@google.comBEGIN_DECLARE_SIM_OBJECT_PARAMS(O3Checker)
5612955Sgabeblack@google.com
5713086Sgabeblack@google.com    Param<Counter> max_insts_any_thread;
5813086Sgabeblack@google.com    Param<Counter> max_insts_all_threads;
5913086Sgabeblack@google.com    Param<Counter> max_loads_any_thread;
6013303Sgabeblack@google.com    Param<Counter> max_loads_all_threads;
6112955Sgabeblack@google.com
6213303Sgabeblack@google.com#if FULL_SYSTEM
6313303Sgabeblack@google.com    SimObjectParam<AlphaITB *> itb;
6413303Sgabeblack@google.com    SimObjectParam<AlphaDTB *> dtb;
6513303Sgabeblack@google.com    SimObjectParam<FunctionalMemory *> mem;
6613303Sgabeblack@google.com    SimObjectParam<System *> system;
6713303Sgabeblack@google.com    Param<int> cpu_id;
6813127Sgabeblack@google.com    Param<Tick> profile;
6913303Sgabeblack@google.com#else
7013303Sgabeblack@google.com    SimObjectParam<Process *> workload;
7113303Sgabeblack@google.com#endif // FULL_SYSTEM
7213303Sgabeblack@google.com    Param<int> clock;
7313303Sgabeblack@google.com    SimObjectParam<BaseMem *> icache;
7413303Sgabeblack@google.com    SimObjectParam<BaseMem *> dcache;
7513303Sgabeblack@google.com
7613303Sgabeblack@google.com    Param<bool> defer_registration;
7713303Sgabeblack@google.com    Param<bool> exitOnError;
7813303Sgabeblack@google.com    Param<bool> function_trace;
7913303Sgabeblack@google.com    Param<Tick> function_trace_start;
8013303Sgabeblack@google.com
8113303Sgabeblack@google.comEND_DECLARE_SIM_OBJECT_PARAMS(O3Checker)
8213317Sgabeblack@google.com
8313317Sgabeblack@google.comBEGIN_INIT_SIM_OBJECT_PARAMS(O3Checker)
8413303Sgabeblack@google.com
8513303Sgabeblack@google.com    INIT_PARAM(max_insts_any_thread,
8613303Sgabeblack@google.com               "terminate when any thread reaches this inst count"),
8712955Sgabeblack@google.com    INIT_PARAM(max_insts_all_threads,
8812955Sgabeblack@google.com               "terminate when all threads have reached this inst count"),
8912955Sgabeblack@google.com    INIT_PARAM(max_loads_any_thread,
9012955Sgabeblack@google.com               "terminate when any thread reaches this load count"),
9112955Sgabeblack@google.com    INIT_PARAM(max_loads_all_threads,
9212955Sgabeblack@google.com               "terminate when all threads have reached this load count"),
9312955Sgabeblack@google.com
9412955Sgabeblack@google.com#if FULL_SYSTEM
9512955Sgabeblack@google.com    INIT_PARAM(itb, "Instruction TLB"),
9612955Sgabeblack@google.com    INIT_PARAM(dtb, "Data TLB"),
9712955Sgabeblack@google.com    INIT_PARAM(mem, "memory"),
9812955Sgabeblack@google.com    INIT_PARAM(system, "system object"),
9912988Sgabeblack@google.com    INIT_PARAM(cpu_id, "processor ID"),
10013303Sgabeblack@google.com    INIT_PARAM(profile, ""),
10112988Sgabeblack@google.com#else
10212988Sgabeblack@google.com    INIT_PARAM(workload, "processes to run"),
10312988Sgabeblack@google.com#endif // FULL_SYSTEM
10412988Sgabeblack@google.com
10512955Sgabeblack@google.com    INIT_PARAM(clock, "clock speed"),
10612955Sgabeblack@google.com    INIT_PARAM(icache, "L1 instruction cache object"),
10712955Sgabeblack@google.com    INIT_PARAM(dcache, "L1 data cache object"),
10812955Sgabeblack@google.com
10912955Sgabeblack@google.com    INIT_PARAM(defer_registration, "defer system registration (for sampling)"),
11012955Sgabeblack@google.com    INIT_PARAM(exitOnError, "exit on error"),
11112957Sgabeblack@google.com    INIT_PARAM(function_trace, "Enable function trace"),
11213063Sgabeblack@google.com    INIT_PARAM(function_trace_start, "Cycle to start function trace")
11313063Sgabeblack@google.com
11412955Sgabeblack@google.comEND_INIT_SIM_OBJECT_PARAMS(O3Checker)
11512955Sgabeblack@google.com
11612955Sgabeblack@google.com
11712955Sgabeblack@google.comCREATE_SIM_OBJECT(O3Checker)
11812955Sgabeblack@google.com{
11912955Sgabeblack@google.com    O3Checker::Params *params = new O3Checker::Params();
12012955Sgabeblack@google.com    params->name = getInstanceName();
12112955Sgabeblack@google.com    params->numberOfThreads = 1;
12212955Sgabeblack@google.com    params->max_insts_any_thread = 0;
12312955Sgabeblack@google.com    params->max_insts_all_threads = 0;
12412955Sgabeblack@google.com    params->max_loads_any_thread = 0;
12512955Sgabeblack@google.com    params->max_loads_all_threads = 0;
12612955Sgabeblack@google.com    params->exitOnError = exitOnError;
12712955Sgabeblack@google.com    params->deferRegistration = defer_registration;
12812955Sgabeblack@google.com    params->functionTrace = function_trace;
12912955Sgabeblack@google.com    params->functionTraceStart = function_trace_start;
13012955Sgabeblack@google.com    params->clock = clock;
13113303Sgabeblack@google.com    // Hack to touch all parameters.  Consider not deriving Checker
13212955Sgabeblack@google.com    // from BaseCPU..it's not really a CPU in the end.
13312955Sgabeblack@google.com    Counter temp;
13412955Sgabeblack@google.com    temp = max_insts_any_thread;
13512955Sgabeblack@google.com    temp = max_insts_all_threads;
13612955Sgabeblack@google.com    temp = max_loads_any_thread;
13712955Sgabeblack@google.com    temp = max_loads_all_threads;
13812955Sgabeblack@google.com    BaseMem *cache = icache;
13912955Sgabeblack@google.com    cache = dcache;
14012955Sgabeblack@google.com
14113208Sgabeblack@google.com#if FULL_SYSTEM
14213208Sgabeblack@google.com    params->itb = itb;
14313208Sgabeblack@google.com    params->dtb = dtb;
14413208Sgabeblack@google.com    params->mem = mem;
14513208Sgabeblack@google.com    params->system = system;
14613208Sgabeblack@google.com    params->cpu_id = cpu_id;
14713208Sgabeblack@google.com    params->profile = profile;
14813208Sgabeblack@google.com#else
14913208Sgabeblack@google.com    params->process = workload;
15013208Sgabeblack@google.com#endif
15113208Sgabeblack@google.com
15213208Sgabeblack@google.com    O3Checker *cpu = new O3Checker(params);
15313208Sgabeblack@google.com    return cpu;
15413208Sgabeblack@google.com}
15513208Sgabeblack@google.com
15613208Sgabeblack@google.comREGISTER_SIM_OBJECT("O3Checker", O3Checker)
15713208Sgabeblack@google.com