Deleted Added
sdiff udiff text old ( 12041:52b3b120dbc0 ) new ( 12563:8d59ed22ae79 )
full compact
1# Copyright (c) 2017 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

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

35# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40#
41# Authors: Nathan Binkert
42
43from __future__ import print_function
44
45import m5
46import _m5.event
47
48from _m5.event import GlobalSimLoopExitEvent as SimExit
49from _m5.event import PyEvent as Event
50from _m5.event import getEventQueue, setEventQueue
51
52mainq = None

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

73class ProgressEvent(Event):
74 def __init__(self, eventq, period):
75 super(ProgressEvent, self).__init__()
76 self.period = int(period)
77 self.eventq = eventq
78 self.eventq.schedule(self, m5.curTick() + self.period)
79
80 def __call__(self):
81 print("Progress! Time now %fs" % (m5.curTick()/1e12))
82 self.eventq.schedule(self, m5.curTick() + self.period)
83
84
85def create(func, priority=Event.Default_Pri):
86 """Create an Event from a function"""
87
88 return EventWrapper(func, priority=priority)
89
90__all__ = [ 'Event', 'EventWrapper', 'ProgressEvent', 'SimExit',
91 'mainq', 'create' ]