当前位置: 首页>>代码示例>>Python>>正文


Python Machine.loadProgram方法代码示例

本文整理汇总了Python中machine.Machine.loadProgram方法的典型用法代码示例。如果您正苦于以下问题:Python Machine.loadProgram方法的具体用法?Python Machine.loadProgram怎么用?Python Machine.loadProgram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在machine.Machine的用法示例。


在下文中一共展示了Machine.loadProgram方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_execute_trap

# 需要导入模块: from machine import Machine [as 别名]
# 或者: from machine.Machine import loadProgram [as 别名]
 def test_execute_trap(self):
     machine = Machine()
     machine.loadProgram('Tomasulo/intUnit1.hex')
     instruction = Instruction(0x44800003)
     machine.issue(instruction)
     machine.execute()
     machine.execute()
开发者ID:kaledj,项目名称:TomasuloSim,代码行数:9,代码来源:test_machine.py

示例2: test_brUnit1

# 需要导入模块: from machine import Machine [as 别名]
# 或者: from machine.Machine import loadProgram [as 别名]
 def test_brUnit1(self):
     sys.stdout = output = io.StringIO()
     machine = Machine()
     machine.loadProgram('Tomasulo/brUnit1.hex')
     machine.run()
     with open('Tomasulo/brUnit1.out', 'r') as answerFile:
         answer = answerFile.read()
     self.assertEquals(output.getvalue(), answer)
开发者ID:kaledj,项目名称:TomasuloSim,代码行数:10,代码来源:test_tomasulo.py

示例3: test_allInts

# 需要导入模块: from machine import Machine [as 别名]
# 或者: from machine.Machine import loadProgram [as 别名]
 def test_allInts(self):
     for i in range(1, 9):
         sys.stdout = output = io.StringIO()
         machine = Machine()
         machine.loadProgram('Tomasulo/intUnit{0}.hex'.format(i))
         machine.run()
         with open('Tomasulo/intUnit{0}.out'.format(i), 'r') as answerFile:
             answer = answerFile.read()
         self.assertEquals(output.getvalue(), answer)
开发者ID:kaledj,项目名称:TomasuloSim,代码行数:11,代码来源:test_tomasulo.py

示例4: test_all

# 需要导入模块: from machine import Machine [as 别名]
# 或者: from machine.Machine import loadProgram [as 别名]
 def test_all(self):
     sys.stdout = output = io.StringIO()
     for inputFile in os.listdir('Tomasulo'):
         if inputFile.endswith('.dlx'): continue
         if inputFile.endswith('.out'): continue
         machine = Machine()
         machine.loadProgram('Tomasulo/' + inputFile)
         machine.run()
         with open('Tomasulo/' + inputFile.strip('.hex') + '.out', 'r') as answerFile:
             answer = answerFile.read()
         self.assertEquals(output.getvalue(), answer)
开发者ID:kaledj,项目名称:TomasuloSim,代码行数:13,代码来源:test_tomasulo.py

示例5: test_nextInstructionAndIssue

# 需要导入模块: from machine import Machine [as 别名]
# 或者: from machine.Machine import loadProgram [as 别名]
 def test_nextInstructionAndIssue(self):
     machine = Machine()
     machine.loadProgram('Tomasulo/memUnit1.hex')
     count = 0
     while True:
         instruc = machine.nextInstruction()
         machine.issue(instruc)
         count += 1
         machine.PC += 4
         if instruc.isHalt():
             break
     self.assertEquals(count, 26)
     rstations = machine.dumpRStations()
开发者ID:kaledj,项目名称:TomasuloSim,代码行数:15,代码来源:test_machine.py

示例6: test_nextInstruction

# 需要导入模块: from machine import Machine [as 别名]
# 或者: from machine.Machine import loadProgram [as 别名]
 def test_nextInstruction(self):
     machine = Machine()
     machine.loadProgram('Tomasulo/intUnit1.hex')
     instruc = machine.nextInstruction()
开发者ID:kaledj,项目名称:TomasuloSim,代码行数:6,代码来源:test_machine.py


注:本文中的machine.Machine.loadProgram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。