Beispiel #1
0
def execute_trunc_w_s(s, inst):
    # TODO: check for overflow
    x = bits2float(s.rf[inst.fs()])
    s.rf[inst.fd()] = trim(int(x))  # round down
    s.pc += 4
Beispiel #2
0
def execute_c_le_s(s, inst):
    a = bits2float(s.rf[inst.fs()])
    b = bits2float(s.rf[inst.ft()])
    s.rf[inst.fd()] = 1 if a <= b else 0
    s.pc += 4
Beispiel #3
0
def execute_cvt_w_s(s, inst):
    x = bits2float(s.rf[inst.fs()])
    s.rf[inst.fd()] = trim(int(x))
    s.pc += 4
Beispiel #4
0
def execute_div_s(s, inst):
    a = bits2float(s.rf[inst.fs()])
    b = bits2float(s.rf[inst.ft()])
    s.rf[inst.fd()] = float2bits(a / b)
    s.pc += 4