コード例 #1
0
ファイル: elf.py プロジェクト: Emantor/pysc
def start_of_simulation(*k, **kw):
    for param in get_args().loadelf:
        result = memoryre.match(param)
        if not result:
            print("-e takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a base address: '-e sdram=hello.sparc(0x40000000)'" % (param))
            continue
        groups = result.groupdict()
        if not 'object' in groups or not 'filename' in groups:
            print("-e takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a base address: '-e sdram=hello.sparc(0x40000000)'" % (param))
            continue
        obj = groups['object']
        filename = groups['filename']
        if "baseaddr" in groups and groups['baseaddr']:
            base = int(groups['baseaddr'], 0) # not 100% right, won't work in the case when there is no 0x in front of Hex string!
        elif filename.endswith('.sparc') or filename.endswith('.dsu'):
            base = 0x40000000
        else:
            base = 0x00000000
        stores = usi.find(obj)
        if len(stores) == 0:
            print("scireg %s not found in simulation for parameter -e %s" % (obj, param))
            continue

        load_elf_into_scireg(filename, stores, base)

    for param in get_args().intrinsics:
        result = intrinsicre.match(param)
        if not result:
            print("-i takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a list of intrinsics: '-i leon3_0=hello.sparc(open,close)'" % (param))
            continue
        groups = result.groupdict()
        if not 'object' in groups or not 'filename' in groups or not 'intrinsics':
            print("-i takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a base address: '-i leon3_0=hello.sparc(open,close)'" % (param))
            continue
        obj = groups['object']
        filename = groups['filename']
        intrinsiclist = groups['intrinsics'].split(',')
        intrinsics = {}
        for intrinsic in intrinsiclist:
            splitted = intrinsic.split('=')
            if len(splitted) == 1:
                if splitted[0] in intrinsic_groups:
                    intrinsics.update(intrinsic_groups[splitted[0]])
                else:
                    intrinsics[splitted[0]] = splitted[0]

            elif len(splitted) > 1:
                if splitted[1] == 'None':
                    del(intrinsics[splitted[0]])
                else:
                    intrinsics[splitted[0]] = splitted[1]
            else:
                pass
        cpus = usi.find(obj)
        if len(cpus) == 0:
            print("cpu %s not found in simulation for parameter -i %s" % (obj, param))
            continue

        load_elf_intrinsics_to_processor(filename, cpus, intrinsics)
コード例 #2
0
def start_of_initialization(phase):
    global REPORT
    reporter = get_args().reporter
    verbosity = get_args().verbosity
    filename = None
    if reporter.startswith("hdf5="):
        filename = reporter[5:]
        db_reporter.logger = db_reporter.Logger(filename)
        REPORT = db_reporter.report
    elif reporter == "console":
        REPORT = console_reporter.report
    else:
        print("Reporter unknown '%s'" % reporter)
        sys.exit(1)
    usi.on("report")(REPORT)

    print("Set verbosity to level %d" % verbosity)
    print("Old verbosity level was %d" % usi.set_verbosity(verbosity))
コード例 #3
0
ファイル: __init__.py プロジェクト: woaidr/emc2-1
def parse_args(*k, **kw):
    for jsonfile in get_args().json:
        with open(jsonfile) as openfile:
            values = json.load(openfile)
            parameter.writeValueDict('', values)

    for option in get_args().option:
        l = option.split('=')
        if len(l) == 2:
            name = l[0]
            value = l[1]
            #if parameter.exists(name):
            parameter.write(name, value)
            #else:
            #    print("Option does not exist: %s" % (name))
            #    sys.exit(1)
        else:
            print("Option malformated '%s', it needs to be formated 'key=value'" % option)
            sys.exit(1)
コード例 #4
0
ファイル: __init__.py プロジェクト: woaidr/emc2-1
def show_configuration(*k, **kw):
    """View detailed model configuration and check for mal formated options"""
    malformated = False
    for option in get_args().option:
        l = option.split('=')
        if len(l) == 2:
            name = l[0]
            value = l[1]
            if not parameter.exists(name):
                print("Option does not exist: %s" % (name))
                malformated = True
    if malformated:
        print("The execution is stoped due to malformated options")
        sys.exit(1)

    if get_args().list:
        print("Parameter List:")
        params = parameter.readPropertyDict()
        parameter.printDict(params)
        #params = parameter.filterDict(params, "generics")
        sys.exit(0)
コード例 #5
0
def class_systems(*k, **kw):
    
    # gs_params for options
    _mctrl_prom_elf_arg = "conf.mctrl.prom.elf"
    _mctrl_ram_sdram_elf_arg = "conf.mctrl.ram.sdram.elf"

    for param in get_args().option:
        param = param.split("=")

        # save in variables
        if param[0] == _mctrl_prom_elf_arg:
            mctrl_prom_elf = param[1]

        if param[0] == _mctrl_ram_sdram_elf_arg:
            mctrl_ram_sdram_elf = param[1]

    leonsystem = LeonSystem("leon_system", 0)
    leonsystem.store_elf(mctrl_prom_elf, mctrl_ram_sdram_elf, True)
    #leonsystem.store_elf("build/core/software/prom/sdram/sdram.prom", "build/quadcopter/test/test.sparc", True)
    # Fehlermeldung wenn store noch nciht existiert AHBMem/Memory!
    #microblazesystem = LeonSystem("microblaze_system", 1)
    #microblazesystem.store_elf("build/core/software/prom/sdram/sdram.prom", "build/core/software/trapgen/hanoi.sparc", True)
    #microblazesystem = MicroBlazeSystem("microblaze_system")
    #microblazesystem.store_elf("build/core/software/prom/sdram/sdram.prom", "build/core/software/grlib_tests/hello.sparc", True)
    #"hello.microblaze",
    #microblazesystem.store_elf("build/core/software/prom/sdram/sdram.prom", "build/core/software/grlib_tests/hello.sparc", True)
    #armsystem = LeonSystem("a_system", 1)
    #armsystem.store_elf("build/core/software/prom/sdram/sdram.prom", "build/core/software/trapgen/hanoi.sparc", True)
    #armsystem = LeonSystem("arm_system", 2)
    #armsystem.store_elf("build/core/software/prom/sdram/sdram.prom", "build/core/software/grlib_tests/hello.sparc", True)
    #armsystem = ARMSystem("arm_system")
    #armsystem.store_elf("build/arm/prom/arm.prom", "build/core/software/grlib_tests/hello.sparc", True)
    #supervisorsystem = SupervisorSystem("supervisor_system")
    usi.add_to_reporting_list("leon_system.ahbctrl", usi.report.SC_WARNING, 0)
    for vec in ['ivectorcache', 'dvectorcache']:
       caches = usi.find("leon_system.cpu.{}.*".format(vec))
       usi.add_to_reporting_list(caches, usi.report.SC_WARNING, 0)
コード例 #6
0
def start_of_simulation(*k, **kw):
    for param in get_args().loadelf:
        result = memoryre.match(param)
        if not result:
            print(
                "-e takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a base address: '-e sdram=hello.sparc(0x40000000)'"
                % (param))
            continue
        groups = result.groupdict()
        if not 'object' in groups or not 'filename' in groups:
            print(
                "-e takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a base address: '-e sdram=hello.sparc(0x40000000)'"
                % (param))
            continue
        obj = groups['object']
        filename = groups['filename']
        if "baseaddr" in groups and groups['baseaddr']:
            base = int(
                groups['baseaddr'], 0
            )  # not 100% right, won't work in the case when there is no 0x in front of Hex string!
        elif filename.endswith('.sparc') or filename.endswith('.dsu'):
            base = 0x40000000
        else:
            base = 0x00000000
        stores = usi.find(obj)
        if len(stores) == 0:
            print("scireg %s not found in simulation for parameter -e %s" %
                  (obj, param))
            continue

        load_elf_into_scireg(filename, stores, base)

    for param in get_args().intrinsics:
        result = intrinsicre.match(param)
        if not result:
            print(
                "-i takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a list of intrinsics: '-i leon3_0=hello.sparc(open,close)'"
                % (param))
            continue
        groups = result.groupdict()
        if not 'object' in groups or not 'filename' in groups or not 'intrinsics':
            print(
                "-i takes always a key/value pair. '%s' is not a key/value pair. The value must be contain a file name and a base address: '-i leon3_0=hello.sparc(open,close)'"
                % (param))
            continue
        obj = groups['object']
        filename = groups['filename']
        intrinsiclist = groups['intrinsics'].split(',')
        intrinsics = {}
        for intrinsic in intrinsiclist:
            splitted = intrinsic.split('=')
            if len(splitted) == 1:
                if splitted[0] in intrinsic_groups:
                    intrinsics.update(intrinsic_groups[splitted[0]])
                else:
                    intrinsics[splitted[0]] = splitted[0]

            elif len(splitted) > 1:
                if splitted[1] == 'None':
                    del (intrinsics[splitted[0]])
                else:
                    intrinsics[splitted[0]] = splitted[1]
            else:
                pass
        cpus = usi.find(obj)
        if len(cpus) == 0:
            print("cpu %s not found in simulation for parameter -i %s" %
                  (obj, param))
            continue

        load_elf_intrinsics_to_processor(filename, cpus, intrinsics)
コード例 #7
0
ファイル: __init__.py プロジェクト: Emantor/pysc
def args(*k, **kw):
    from usi.tools.args import get_args
    ARGS = get_args()
    if ARGS.console:
        start()
コード例 #8
0
def args(*k, **kw):
    from usi.tools.args import get_args
    ARGS = get_args()
    if ARGS.console:
        start()