atomic.cc revision 2657
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) {
2532623SN/A        data_read_pkt->reset();
2542641Sstever@eecs.umich.edu        data_read_pkt->reinitFromRequest();
2552623SN/A
2562630SN/A        dcache_complete = dcachePort.sendAtomic(data_read_pkt);
2572623SN/A        dcache_access = true;
2582623SN/A
2592641Sstever@eecs.umich.edu        assert(data_read_pkt->result == Packet::Success);
2602623SN/A        data = data_read_pkt->get<T>();
2612623SN/A
2622623SN/A    }
2632623SN/A
2642623SN/A    // This will need a new way to tell if it has a dcache attached.
2652623SN/A    if (data_read_req->getFlags() & UNCACHEABLE)
2662623SN/A        recordEvent("Uncached Read");
2672623SN/A
2682623SN/A    return fault;
2692623SN/A}
2702623SN/A
2712623SN/A#ifndef DOXYGEN_SHOULD_SKIP_THIS
2722623SN/A
2732623SN/Atemplate
2742623SN/AFault
2752623SN/AAtomicSimpleCPU::read(Addr addr, uint64_t &data, unsigned flags);
2762623SN/A
2772623SN/Atemplate
2782623SN/AFault
2792623SN/AAtomicSimpleCPU::read(Addr addr, uint32_t &data, unsigned flags);
2802623SN/A
2812623SN/Atemplate
2822623SN/AFault
2832623SN/AAtomicSimpleCPU::read(Addr addr, uint16_t &data, unsigned flags);
2842623SN/A
2852623SN/Atemplate
2862623SN/AFault
2872623SN/AAtomicSimpleCPU::read(Addr addr, uint8_t &data, unsigned flags);
2882623SN/A
2892623SN/A#endif //DOXYGEN_SHOULD_SKIP_THIS
2902623SN/A
2912623SN/Atemplate<>
2922623SN/AFault
2932623SN/AAtomicSimpleCPU::read(Addr addr, double &data, unsigned flags)
2942623SN/A{
2952623SN/A    return read(addr, *(uint64_t*)&data, flags);
2962623SN/A}
2972623SN/A
2982623SN/Atemplate<>
2992623SN/AFault
3002623SN/AAtomicSimpleCPU::read(Addr addr, float &data, unsigned flags)
3012623SN/A{
3022623SN/A    return read(addr, *(uint32_t*)&data, flags);
3032623SN/A}
3042623SN/A
3052623SN/A
3062623SN/Atemplate<>
3072623SN/AFault
3082623SN/AAtomicSimpleCPU::read(Addr addr, int32_t &data, unsigned flags)
3092623SN/A{
3102623SN/A    return read(addr, (uint32_t&)data, flags);
3112623SN/A}
3122623SN/A
3132623SN/A
3142623SN/Atemplate <class T>
3152623SN/AFault
3162623SN/AAtomicSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
3172623SN/A{
3182623SN/A    data_write_req->setVaddr(addr);
3192623SN/A    data_write_req->setTime(curTick);
3202623SN/A    data_write_req->setSize(sizeof(T));
3212623SN/A    data_write_req->setFlags(flags);
3222623SN/A
3232623SN/A    if (traceData) {
3242623SN/A        traceData->setAddr(addr);
3252623SN/A    }
3262623SN/A
3272623SN/A    // translate to physical address
3282623SN/A    Fault fault = cpuXC->translateDataWriteReq(data_write_req);
3292623SN/A
3302623SN/A    // Now do the access.
3312623SN/A    if (fault == NoFault) {
3322623SN/A        data_write_pkt->reset();
3332623SN/A        data = htog(data);
3342623SN/A        data_write_pkt->dataStatic(&data);
3352641Sstever@eecs.umich.edu        data_write_pkt->reinitFromRequest();
3362623SN/A
3372630SN/A        dcache_complete = dcachePort.sendAtomic(data_write_pkt);
3382623SN/A        dcache_access = true;
3392623SN/A
3402641Sstever@eecs.umich.edu        assert(data_write_pkt->result == Packet::Success);
3412631SN/A
3422631SN/A        if (res && data_write_req->getFlags() & LOCKED) {
3432631SN/A            *res = data_write_req->getScResult();
3442631SN/A        }
3452623SN/A    }
3462623SN/A
3472623SN/A    // This will need a new way to tell if it's hooked up to a cache or not.
3482623SN/A    if (data_write_req->getFlags() & UNCACHEABLE)
3492623SN/A        recordEvent("Uncached Write");
3502623SN/A
3512623SN/A    // If the write needs to have a fault on the access, consider calling
3522623SN/A    // changeStatus() and changing it to "bad addr write" or something.
3532623SN/A    return fault;
3542623SN/A}
3552623SN/A
3562623SN/A
3572623SN/A#ifndef DOXYGEN_SHOULD_SKIP_THIS
3582623SN/Atemplate
3592623SN/AFault
3602623SN/AAtomicSimpleCPU::write(uint64_t data, Addr addr,
3612623SN/A                       unsigned flags, uint64_t *res);
3622623SN/A
3632623SN/Atemplate
3642623SN/AFault
3652623SN/AAtomicSimpleCPU::write(uint32_t data, Addr addr,
3662623SN/A                       unsigned flags, uint64_t *res);
3672623SN/A
3682623SN/Atemplate
3692623SN/AFault
3702623SN/AAtomicSimpleCPU::write(uint16_t data, Addr addr,
3712623SN/A                       unsigned flags, uint64_t *res);
3722623SN/A
3732623SN/Atemplate
3742623SN/AFault
3752623SN/AAtomicSimpleCPU::write(uint8_t data, Addr addr,
3762623SN/A                       unsigned flags, uint64_t *res);
3772623SN/A
3782623SN/A#endif //DOXYGEN_SHOULD_SKIP_THIS
3792623SN/A
3802623SN/Atemplate<>
3812623SN/AFault
3822623SN/AAtomicSimpleCPU::write(double data, Addr addr, unsigned flags, uint64_t *res)
3832623SN/A{
3842623SN/A    return write(*(uint64_t*)&data, addr, flags, res);
3852623SN/A}
3862623SN/A
3872623SN/Atemplate<>
3882623SN/AFault
3892623SN/AAtomicSimpleCPU::write(float data, Addr addr, unsigned flags, uint64_t *res)
3902623SN/A{
3912623SN/A    return write(*(uint32_t*)&data, addr, flags, res);
3922623SN/A}
3932623SN/A
3942623SN/A
3952623SN/Atemplate<>
3962623SN/AFault
3972623SN/AAtomicSimpleCPU::write(int32_t data, Addr addr, unsigned flags, uint64_t *res)
3982623SN/A{
3992623SN/A    return write((uint32_t)data, addr, flags, res);
4002623SN/A}
4012623SN/A
4022623SN/A
4032623SN/Avoid
4042623SN/AAtomicSimpleCPU::tick()
4052623SN/A{
4062623SN/A    Tick latency = cycles(1); // instruction takes one cycle by default
4072623SN/A
4082623SN/A    for (int i = 0; i < width; ++i) {
4092623SN/A        numCycles++;
4102623SN/A
4112626SN/A        checkForInterrupts();
4122626SN/A
4132623SN/A        ifetch_req->resetMin();
4142623SN/A        ifetch_pkt->reset();
4152623SN/A        Fault fault = setupFetchPacket(ifetch_pkt);
4162623SN/A
4172623SN/A        if (fault == NoFault) {
4182630SN/A            Tick icache_complete = icachePort.sendAtomic(ifetch_pkt);
4192623SN/A            // ifetch_req is initialized to read the instruction directly
4202623SN/A            // into the CPU object's inst field.
4212623SN/A
4222623SN/A            dcache_access = false; // assume no dcache access
4232623SN/A            preExecute();
4242623SN/A            fault = curStaticInst->execute(this, traceData);
4252623SN/A            postExecute();
4262623SN/A
4272623SN/A            if (simulate_stalls) {
4282623SN/A                // This calculation assumes that the icache and dcache
4292623SN/A                // access latencies are always a multiple of the CPU's
4302623SN/A                // cycle time.  If not, the next tick event may get
4312623SN/A                // scheduled at a non-integer multiple of the CPU
4322623SN/A                // cycle time.
4332623SN/A                Tick icache_stall = icache_complete - curTick - cycles(1);
4342623SN/A                Tick dcache_stall =
4352623SN/A                    dcache_access ? dcache_complete - curTick - cycles(1) : 0;
4362623SN/A                latency += icache_stall + dcache_stall;
4372623SN/A            }
4382623SN/A
4392623SN/A        }
4402623SN/A
4412623SN/A        advancePC(fault);
4422623SN/A    }
4432623SN/A
4442626SN/A    if (_status != Idle)
4452626SN/A        tickEvent.schedule(curTick + latency);
4462623SN/A}
4472623SN/A
4482623SN/A
4492623SN/A////////////////////////////////////////////////////////////////////////
4502623SN/A//
4512623SN/A//  AtomicSimpleCPU Simulation Object
4522623SN/A//
4532623SN/ABEGIN_DECLARE_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
4542623SN/A
4552623SN/A    Param<Counter> max_insts_any_thread;
4562623SN/A    Param<Counter> max_insts_all_threads;
4572623SN/A    Param<Counter> max_loads_any_thread;
4582623SN/A    Param<Counter> max_loads_all_threads;
4592623SN/A    SimObjectParam<MemObject *> mem;
4602623SN/A
4612623SN/A#if FULL_SYSTEM
4622623SN/A    SimObjectParam<AlphaITB *> itb;
4632623SN/A    SimObjectParam<AlphaDTB *> dtb;
4642623SN/A    SimObjectParam<System *> system;
4652623SN/A    Param<int> cpu_id;
4662623SN/A    Param<Tick> profile;
4672623SN/A#else
4682623SN/A    SimObjectParam<Process *> workload;
4692623SN/A#endif // FULL_SYSTEM
4702623SN/A
4712623SN/A    Param<int> clock;
4722623SN/A
4732623SN/A    Param<bool> defer_registration;
4742623SN/A    Param<int> width;
4752623SN/A    Param<bool> function_trace;
4762623SN/A    Param<Tick> function_trace_start;
4772623SN/A    Param<bool> simulate_stalls;
4782623SN/A
4792623SN/AEND_DECLARE_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
4802623SN/A
4812623SN/ABEGIN_INIT_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
4822623SN/A
4832623SN/A    INIT_PARAM(max_insts_any_thread,
4842623SN/A               "terminate when any thread reaches this inst count"),
4852623SN/A    INIT_PARAM(max_insts_all_threads,
4862623SN/A               "terminate when all threads have reached this inst count"),
4872623SN/A    INIT_PARAM(max_loads_any_thread,
4882623SN/A               "terminate when any thread reaches this load count"),
4892623SN/A    INIT_PARAM(max_loads_all_threads,
4902623SN/A               "terminate when all threads have reached this load count"),
4912623SN/A    INIT_PARAM(mem, "memory"),
4922623SN/A
4932623SN/A#if FULL_SYSTEM
4942623SN/A    INIT_PARAM(itb, "Instruction TLB"),
4952623SN/A    INIT_PARAM(dtb, "Data TLB"),
4962623SN/A    INIT_PARAM(system, "system object"),
4972623SN/A    INIT_PARAM(cpu_id, "processor ID"),
4982623SN/A    INIT_PARAM(profile, ""),
4992623SN/A#else
5002623SN/A    INIT_PARAM(workload, "processes to run"),
5012623SN/A#endif // FULL_SYSTEM
5022623SN/A
5032623SN/A    INIT_PARAM(clock, "clock speed"),
5042623SN/A    INIT_PARAM(defer_registration, "defer system registration (for sampling)"),
5052623SN/A    INIT_PARAM(width, "cpu width"),
5062623SN/A    INIT_PARAM(function_trace, "Enable function trace"),
5072623SN/A    INIT_PARAM(function_trace_start, "Cycle to start function trace"),
5082623SN/A    INIT_PARAM(simulate_stalls, "Simulate cache stall cycles")
5092623SN/A
5102623SN/AEND_INIT_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
5112623SN/A
5122623SN/A
5132623SN/ACREATE_SIM_OBJECT(AtomicSimpleCPU)
5142623SN/A{
5152623SN/A    AtomicSimpleCPU::Params *params = new AtomicSimpleCPU::Params();
5162623SN/A    params->name = getInstanceName();
5172623SN/A    params->numberOfThreads = 1;
5182623SN/A    params->max_insts_any_thread = max_insts_any_thread;
5192623SN/A    params->max_insts_all_threads = max_insts_all_threads;
5202623SN/A    params->max_loads_any_thread = max_loads_any_thread;
5212623SN/A    params->max_loads_all_threads = max_loads_all_threads;
5222623SN/A    params->deferRegistration = defer_registration;
5232623SN/A    params->clock = clock;
5242623SN/A    params->functionTrace = function_trace;
5252623SN/A    params->functionTraceStart = function_trace_start;
5262623SN/A    params->width = width;
5272623SN/A    params->simulate_stalls = simulate_stalls;
5282623SN/A    params->mem = mem;
5292623SN/A
5302623SN/A#if FULL_SYSTEM
5312623SN/A    params->itb = itb;
5322623SN/A    params->dtb = dtb;
5332623SN/A    params->system = system;
5342623SN/A    params->cpu_id = cpu_id;
5352623SN/A    params->profile = profile;
5362623SN/A#else
5372623SN/A    params->process = workload;
5382623SN/A#endif
5392623SN/A
5402623SN/A    AtomicSimpleCPU *cpu = new AtomicSimpleCPU(params);
5412623SN/A    return cpu;
5422623SN/A}
5432623SN/A
5442623SN/AREGISTER_SIM_OBJECT("AtomicSimpleCPU", AtomicSimpleCPU)
5452623SN/A
546