timing.cc revision 2644
12623SN/A/*
22623SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
32623SN/A * All rights reserved.
42623SN/A *
52623SN/A * Redistribution and use in source and binary forms, with or without
62623SN/A * modification, are permitted provided that the following conditions are
72623SN/A * met: redistributions of source code must retain the above copyright
82623SN/A * notice, this list of conditions and the following disclaimer;
92623SN/A * redistributions in binary form must reproduce the above copyright
102623SN/A * notice, this list of conditions and the following disclaimer in the
112623SN/A * documentation and/or other materials provided with the distribution;
122623SN/A * neither the name of the copyright holders nor the names of its
132623SN/A * contributors may be used to endorse or promote products derived from
142623SN/A * this software without specific prior written permission.
152623SN/A *
162623SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172623SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182623SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192623SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202623SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212623SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222623SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232623SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242623SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252623SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262623SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272623SN/A */
282623SN/A
292623SN/A#include "arch/utility.hh"
302623SN/A#include "cpu/exetrace.hh"
312623SN/A#include "cpu/simple/timing.hh"
322623SN/A#include "mem/packet_impl.hh"
332623SN/A#include "sim/builder.hh"
342623SN/A
352623SN/Ausing namespace std;
362623SN/Ausing namespace TheISA;
372623SN/A
382623SN/A
392623SN/Avoid
402623SN/ATimingSimpleCPU::init()
412623SN/A{
422623SN/A    //Create Memory Ports (conect them up)
432623SN/A    Port *mem_dport = mem->getPort("");
442623SN/A    dcachePort.setPeer(mem_dport);
452623SN/A    mem_dport->setPeer(&dcachePort);
462623SN/A
472623SN/A    Port *mem_iport = mem->getPort("");
482623SN/A    icachePort.setPeer(mem_iport);
492623SN/A    mem_iport->setPeer(&icachePort);
502623SN/A
512623SN/A    BaseCPU::init();
522623SN/A#if FULL_SYSTEM
532623SN/A    for (int i = 0; i < execContexts.size(); ++i) {
542623SN/A        ExecContext *xc = execContexts[i];
552623SN/A
562623SN/A        // initialize CPU, including PC
572623SN/A        TheISA::initCPU(xc, xc->readCpuId());
582623SN/A    }
592623SN/A#endif
602623SN/A}
612623SN/A
622623SN/ATick
632630SN/ATimingSimpleCPU::CpuPort::recvAtomic(Packet *pkt)
642623SN/A{
652623SN/A    panic("TimingSimpleCPU doesn't expect recvAtomic callback!");
662623SN/A    return curTick;
672623SN/A}
682623SN/A
692623SN/Avoid
702630SN/ATimingSimpleCPU::CpuPort::recvFunctional(Packet *pkt)
712623SN/A{
722623SN/A    panic("TimingSimpleCPU doesn't expect recvFunctional callback!");
732623SN/A}
742623SN/A
752623SN/Avoid
762623SN/ATimingSimpleCPU::CpuPort::recvStatusChange(Status status)
772623SN/A{
782631SN/A    if (status == RangeChange)
792631SN/A        return;
802631SN/A
812623SN/A    panic("TimingSimpleCPU doesn't expect recvStatusChange callback!");
822623SN/A}
832623SN/A
842623SN/ATimingSimpleCPU::TimingSimpleCPU(Params *p)
852623SN/A    : BaseSimpleCPU(p), icachePort(this), dcachePort(this)
862623SN/A{
872623SN/A    _status = Idle;
882623SN/A    ifetch_pkt = dcache_pkt = NULL;
892623SN/A}
902623SN/A
912623SN/A
922623SN/ATimingSimpleCPU::~TimingSimpleCPU()
932623SN/A{
942623SN/A}
952623SN/A
962623SN/Avoid
972623SN/ATimingSimpleCPU::serialize(ostream &os)
982623SN/A{
992623SN/A    BaseSimpleCPU::serialize(os);
1002623SN/A    SERIALIZE_ENUM(_status);
1012623SN/A}
1022623SN/A
1032623SN/Avoid
1042623SN/ATimingSimpleCPU::unserialize(Checkpoint *cp, const string &section)
1052623SN/A{
1062623SN/A    BaseSimpleCPU::unserialize(cp, section);
1072623SN/A    UNSERIALIZE_ENUM(_status);
1082623SN/A}
1092623SN/A
1102623SN/Avoid
1112623SN/ATimingSimpleCPU::switchOut(Sampler *s)
1122623SN/A{
1132623SN/A    sampler = s;
1142623SN/A    if (status() == Running) {
1152623SN/A        _status = SwitchedOut;
1162623SN/A    }
1172623SN/A    sampler->signalSwitched();
1182623SN/A}
1192623SN/A
1202623SN/A
1212623SN/Avoid
1222623SN/ATimingSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
1232623SN/A{
1242623SN/A    BaseCPU::takeOverFrom(oldCPU);
1252623SN/A
1262623SN/A    // if any of this CPU's ExecContexts are active, mark the CPU as
1272623SN/A    // running and schedule its tick event.
1282623SN/A    for (int i = 0; i < execContexts.size(); ++i) {
1292623SN/A        ExecContext *xc = execContexts[i];
1302623SN/A        if (xc->status() == ExecContext::Active && _status != Running) {
1312623SN/A            _status = Running;
1322623SN/A            break;
1332623SN/A        }
1342623SN/A    }
1352623SN/A}
1362623SN/A
1372623SN/A
1382623SN/Avoid
1392623SN/ATimingSimpleCPU::activateContext(int thread_num, int delay)
1402623SN/A{
1412623SN/A    assert(thread_num == 0);
1422623SN/A    assert(cpuXC);
1432623SN/A
1442623SN/A    assert(_status == Idle);
1452623SN/A
1462623SN/A    notIdleFraction++;
1472623SN/A    _status = Running;
1482623SN/A    // kick things off by initiating the fetch of the next instruction
1492623SN/A    Event *e =
1502623SN/A        new EventWrapper<TimingSimpleCPU, &TimingSimpleCPU::fetch>(this, true);
1512623SN/A    e->schedule(curTick + cycles(delay));
1522623SN/A}
1532623SN/A
1542623SN/A
1552623SN/Avoid
1562623SN/ATimingSimpleCPU::suspendContext(int thread_num)
1572623SN/A{
1582623SN/A    assert(thread_num == 0);
1592623SN/A    assert(cpuXC);
1602623SN/A
1612644Sstever@eecs.umich.edu    assert(_status == Running);
1622623SN/A
1632644Sstever@eecs.umich.edu    // just change status to Idle... if status != Running,
1642644Sstever@eecs.umich.edu    // completeInst() will not initiate fetch of next instruction.
1652623SN/A
1662623SN/A    notIdleFraction--;
1672623SN/A    _status = Idle;
1682623SN/A}
1692623SN/A
1702623SN/A
1712623SN/Atemplate <class T>
1722623SN/AFault
1732623SN/ATimingSimpleCPU::read(Addr addr, T &data, unsigned flags)
1742623SN/A{
1752623SN/A    Request *data_read_req = new Request(true);
1762623SN/A
1772623SN/A    data_read_req->setVaddr(addr);
1782623SN/A    data_read_req->setSize(sizeof(T));
1792623SN/A    data_read_req->setFlags(flags);
1802623SN/A    data_read_req->setTime(curTick);
1812623SN/A
1822623SN/A    if (traceData) {
1832623SN/A        traceData->setAddr(data_read_req->getVaddr());
1842623SN/A    }
1852623SN/A
1862623SN/A   // translate to physical address
1872623SN/A    Fault fault = cpuXC->translateDataReadReq(data_read_req);
1882623SN/A
1892623SN/A    // Now do the access.
1902623SN/A    if (fault == NoFault) {
1912641Sstever@eecs.umich.edu        Packet *data_read_pkt =
1922641Sstever@eecs.umich.edu            new Packet(data_read_req, Packet::ReadReq, Packet::Broadcast);
1932623SN/A        data_read_pkt->dataDynamic<T>(new T);
1942623SN/A
1952630SN/A        if (!dcachePort.sendTiming(data_read_pkt)) {
1962623SN/A            _status = DcacheRetry;
1972623SN/A            dcache_pkt = data_read_pkt;
1982623SN/A        } else {
1992623SN/A            _status = DcacheWaitResponse;
2002623SN/A            dcache_pkt = NULL;
2012623SN/A        }
2022623SN/A    }
2032623SN/A
2042623SN/A    // This will need a new way to tell if it has a dcache attached.
2052623SN/A    if (data_read_req->getFlags() & UNCACHEABLE)
2062623SN/A        recordEvent("Uncached Read");
2072623SN/A
2082623SN/A    return fault;
2092623SN/A}
2102623SN/A
2112623SN/A#ifndef DOXYGEN_SHOULD_SKIP_THIS
2122623SN/A
2132623SN/Atemplate
2142623SN/AFault
2152623SN/ATimingSimpleCPU::read(Addr addr, uint64_t &data, unsigned flags);
2162623SN/A
2172623SN/Atemplate
2182623SN/AFault
2192623SN/ATimingSimpleCPU::read(Addr addr, uint32_t &data, unsigned flags);
2202623SN/A
2212623SN/Atemplate
2222623SN/AFault
2232623SN/ATimingSimpleCPU::read(Addr addr, uint16_t &data, unsigned flags);
2242623SN/A
2252623SN/Atemplate
2262623SN/AFault
2272623SN/ATimingSimpleCPU::read(Addr addr, uint8_t &data, unsigned flags);
2282623SN/A
2292623SN/A#endif //DOXYGEN_SHOULD_SKIP_THIS
2302623SN/A
2312623SN/Atemplate<>
2322623SN/AFault
2332623SN/ATimingSimpleCPU::read(Addr addr, double &data, unsigned flags)
2342623SN/A{
2352623SN/A    return read(addr, *(uint64_t*)&data, flags);
2362623SN/A}
2372623SN/A
2382623SN/Atemplate<>
2392623SN/AFault
2402623SN/ATimingSimpleCPU::read(Addr addr, float &data, unsigned flags)
2412623SN/A{
2422623SN/A    return read(addr, *(uint32_t*)&data, flags);
2432623SN/A}
2442623SN/A
2452623SN/A
2462623SN/Atemplate<>
2472623SN/AFault
2482623SN/ATimingSimpleCPU::read(Addr addr, int32_t &data, unsigned flags)
2492623SN/A{
2502623SN/A    return read(addr, (uint32_t&)data, flags);
2512623SN/A}
2522623SN/A
2532623SN/A
2542623SN/Atemplate <class T>
2552623SN/AFault
2562623SN/ATimingSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
2572623SN/A{
2582623SN/A    Request *data_write_req = new Request(true);
2592623SN/A    data_write_req->setVaddr(addr);
2602623SN/A    data_write_req->setTime(curTick);
2612623SN/A    data_write_req->setSize(sizeof(T));
2622623SN/A    data_write_req->setFlags(flags);
2632623SN/A
2642623SN/A    // translate to physical address
2652623SN/A    Fault fault = cpuXC->translateDataWriteReq(data_write_req);
2662623SN/A    // Now do the access.
2672623SN/A    if (fault == NoFault) {
2682641Sstever@eecs.umich.edu        Packet *data_write_pkt =
2692641Sstever@eecs.umich.edu            new Packet(data_write_req, Packet::WriteReq, Packet::Broadcast);
2702623SN/A        data_write_pkt->allocate();
2712623SN/A        data_write_pkt->set(data);
2722623SN/A
2732630SN/A        if (!dcachePort.sendTiming(data_write_pkt)) {
2742623SN/A            _status = DcacheRetry;
2752623SN/A            dcache_pkt = data_write_pkt;
2762623SN/A        } else {
2772623SN/A            _status = DcacheWaitResponse;
2782623SN/A            dcache_pkt = NULL;
2792623SN/A        }
2802623SN/A    }
2812623SN/A
2822623SN/A    // This will need a new way to tell if it's hooked up to a cache or not.
2832623SN/A    if (data_write_req->getFlags() & UNCACHEABLE)
2842623SN/A        recordEvent("Uncached Write");
2852623SN/A
2862623SN/A    // If the write needs to have a fault on the access, consider calling
2872623SN/A    // changeStatus() and changing it to "bad addr write" or something.
2882623SN/A    return fault;
2892623SN/A}
2902623SN/A
2912623SN/A
2922623SN/A#ifndef DOXYGEN_SHOULD_SKIP_THIS
2932623SN/Atemplate
2942623SN/AFault
2952623SN/ATimingSimpleCPU::write(uint64_t data, Addr addr,
2962623SN/A                       unsigned flags, uint64_t *res);
2972623SN/A
2982623SN/Atemplate
2992623SN/AFault
3002623SN/ATimingSimpleCPU::write(uint32_t data, Addr addr,
3012623SN/A                       unsigned flags, uint64_t *res);
3022623SN/A
3032623SN/Atemplate
3042623SN/AFault
3052623SN/ATimingSimpleCPU::write(uint16_t data, Addr addr,
3062623SN/A                       unsigned flags, uint64_t *res);
3072623SN/A
3082623SN/Atemplate
3092623SN/AFault
3102623SN/ATimingSimpleCPU::write(uint8_t data, Addr addr,
3112623SN/A                       unsigned flags, uint64_t *res);
3122623SN/A
3132623SN/A#endif //DOXYGEN_SHOULD_SKIP_THIS
3142623SN/A
3152623SN/Atemplate<>
3162623SN/AFault
3172623SN/ATimingSimpleCPU::write(double data, Addr addr, unsigned flags, uint64_t *res)
3182623SN/A{
3192623SN/A    return write(*(uint64_t*)&data, addr, flags, res);
3202623SN/A}
3212623SN/A
3222623SN/Atemplate<>
3232623SN/AFault
3242623SN/ATimingSimpleCPU::write(float data, Addr addr, unsigned flags, uint64_t *res)
3252623SN/A{
3262623SN/A    return write(*(uint32_t*)&data, addr, flags, res);
3272623SN/A}
3282623SN/A
3292623SN/A
3302623SN/Atemplate<>
3312623SN/AFault
3322623SN/ATimingSimpleCPU::write(int32_t data, Addr addr, unsigned flags, uint64_t *res)
3332623SN/A{
3342623SN/A    return write((uint32_t)data, addr, flags, res);
3352623SN/A}
3362623SN/A
3372623SN/A
3382623SN/Avoid
3392623SN/ATimingSimpleCPU::fetch()
3402623SN/A{
3412631SN/A    checkForInterrupts();
3422631SN/A
3432623SN/A    Request *ifetch_req = new Request(true);
3442623SN/A    ifetch_req->setSize(sizeof(MachInst));
3452623SN/A
3462641Sstever@eecs.umich.edu    ifetch_pkt = new Packet(ifetch_req, Packet::ReadReq, Packet::Broadcast);
3472623SN/A    ifetch_pkt->dataStatic(&inst);
3482623SN/A
3492623SN/A    Fault fault = setupFetchPacket(ifetch_pkt);
3502623SN/A    if (fault == NoFault) {
3512630SN/A        if (!icachePort.sendTiming(ifetch_pkt)) {
3522623SN/A            // Need to wait for retry
3532623SN/A            _status = IcacheRetry;
3542623SN/A        } else {
3552623SN/A            // Need to wait for cache to respond
3562623SN/A            _status = IcacheWaitResponse;
3572623SN/A            // ownership of packet transferred to memory system
3582623SN/A            ifetch_pkt = NULL;
3592623SN/A        }
3602623SN/A    } else {
3612644Sstever@eecs.umich.edu        // fetch fault: advance directly to next instruction (fault handler)
3622644Sstever@eecs.umich.edu        advanceInst(fault);
3632623SN/A    }
3642623SN/A}
3652623SN/A
3662623SN/A
3672623SN/Avoid
3682644Sstever@eecs.umich.eduTimingSimpleCPU::advanceInst(Fault fault)
3692623SN/A{
3702623SN/A    advancePC(fault);
3712623SN/A
3722631SN/A    if (_status == Running) {
3732631SN/A        // kick off fetch of next instruction... callback from icache
3742631SN/A        // response will cause that instruction to be executed,
3752631SN/A        // keeping the CPU running.
3762631SN/A        fetch();
3772631SN/A    }
3782623SN/A}
3792623SN/A
3802623SN/A
3812623SN/Avoid
3822644Sstever@eecs.umich.eduTimingSimpleCPU::completeIfetch(Packet *pkt)
3832623SN/A{
3842623SN/A    // received a response from the icache: execute the received
3852623SN/A    // instruction
3862644Sstever@eecs.umich.edu    assert(pkt->result == Packet::Success);
3872623SN/A    assert(_status == IcacheWaitResponse);
3882623SN/A    _status = Running;
3892644Sstever@eecs.umich.edu
3902644Sstever@eecs.umich.edu    delete pkt->req;
3912644Sstever@eecs.umich.edu    delete pkt;
3922644Sstever@eecs.umich.edu
3932623SN/A    preExecute();
3942644Sstever@eecs.umich.edu    if (curStaticInst->isMemRef() && !curStaticInst->isDataPrefetch()) {
3952623SN/A        // load or store: just send to dcache
3962623SN/A        Fault fault = curStaticInst->initiateAcc(this, traceData);
3972644Sstever@eecs.umich.edu        if (fault == NoFault) {
3982644Sstever@eecs.umich.edu            // successfully initiated access: instruction will
3992644Sstever@eecs.umich.edu            // complete in dcache response callback
4002644Sstever@eecs.umich.edu            assert(_status == DcacheWaitResponse);
4012644Sstever@eecs.umich.edu        } else {
4022644Sstever@eecs.umich.edu            // fault: complete now to invoke fault handler
4032644Sstever@eecs.umich.edu            postExecute();
4042644Sstever@eecs.umich.edu            advanceInst(fault);
4052644Sstever@eecs.umich.edu        }
4062623SN/A    } else {
4072623SN/A        // non-memory instruction: execute completely now
4082623SN/A        Fault fault = curStaticInst->execute(this, traceData);
4092644Sstever@eecs.umich.edu        postExecute();
4102644Sstever@eecs.umich.edu        advanceInst(fault);
4112623SN/A    }
4122623SN/A}
4132623SN/A
4142623SN/A
4152623SN/Abool
4162630SN/ATimingSimpleCPU::IcachePort::recvTiming(Packet *pkt)
4172623SN/A{
4182644Sstever@eecs.umich.edu    cpu->completeIfetch(pkt);
4192623SN/A    return true;
4202623SN/A}
4212623SN/A
4222623SN/APacket *
4232623SN/ATimingSimpleCPU::IcachePort::recvRetry()
4242623SN/A{
4252623SN/A    // we shouldn't get a retry unless we have a packet that we're
4262623SN/A    // waiting to transmit
4272623SN/A    assert(cpu->ifetch_pkt != NULL);
4282623SN/A    assert(cpu->_status == IcacheRetry);
4292623SN/A    cpu->_status = IcacheWaitResponse;
4302623SN/A    Packet *tmp = cpu->ifetch_pkt;
4312623SN/A    cpu->ifetch_pkt = NULL;
4322623SN/A    return tmp;
4332623SN/A}
4342623SN/A
4352623SN/Avoid
4362623SN/ATimingSimpleCPU::completeDataAccess(Packet *pkt)
4372623SN/A{
4382623SN/A    // received a response from the dcache: complete the load or store
4392623SN/A    // instruction
4402641Sstever@eecs.umich.edu    assert(pkt->result == Packet::Success);
4412623SN/A    assert(_status == DcacheWaitResponse);
4422623SN/A    _status = Running;
4432623SN/A
4442623SN/A    Fault fault = curStaticInst->completeAcc(pkt, this, traceData);
4452623SN/A
4462644Sstever@eecs.umich.edu    delete pkt->req;
4472644Sstever@eecs.umich.edu    delete pkt;
4482644Sstever@eecs.umich.edu
4492644Sstever@eecs.umich.edu    postExecute();
4502644Sstever@eecs.umich.edu    advanceInst(fault);
4512623SN/A}
4522623SN/A
4532623SN/A
4542623SN/A
4552623SN/Abool
4562630SN/ATimingSimpleCPU::DcachePort::recvTiming(Packet *pkt)
4572623SN/A{
4582630SN/A    cpu->completeDataAccess(pkt);
4592623SN/A    return true;
4602623SN/A}
4612623SN/A
4622623SN/APacket *
4632623SN/ATimingSimpleCPU::DcachePort::recvRetry()
4642623SN/A{
4652623SN/A    // we shouldn't get a retry unless we have a packet that we're
4662623SN/A    // waiting to transmit
4672623SN/A    assert(cpu->dcache_pkt != NULL);
4682623SN/A    assert(cpu->_status == DcacheRetry);
4692623SN/A    cpu->_status = DcacheWaitResponse;
4702623SN/A    Packet *tmp = cpu->dcache_pkt;
4712623SN/A    cpu->dcache_pkt = NULL;
4722623SN/A    return tmp;
4732623SN/A}
4742623SN/A
4752623SN/A
4762623SN/A////////////////////////////////////////////////////////////////////////
4772623SN/A//
4782623SN/A//  TimingSimpleCPU Simulation Object
4792623SN/A//
4802623SN/ABEGIN_DECLARE_SIM_OBJECT_PARAMS(TimingSimpleCPU)
4812623SN/A
4822623SN/A    Param<Counter> max_insts_any_thread;
4832623SN/A    Param<Counter> max_insts_all_threads;
4842623SN/A    Param<Counter> max_loads_any_thread;
4852623SN/A    Param<Counter> max_loads_all_threads;
4862623SN/A    SimObjectParam<MemObject *> mem;
4872623SN/A
4882623SN/A#if FULL_SYSTEM
4892623SN/A    SimObjectParam<AlphaITB *> itb;
4902623SN/A    SimObjectParam<AlphaDTB *> dtb;
4912623SN/A    SimObjectParam<System *> system;
4922623SN/A    Param<int> cpu_id;
4932623SN/A    Param<Tick> profile;
4942623SN/A#else
4952623SN/A    SimObjectParam<Process *> workload;
4962623SN/A#endif // FULL_SYSTEM
4972623SN/A
4982623SN/A    Param<int> clock;
4992623SN/A
5002623SN/A    Param<bool> defer_registration;
5012623SN/A    Param<int> width;
5022623SN/A    Param<bool> function_trace;
5032623SN/A    Param<Tick> function_trace_start;
5042623SN/A    Param<bool> simulate_stalls;
5052623SN/A
5062623SN/AEND_DECLARE_SIM_OBJECT_PARAMS(TimingSimpleCPU)
5072623SN/A
5082623SN/ABEGIN_INIT_SIM_OBJECT_PARAMS(TimingSimpleCPU)
5092623SN/A
5102623SN/A    INIT_PARAM(max_insts_any_thread,
5112623SN/A               "terminate when any thread reaches this inst count"),
5122623SN/A    INIT_PARAM(max_insts_all_threads,
5132623SN/A               "terminate when all threads have reached this inst count"),
5142623SN/A    INIT_PARAM(max_loads_any_thread,
5152623SN/A               "terminate when any thread reaches this load count"),
5162623SN/A    INIT_PARAM(max_loads_all_threads,
5172623SN/A               "terminate when all threads have reached this load count"),
5182623SN/A    INIT_PARAM(mem, "memory"),
5192623SN/A
5202623SN/A#if FULL_SYSTEM
5212623SN/A    INIT_PARAM(itb, "Instruction TLB"),
5222623SN/A    INIT_PARAM(dtb, "Data TLB"),
5232623SN/A    INIT_PARAM(system, "system object"),
5242623SN/A    INIT_PARAM(cpu_id, "processor ID"),
5252623SN/A    INIT_PARAM(profile, ""),
5262623SN/A#else
5272623SN/A    INIT_PARAM(workload, "processes to run"),
5282623SN/A#endif // FULL_SYSTEM
5292623SN/A
5302623SN/A    INIT_PARAM(clock, "clock speed"),
5312623SN/A    INIT_PARAM(defer_registration, "defer system registration (for sampling)"),
5322623SN/A    INIT_PARAM(width, "cpu width"),
5332623SN/A    INIT_PARAM(function_trace, "Enable function trace"),
5342623SN/A    INIT_PARAM(function_trace_start, "Cycle to start function trace"),
5352623SN/A    INIT_PARAM(simulate_stalls, "Simulate cache stall cycles")
5362623SN/A
5372623SN/AEND_INIT_SIM_OBJECT_PARAMS(TimingSimpleCPU)
5382623SN/A
5392623SN/A
5402623SN/ACREATE_SIM_OBJECT(TimingSimpleCPU)
5412623SN/A{
5422623SN/A    TimingSimpleCPU::Params *params = new TimingSimpleCPU::Params();
5432623SN/A    params->name = getInstanceName();
5442623SN/A    params->numberOfThreads = 1;
5452623SN/A    params->max_insts_any_thread = max_insts_any_thread;
5462623SN/A    params->max_insts_all_threads = max_insts_all_threads;
5472623SN/A    params->max_loads_any_thread = max_loads_any_thread;
5482623SN/A    params->max_loads_all_threads = max_loads_all_threads;
5492623SN/A    params->deferRegistration = defer_registration;
5502623SN/A    params->clock = clock;
5512623SN/A    params->functionTrace = function_trace;
5522623SN/A    params->functionTraceStart = function_trace_start;
5532623SN/A    params->mem = mem;
5542623SN/A
5552623SN/A#if FULL_SYSTEM
5562623SN/A    params->itb = itb;
5572623SN/A    params->dtb = dtb;
5582623SN/A    params->system = system;
5592623SN/A    params->cpu_id = cpu_id;
5602623SN/A    params->profile = profile;
5612623SN/A#else
5622623SN/A    params->process = workload;
5632623SN/A#endif
5642623SN/A
5652623SN/A    TimingSimpleCPU *cpu = new TimingSimpleCPU(params);
5662623SN/A    return cpu;
5672623SN/A}
5682623SN/A
5692623SN/AREGISTER_SIM_OBJECT("TimingSimpleCPU", TimingSimpleCPU)
5702623SN/A
571