atomic.cc revision 2662
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/atomic.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/AAtomicSimpleCPU::TickEvent::TickEvent(AtomicSimpleCPU *c)
392623SN/A    : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c)
402623SN/A{
412623SN/A}
422623SN/A
432623SN/A
442623SN/Avoid
452623SN/AAtomicSimpleCPU::TickEvent::process()
462623SN/A{
472623SN/A    cpu->tick();
482623SN/A}
492623SN/A
502623SN/Aconst char *
512623SN/AAtomicSimpleCPU::TickEvent::description()
522623SN/A{
532623SN/A    return "AtomicSimpleCPU tick event";
542623SN/A}
552623SN/A
562623SN/A
572623SN/Avoid
582623SN/AAtomicSimpleCPU::init()
592623SN/A{
602623SN/A    //Create Memory Ports (conect them up)
612623SN/A    Port *mem_dport = mem->getPort("");
622623SN/A    dcachePort.setPeer(mem_dport);
632623SN/A    mem_dport->setPeer(&dcachePort);
642623SN/A
652623SN/A    Port *mem_iport = mem->getPort("");
662623SN/A    icachePort.setPeer(mem_iport);
672623SN/A    mem_iport->setPeer(&icachePort);
682623SN/A
692623SN/A    BaseCPU::init();
702623SN/A#if FULL_SYSTEM
712623SN/A    for (int i = 0; i < execContexts.size(); ++i) {
722623SN/A        ExecContext *xc = execContexts[i];
732623SN/A
742623SN/A        // initialize CPU, including PC
752623SN/A        TheISA::initCPU(xc, xc->readCpuId());
762623SN/A    }
772623SN/A#endif
782623SN/A}
792623SN/A
802623SN/Abool
812630SN/AAtomicSimpleCPU::CpuPort::recvTiming(Packet *pkt)
822623SN/A{
832623SN/A    panic("AtomicSimpleCPU doesn't expect recvAtomic callback!");
842623SN/A    return true;
852623SN/A}
862623SN/A
872623SN/ATick
882630SN/AAtomicSimpleCPU::CpuPort::recvAtomic(Packet *pkt)
892623SN/A{
902623SN/A    panic("AtomicSimpleCPU doesn't expect recvAtomic callback!");
912623SN/A    return curTick;
922623SN/A}
932623SN/A
942623SN/Avoid
952630SN/AAtomicSimpleCPU::CpuPort::recvFunctional(Packet *pkt)
962623SN/A{
972623SN/A    panic("AtomicSimpleCPU doesn't expect recvFunctional callback!");
982623SN/A}
992623SN/A
1002623SN/Avoid
1012623SN/AAtomicSimpleCPU::CpuPort::recvStatusChange(Status status)
1022623SN/A{
1032626SN/A    if (status == RangeChange)
1042626SN/A        return;
1052626SN/A
1062623SN/A    panic("AtomicSimpleCPU doesn't expect recvStatusChange callback!");
1072623SN/A}
1082623SN/A
1092657Ssaidi@eecs.umich.eduvoid
1102623SN/AAtomicSimpleCPU::CpuPort::recvRetry()
1112623SN/A{
1122623SN/A    panic("AtomicSimpleCPU doesn't expect recvRetry callback!");
1132623SN/A}
1142623SN/A
1152623SN/A
1162623SN/AAtomicSimpleCPU::AtomicSimpleCPU(Params *p)
1172623SN/A    : BaseSimpleCPU(p), tickEvent(this),
1182623SN/A      width(p->width), simulate_stalls(p->simulate_stalls),
1192640Sstever@eecs.umich.edu      icachePort(name() + "-iport", this), dcachePort(name() + "-iport", this)
1202623SN/A{
1212623SN/A    _status = Idle;
1222623SN/A
1232623SN/A    ifetch_req = new Request(true);
1242623SN/A    ifetch_req->setAsid(0);
1252623SN/A    // @todo fix me and get the real cpu iD!!!
1262623SN/A    ifetch_req->setCpuNum(0);
1272623SN/A    ifetch_req->setSize(sizeof(MachInst));
1282641Sstever@eecs.umich.edu    ifetch_pkt = new Packet(ifetch_req, Packet::ReadReq, Packet::Broadcast);
1292623SN/A    ifetch_pkt->dataStatic(&inst);
1302623SN/A
1312623SN/A    data_read_req = new Request(true);
1322623SN/A    // @todo fix me and get the real cpu iD!!!
1332623SN/A    data_read_req->setCpuNum(0);
1342623SN/A    data_read_req->setAsid(0);
1352641Sstever@eecs.umich.edu    data_read_pkt = new Packet(data_read_req, Packet::ReadReq,
1362641Sstever@eecs.umich.edu                               Packet::Broadcast);
1372623SN/A    data_read_pkt->dataStatic(&dataReg);
1382623SN/A
1392623SN/A    data_write_req = new Request(true);
1402623SN/A    // @todo fix me and get the real cpu iD!!!
1412623SN/A    data_write_req->setCpuNum(0);
1422623SN/A    data_write_req->setAsid(0);
1432641Sstever@eecs.umich.edu    data_write_pkt = new Packet(data_write_req, Packet::WriteReq,
1442641Sstever@eecs.umich.edu                                Packet::Broadcast);
1452623SN/A}
1462623SN/A
1472623SN/A
1482623SN/AAtomicSimpleCPU::~AtomicSimpleCPU()
1492623SN/A{
1502623SN/A}
1512623SN/A
1522623SN/Avoid
1532623SN/AAtomicSimpleCPU::serialize(ostream &os)
1542623SN/A{
1552623SN/A    BaseSimpleCPU::serialize(os);
1562623SN/A    SERIALIZE_ENUM(_status);
1572623SN/A    nameOut(os, csprintf("%s.tickEvent", name()));
1582623SN/A    tickEvent.serialize(os);
1592623SN/A}
1602623SN/A
1612623SN/Avoid
1622623SN/AAtomicSimpleCPU::unserialize(Checkpoint *cp, const string &section)
1632623SN/A{
1642623SN/A    BaseSimpleCPU::unserialize(cp, section);
1652623SN/A    UNSERIALIZE_ENUM(_status);
1662623SN/A    tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
1672623SN/A}
1682623SN/A
1692623SN/Avoid
1702623SN/AAtomicSimpleCPU::switchOut(Sampler *s)
1712623SN/A{
1722623SN/A    sampler = s;
1732623SN/A    if (status() == Running) {
1742623SN/A        _status = SwitchedOut;
1752623SN/A
1762623SN/A        tickEvent.squash();
1772623SN/A    }
1782623SN/A    sampler->signalSwitched();
1792623SN/A}
1802623SN/A
1812623SN/A
1822623SN/Avoid
1832623SN/AAtomicSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
1842623SN/A{
1852623SN/A    BaseCPU::takeOverFrom(oldCPU);
1862623SN/A
1872623SN/A    assert(!tickEvent.scheduled());
1882623SN/A
1892623SN/A    // if any of this CPU's ExecContexts are active, mark the CPU as
1902623SN/A    // running and schedule its tick event.
1912623SN/A    for (int i = 0; i < execContexts.size(); ++i) {
1922623SN/A        ExecContext *xc = execContexts[i];
1932623SN/A        if (xc->status() == ExecContext::Active && _status != Running) {
1942623SN/A            _status = Running;
1952623SN/A            tickEvent.schedule(curTick);
1962623SN/A            break;
1972623SN/A        }
1982623SN/A    }
1992623SN/A}
2002623SN/A
2012623SN/A
2022623SN/Avoid
2032623SN/AAtomicSimpleCPU::activateContext(int thread_num, int delay)
2042623SN/A{
2052623SN/A    assert(thread_num == 0);
2062623SN/A    assert(cpuXC);
2072623SN/A
2082623SN/A    assert(_status == Idle);
2092623SN/A    assert(!tickEvent.scheduled());
2102623SN/A
2112623SN/A    notIdleFraction++;
2122623SN/A    tickEvent.schedule(curTick + cycles(delay));
2132623SN/A    _status = Running;
2142623SN/A}
2152623SN/A
2162623SN/A
2172623SN/Avoid
2182623SN/AAtomicSimpleCPU::suspendContext(int thread_num)
2192623SN/A{
2202623SN/A    assert(thread_num == 0);
2212623SN/A    assert(cpuXC);
2222623SN/A
2232623SN/A    assert(_status == Running);
2242626SN/A
2252626SN/A    // tick event may not be scheduled if this gets called from inside
2262626SN/A    // an instruction's execution, e.g. "quiesce"
2272626SN/A    if (tickEvent.scheduled())
2282626SN/A        tickEvent.deschedule();
2292623SN/A
2302623SN/A    notIdleFraction--;
2312623SN/A    _status = Idle;
2322623SN/A}
2332623SN/A
2342623SN/A
2352623SN/Atemplate <class T>
2362623SN/AFault
2372623SN/AAtomicSimpleCPU::read(Addr addr, T &data, unsigned flags)
2382623SN/A{
2392623SN/A    data_read_req->setVaddr(addr);
2402623SN/A    data_read_req->setSize(sizeof(T));
2412623SN/A    data_read_req->setFlags(flags);
2422623SN/A    data_read_req->setTime(curTick);
2432623SN/A
2442623SN/A    if (traceData) {
2452623SN/A        traceData->setAddr(addr);
2462623SN/A    }
2472623SN/A
2482623SN/A    // translate to physical address
2492623SN/A    Fault fault = cpuXC->translateDataReadReq(data_read_req);
2502623SN/A
2512623SN/A    // Now do the access.
2522623SN/A    if (fault == NoFault) {
2532641Sstever@eecs.umich.edu        data_read_pkt->reinitFromRequest();
2542623SN/A
2552662Sstever@eecs.umich.edu        dcache_latency = dcachePort.sendAtomic(data_read_pkt);
2562623SN/A        dcache_access = true;
2572623SN/A
2582641Sstever@eecs.umich.edu        assert(data_read_pkt->result == Packet::Success);
2592623SN/A        data = data_read_pkt->get<T>();
2602623SN/A
2612623SN/A    }
2622623SN/A
2632623SN/A    // This will need a new way to tell if it has a dcache attached.
2642623SN/A    if (data_read_req->getFlags() & UNCACHEABLE)
2652623SN/A        recordEvent("Uncached Read");
2662623SN/A
2672623SN/A    return fault;
2682623SN/A}
2692623SN/A
2702623SN/A#ifndef DOXYGEN_SHOULD_SKIP_THIS
2712623SN/A
2722623SN/Atemplate
2732623SN/AFault
2742623SN/AAtomicSimpleCPU::read(Addr addr, uint64_t &data, unsigned flags);
2752623SN/A
2762623SN/Atemplate
2772623SN/AFault
2782623SN/AAtomicSimpleCPU::read(Addr addr, uint32_t &data, unsigned flags);
2792623SN/A
2802623SN/Atemplate
2812623SN/AFault
2822623SN/AAtomicSimpleCPU::read(Addr addr, uint16_t &data, unsigned flags);
2832623SN/A
2842623SN/Atemplate
2852623SN/AFault
2862623SN/AAtomicSimpleCPU::read(Addr addr, uint8_t &data, unsigned flags);
2872623SN/A
2882623SN/A#endif //DOXYGEN_SHOULD_SKIP_THIS
2892623SN/A
2902623SN/Atemplate<>
2912623SN/AFault
2922623SN/AAtomicSimpleCPU::read(Addr addr, double &data, unsigned flags)
2932623SN/A{
2942623SN/A    return read(addr, *(uint64_t*)&data, flags);
2952623SN/A}
2962623SN/A
2972623SN/Atemplate<>
2982623SN/AFault
2992623SN/AAtomicSimpleCPU::read(Addr addr, float &data, unsigned flags)
3002623SN/A{
3012623SN/A    return read(addr, *(uint32_t*)&data, flags);
3022623SN/A}
3032623SN/A
3042623SN/A
3052623SN/Atemplate<>
3062623SN/AFault
3072623SN/AAtomicSimpleCPU::read(Addr addr, int32_t &data, unsigned flags)
3082623SN/A{
3092623SN/A    return read(addr, (uint32_t&)data, flags);
3102623SN/A}
3112623SN/A
3122623SN/A
3132623SN/Atemplate <class T>
3142623SN/AFault
3152623SN/AAtomicSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
3162623SN/A{
3172623SN/A    data_write_req->setVaddr(addr);
3182623SN/A    data_write_req->setTime(curTick);
3192623SN/A    data_write_req->setSize(sizeof(T));
3202623SN/A    data_write_req->setFlags(flags);
3212623SN/A
3222623SN/A    if (traceData) {
3232623SN/A        traceData->setAddr(addr);
3242623SN/A    }
3252623SN/A
3262623SN/A    // translate to physical address
3272623SN/A    Fault fault = cpuXC->translateDataWriteReq(data_write_req);
3282623SN/A
3292623SN/A    // Now do the access.
3302623SN/A    if (fault == NoFault) {
3312623SN/A        data = htog(data);
3322662Sstever@eecs.umich.edu        data_write_pkt->reinitFromRequest();
3332623SN/A        data_write_pkt->dataStatic(&data);
3342623SN/A
3352662Sstever@eecs.umich.edu        dcache_latency = dcachePort.sendAtomic(data_write_pkt);
3362623SN/A        dcache_access = true;
3372623SN/A
3382641Sstever@eecs.umich.edu        assert(data_write_pkt->result == Packet::Success);
3392631SN/A
3402631SN/A        if (res && data_write_req->getFlags() & LOCKED) {
3412631SN/A            *res = data_write_req->getScResult();
3422631SN/A        }
3432623SN/A    }
3442623SN/A
3452623SN/A    // This will need a new way to tell if it's hooked up to a cache or not.
3462623SN/A    if (data_write_req->getFlags() & UNCACHEABLE)
3472623SN/A        recordEvent("Uncached Write");
3482623SN/A
3492623SN/A    // If the write needs to have a fault on the access, consider calling
3502623SN/A    // changeStatus() and changing it to "bad addr write" or something.
3512623SN/A    return fault;
3522623SN/A}
3532623SN/A
3542623SN/A
3552623SN/A#ifndef DOXYGEN_SHOULD_SKIP_THIS
3562623SN/Atemplate
3572623SN/AFault
3582623SN/AAtomicSimpleCPU::write(uint64_t data, Addr addr,
3592623SN/A                       unsigned flags, uint64_t *res);
3602623SN/A
3612623SN/Atemplate
3622623SN/AFault
3632623SN/AAtomicSimpleCPU::write(uint32_t data, Addr addr,
3642623SN/A                       unsigned flags, uint64_t *res);
3652623SN/A
3662623SN/Atemplate
3672623SN/AFault
3682623SN/AAtomicSimpleCPU::write(uint16_t data, Addr addr,
3692623SN/A                       unsigned flags, uint64_t *res);
3702623SN/A
3712623SN/Atemplate
3722623SN/AFault
3732623SN/AAtomicSimpleCPU::write(uint8_t data, Addr addr,
3742623SN/A                       unsigned flags, uint64_t *res);
3752623SN/A
3762623SN/A#endif //DOXYGEN_SHOULD_SKIP_THIS
3772623SN/A
3782623SN/Atemplate<>
3792623SN/AFault
3802623SN/AAtomicSimpleCPU::write(double data, Addr addr, unsigned flags, uint64_t *res)
3812623SN/A{
3822623SN/A    return write(*(uint64_t*)&data, addr, flags, res);
3832623SN/A}
3842623SN/A
3852623SN/Atemplate<>
3862623SN/AFault
3872623SN/AAtomicSimpleCPU::write(float data, Addr addr, unsigned flags, uint64_t *res)
3882623SN/A{
3892623SN/A    return write(*(uint32_t*)&data, addr, flags, res);
3902623SN/A}
3912623SN/A
3922623SN/A
3932623SN/Atemplate<>
3942623SN/AFault
3952623SN/AAtomicSimpleCPU::write(int32_t data, Addr addr, unsigned flags, uint64_t *res)
3962623SN/A{
3972623SN/A    return write((uint32_t)data, addr, flags, res);
3982623SN/A}
3992623SN/A
4002623SN/A
4012623SN/Avoid
4022623SN/AAtomicSimpleCPU::tick()
4032623SN/A{
4042623SN/A    Tick latency = cycles(1); // instruction takes one cycle by default
4052623SN/A
4062623SN/A    for (int i = 0; i < width; ++i) {
4072623SN/A        numCycles++;
4082623SN/A
4092626SN/A        checkForInterrupts();
4102626SN/A
4112623SN/A        ifetch_req->resetMin();
4122662Sstever@eecs.umich.edu        Fault fault = setupFetchRequest(ifetch_req);
4132623SN/A
4142623SN/A        if (fault == NoFault) {
4152662Sstever@eecs.umich.edu            ifetch_pkt->reinitFromRequest();
4162662Sstever@eecs.umich.edu
4172662Sstever@eecs.umich.edu            Tick icache_latency = icachePort.sendAtomic(ifetch_pkt);
4182623SN/A            // ifetch_req is initialized to read the instruction directly
4192623SN/A            // into the CPU object's inst field.
4202623SN/A
4212623SN/A            dcache_access = false; // assume no dcache access
4222623SN/A            preExecute();
4232623SN/A            fault = curStaticInst->execute(this, traceData);
4242623SN/A            postExecute();
4252623SN/A
4262623SN/A            if (simulate_stalls) {
4272623SN/A                // This calculation assumes that the icache and dcache
4282623SN/A                // access latencies are always a multiple of the CPU's
4292623SN/A                // cycle time.  If not, the next tick event may get
4302623SN/A                // scheduled at a non-integer multiple of the CPU
4312623SN/A                // cycle time.
4322662Sstever@eecs.umich.edu                Tick icache_stall = icache_latency - cycles(1);
4332623SN/A                Tick dcache_stall =
4342662Sstever@eecs.umich.edu                    dcache_access ? dcache_latency - cycles(1) : 0;
4352623SN/A                latency += icache_stall + dcache_stall;
4362623SN/A            }
4372623SN/A
4382623SN/A        }
4392623SN/A
4402623SN/A        advancePC(fault);
4412623SN/A    }
4422623SN/A
4432626SN/A    if (_status != Idle)
4442626SN/A        tickEvent.schedule(curTick + latency);
4452623SN/A}
4462623SN/A
4472623SN/A
4482623SN/A////////////////////////////////////////////////////////////////////////
4492623SN/A//
4502623SN/A//  AtomicSimpleCPU Simulation Object
4512623SN/A//
4522623SN/ABEGIN_DECLARE_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
4532623SN/A
4542623SN/A    Param<Counter> max_insts_any_thread;
4552623SN/A    Param<Counter> max_insts_all_threads;
4562623SN/A    Param<Counter> max_loads_any_thread;
4572623SN/A    Param<Counter> max_loads_all_threads;
4582623SN/A    SimObjectParam<MemObject *> mem;
4592623SN/A
4602623SN/A#if FULL_SYSTEM
4612623SN/A    SimObjectParam<AlphaITB *> itb;
4622623SN/A    SimObjectParam<AlphaDTB *> dtb;
4632623SN/A    SimObjectParam<System *> system;
4642623SN/A    Param<int> cpu_id;
4652623SN/A    Param<Tick> profile;
4662623SN/A#else
4672623SN/A    SimObjectParam<Process *> workload;
4682623SN/A#endif // FULL_SYSTEM
4692623SN/A
4702623SN/A    Param<int> clock;
4712623SN/A
4722623SN/A    Param<bool> defer_registration;
4732623SN/A    Param<int> width;
4742623SN/A    Param<bool> function_trace;
4752623SN/A    Param<Tick> function_trace_start;
4762623SN/A    Param<bool> simulate_stalls;
4772623SN/A
4782623SN/AEND_DECLARE_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
4792623SN/A
4802623SN/ABEGIN_INIT_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
4812623SN/A
4822623SN/A    INIT_PARAM(max_insts_any_thread,
4832623SN/A               "terminate when any thread reaches this inst count"),
4842623SN/A    INIT_PARAM(max_insts_all_threads,
4852623SN/A               "terminate when all threads have reached this inst count"),
4862623SN/A    INIT_PARAM(max_loads_any_thread,
4872623SN/A               "terminate when any thread reaches this load count"),
4882623SN/A    INIT_PARAM(max_loads_all_threads,
4892623SN/A               "terminate when all threads have reached this load count"),
4902623SN/A    INIT_PARAM(mem, "memory"),
4912623SN/A
4922623SN/A#if FULL_SYSTEM
4932623SN/A    INIT_PARAM(itb, "Instruction TLB"),
4942623SN/A    INIT_PARAM(dtb, "Data TLB"),
4952623SN/A    INIT_PARAM(system, "system object"),
4962623SN/A    INIT_PARAM(cpu_id, "processor ID"),
4972623SN/A    INIT_PARAM(profile, ""),
4982623SN/A#else
4992623SN/A    INIT_PARAM(workload, "processes to run"),
5002623SN/A#endif // FULL_SYSTEM
5012623SN/A
5022623SN/A    INIT_PARAM(clock, "clock speed"),
5032623SN/A    INIT_PARAM(defer_registration, "defer system registration (for sampling)"),
5042623SN/A    INIT_PARAM(width, "cpu width"),
5052623SN/A    INIT_PARAM(function_trace, "Enable function trace"),
5062623SN/A    INIT_PARAM(function_trace_start, "Cycle to start function trace"),
5072623SN/A    INIT_PARAM(simulate_stalls, "Simulate cache stall cycles")
5082623SN/A
5092623SN/AEND_INIT_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
5102623SN/A
5112623SN/A
5122623SN/ACREATE_SIM_OBJECT(AtomicSimpleCPU)
5132623SN/A{
5142623SN/A    AtomicSimpleCPU::Params *params = new AtomicSimpleCPU::Params();
5152623SN/A    params->name = getInstanceName();
5162623SN/A    params->numberOfThreads = 1;
5172623SN/A    params->max_insts_any_thread = max_insts_any_thread;
5182623SN/A    params->max_insts_all_threads = max_insts_all_threads;
5192623SN/A    params->max_loads_any_thread = max_loads_any_thread;
5202623SN/A    params->max_loads_all_threads = max_loads_all_threads;
5212623SN/A    params->deferRegistration = defer_registration;
5222623SN/A    params->clock = clock;
5232623SN/A    params->functionTrace = function_trace;
5242623SN/A    params->functionTraceStart = function_trace_start;
5252623SN/A    params->width = width;
5262623SN/A    params->simulate_stalls = simulate_stalls;
5272623SN/A    params->mem = mem;
5282623SN/A
5292623SN/A#if FULL_SYSTEM
5302623SN/A    params->itb = itb;
5312623SN/A    params->dtb = dtb;
5322623SN/A    params->system = system;
5332623SN/A    params->cpu_id = cpu_id;
5342623SN/A    params->profile = profile;
5352623SN/A#else
5362623SN/A    params->process = workload;
5372623SN/A#endif
5382623SN/A
5392623SN/A    AtomicSimpleCPU *cpu = new AtomicSimpleCPU(params);
5402623SN/A    return cpu;
5412623SN/A}
5422623SN/A
5432623SN/AREGISTER_SIM_OBJECT("AtomicSimpleCPU", AtomicSimpleCPU)
5442623SN/A
545