# ========== Copyright Header Begin ==========================================
# OpenSPARC T2 Processor File: SamCmd.py
# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
# The above named program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation.
# The above named program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public
# License along with this work; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# ========== Copyright Header End ============================================
# print all sam py commands
print "stepi (n=1,cpu=-1,file=" ")"
print "mem (start_addr=0,size=8)"
print "mem_dis (sstart_addr=0,size=8)"
print "mem_va (start_addr=0,size=8)"
print "mem_va_dis (start_addr=0,size=8)"
print "write (value,addr)"
print "setreg (regname,value)"
print "sam_help (command=" ")"
print "rg (cpu= 0, gl = -1)"
print "rw (cpu= 0, wp = -1)"
print "rtr (cpu= 0, tl = -1)"
print "break_pc (pc_va, cpu_id|all) - set a breakpoint on pc value"
print "break_opcode (opcode, cpu_id|all) - set a breakpoint on opcode"
print "bplist() -list all breakpoints"
print "dbreak (bp_id='all', cpu='all') - delete a breakpoint"
print "file - run <script file name>"
print "load - load <mode> <addr> <value>"
print "console-send - console-send <string>"}
print "exper - exper <N>"
print "stepim - stepim <N>"
print "stept - stept <Msecs>"
print "on - on STOP <command>"
print "rdt - rdt [<FILE>]"
print "diskdelay - diskdelay [ddelay[/wrddelay]] [start_cycle]"
print "time - time start | stop"
print "resume - back to prev sync mode"
print "alias - alias [<old cmd>] [<new cmd>] "
print "penable - penable [-all | <thN>]"
print "pdisable -pdisable [-all | <thN>]"
# simulator current version
# stepi [<ninstr>] [-t [cpuid]] [-o <file_name>]
def stepi (n
=1,cpu
=-1,file=" "):
# read mem from physical start_addr, Size bytes
def mem (start_addr
=0,size
=8):
cmd
= "mem -a "+str(start_addr
)+" -s "+str(size
)
# read mem from virtual start_addr, Size bytes
def mem_va (start_addr
=0,size
=8):
cmd
= "mem -a "+str(start_addr
)+" -s "+str(size
)+" -va"
# disassemble mem from virtual start_addr, Size bytes
def mem_va_dis (start_addr
=0,size
=8):
cmd
= "mem -a "+str(start_addr
)+" -s "+str(size
)+" -va -dis"
# disassemble mem from physical start_addr, Size bytes
def mem_dis (start_addr
=0,size
=8):
cmd
= "mem -a "+str(start_addr
)+" -s "+str(size
)+" -dis"
# write word <value> <paddr>
cmd
= "write word "+str(value
)+" "+str(addr
)
# setreg <regname> <value>
def setreg (regname
,value
):
cmd
= "setreg "+regname
+" "+str(value
)
def sam_help (command
=" "):
sam
.ui_exec("help "+command
);
# display current pc values
# display cpu global regs
def rg (cpu
= 0, gl
= -1):
cmd
= "r -cpu "+str(cpu
)+" -g "+str(gl
)
def rw (cpu
= 0, wp
= -1):
cmd
= "r -cpu "+str(cpu
)+" -w "+str(wp
)
def rtr (cpu
= 0, tl
= -1):
cmd
= "r -cpu "+str(cpu
)+" -w "+str(tl
)
# display floating point regs
cmd
= "r -cpu "+str(cpu
)+" -f"
# display double floating point regs
cmd
= "r -cpu "+str(cpu
)+" -df"
cmd
= "r -cpu "+str(cpu
)+" -pr"
cmd
= "r -cpu "+str(cpu
)+" -asr"
# display hypervisor regs
cmd
= "r -cpu "+str(cpu
)+" -hpr"
# set a breakpoint on pc value
def break_pc (pc
, cpu
= 0):
cmd
= "break cpu="+str(cpu
)+" pc="+str(pc
)
# set a breakpoint on opcode value
def break_opcode (opcode
, cpu
= 0):
cmd
= "break cpu="+str(cpu
)+" opcode="+str(opcode
)
def dbreak (bp_id
="all", cpu
="all"):
cmd
= "dbreak cpu="+str(cpu
)
cmd
+= " bp_id="+str(bp_id
)