Exemple #1
0
 def get(self,
         iaddr: str,
         address: SSV.SimAddress,
         size: int) -> SV.SimValue:
     try:
         for base in self.baseoffsets:
             if (
                     address.offsetvalue >= base
                     and address.offsetvalue < base + self.buffersize):
                 address = address.add_offset(-base)
                 try:
                     memval = SimMemory.get(self, iaddr, address, size)
                 except SU.CHBSimError:
                     memval = SV.mk_simvalue(0, size=size)
                 return memval
         else:
             raise SU.CHBSimError(
                 self.simstate,
                 iaddr,
                 "invalid shared memory address: " + str(address))
     except SU.CHBSimError as e:
         print("Error in shared memory: " + str(e))
         name = (self.name
                 + '['
                 + str(address.offsetvalue)
                 + ']'
                 + ' (value not retrieved: '
                 + str(e)
                 + ')')
         return SSV.SimSymbol(name)
 def get(self, iaddr: str, address: SSV.SimAddress,
         size: int) -> SV.SimValue:
     try:
         memval = SimMemory.get(self, iaddr, address, size)
     except SU.CHBSimError as e:
         print("Error in basemem: " + str(e))
         name = (self.name + '[' + str(address.offsetvalue) + ']' +
                 ' (value not retrieved: ' + str(e) + ')')
         return SSV.SimSymbol(name)
     else:
         return memval
    def do_initialization(self, simstate: "SimulationState") -> None:
        simstate.registers["sp"] = SSV.SimStackAddress(SV.simZero)
        simstate.registers["zero"] = SV.simZero
        for reg in [
                "ra", "gp", "fp", "s0", "s1", "s2", "s3", "s4", "s5", "s6",
                "s7"
        ]:
            simstate.registers[reg] = SSV.SimSymbol(reg + "_in")
        simstate.registers["t9"] = SSV.mk_global_address(
            int(simstate.startaddr, 16), modulename=simstate.modulename)

        if len(self.cmdlineargs) > 0:
            self.initialize_cmdline_arguments(simstate)