コード例 #1
0
ファイル: two_level.py プロジェクト: AMDmi3/gem5
# import the m5 (gem5) library created when gem5 is built
import m5
# import all of the SimObjects
from m5.objects import *

# Add the common scripts to our path
m5.util.addToPath('../../common')

# import the caches which we made
from caches import *

# import the SimpleOpts module
import SimpleOpts

# Set the usage message to display
SimpleOpts.set_usage("usage: %prog [options] <binary to execute>")

# Finalize the arguments and grab the opts so we can pass it on to our objects
(opts, args) = SimpleOpts.parse_args()

# get ISA for the default binary to run. This is mostly for simple testing
isa = str(m5.defines.buildEnv['TARGET_ISA']).lower()

# Default to running 'hello', use the compiled ISA to find the binary
binary = 'tests/test-progs/hello/bin/' + isa + '/linux/hello'

# Check if there was a binary passed in via the command line and error if
# there are too many arguments
if len(args) == 1:
    binary = args[0]
elif len(args) > 1:
コード例 #2
0
# import the m5 (gem5) library created when gem5 is built
import m5
# import all of the SimObjects
from m5.objects import *

# Add the common scripts to our path
m5.util.addToPath('../../common')

# import the caches which we made
from caches import *

# import the SimpleOpts module
import SimpleOpts

# Set the usage message to display
SimpleOpts.set_usage("usage: %prog [options] <binary to execute>")

# Finalize the arguments and grab the opts so we can pass it on to our objects
(opts, args) = SimpleOpts.parse_args()

# get ISA for the default binary to run. This is mostly for simple testing
isa = str(m5.defines.buildEnv['TARGET_ISA']).lower()

# Default to running 'hello', use the compiled ISA to find the binary
binary = 'tests/test-progs/hello/bin/' + isa + '/linux/hello'

# Check if there was a binary passed in via the command line and error if
# there are too many arguments
if len(args) == 1:
    binary = args[0]
elif len(args) > 1:
コード例 #3
0
import errno
import os
import sys
import time

import m5
import m5.ticks
from m5.objects import *

sys.path.append('gem5/configs/common/') # For the next line...
import SimpleOpts

from system import *

SimpleOpts.set_usage(
    "usage: %prog [options] kernel disk cpu_type mem_sys num_cpus boot_type")

SimpleOpts.add_option("--allow_listeners", default=False, action="store_true",
                      help="Listeners disabled by default")

if __name__ == "__m5_main__":
    (opts, args) = SimpleOpts.parse_args()

    if len(args) != 6:
        SimpleOpts.print_help()
        m5.fatal("Bad arguments")

    kernel, disk, cpu_type, mem_sys, num_cpus, boot_type = args
    num_cpus = int(num_cpus)

    # create the system we are going to simulate
コード例 #4
0
import m5
from m5.objects import *
from m5.ticks import fromSeconds
from m5.util.convert import toLatency

sys.path.append('configs/common/')  # For the next line...
import SimpleOpts

from system import MySystem

SimpleOpts.add_option("--script",
                      default='',
                      help="Script to execute in the simulated system")

SimpleOpts.set_usage("usage: %prog [options] roi_instructions samples=1")


class UnexpectedExit(Exception):
    pass


def fastforward(system, instructions):
    """ Fast forward the simulation by instructions.
        This only works with system.cpu (kvm CPU), not other CPUs.
        @param instructions the number of instructions to simulate before
               exit. This is the total instructions across all cores.
        @return The number of instructions past the goal
    """
    goal = system.totalInsts() + instructions