Beispiel #1
0
def execute_fmax_d( s, inst ):
  a, b = s.fp[inst.rs1], s.fp[inst.rs2]
  # TODO: s.fp[ inst.rd ] = sfp.isNaNF64UI(b) || ...
  s.fp[ inst.rd ] = a if sfp.f64_le_quiet(b,a) else b
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #2
0
def execute_fmax_s( s, inst ):
  a, b = trim_32( s.fp[inst.rs1] ), trim_32( s.fp[inst.rs2] )
  # TODO: s.fp[ inst.rd ] = sfp.isNaNF32UI(b) || ...
  s.fp[ inst.rd ] = a if sfp.f32_le_quiet(b,a) else b
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #3
0
def execute_fmadd_s( s, inst ):
  a, b, c = s.fp[inst.rs1], s.fp[inst.rs2], s.fp[inst.rs3]
  s.fp[ inst.rd ] = sfp.f32_mulAdd( a, b, c )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #4
0
def execute_fcvt_s_wu( s, inst ):
  a = trim_32(s.rf[inst.rs1])
  s.fp[inst.rd] = sfp.ui32_to_f32( a )
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #5
0
def execute_fcvt_s_w( s, inst ):
  a = signed( s.rf[inst.rs1], 32 )
  s.fp[inst.rd] = sfp.i32_to_f32( a )
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #6
0
def execute_fle_s( s, inst ):
  a, b = trim_32( s.fp[inst.rs1] ), trim_32( s.fp[inst.rs2] )
  s.rf[ inst.rd ] = sfp.f32_le( a, b )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #7
0
def execute_fcvt_wu_s( s, inst ):
  s.rf[inst.rd] = sext_32(sfp.f32_to_ui32( s.fp[inst.rs1], inst.rm, True ))
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #8
0
def execute_fcvt_l_s( s, inst ):
  s.rf[inst.rd] = sfp.f32_to_i64( s.fp[inst.rs1], inst.rm, True )
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #9
0
def execute_fcvt_s_lu( s, inst ):
  a = s.rf[inst.rs1]
  s.fp[inst.rd] = sfp.ui64_to_f32( a )
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #10
0
def execute_fsub_d( s, inst ):
  a, b = s.fp[inst.rs1], s.fp[inst.rs2]
  s.fp[ inst.rd ] = sfp.f64_sub( a, b )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #11
0
def execute_fcvt_d_l( s, inst ):
  a = signed( s.rf[inst.rs1], 64 )
  s.fp[inst.rd] = sfp.i64_to_f64( a )
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #12
0
def execute_fnmsub_d( s, inst ):
  a, b, c = s.fp[inst.rs1], s.fp[inst.rs2], s.fp[inst.rs3]
  s.fp[ inst.rd ] = sfp.f64_mulAdd( fp_neg(a,64), b, c )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #13
0
def execute_fcvt_d_s( s, inst ):
  s.fp[inst.rd] = sfp.f32_to_f64( trim_32(s.fp[inst.rs1]) )
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #14
0
def execute_fcvt_s_d( s, inst ):
  s.fp[inst.rd] = sfp.f64_to_f32( s.fp[inst.rs1] )
  s.fcsr        = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #15
0
def execute_fnmadd_s( s, inst ):
  a, b, c = s.fp[inst.rs1], s.fp[inst.rs2], s.fp[inst.rs3]
  s.fp[ inst.rd ] = sfp.f32_mulAdd( fp_neg(a,32), b, fp_neg(c,32) )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #16
0
def execute_fsqrt_s( s, inst ):
  a = trim_32( s.fp[inst.rs1] )
  s.fp[ inst.rd ] = sext_32( sfp.f32_sqrt( a ) )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #17
0
def execute_fsub_s( s, inst ):
  a, b = trim_32( s.fp[inst.rs1] ), trim_32( s.fp[inst.rs2] )
  s.fp[ inst.rd ] = sext_32( sfp.f32_sub( a, b ) )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4
Beispiel #18
0
def execute_fsqrt_d( s, inst ):
  a = s.fp[inst.rs1]
  s.fp[ inst.rd ] = sfp.f64_sqrt( a )
  s.fcsr          = sfp.get_flags()
  sfp.set_flags( 0 )
  s.pc += 4