-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.py
60 lines (50 loc) · 1.92 KB
/
commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## Copyright 2000-2007 Virtutech AB
##
## The contents herein are Source Code which are a subset of Licensed
## Software pursuant to the terms of the Virtutech Simics Software
## License Agreement (the "Agreement"), and are being distributed under
## the Agreement. You should have received a copy of the Agreement with
## this Licensed Software; if not, please contact Virtutech for a copy
## of the Agreement prior to using this Licensed Software.
##
## By using this Source Code, you agree to be bound by all of the terms
## of the Agreement, and use of this Source Code is subject to the terms
## the Agreement.
##
## This Source Code and any derivatives thereof are provided on an "as
## is" basis. Virtutech makes no warranties with respect to the Source
## Code or any derivatives thereof and disclaims all implied warranties,
## including, without limitation, warranties of merchantability and
## fitness for a particular purpose and non-infringement.
from cli import *
import sim_commands
# increment command
def increment_value_cmd(obj):
try:
obj.value += 1
print "The new counter value is:", obj.value
except Exception, msg:
print "Error incrementing counter:", msg
new_command("increment", increment_value_cmd, [],
alias = "",
type = "transmem commands",
short = "increment value",
namespace = "transmem",
doc = """
Increments the value by adding 1 to it.
""")
#
# ------------------------ info -----------------------
#
def get_info(obj):
# USER-TODO: Return something useful here
return []
sim_commands.new_info_command('transmem', get_info)
#
# ------------------------ status -----------------------
#
def get_status(obj):
# USER-TODO: Return something useful here
return [("Internals",
[("Attribute 'value'", SIM_get_attribute(obj, "value"))])]
sim_commands.new_status_command('transmem', get_status)