Deleted Added
sdiff udiff text old ( 10670:3bfbaefa3844 ) new ( 10756:f9c0692f73ec )
full compact
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * Copyright (c) 2013 Mark D. Hill and David A. Wood
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

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

66thread_loop(EventQueue *queue)
67{
68 while (true) {
69 threadBarrier->wait();
70 doSimLoop(queue);
71 }
72}
73
74GlobalEvent*
75getLimitEvent(void) {
76 static GlobalSimLoopExitEvent
77 simulate_limit_event(mainEventQueue[0]->getCurTick(),
78 "simulate() limit reached", 0);
79 return &simulate_limit_event;
80}
81
82/** Simulate for num_cycles additional cycles. If num_cycles is -1
83 * (the default), do not limit simulation; some other event must
84 * terminate the loop. Exported to Python via SWIG.
85 * @return The SimLoopExitEvent that caused the loop to exit.
86 */
87GlobalSimLoopExitEvent *
88simulate(Tick num_cycles)
89{

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

108
109 inform("Entering event queue @ %d. Starting simulation...\n", curTick());
110
111 if (num_cycles < MaxTick - curTick())
112 num_cycles = curTick() + num_cycles;
113 else // counter would roll over or be set to MaxTick anyhow
114 num_cycles = MaxTick;
115
116 getLimitEvent()->reschedule(num_cycles);
117
118 GlobalSyncEvent *quantum_event = NULL;
119 if (numMainEventQueues > 1) {
120 if (simQuantum == 0) {
121 fatal("Quantum for multi-eventq simulation not specified");
122 }
123
124 quantum_event = new GlobalSyncEvent(curTick() + simQuantum, simQuantum,

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

139 // locate the global exit event and return it to Python
140 BaseGlobalEvent *global_event = local_event->globalEvent();
141 assert(global_event != NULL);
142
143 GlobalSimLoopExitEvent *global_exit_event =
144 dynamic_cast<GlobalSimLoopExitEvent *>(global_event);
145 assert(global_exit_event != NULL);
146
147 //! Delete the simulation quantum event.
148 if (quantum_event != NULL) {
149 quantum_event->deschedule();
150 delete quantum_event;
151 }
152
153 return global_exit_event;
154}

--- 74 unchanged lines hidden ---