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 |
74GlobalSimLoopExitEvent *simulate_limit_event = nullptr; |
75 76/** Simulate for num_cycles additional cycles. If num_cycles is -1 77 * (the default), do not limit simulation; some other event must 78 * terminate the loop. Exported to Python via SWIG. 79 * @return The SimLoopExitEvent that caused the loop to exit. 80 */ 81GlobalSimLoopExitEvent * 82simulate(Tick num_cycles) --- 10 unchanged lines hidden (view full) --- 93 // the main thread (the one we're currently running on) 94 // handles queue 0, so we only need to allocate new threads 95 // for queues 1..N-1. We'll call these the "subordinate" threads. 96 for (uint32_t i = 1; i < numMainEventQueues; i++) { 97 threads.push_back(new std::thread(thread_loop, mainEventQueue[i])); 98 } 99 100 threads_initialized = true; |
101 simulate_limit_event = 102 new GlobalSimLoopExitEvent(mainEventQueue[0]->getCurTick(), 103 "simulate() limit reached", 0); |
104 } 105 106 inform("Entering event queue @ %d. Starting simulation...\n", curTick()); 107 108 if (num_cycles < MaxTick - curTick()) 109 num_cycles = curTick() + num_cycles; 110 else // counter would roll over or be set to MaxTick anyhow 111 num_cycles = MaxTick; 112 |
113 simulate_limit_event->reschedule(num_cycles); |
114 115 GlobalSyncEvent *quantum_event = NULL; 116 if (numMainEventQueues > 1) { 117 if (simQuantum == 0) { 118 fatal("Quantum for multi-eventq simulation not specified"); 119 } 120 121 quantum_event = new GlobalSyncEvent(curTick() + simQuantum, simQuantum, --- 104 unchanged lines hidden --- |