doc="""
Toggles trace mode<br/>
When active, lists all changes to TLB entries and to MMU registers.<br/>
""",
            filename="/mp/simics-3.0/src/devices/cheetah-mmu/commands.py",
            linenumber="429")

new_command("reverse-lookup",
            reverse_cmd, [arg(addr_t, "address")],
            alias="",
            type="%s commands" % device_name,
            short="check TLBs for reverse translation",
            namespace=device_name,
            see_also=["<%s>." % device_name + 'd-probe'],
            doc="""
List mappings in all TLBs that matches the specified physical address<br/>
""",
            filename="/mp/simics-3.0/src/devices/cheetah-mmu/commands.py",
            linenumber="440")

#
# ----------------- info command -----------------
#


def get_info(obj):
    return [(None, [('CPU', obj.cpu)])]


new_info_command(device_name, get_info)
Beispiel #2
0
    try:
        link_info += [("gateway", rn.gateway)]
    except:
        link_info += [("gateway", "<not set>")]

    doc = [(None,
            [("Type", type),
             ("Host access", access),
             ("Connected", iff(rn.connected, "Yes", "No"))]),
           ("Host Network", host_info)]
    if len(link_info) > 0:
        doc += [("Simulated Network", link_info)]
    return doc

for cls in rn_classes:
    sim_commands.new_info_command(cls, get_info)

#
# -------------- status --------------
#

def get_status(rn):
    return [(None,
             [("Connected", iff(rn.connected, "Yes", "No"))])]

for cls in rn_classes:
    sim_commands.new_status_command(cls, get_status)

#
# -------------- disconnect --------------
#
Beispiel #3
0
##  Copyright 2005-2007 Virtutech AB

from cli import *
import sim_commands
import string


def info(obj):
    return []


def status(obj):
    return [(None, [("Attribute a", "%d" % obj.a)])]


sim_commands.new_info_command("sample_device_dml", info)
sim_commands.new_status_command("sample_device_dml", status)
new_command("root",
            root_cmd, [arg(filename_t(dirs=1, exist=1), "dir", "?", "")],
            namespace="hostfs",
            type="hostfs commands",
            short="set or show the hostfs root directory",
            doc="""
Set the host directory that is visible to the simulated machine to
<arg>dir</arg>. If no directory is specified, the current root directory
is shown. Changes may not take effect until next the file system is
mounted.""",
            filename="/mp/simics-3.0/src/devices/hostfs/commands.py",
            linenumber="10")


def get_info(obj):
    return [(None, [("Host Root", obj.host_root)])]


sim_commands.new_info_command('hostfs', get_info)


def get_status(obj):
    if obj.version == (1L << 64) - 1:
        mount_stat = "no"
    else:
        mount_stat = "yes"
    return [(None, [("Mounted", mount_stat)])]


sim_commands.new_status_command('hostfs', get_status)
        ]
    return stat


def get_sc_info(obj):
    return ([("Configuration", [("Text Console", obj.console),
                                ("NVCI Object", obj.nvci),
                                ("IOSRAM-SBBC", obj.iosram_sbbc),
                                ("Interrupt Bus", obj.irq_bus),
                                ("Recorder", obj.recorder)]),
             (None, [("Chassis Type", obj.chassis_type)])] +
            [("Boards", get_boards(obj))] +
            [("Memory Banks", get_mem_banks(obj))])


sim_commands.new_info_command("serengeti-console", get_sc_info)

#
# --------------------- status ---------------------
#

# No status to report

#
# --------------- NVCI COMMANDS ----------
#


def get_nvci_info(obj):
    return []
Beispiel #6
0
          ("Last SENSE key", "%d" % sense),
          ("Target to reselect", resel_tgt)]

    if obj.classname == "scsi-disk":
        st += [("Sectors read",
                "%d  ( = %d bytes)" % (obj.sectors_read, obj.sectors_read * 512)),
               ("Sectors written",
                "%d  ( = %d bytes)" % (obj.sectors_written, obj.sectors_written * 512))]
    else:
        st += [("Sectors read",
                "%d  ( = %d bytes)" % (obj.sectors_read, obj.sectors_read * 2048)),
               ("Sectors written",
                "%d  ( = %d bytes)" % (obj.sectors_written, obj.sectors_written * 2048))]
    return [(None, st)]

# will only be called for scsi-disk itself
sim_commands.new_info_command("scsi-disk", get_info)
sim_commands.new_status_command("scsi-disk", get_status)

try:
    from sun_vtoc_commands import *
    create_sun_vtoc_commands("scsi-disk")
except:
    pass

try:
    from pc_disk_commands import *
    create_pc_partition_table_commands("scsi-disk")
except:
    pass
from cli import *
import sim_commands


def get_info(obj):
    return [("Connected processors", [(i, obj.cpu_list[i].name)
                                      for i in range(len(obj.cpu_list))])]


sim_commands.new_info_command("cpu-group", get_info)
Beispiel #8
0
    else:
        return 0

def get_info(obj):
    return [ (None, [
        ("PHY object", obj.phy),
        ] ) ] + sim_commands.get_pci_info(obj)

def get_status(obj):
    csr0 = obj.csr_csr0
    csr0a = "INIT=%d STRT=%d STOP=%d TDMD=%d TXON=%d RXON=%d INEA=%d INTR=%d" % (
        checkbit(csr0, 0), checkbit(csr0, 1), checkbit(csr0, 2), checkbit(csr0, 3),
        checkbit(csr0, 4), checkbit(csr0, 5), checkbit(csr0, 6), checkbit(csr0, 7))
    csr0b = "IDON=%d TINT=%d RINT=%d MERR=%d MISS=%d CERR=%d BABL=%d ERR=%d" % (
        checkbit(csr0, 8), checkbit(csr0, 9), checkbit(csr0, 10), checkbit(csr0, 11),
        checkbit(csr0, 12), checkbit(csr0, 13), checkbit(csr0, 14), checkbit(csr0, 15))
    return ([ (None,
               [ ("CSR0", csr0a),
                 ("",  csr0b),
                 ("CSR1", "0x%x" % obj.csr_csr1),
                 ("CSR2", "0x%x" % obj.csr_csr2),
                 ("CSR3", "BCON=%d ACON=%d BSWP=%d" % (
        (checkbit(obj.csr_csr3, 0), checkbit(obj.csr_csr3, 1), checkbit(obj.csr_csr3, 2)))),
                 ("CSR15", "0x%x" % obj.csr_csr15),
                 ("RAP", obj.ioreg_rap) ]),
              ] + sim_commands.get_pci_status(obj))

sim_commands.new_pci_header_command('AM79C973', None)
sim_commands.new_info_command('AM79C973', get_info)
sim_commands.new_status_command('AM79C973', get_status)
from cli import *
import sim_commands


def get_info(obj):
    return [(None, [])]


sim_commands.new_info_command('v9-sol9-idle-opt', get_info)


def get_status(obj):
    return [(None, [("Enabled", iff(obj.enabled, "yes", "no")),
                    ("Auto-detect", iff(obj.auto_detect, "yes", "no")),
                    ("Multi-pro", iff(obj.multi_pro, "yes", "no")),
                    ("Memory space", obj.memory_space),
                    ("Address", "0x%x" % obj.address),
                    ("Idle speed", obj.idle_speed),
                    ("Busy speed", obj.busy_speed)])]


sim_commands.new_status_command('v9-sol9-idle-opt', get_status)


def v9_sol9_idle_opt_cmd(memory_space, multi_pro):
    i = 0
    done = 0
    while not done:
        try:
            obj_name = "idle-opt-%d" % i
            SIM_get_object(obj_name) != None
Beispiel #10
0
from cli import *
import sim_commands

def get_info(obj):
    return [("Connected processors",
             [(i, obj.cpu_list[i].name)
              for i in range(len(obj.cpu_list))])]

sim_commands.new_info_command("ppc-broadcast-bus", get_info)
Beispiel #11
0
            None,
            [
                ("Global clock frequency", "%s" % fmt_prefixed_unit(server.frequency, "Hz")),
                ("Minimum latency", "%s" % fmt_prefixed_unit(server.min_latency * 1.0 / server.frequency, "s")),
                ("Local client", local_conn),
            ],
        ),
        ("TCP/IP connections", [("Listen port", server.tcp_port), ("Clients", len(tcp_conns))]),
        ("File socket connections", [("Socket file", unix_socket), ("Clients", len(unix_conns))]),
        ("Links", [(name, "id=%d class=%s master=%d" % (id, cls, master)) for id, name, cls, master in server.links]),
    ]

    return info


sim_commands.new_info_command("central-server", get_server_info)

#
# -------------- connections --------------
#


def connections_obj_cmd(obj):
    try:
        c = obj.connections
    except Exception, msg:
        print msg
        return
    else:
        print_columns(
            [Just_Left, Just_Left, Just_Left, Just_Left, Just_Left],
         "%s" % fmt_prefixed_unit(server.frequency, "Hz")),
        ("Minimum latency", "%s" %
         fmt_prefixed_unit(server.min_latency * 1.0 / server.frequency, "s")),
        ("Local client", local_conn)
    ]),
            ("TCP/IP connections", [("Listen port", server.tcp_port),
                                    ("Clients", len(tcp_conns))]),
            ("File socket connections", [("Socket file", unix_socket),
                                         ("Clients", len(unix_conns))]),
            ("Links", [(name, "id=%d class=%s master=%d" % (id, cls, master))
                       for id, name, cls, master in server.links])]

    return info


sim_commands.new_info_command("central-server", get_server_info)

#
# -------------- connections --------------
#


def connections_obj_cmd(obj):
    try:
        c = obj.connections
    except Exception, msg:
        print msg
        return
    else:
        print_columns([Just_Left, Just_Left, Just_Left, Just_Left, Just_Left],
                      [["ID", "Proto", "Addr", "Version", "Description"]] + c)
Beispiel #13
0
from cli import *
import sim_commands

#
# ------------------------ info -----------------------
#


def get_sample_info(obj):
    return []


sim_commands.new_info_command('sample-device', get_sample_info)

#
# ------------------------ status -----------------------
#


def get_sample_status(obj):
    return [(None, [("Attribute 'value'", obj.value)])]


sim_commands.new_status_command('sample-device', get_sample_status)

#
# ------------------------ add-log -----------------------
#


def add_log_cmd(obj, str):
from cli import *
from string import *
import nic_common
import sim_commands

nic_common.new_nic_commands("ppc440gp-emac")

#
# ------------------------ info -----------------------
#

sim_commands.new_info_command("ppc440gp-emac", nic_common.get_nic_info)

#
# ------------------------ status -----------------------
#


def get_emac_status(obj):
    status = []
    for x in obj.attributes:
        name = x[0]
        if name[0:6] == "EMACx_":
            value = SIM_get_attribute(obj, name)
            name = name[0:5] + "_" + name[6:]
            description = x[2]
            status.append((name, "0x%08x" % value))
    return nic_common.get_nic_status(obj) + [("Registers", status)]


sim_commands.new_status_command("ppc440gp-emac", get_emac_status)
Beispiel #15
0
new_command("process_info", process_info_cmd,
            args = [],
            alias = "",
            type  = "common commands",
            short = "process info",
	    namespace = "common",
            doc = """
Shows information about the os processes (requires os visibility in kernel).
""")

#
# ------------------------ info -----------------------
#

def get_info(obj):
    # USER-TODO: Return something useful here
    return []

sim_commands.new_info_command('common', get_info)

#
# ------------------------ status -----------------------
#

def get_status(obj):
    # USER-TODO: Return something useful here
    return [("Internals",
             [("Attribute 'value'", SIM_get_attribute(obj, "disk_delay"))])]

sim_commands.new_status_command('common', get_status)
Beispiel #16
0
              [("Rate", "%d pps" % obj.pps),
               ("Size", "%d bytes" % obj.packet_size)])] +
            nic_common.get_nic_info(obj))

def get_status(obj):
    left = obj.count
    if left is None:
        left = "unlimited"
    return ([ (None,
               [ ("Enabled", iff(obj.enabled, "yes", "no")),
                 ("Packets left to send", left),
                 ("Packets sent", obj.total_tx_packets),
                 ("Packets received", obj.total_rx_packets)])] +
            nic_common.get_nic_status(obj))

sim_commands.new_info_command("etg", get_info)
sim_commands.new_status_command("etg", get_status)

def start(obj, count):
    if count:
        obj.count = count
    if not obj.enabled:
        print "Starting", obj.name
        obj.enabled = 1

new_command("start", start,
            [arg(int_t, "count", "?")],
            type = "etg commands",
            short = "Start generating traffic",
            namespace = "etg",
            doc = """
Beispiel #17
0
##  Copyright 2005-2007 Virtutech AB

from cli import *
import sim_commands
import string

def info(obj):
    return []

def status(obj):
    return [ (None,
              [ ("Attribute a", "%d" % obj.a)])]

    
sim_commands.new_info_command("sample_device_dml", info)
sim_commands.new_status_command("sample_device_dml", status)
                    bit_state += "input,  value=%d" % checkbit(pxin,bit)
            # interruptible ports
            if interruptible_port :
                # interrupt control bits
                bit_state += ", ie=%d, ies=%d, ifg=%d" % (checkbit(pxie,bit),
                                                          checkbit(pxies,bit),
                                                          checkbit(pxifg,bit))
            # complete the bit state list
            bit_state_list += [(bit_name, bit_state)]
        # generate status item for this port
        report_list += [("Port %d" % (port), bit_state_list)]
    # return the completed list
    # print report_list
    return report_list

sim_commands.new_info_command('telos-io-ports', get_info_io_ports)
sim_commands.new_status_command('telos-io-ports', get_status_io_ports)


#----------------------------------------------------------------------
#  Info & Status for environment
#----------------------------------------------------------------------
def get_info_environment(obj):
    return [ (None,
              [])
             ]

def get_status_environment(obj):
    return [ ("Parameter values",
              [("Location.X", "%d" % obj.location_x),
               ("Location.Y", "%d" % obj.location_y),
""", filename="/mp/simics-3.0/src/core/common/profile_commands.py", linenumber="89")

def brec_get_info(obj):
    return [(None,
             [("Address type", VT_addr_type_to_str(obj.address_type)),
              ("CPU type", obj.cpu_type)])]

def brec_get_status(obj):
    plist = []
    for cpu in obj.processors:
        plist.append(cpu.name)
    return [(None,
             [("Number of arcs", obj.num_arcs),
              ("Attached processors", ", ".join(plist))])]

sim_commands.new_info_command("branch_recorder", brec_get_info,
                              "profiling commands")
sim_commands.new_status_command("branch_recorder", brec_get_status,
                                "profiling commands")

def start_instruction_profiling_cmd(cpu):
    if not supports_branch_profiling(cpu):
        return

    bname = "%s_branch_recorder" % cpu.name
    try:
        SIM_get_object(bname)
        print "Error! An object called %s already exists." % bname
        return
    except:
        pass
    try:
import sim_commands


def get_info(obj):
    try:
        devices = obj.i2c_devices
    except:
        devices = "None"
    else:
        devices.sort()
        devices = ", ".join(
            map(lambda x: ("%s (0x%x)" % (x[0], x[1])), devices))
    return [(None, [('I2C devices', devices)])]


def get_status(obj):
    slave = obj.current_slave
    if not slave:
        slave = '<none>'
    state = [
        'idle', 'master transmit', 'master receive', 'slave transmit',
        'slave receive'
    ][obj.current_state]
    return [(None, [('Current slave', slave), ('Current state', state)])]


sim_commands.new_info_command("i2c-bus", get_info)
sim_commands.new_status_command("i2c-bus", get_status)
##  Copyright 2003-2007 Virtutech AB

from cli import *
import sim_commands

device_name = get_last_loaded_module()

def get_info(obj):
    return [ (None,
              [ ("SCSI bus", obj.scsi_bus) ] ) ] + sim_commands.get_pci_info(obj)

def get_status(obj):
    return [] + sim_commands.get_pci_status(obj)

sim_commands.new_info_command(device_name, get_info)
sim_commands.new_status_command(device_name, get_status)
sim_commands.new_pci_header_command(device_name, None)
Beispiel #22
0
        checkbit(csr0, 4), checkbit(csr0, 5), checkbit(csr0, 6), checkbit(csr0, 7))
    csr0b = "IDON=%d TINT=%d RINT=%d MERR=%d MISS=%d CERR=%d BABL=%d ERR=%d" % (
        checkbit(csr0, 8), checkbit(csr0, 9), checkbit(csr0, 10), checkbit(csr0, 11),
        checkbit(csr0, 12), checkbit(csr0, 13), checkbit(csr0, 14), checkbit(csr0, 15))
    #    log = obj.log_addr
    #    log_addr = "%x.%x.%x.%x.%x.%x.%x.%x" % (
    #        log[0], log[1], log[2], log[3], log[4], log[5], log[6], log[7])
    #    if obj.connected == 1:
    #        connected = "yes"
    #    else:
    #        connected = "no"
    return ([ (None,
               [ ("CSR0", csr0a),
                 (None,  csr0b),
                 ("CSR1", "0x%x" % obj.csr_csr1),
                 ("CSR2", "0x%x" % obj.csr_csr2),
                 ("CSR3", "BCON=%d ACON=%d BSWP=%d" % (
        (checkbit(obj.csr_csr3, 0), checkbit(obj.csr_csr3, 1), checkbit(obj.csr_csr3, 2)))),
                 ("CSR15", "0x%x" % obj.csr_csr15),
                 ("RAP", obj.ioreg_rap) ]),
              #              (None,
              #               [("Packets sent", obj.pkt_snt),
              #                ("Packets received", obj.pkt_rec)])
              ] + nic_common.get_nic_status(obj))


nic_common.new_nic_commands('AM79C960-dml')

sim_commands.new_info_command('AM79C960-dml', get_info)
sim_commands.new_status_command('AM79C960-dml', get_status)
Beispiel #23
0
SIM_register_class(class_name, class_data)

SIM_register_typed_attribute(class_name, "value",
                             get_value, None,
                             set_value, None,
                             Sim_Attr_Optional,
                             "i", None,
                             "The <i>value</i> register.")

io_iface = io_memory_interface_t()
io_iface.operation = operation
SIM_register_interface(class_name, "io_memory", io_iface)


# Since this is a Python file, the module commands can be defined here,
# instead of using a separate commands.py file.

import sim_commands

# info command prints static information
def get_info(obj):
    return []

# status command prints dynamic information
def get_status(obj):
    return [("Registers",
             [("Value", obj.value)])]

sim_commands.new_info_command(class_name, get_info)
sim_commands.new_status_command(class_name, get_status)
Beispiel #24
0
    log = obj.log_addr
    log_addr = "%x.%x.%x.%x.%x.%x.%x.%x" % (log[0], log[1], log[2], log[3], log[4], log[5], log[6], log[7])
    if obj.connected == 1:
        connected = "yes"
    else:
        connected = "no"

    return [
        (
            None,
            [
                ("CSR", csr0a),
                (None, csr0b),
                ("CSR1", "0x%x" % obj.csr1),
                ("CSR2", "0x%x" % obj.csr2),
                (
                    "CSR3",
                    "BCON=%d ACON=%d BSWP=%d" % ((checkbit(obj.csr3, 0), checkbit(obj.csr3, 1), checkbit(obj.csr3, 2))),
                ),
                ("RAP", obj.rap),
            ],
        ),
        (None, [("Packets sent", obj.pkt_snt), ("Packets received", obj.pkt_rec)]),
    ] + nic_common.get_nic_status(obj)


nic_common.new_nic_commands("AM79C960")

sim_commands.new_info_command("AM79C960", get_info)
sim_commands.new_status_command("AM79C960", get_status)
Beispiel #25
0
from cli import *
from string import *
import nic_common
import sim_commands


nic_common.new_nic_commands("ppc440gp-emac")


#
# ------------------------ info -----------------------
#

sim_commands.new_info_command("ppc440gp-emac", nic_common.get_nic_info)

#
# ------------------------ status -----------------------
#

def get_emac_status(obj):
    status = []
    for x in obj.attributes:
        name = x[0]
        if name[0:6] == "EMACx_":
            value = SIM_get_attribute(obj, name)
            name = name[0:5] + "_" + name[6:]
            description = x[2]
            status.append((name, "0x%08x" % value))
    return nic_common.get_nic_status(obj) + [("Registers", status)]

sim_commands.new_status_command("ppc440gp-emac", get_emac_status)
Beispiel #26
0
##  Copyright 2004-2007 Virtutech AB

from cli import *
import sim_commands


def get_sbd_info(obj):
    return []


sim_commands.new_info_command('simple-byte-dump', get_sbd_info)


def get_sbd_status(obj):
    return [(None, [("Output file: ", obj.filename)])]


sim_commands.new_status_command('simple-byte-dump', get_sbd_status)


def set_output_file_cmd(obj, filename):
    try:
        obj.filename = filename
    except Exception, msg:
        print "Could not set output filename: %s" % msg


new_command("set-output-file",
            set_output_file_cmd, [arg(str_t, "filename")],
            alias="",
            type="simple-byte-dump commands",
Beispiel #27
0
##  Copyright 2005-2007 Virtutech AB

from cli import *
import sim_commands

def get_info(obj):
    return [("Connected processors:",
             [('', tgt.name)
              for tgt in obj.reset_targets])]

sim_commands.new_info_command("x86-reset-bus", get_info)
             [("%s:%d" % (ip, ctid), "%s %s (%d blocks)" % (method, filename, blocks))
              for stid, ctid, method, ip, filename, blocks in obj.tftp_sessions])]

def get_status(obj):
    snds = get_sn_devs(obj)
    doc = []
    svc_list = map(lambda x: [x[0], iff(x[1], 'en', 'dis') + 'abled'],
                   obj.services.items())
    doc += [("Service Status", svc_list)]
    for snd in snds:
        if snd.link:
            doc += [("ARP table network %s" % snd.link.name,
                     snd.arp_table)]
    return doc + get_tftp_status(obj)

sim_commands.new_info_command("service-node", get_info)
sim_commands.new_status_command("service-node", get_status)

def get_host_name(node, ip):
    hosts = node.hosts
    for h in hosts:
        if h[1] == ip:
            if len(h[3]) > 0:
                return h[2] + "." + h[3]
            else:
                return h[2]
    else:
        return ""

def arp_cmd(obj, del_flag, del_ip):
    snds = get_sn_devs(obj)
Beispiel #29
0
            ])]


def get_mips_status(obj):
    address_bits = obj.address_width[1]
    return [(None, [
        ("Cycles", obj.cycles),
        ("Program counter",
         "0x%0*x" % (address_bits / 4, SIM_get_program_counter(obj))),
        ("Context", obj.current_context),
        ("Interrupts", obj.status & 1 and "Enabled" or "Disabled"),
    ])]


sim_commands.new_status_command('mips', get_mips_status)
sim_commands.new_info_command('mips', get_mips_info)


def get_diff_regs(cpu):
    diff_regs = SIM_get_all_registers(cpu)
    diff_regs = [SIM_get_register_name(cpu, i) for i in diff_regs]
    diff_regs.remove('pc')
    diff_regs.remove('count')
    return diff_regs


funcs = {
    'print_disassemble_line': local_print_disassemble_line,
    'pregs': local_pregs,
    'get_pending_exception_string': local_pending_exception,
    'get_info': get_mips_info,
Beispiel #30
0
        else:
            print "Not following any context."
    else:
        gdb.context_object = ctxt
        gdb.follow_context = 1
        print "Started following %s." % ctxt

new_command("follow-context", follow_context_cmd,
            [arg(obj_t('context', 'context'), "context", "?")],
            type = "symbolic debugging commands",
            short = "follow context",
            namespace = "gdb-remote",
            doc = """
Set the GDB session to follow <arg>context</arg>.  If <arg>context</arg>
is not specified, the GDB session will stop following any context.""", filename="/mp/simics-3.0/src/extensions/gdb-remote/commands.py", linenumber="78")

def get_info(gdb):
    """Return information about gdb object as list of (doc, value)
    tuples."""
    return ([ (None,
               [ ("Architecture",	gdb.architecture),
                 ("Listen port",	gdb.listen),
                 ("Processor",		gdb.processor),
                 ("Context",		gdb.context_object),
                 ("Follow context",	iff(gdb.follow_context, "enabled",
                                            "disabled"))
                 ] )
              ])

sim_commands.new_info_command("gdb-remote", get_info)
Beispiel #31
0
                csr0, 5), checkbit(csr0, 6), checkbit(csr0, 7))
    csr0b = "IDON=%d TINT=%d RINT=%d MERR=%d MISS=%d CERR=%d BABL=%d ERR=%d" % (
        checkbit(csr0, 8), checkbit(csr0, 9), checkbit(csr0, 10),
        checkbit(csr0, 11), checkbit(csr0, 12), checkbit(
            csr0, 13), checkbit(csr0, 14), checkbit(csr0, 15))
    #    log = obj.log_addr
    #    log_addr = "%x.%x.%x.%x.%x.%x.%x.%x" % (
    #        log[0], log[1], log[2], log[3], log[4], log[5], log[6], log[7])
    #    if obj.connected == 1:
    #        connected = "yes"
    #    else:
    #        connected = "no"
    return ([
        (None, [("CSR0", csr0a),
                (None, csr0b), ("CSR1", "0x%x" % obj.csr_csr1),
                ("CSR2", "0x%x" % obj.csr_csr2),
                ("CSR3", "BCON=%d ACON=%d BSWP=%d" %
                 ((checkbit(obj.csr_csr3, 0), checkbit(
                     obj.csr_csr3, 1), checkbit(obj.csr_csr3, 2)))),
                ("CSR15", "0x%x" % obj.csr_csr15), ("RAP", obj.ioreg_rap)]),
        #              (None,
        #               [("Packets sent", obj.pkt_snt),
        #                ("Packets received", obj.pkt_rec)])
    ] + nic_common.get_nic_status(obj))


nic_common.new_nic_commands('AM79C960-dml')

sim_commands.new_info_command('AM79C960-dml', get_info)
sim_commands.new_status_command('AM79C960-dml', get_status)
Beispiel #32
0
            alias = "",
            type  = "%s commands" % device_name,
            short = "toggle trace functionality",
            namespace = device_name,
            doc = """
Toggles trace mode<br/>
When active, lists all changes to TLB entries and to MMU registers.<br/>
""", filename="/mp/simics-3.0/src/devices/spitfire-mmu/commands.py", linenumber="307")

new_command("reverse-lookup", reverse_cmd,
            [arg(addr_t, "address") ],
            alias = "",
            type  = "%s commands" % device_name,
            short = "check TLBs for reverse translation",
            namespace = device_name,
            see_also = ["<%s>." % device_name + 'd-probe'],
            doc = """
List mappings in all TLBs that matches the specified physical address<br/>
""", filename="/mp/simics-3.0/src/devices/spitfire-mmu/commands.py", linenumber="318")


#
# ----------------- info command -----------------
#

def get_info(obj):
    return [(None,
             [('CPU', obj.cpu)])]

new_info_command(device_name, get_info)
Beispiel #33
0
##  Copyright 2004-2007 Virtutech AB

from cli import *
import sim_commands

def get_sbd_info(obj):
    return []

sim_commands.new_info_command('simple-byte-dump', get_sbd_info)

def get_sbd_status(obj):
    return [(None,
             [("Output file: ", obj.filename)])]

sim_commands.new_status_command('simple-byte-dump', get_sbd_status)

def set_output_file_cmd(obj, filename):
    try:
        obj.filename = filename
    except Exception, msg:
        print "Could not set output filename: %s" % msg

new_command("set-output-file", set_output_file_cmd,
            [arg(str_t, "filename")],
            alias = "",
            type  = "simple-byte-dump commands",
            short = "sets file to output to",
	    namespace = "simple-byte-dump",
            doc = """
Sets the name of the file to which bytes will be written.
Beispiel #34
0
##  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

try:
    # commands from scsi-disk
    from mod_scsi_disk_commands import *
    sim_commands.new_info_command("scsi-cdrom", get_info)
    sim_commands.new_status_command("scsi-cdrom", get_status)
except:
    print "Cannot include scsi-disk commands"

#
# -------------------- insert --------------------
#

def insert_cmd(obj, medium):
    try:
        obj.cd_media = medium
        print "Inserting medium '%s' in CD-ROM drive" % medium.name
    except Exception, msg:
        print "Error inserting medium: %s" % msg
Beispiel #35
0
new_command("dump_lock", dump_lock_cmd,
            args = [arg(int_t, "addr")],
            alias = "",
            type  = "sync_char commands",
            short = "dump lock",
	    namespace = "sync_char",
            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('sync_char', get_info)

#
# ------------------------ status -----------------------
#

def get_status(obj):
    # USER-TODO: Return something useful here
    return [("Internals",
             [("Attribute 'value'", SIM_get_attribute(obj, "disk_delay"))])]

sim_commands.new_status_command('sync_char', get_status)
Beispiel #36
0
            short="increment value",
            namespace="emerald",
            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('emerald', 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('emerald', get_status)
Beispiel #37
0
##  
##  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

def get_info(obj):
    return ([(None,
              [("System Console", obj.sc)])]
            + sim_commands.get_pci_info(obj))

sim_commands.new_info_command("sbbc-pci", get_info)

def get_status(obj):
    return ([("Registers",
              [("Interrupt Enable", "0x%x" % obj.interrupt_enable),
               ("Interrupt Status", "0x%x" % obj.interrupt_status),
               ("EPLD Interrupt", "0x%x" % obj.epld_interrupt),
               ("Irq Generation 0", "0x%x" % obj.irq_generation_0),
               ("Irq Generation 1", "0x%x" % obj.irq_generation_1)]),
             (None,
              [("Access info", iff(obj.access_info, "enabled", "disabled"))])]
            + sim_commands.get_pci_status(obj))

sim_commands.new_status_command("sbbc-pci", get_status)

sim_commands.new_pci_header_command("sbbc-pci", None)
Beispiel #38
0
##  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

#
# ------------------------ info -----------------------
#

def get_sample_info(obj):
    return []

sim_commands.new_info_command('sample-device', get_sample_info)

#
# ------------------------ status -----------------------
#

def get_sample_status(obj):
    return [(None,
             [("Attribute 'value'", obj.value)])]

sim_commands.new_status_command('sample-device', get_sample_status)

#
# ------------------------ add-log -----------------------
#
Beispiel #39
0
        obj.host_root = root
    else:
        print obj.host_root

new_command("root", root_cmd,
            [arg(filename_t(dirs=1, exist=1), "dir", "?", "")],
            namespace = "hostfs",
            type = "hostfs commands",
            short = "set or show the hostfs root directory",
            doc = """
Set the host directory that is visible to the simulated machine to
<arg>dir</arg>. If no directory is specified, the current root directory
is shown. Changes may not take effect until next the file system is
mounted.""", filename="/mp/simics-3.0/src/devices/hostfs/commands.py", linenumber="10")

def get_info(obj):
    return [(None,
             [("Host Root", obj.host_root)])]

sim_commands.new_info_command('hostfs', get_info)

def get_status(obj):
    if obj.version == (1L << 64) - 1:
        mount_stat = "no"
    else:
        mount_stat = "yes"
    return [(None,
             [("Mounted", mount_stat)])]

sim_commands.new_status_command('hostfs', get_status)
Beispiel #40
0
            nic_common.get_nic_info(obj))


def get_status(obj):
    return ([ ("Status and control registers",
               [("ISQ",      "0x%x" % (obj.ctrl_regs[0])),
                ("RxCFG",    "0x%x" % (obj.ctrl_regs[3])),
                ("RxEvent",  "0x%x" % (obj.ctrl_regs[4])),
                ("RxCTL",    "0x%x" % (obj.ctrl_regs[5])),
                ("TxCFG",    "0x%x" % (obj.ctrl_regs[7])),
                ("TxEvent",  "0x%x" % (obj.ctrl_regs[8])),
                ("TxCMD",    "0x%x" % (obj.ctrl_regs[9])),
                ("BufCFG",   "0x%x" % (obj.ctrl_regs[0xb])),
                ("BufEvent", "0x%x" % (obj.ctrl_regs[0xc])),
                ("RxMISS",   "0x%x" % (obj.ctrl_regs[0x10])),
                ("TxCOL",    "0x%x" % (obj.ctrl_regs[0x12])),
                ("LineCTL",  "0x%x" % (obj.ctrl_regs[0x13])),
                ("LineST",   "0x%x" % (obj.ctrl_regs[0x14])),
                ("SelfCTL",  "0x%x" % (obj.ctrl_regs[0x15])),
                ("SelfST",   "0x%x" % (obj.ctrl_regs[0x16])),
                ("BusCTL",   "0x%x" % (obj.ctrl_regs[0x17])),
                ("BusST",    "0x%x" % (obj.ctrl_regs[0x18])),
                ("TestCTL",  "0x%x" % (obj.ctrl_regs[0x19])),
                ("AUI_TDR",  "0x%x" % (obj.ctrl_regs[0x1c]))])] +
            nic_common.get_nic_status(obj))

nic_common.new_nic_commands("CS8900A")

sim_commands.new_info_command("CS8900A", get_info)
sim_commands.new_status_command("CS8900A", get_status)
Beispiel #41
0
SIM_register_typed_attribute(
    class_name, 'start_time',
    get_start_time, None,
    set_start_time, None,
    Sim_Attr_Optional,
    'i', None,
    'The time, as seconds in standard Unix format, when the simulation was '
    'started.')

io_if = io_memory_interface_t()
io_if.operation = rtc_operation
SIM_register_interface(class_name, 'io_memory', io_if)

from cli import *
import sim_commands

# info command prints static information
def get_info(obj):
    return []

# status command prints dynamic information
def get_status(obj):
    inst = device_instances[obj]
    return [('Registers',
             [('Seconds', str(long(inst.current_time())))]),
            ('Other', [('Time', time.ctime(inst.current_time()))])]

sim_commands.new_info_command(class_name, get_info)
sim_commands.new_status_command(class_name, get_status)
Beispiel #42
0
##  Copyright 2003-2007 Virtutech AB

from cli import *
import sim_commands

def get_info(obj):
    tgts = obj.object_list

    return [("Connected processors",
             [(("%2d" % tgts[i][0]), tgts[i][1].name)
              for i in range(len(tgts))])]

sim_commands.new_info_command("sparc-irq-bus", get_info)
Beispiel #43
0
            ])
           ]

def get_mips_status(obj):
    address_bits = obj.address_width[1]
    return [(None, [
              ("Cycles", obj.cycles),
              ("Program counter", "0x%0*x"%(address_bits/4,
                                            SIM_get_program_counter(obj))),
              ("Context", obj.current_context),
              ("Interrupts", obj.status & 1 and "Enabled" or "Disabled"),
            ])
           ]

sim_commands.new_status_command('mips', get_mips_status)
sim_commands.new_info_command('mips', get_mips_info)

def get_diff_regs(cpu):
    diff_regs = SIM_get_all_registers(cpu)
    diff_regs = [ SIM_get_register_name(cpu, i) for i in diff_regs ]
    diff_regs.remove('pc')
    diff_regs.remove('count')
    return diff_regs

funcs = { 'print_disassemble_line':
          local_print_disassemble_line,
          'pregs':
          local_pregs,
          'get_pending_exception_string':
          local_pending_exception,
          'get_info':
                                     ("Size", "%d bytes" % obj.packet_size)])]
            + nic_common.get_nic_info(obj))


def get_status(obj):
    left = obj.count
    if left is None:
        left = "unlimited"
    return ([(None, [("Enabled", iff(obj.enabled, "yes", "no")),
                     ("Packets left to send", left),
                     ("Packets sent", obj.total_tx_packets),
                     ("Packets received", obj.total_rx_packets)])] +
            nic_common.get_nic_status(obj))


sim_commands.new_info_command("etg", get_info)
sim_commands.new_status_command("etg", get_status)


def start(obj, count):
    if count:
        obj.count = count
    if not obj.enabled:
        print "Starting", obj.name
        obj.enabled = 1


new_command("start",
            start, [arg(int_t, "count", "?")],
            type="etg commands",
            short="Start generating traffic",
Beispiel #45
0
##  Copyright 2003-2007 Virtutech AB

from cli import *
import sim_commands


def get_info(obj):
    spaces = obj.memory_spaces

    return [("Space translations", [(spaces[i][0].name, spaces[i][1].name)
                                    for i in range(len(spaces))])]


sim_commands.new_info_command("local-space-mapper", get_info)
Beispiel #46
0
import sim_commands


def sac_get_info(obj):
    buses = [o[0].name for o in obj.pci_buses]
    return [(None, [("I/O space", obj.io_space.name)] +
             [("PCI bus %d" % n, bus.name) for [bus, n] in obj.pci_buses])]


sim_commands.new_info_command('i82461GX', sac_get_info)
# cpc700-uic


def uic_get_info(obj):
    return [(None, [("interrupt device", obj.irq_dev)])]


def uic_get_status(obj):
    return [(None, [("UICSR (status)", number_str(obj.uicsr, 16)),
                    ("UICER (enable)", number_str(obj.uicer, 16)),
                    ("UICCR (critical)", number_str(obj.uiccr, 16)),
                    ("UICVCR (vector)", number_str(obj.uicvcr, 16))])]


sim_commands.new_info_command("cpc700-uic", uic_get_info)
sim_commands.new_status_command("cpc700-uic", uic_get_status)

# cpc700-mc

sim_commands.new_info_command("cpc700-mc", get_empty)
sim_commands.new_status_command("cpc700-mc", get_empty)

# cpc700-gpt

sim_commands.new_info_command("cpc700-gpt", get_empty)
sim_commands.new_status_command("cpc700-gpt", get_empty)

# cpc700-pi

sim_commands.new_info_command("cpc700-pi", get_empty)
Beispiel #48
0
def get_sc_info(obj):
    return ([("Configuration",
             [("Text Console", obj.console),
              ("NVCI Object", obj.nvci),
              ("IOSRAM-SBBC", obj.iosram_sbbc),
              ("Interrupt Bus", obj.irq_bus),
              ("Recorder", obj.recorder)]),
            (None,
             [("Chassis Type", obj.chassis_type)])]
            + [("Boards",
                get_boards(obj))]
            + [("Memory Banks",
                get_mem_banks(obj))])

sim_commands.new_info_command("serengeti-console", get_sc_info)

#
# --------------------- status ---------------------
#

# No status to report

#
# --------------- NVCI COMMANDS ----------
#

def get_nvci_info(obj):
    return []

sim_commands.new_info_command("nvci", get_nvci_info)
Beispiel #49
0
from cli import *
import sim_commands


def get_info(obj):
    return [("Connected processors", [(i, obj.cpu_list[i].name) for i in range(len(obj.cpu_list))])]


sim_commands.new_info_command("cpu-group", get_info)
Beispiel #50
0
new_command("increment", increment_value_cmd, [],
            alias = "",
            type  = "empty-device commands",
            short = "increment value",
	    namespace = "empty-device",
            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('empty-device', 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('empty-device', get_status)
from cli import *
import sim_commands

#
# -------------------- info, status --------------------
#


def get_info(obj):
    return [('Clients', [(x.name, x.classname) for x in obj.clients])]


sim_commands.new_info_command("recorder", get_info)


def get_status(obj):
    if obj.recording:
        rec = "yes (file: %s)" % obj.out_file
    else:
        rec = "no"
    if obj.playback:
        play = "yes (file: %s)" % obj.in_file
    else:
        play = "no"
    return [(None, [("Recording", rec), ("Playing back", play)])]


sim_commands.new_status_command("recorder", get_status)

#
# -------------------- playback-start --------------------
        return "%.3g %s%s" % (val, pre[0], unit)
    else: # abs(val) < 1.0:
        pre = prefixes_down
        while val < 1.0 and len(pre) > 1:
            val = val * 1000.0
            pre = pre[1:]
        return "%.3g %s%s" % (val, pre[0], unit)


def get_info(obj):
    devices = obj.devices
    doc = ([(None,
             [("Timing granularity", fmt_prefixed_unit(obj.frequency, "Hz")),
              ("Latency", fmt_prefixed_unit(obj.latency * 1.0 / obj.frequency, "s")),
              ("Maximum throughput", iff(obj.throttle,
                                         "%s bps" % obj.throttle,
                                         "unlimited"))]),
            ("Devices",
             [("Local devices",  ["<%d:%d> %s" % (lid, iff(gid is None, -1, gid), name)
                                  for gid, lid, name, dev, _ in devices if dev]),
              ("Remote devices", ["<%d:%d> %s" % (lid, iff(gid is None, -1, gid), name)
                                  for gid, lid, name, dev, _ in devices if not dev])])])
    return doc

def get_status(obj):
    return []

sim_commands.new_info_command("serial-link", get_info)
sim_commands.new_status_command("serial-link", get_status)