simulate.cc (7823:dac01f14f20f) simulate.cc (9174:2171e04a2ee5)
1/*
2 * Copyright (c) 2006 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;

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

44 * terminate the loop. Exported to Python via SWIG.
45 * @return The SimLoopExitEvent that caused the loop to exit.
46 */
47SimLoopExitEvent *
48simulate(Tick num_cycles)
49{
50 inform("Entering event queue @ %d. Starting simulation...\n", curTick());
51
1/*
2 * Copyright (c) 2006 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;

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

44 * terminate the loop. Exported to Python via SWIG.
45 * @return The SimLoopExitEvent that caused the loop to exit.
46 */
47SimLoopExitEvent *
48simulate(Tick num_cycles)
49{
50 inform("Entering event queue @ %d. Starting simulation...\n", curTick());
51
52 if (num_cycles < 0)
53 fatal("simulate: num_cycles must be >= 0 (was %d)\n", num_cycles);
54 else if (curTick() + num_cycles < 0) //Overflow
55 num_cycles = MaxTick;
56 else
52 if (num_cycles < MaxTick - curTick())
57 num_cycles = curTick() + num_cycles;
53 num_cycles = curTick() + num_cycles;
54 else // counter would roll over or be set to MaxTick anyhow
55 num_cycles = MaxTick;
58
59 Event *limit_event =
60 new SimLoopExitEvent("simulate() limit reached", 0);
61 mainEventQueue.schedule(limit_event, num_cycles);
62
63 while (1) {
64 // there should always be at least one event (the SimLoopExitEvent
65 // we just scheduled) in the queue

--- 56 unchanged lines hidden ---
56
57 Event *limit_event =
58 new SimLoopExitEvent("simulate() limit reached", 0);
59 mainEventQueue.schedule(limit_event, num_cycles);
60
61 while (1) {
62 // there should always be at least one event (the SimLoopExitEvent
63 // we just scheduled) in the queue

--- 56 unchanged lines hidden ---