OpenCores
URL https://opencores.org/ocsvn/fwrisc/fwrisc/trunk

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [riscv-compliance/] [riscv-test-suite/] [rv32ud/] [rv64ud/] [fcvt.S] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
# See LICENSE for license details.
2
 
3
#*****************************************************************************
4
# fcvt.S
5
#-----------------------------------------------------------------------------
6
#
7
# Test fcvt.d.{wu|w|lu|l}, fcvt.s.d, and fcvt.d.s instructions.
8
#
9
 
10
#include "riscv_test.h"
11
#include "compliance_test.h"
12
#include "compliance_io.h"
13
#include "aw_test_macros.h"
14
 
15
 
16
RVTEST_RV64UF
17
RVTEST_CODE_BEGIN
18
 
19
#if __riscv_xlen == 32
20
    # Replace the function with the 32-bit variant defined in test_macros.h
21
    #undef TEST_INT_FP_OP_D
22
    #define TEST_INT_FP_OP_D TEST_INT_FP_OP_D32
23
 
24
    #undef TEST_FCVT_S_D
25
    #define TEST_FCVT_S_D TEST_FCVT_S_D32
26
#endif
27
 
28
  #-------------------------------------------------------------
29
  # Arithmetic tests
30
  #-------------------------------------------------------------
31
 
32
  TEST_INT_FP_OP_D(2,  fcvt.d.w,                   2.0,  2);
33
  TEST_INT_FP_OP_D(3,  fcvt.d.w,                  -2.0, -2);
34
 
35
  TEST_INT_FP_OP_D(4, fcvt.d.wu,                   2.0,  2);
36
  TEST_INT_FP_OP_D(5, fcvt.d.wu,            4294967294, -2);
37
 
38
#if __riscv_xlen >= 64
39
  TEST_INT_FP_OP_D(6,  fcvt.d.l,                   2.0,  2);
40
  TEST_INT_FP_OP_D(7,  fcvt.d.l,                  -2.0, -2);
41
 
42
  TEST_INT_FP_OP_D(8, fcvt.d.lu,                   2.0,  2);
43
  TEST_INT_FP_OP_D(9, fcvt.d.lu, 1.8446744073709552e19, -2);
44
#endif
45
 
46
  TEST_FCVT_S_D(10, -1.5, -1.5)
47
  TEST_FCVT_D_S(11, -1.5, -1.5)
48
 
49
#if __riscv_xlen >= 64
50
  TEST_CASE(12, a0, 0x7ff8000000000000,
51
    la a1, test_data_22;
52
    ld a2, 0(a1);
53
    fmv.d.x f2, a2;
54
    fcvt.s.d f2, f2;
55
    fcvt.d.s f2, f2;
56
    fmv.x.d a0, f2;
57
  )
58
#else
59
  TEST_CASE_D32(12, a0, a1, 0x7ff8000000000000,
60
    la a1, test_data_22;
61
    fld f2, 0(a1);
62
    fcvt.s.d f2, f2;
63
    fcvt.d.s f2, f2;
64
    fsd f2, 0(a1);
65
    lw a0, 0(a1);
66
    lw a1, 4(a1)
67
  )
68
#endif
69
 
70
  # show finished.
71
  li  TESTNUM, 13;
72
  SWSIG (13, TESTNUM);
73
 
74
  TEST_PASSFAIL
75
 
76
RVTEST_CODE_END
77
 
78
  .data
79
 
80
  TEST_DATA
81
 
82
test_data_22:
83
  .dword 0x7ffcffffffff8004
84
 
85
RV_COMPLIANCE_DATA_BEGIN
86
test_res:
87
    .fill 40, 4, -1
88
RV_COMPLIANCE_DATA_END
89
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.