本文整理匯總了Python中machine.Machine.loadInstructions方法的典型用法代碼示例。如果您正苦於以下問題:Python Machine.loadInstructions方法的具體用法?Python Machine.loadInstructions怎麽用?Python Machine.loadInstructions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類machine.Machine
的用法示例。
在下文中一共展示了Machine.loadInstructions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from machine import Machine [as 別名]
# 或者: from machine.Machine import loadInstructions [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()