atomic.cc (2901:f9a45473ab55) atomic.cc (2915:1f4d02556ac1)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 19 unchanged lines hidden (view full) ---

28 * Authors: Steve Reinhardt
29 */
30
31#include "arch/utility.hh"
32#include "cpu/exetrace.hh"
33#include "cpu/simple/atomic.hh"
34#include "mem/packet_impl.hh"
35#include "sim/builder.hh"
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 19 unchanged lines hidden (view full) ---

28 * Authors: Steve Reinhardt
29 */
30
31#include "arch/utility.hh"
32#include "cpu/exetrace.hh"
33#include "cpu/simple/atomic.hh"
34#include "mem/packet_impl.hh"
35#include "sim/builder.hh"
36#include "sim/system.hh"
37
38using namespace std;
39using namespace TheISA;
40
41AtomicSimpleCPU::TickEvent::TickEvent(AtomicSimpleCPU *c)
42 : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c)
43{
44}

--- 109 unchanged lines hidden (view full) ---

154
155AtomicSimpleCPU::~AtomicSimpleCPU()
156{
157}
158
159void
160AtomicSimpleCPU::serialize(ostream &os)
161{
36
37using namespace std;
38using namespace TheISA;
39
40AtomicSimpleCPU::TickEvent::TickEvent(AtomicSimpleCPU *c)
41 : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c)
42{
43}

--- 109 unchanged lines hidden (view full) ---

153
154AtomicSimpleCPU::~AtomicSimpleCPU()
155{
156}
157
158void
159AtomicSimpleCPU::serialize(ostream &os)
160{
162 SERIALIZE_ENUM(_status);
163 BaseSimpleCPU::serialize(os);
161 SimObject::State so_state = SimObject::getState();
162 SERIALIZE_ENUM(so_state);
164 nameOut(os, csprintf("%s.tickEvent", name()));
165 tickEvent.serialize(os);
163 nameOut(os, csprintf("%s.tickEvent", name()));
164 tickEvent.serialize(os);
165 BaseSimpleCPU::serialize(os);
166}
167
168void
169AtomicSimpleCPU::unserialize(Checkpoint *cp, const string &section)
170{
166}
167
168void
169AtomicSimpleCPU::unserialize(Checkpoint *cp, const string &section)
170{
171 UNSERIALIZE_ENUM(_status);
172 BaseSimpleCPU::unserialize(cp, section);
171 SimObject::State so_state;
172 UNSERIALIZE_ENUM(so_state);
173 tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
173 tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
174 BaseSimpleCPU::unserialize(cp, section);
174}
175
176void
177AtomicSimpleCPU::resume()
178{
175}
176
177void
178AtomicSimpleCPU::resume()
179{
179 assert(system->getMemoryMode() == System::Atomic);
180 changeState(SimObject::Running);
180 if (thread->status() == ThreadContext::Active) {
181 if (!tickEvent.scheduled())
182 tickEvent.schedule(curTick);
183 }
181}
182
183void
184AtomicSimpleCPU::switchOut()
185{
186 assert(status() == Running || status() == Idle);
187 _status = SwitchedOut;
188

--- 265 unchanged lines hidden (view full) ---

454//
455BEGIN_DECLARE_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
456
457 Param<Counter> max_insts_any_thread;
458 Param<Counter> max_insts_all_threads;
459 Param<Counter> max_loads_any_thread;
460 Param<Counter> max_loads_all_threads;
461 SimObjectParam<MemObject *> mem;
184}
185
186void
187AtomicSimpleCPU::switchOut()
188{
189 assert(status() == Running || status() == Idle);
190 _status = SwitchedOut;
191

--- 265 unchanged lines hidden (view full) ---

457//
458BEGIN_DECLARE_SIM_OBJECT_PARAMS(AtomicSimpleCPU)
459
460 Param<Counter> max_insts_any_thread;
461 Param<Counter> max_insts_all_threads;
462 Param<Counter> max_loads_any_thread;
463 Param<Counter> max_loads_all_threads;
464 SimObjectParam<MemObject *> mem;
462 SimObjectParam<System *> system;
463
464#if FULL_SYSTEM
465 SimObjectParam<AlphaITB *> itb;
466 SimObjectParam<AlphaDTB *> dtb;
465
466#if FULL_SYSTEM
467 SimObjectParam<AlphaITB *> itb;
468 SimObjectParam<AlphaDTB *> dtb;
469 SimObjectParam<System *> system;
467 Param<int> cpu_id;
468 Param<Tick> profile;
469#else
470 SimObjectParam<Process *> workload;
471#endif // FULL_SYSTEM
472
473 Param<int> clock;
474

--- 11 unchanged lines hidden (view full) ---

486 "terminate when any thread reaches this inst count"),
487 INIT_PARAM(max_insts_all_threads,
488 "terminate when all threads have reached this inst count"),
489 INIT_PARAM(max_loads_any_thread,
490 "terminate when any thread reaches this load count"),
491 INIT_PARAM(max_loads_all_threads,
492 "terminate when all threads have reached this load count"),
493 INIT_PARAM(mem, "memory"),
470 Param<int> cpu_id;
471 Param<Tick> profile;
472#else
473 SimObjectParam<Process *> workload;
474#endif // FULL_SYSTEM
475
476 Param<int> clock;
477

--- 11 unchanged lines hidden (view full) ---

489 "terminate when any thread reaches this inst count"),
490 INIT_PARAM(max_insts_all_threads,
491 "terminate when all threads have reached this inst count"),
492 INIT_PARAM(max_loads_any_thread,
493 "terminate when any thread reaches this load count"),
494 INIT_PARAM(max_loads_all_threads,
495 "terminate when all threads have reached this load count"),
496 INIT_PARAM(mem, "memory"),
494 INIT_PARAM(system, "system object"),
495
496#if FULL_SYSTEM
497 INIT_PARAM(itb, "Instruction TLB"),
498 INIT_PARAM(dtb, "Data TLB"),
497
498#if FULL_SYSTEM
499 INIT_PARAM(itb, "Instruction TLB"),
500 INIT_PARAM(dtb, "Data TLB"),
501 INIT_PARAM(system, "system object"),
499 INIT_PARAM(cpu_id, "processor ID"),
500 INIT_PARAM(profile, ""),
501#else
502 INIT_PARAM(workload, "processes to run"),
503#endif // FULL_SYSTEM
504
505 INIT_PARAM(clock, "clock speed"),
506 INIT_PARAM(defer_registration, "defer system registration (for sampling)"),

--- 16 unchanged lines hidden (view full) ---

523 params->max_loads_all_threads = max_loads_all_threads;
524 params->deferRegistration = defer_registration;
525 params->clock = clock;
526 params->functionTrace = function_trace;
527 params->functionTraceStart = function_trace_start;
528 params->width = width;
529 params->simulate_stalls = simulate_stalls;
530 params->mem = mem;
502 INIT_PARAM(cpu_id, "processor ID"),
503 INIT_PARAM(profile, ""),
504#else
505 INIT_PARAM(workload, "processes to run"),
506#endif // FULL_SYSTEM
507
508 INIT_PARAM(clock, "clock speed"),
509 INIT_PARAM(defer_registration, "defer system registration (for sampling)"),

--- 16 unchanged lines hidden (view full) ---

526 params->max_loads_all_threads = max_loads_all_threads;
527 params->deferRegistration = defer_registration;
528 params->clock = clock;
529 params->functionTrace = function_trace;
530 params->functionTraceStart = function_trace_start;
531 params->width = width;
532 params->simulate_stalls = simulate_stalls;
533 params->mem = mem;
531 params->system = system;
532
533#if FULL_SYSTEM
534 params->itb = itb;
535 params->dtb = dtb;
534
535#if FULL_SYSTEM
536 params->itb = itb;
537 params->dtb = dtb;
538 params->system = system;
536 params->cpu_id = cpu_id;
537 params->profile = profile;
538#else
539 params->process = workload;
540#endif
541
542 AtomicSimpleCPU *cpu = new AtomicSimpleCPU(params);
543 return cpu;
544}
545
546REGISTER_SIM_OBJECT("AtomicSimpleCPU", AtomicSimpleCPU)
547
539 params->cpu_id = cpu_id;
540 params->profile = profile;
541#else
542 params->process = workload;
543#endif
544
545 AtomicSimpleCPU *cpu = new AtomicSimpleCPU(params);
546 return cpu;
547}
548
549REGISTER_SIM_OBJECT("AtomicSimpleCPU", AtomicSimpleCPU)
550