12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- from __future__ import division, absolute_import, print_function, unicode_literals
- from awlsim.common.compat import *
- from awlsim.common.util import *
- from awlsim.common.exceptions import *
- from awlsim.core.hardware_params import *
- from awlsim.core.hardware import *
- from awlsim.core.operators import *
- from awlsim.core.offset import *
- from awlsim.core.cpu import *
- class HardwareInterface_Dummy(AbstractHardwareInterface):
- name = "dummy"
- description = "Dummy hardware module that does nothing."
- def __init__(self, sim, parameters={}):
- AbstractHardwareInterface.__init__(self,
- sim = sim,
- parameters = parameters)
- def doStartup(self):
- pass
- def doShutdown(self):
- pass
- def readInputs(self):
- pass
- def writeOutputs(self):
- pass
- def directReadInput(self, accessWidth, accessOffset):
- if accessOffset < self.inputAddressBase:
- return bytearray()
-
- try:
- return self.sim.cpu.fetchInputRange(accessOffset, accessWidth // 8)
- except AwlSimError as e:
-
- return bytearray( (0,) * (accessWidth // 8) )
- def directWriteOutput(self, accessWidth, accessOffset, data):
- if accessOffset < self.outputAddressBase:
- return False
-
- return True
- HardwareInterface = HardwareInterface_Dummy
|