__init__.py (2728:0ee8b52d302b) | __init__.py (2738:5d7a31c7fa29) |
---|---|
1# Copyright (c) 2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 50 unchanged lines hidden (view full) --- 59 60 61# Callback to set trace flags. Not necessarily the best way to do 62# things in the long run (particularly if we change how these global 63# options are handled). 64def setTraceFlags(option, opt_str, value, parser): 65 objects.Trace.flags = value 66 | 1# Copyright (c) 2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 50 unchanged lines hidden (view full) --- 59 60 61# Callback to set trace flags. Not necessarily the best way to do 62# things in the long run (particularly if we change how these global 63# options are handled). 64def setTraceFlags(option, opt_str, value, parser): 65 objects.Trace.flags = value 66 |
67def setTraceStart(option, opt_str, value, parser): 68 objects.Trace.start = value 69 70def clearPCSymbol(option, opt_str, value, parser): 71 objects.ExecutionTrace.pc_symbol = False 72 73def clearPrintCycle(option, opt_str, value, parser): 74 objects.ExecutionTrace.print_cycle = False 75 76def statsTextFile(option, opt_str, value, parser): 77 objects.Statistics.text_file = value 78 | |
79# Standard optparse options. Need to be explicitly included by the 80# user script when it calls optparse.OptionParser(). 81standardOptions = [ 82 optparse.make_option("--traceflags", type="string", action="callback", | 67# Standard optparse options. Need to be explicitly included by the 68# user script when it calls optparse.OptionParser(). 69standardOptions = [ 70 optparse.make_option("--traceflags", type="string", action="callback", |
83 callback=setTraceFlags), 84 optparse.make_option("--tracestart", type="int", action="callback", 85 callback=setTraceStart), 86 optparse.make_option("--nopcsymbol", action="callback", 87 callback=clearPCSymbol, 88 help="Turn off printing PC symbols in trace output"), 89 optparse.make_option("--noprintcycle", action="callback", 90 callback=clearPrintCycle, 91 help="Turn off printing cycles in trace output"), 92 optparse.make_option("--statsfile", type="string", action="callback", 93 callback=statsTextFile, metavar="FILE", 94 help="Sets the output file for the statistics") | 71 callback=setTraceFlags) |
95 ] 96 97# make a SmartDict out of the build options for our local use 98import smartdict 99build_env = smartdict.SmartDict() 100build_env.update(defines.m5_build_env) 101 102# make a SmartDict out of the OS environment too 103env = smartdict.SmartDict() 104env.update(os.environ) 105 | 72 ] 73 74# make a SmartDict out of the build options for our local use 75import smartdict 76build_env = smartdict.SmartDict() 77build_env.update(defines.m5_build_env) 78 79# make a SmartDict out of the OS environment too 80env = smartdict.SmartDict() 81env.update(os.environ) 82 |
83 84# Function to provide to C++ so it can look up instances based on paths 85def resolveSimObject(name): 86 obj = config.instanceDict[name] 87 if not obj._ccObject: 88 obj.createCCObject() 89 if obj._ccObject == -1: 90 panic("resolveSimObject: recursive lookup error on %s" % name) 91 return obj._ccObject 92 |
|
106# The final hook to generate .ini files. Called from the user script 107# once the config is built. 108def instantiate(root): 109 config.ticks_per_sec = float(root.clock.frequency) 110 # ugly temporary hack to get output to config.ini 111 sys.stdout = file('config.ini', 'w') 112 root.print_ini() 113 sys.stdout.close() # close config.ini 114 sys.stdout = sys.__stdout__ # restore to original | 93# The final hook to generate .ini files. Called from the user script 94# once the config is built. 95def instantiate(root): 96 config.ticks_per_sec = float(root.clock.frequency) 97 # ugly temporary hack to get output to config.ini 98 sys.stdout = file('config.ini', 'w') 99 root.print_ini() 100 sys.stdout.close() # close config.ini 101 sys.stdout = sys.__stdout__ # restore to original |
115 main.initialize() # load config.ini into C++ and process it | 102 main.loadIniFile(resolveSimObject) # load config.ini into C++ 103 root.createCCObject() 104 root.connectPorts() 105 main.finalInit() |
116 noDot = True # temporary until we fix dot 117 if not noDot: 118 dot = pydot.Dot() 119 instance.outputDot(dot) 120 dot.orientation = "portrait" 121 dot.size = "8.5,11" 122 dot.ranksep="equally" 123 dot.rank="samerank" --- 14 unchanged lines hidden --- | 106 noDot = True # temporary until we fix dot 107 if not noDot: 108 dot = pydot.Dot() 109 instance.outputDot(dot) 110 dot.orientation = "portrait" 111 dot.size = "8.5,11" 112 dot.ranksep="equally" 113 dot.rank="samerank" --- 14 unchanged lines hidden --- |