Ignore:
Timestamp:
Apr 15, 2015, 4:02:08 PM (9 years ago)
Author:
cfuguet
Message:

reconf: improve reconf:tsar_generic_iob simulation scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/onerun.py

    r969 r974  
    3030    firmdebug    -- activate the DEBUG compilation mode on software
    3131    diskimage    -- relative or absolute path to the disk image
     32    force        -- create configuration files (or overwrite them)
    3233    """
    3334
     
    4849    hardpath = os.path.join(outdir, "config/hard_config.h")
    4950    xmlpath = os.path.join(outdir, "config/giet.map.xml")
    50     dtspath = os.path.join(outdir, "config/linux.dts")
    51     arch.main(args.x, args.y, args.nprocs, hardpath, xmlpath, dtspath)
    52     faultyprocs.generate(args.faultycore, faultpath)
     51    if args.linux:
     52        dtspath = os.path.join(outdir, "config/platform.dts")
     53    else:
     54        dtspath = None
     55
     56    exist = True
     57    exist = exist and os.path.exists(faultpath)
     58    exist = exist and os.path.exists(hardpath)
     59    exist = exist and os.path.exists(xmlpath)
     60    if args.linux: exist = exist and os.path.exists(dtspath)
     61
     62    if not args.force and exist:
     63        print "[ run.py ] Warning: Reusing existing configuration files. "
     64        print "[ run.py ] Script arguments will be ignored (no --force option)"
     65        cmd = raw_input('[ run.py ] Would you like to continue (y/n): ')
     66        if cmd == 'n': exit(0)
     67        if cmd == 'y': pass
     68        else: exit(1)
     69    else:
     70        arch.main(args.x, args.y, args.nprocs, hardpath, xmlpath, dtspath)
     71        faultyprocs.generate(args.faultycore, faultpath)
    5372
    5473    # create a log file
     
    6685    command.extend(['make'])
    6786    command.extend(['-C', basedir])
    68     subprocess.call(command, stdout=logfile, stderr=logfile)
     87    subprocess.check_call(command, stdout=logfile, stderr=logfile)
    6988
    7089    # 4. compile distributed boot executable
     
    81100    command.extend(["CONFIG=" + outdir])
    82101    command.extend(["DEBUG=" + str(args.firmdebug)])
    83     subprocess.call(command, stdout=logfile, stderr=logfile)
     102    if args.linux:
     103        command.extend(["PATCHER_OS=1"])
     104    else:
     105        command.extend(["PATCHER_OS=0"])
     106
     107    subprocess.check_call(command, stdout=logfile, stderr=logfile)
    84108
    85109    # stop after compiling when the compile-only option is activated
    86     if args.compileonly == True:
    87         exit(0)
     110    if args.compileonly == True: exit(0)
    88111
    89112    # 5. execute simulator
     
    107130    if args.debug != None:
    108131        command.extend(["-DEBUG", str(args.debug[0])]);
    109         command.extend(["-NCYCLES", str(args.debug[1])]);
    110         command.extend(["-PROCID", str(args.debug[2])]);
    111         command.extend(["-MEMCID", str(args.debug[3])]);
     132        command.extend(["-PROCID", str(args.debug[1])]);
     133        command.extend(["-MEMCID", str(args.debug[2])]);
     134
     135    if args.ncycles > 0:
     136        command.extend(["-NCYCLES", str(args.ncycles)])
    112137
    113138    elif os.environ.get('SOCLIB_GDB') == None:
    114139        # the procedure grows linearly with the diameter of the mesh.
    115         maxcycles = 1500000 + (args.x + args.y) * 20000
    116         command.extend(["-NCYCLES", str(maxcycles)])
     140        # maxcycles = 1500000 + (args.x + args.y) * 20000
     141        # command.extend(["-NCYCLES", str(maxcycles)])
     142        command.extend(["-NCYCLES", str(200000000)])
    117143
    118144    # OpenMP number of threads definition
     
    131157    logfile.flush()
    132158
    133     subprocess.call(command, stdout=logfile, stderr=logfile)
     159    subprocess.check_call(command, stdout=logfile, stderr=logfile)
    134160
    135161    logfile.close()
     
    198224        help='relative or absolute path to the external firmware')
    199225
     226    parser.add_argument(
     227        '--force', '-f', dest='force', action='store_true',
     228        help='create configuration files (or overwrite them)')
     229
     230    parser.add_argument(
     231        '--linux', dest='linux', action='store_true',
     232        help='generate linux device tree and compile bootloader ' +
     233             'with linux specifics')
     234
     235    parser.add_argument(
     236        '--ncycles', type=int, dest='ncycles', default=-1,
     237        help='max simulation cycles')
     238
    200239    run(parser.parse_args())
    201240
Note: See TracChangeset for help on using the changeset viewer.