Esempio n. 1
0
File: isa.py Progetto: cfbolz/pydgin
def execute_cmn(s, inst):
    if condition_passed(s, inst.cond()):
        a, (b, _) = s.rf[inst.rn()], shifter_operand(s, inst)
        result = a + b

        s.N = (result >> 31) & 1
        s.Z = trim_32(result) == 0
        s.C = carry_from(result)
        s.V = overflow_from_add(a, b, result)

        if inst.rd() == 15:
            return
    s.rf[PC] = s.fetch_pc() + 4
Esempio n. 2
0
def execute_cmn( s, inst ):
  if condition_passed( s, inst.cond ):
    a, (b, _) = s.rf[ inst.rn ], shifter_operand( s, inst )
    result = a + b

    s.N = (result >> 31)&1
    s.Z = trim_32( result ) == 0
    s.C = carry_from( result )
    s.V = overflow_from_add( a, b, result )

    if inst.rd == 15:
      return
  s.rf[PC] = s.fetch_pc() + 4
Esempio n. 3
0
def execute_add(s, inst):
    if condition_passed(s, inst.cond):
        a, (b, _) = s.rf[inst.rn], shifter_operand(s, inst)
        result = a + b
        s.rf[inst.rd] = trim_32(result)

        if inst.S:
            if inst.rd == 15: raise FatalError('Writing SPSR not implemented!')
            s.N = (result >> 31) & 1
            s.Z = trim_32(result) == 0
            s.C = carry_from(result)
            s.V = overflow_from_add(a, b, result)

        if inst.rd == 15:
            return
    s.rf[PC] = s.fetch_pc() + 4
Esempio n. 4
0
def execute_add( s, inst ):
  if condition_passed( s, inst.cond ):
    a, (b, _)  = s.rf[ inst.rn ], shifter_operand( s, inst )
    result   = a + b
    s.rf[ inst.rd ] = trim_32( result )

    if inst.S:
      if inst.rd == 15: raise FatalError('Writing SPSR not implemented!')
      s.N = (result >> 31)&1
      s.Z = trim_32( result ) == 0
      s.C = carry_from( result )
      s.V = overflow_from_add( a, b, result )

    if inst.rd == 15:
      return
  s.rf[PC] = s.fetch_pc() + 4