本文整理汇总了Python中machine.Machine.executeInstructions方法的典型用法代码示例。如果您正苦于以下问题:Python Machine.executeInstructions方法的具体用法?Python Machine.executeInstructions怎么用?Python Machine.executeInstructions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类machine.Machine
的用法示例。
在下文中一共展示了Machine.executeInstructions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from machine import Machine [as 别名]
# 或者: from machine.Machine import executeInstructions [as 别名]
def main(argv):
if len(argv) < 5:
print "Usage: mipssim.py -i [input_file_name] -o [output_file_name]"
quit(-1)
try:
inputFilenameIndex = argv.index('-i') + 1
outputFilenameIndex = argv.index('-o') + 1
except ValueError:
print "Usage: mipssim.py -i [input_file_name] -o [output_file_name]"
quit(-1)
infileName = argv[inputFilenameIndex]
if '.bin' not in infileName:
infileName+='.bin'
outFileName = argv[outputFilenameIndex]
(word, address) = filemanager.loadInstructionsAndAddresses(infileName)
instruction = []
for i in range(len(word)):
instruction.append(Instruction(word[i], address[i]))
disassembler.target_file = open(outFileName+'_dis.txt', 'w')
disassembler.disassembleSet(instruction)
mips = Machine(outFileName+'_sim.txt')
mips.loadInstructions(instruction)
mips.executeInstructions()