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

Subversion Repositories potato

[/] [potato/] [trunk/] [riscv-tests/] [sb.S] - Blame information for rev 15

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 skordal
# See LICENSE for license details.
2
 
3
#*****************************************************************************
4
# sb.S
5
#-----------------------------------------------------------------------------
6
#
7
# Test sb instruction.
8
#
9
 
10
#include "riscv_test.h"
11
#include "test_macros.h"
12
 
13
RVTEST_RV32U
14
RVTEST_CODE_BEGIN
15
 
16
  #-------------------------------------------------------------
17
  # Basic tests
18
  #-------------------------------------------------------------
19
 
20
  TEST_ST_OP( 2, lb, sb, 0xffffffaa, 0, tdat );
21
  TEST_ST_OP( 3, lb, sb, 0x00000000, 1, tdat );
22
#ifdef __RISCVEL
23
  TEST_ST_OP( 4, lh, sb, 0xffffefa0, 2, tdat );
24
#elif defined(__RISCVEB)
25
#else
26
  TEST_ST_OP( 4, lh, sb, 0xffffa0ef, 2, tdat );
27
#error unknown endianness!
28
#endif
29
  TEST_ST_OP( 5, lb, sb, 0x0000000a, 3, tdat );
30
 
31
  # Test with negative offset
32
 
33
  TEST_ST_OP( 6, lb, sb, 0xffffffaa, -3, tdat8 );
34
  TEST_ST_OP( 7, lb, sb, 0x00000000, -2, tdat8 );
35
  TEST_ST_OP( 8, lb, sb, 0xffffffa0, -1, tdat8 );
36
  TEST_ST_OP( 9, lb, sb, 0x0000000a, 0,  tdat8 );
37
 
38
  # Test with a negative base
39
 
40
  TEST_CASE( 10, x3, 0x78, \
41
    la  x1, tdat9; \
42
    li  x2, 0x12345678; \
43
    addi x4, x1, -32; \
44
    sb x2, 32(x4); \
45
    lb x3, 0(x1); \
46
  )
47
 
48
  # Test with unaligned base
49
 
50
  TEST_CASE( 11, x3, 0xffffff98, \
51
    la  x1, tdat9; \
52
    li  x2, 0x00003098; \
53
    addi x1, x1, -6; \
54
    sb x2, 7(x1); \
55
    la  x4, tdat10; \
56
    lb x3, 0(x4); \
57
  )
58
 
59
  #-------------------------------------------------------------
60
  # Bypassing tests
61
  #-------------------------------------------------------------
62
 
63
  TEST_ST_SRC12_BYPASS( 12, 0, 0, lb, sb, 0xffffffdd, 0, tdat );
64
  TEST_ST_SRC12_BYPASS( 13, 0, 1, lb, sb, 0xffffffcd, 1, tdat );
65
  TEST_ST_SRC12_BYPASS( 14, 0, 2, lb, sb, 0xffffffcc, 2, tdat );
66
  TEST_ST_SRC12_BYPASS( 15, 1, 0, lb, sb, 0xffffffbc, 3, tdat );
67
  TEST_ST_SRC12_BYPASS( 16, 1, 1, lb, sb, 0xffffffbb, 4, tdat );
68
  TEST_ST_SRC12_BYPASS( 17, 2, 0, lb, sb, 0xffffffab, 5, tdat );
69
 
70
  TEST_ST_SRC21_BYPASS( 18, 0, 0, lb, sb, 0x33, 0, tdat );
71
  TEST_ST_SRC21_BYPASS( 19, 0, 1, lb, sb, 0x23, 1, tdat );
72
  TEST_ST_SRC21_BYPASS( 20, 0, 2, lb, sb, 0x22, 2, tdat );
73
  TEST_ST_SRC21_BYPASS( 21, 1, 0, lb, sb, 0x12, 3, tdat );
74
  TEST_ST_SRC21_BYPASS( 22, 1, 1, lb, sb, 0x11, 4, tdat );
75
  TEST_ST_SRC21_BYPASS( 23, 2, 0, lb, sb, 0x01, 5, tdat );
76
 
77
  li a0, 0xef
78
  la a1, tdat
79
  sb a0, 3(a1)
80
 
81
  TEST_PASSFAIL
82
 
83
RVTEST_CODE_END
84
 
85
  .data
86
RVTEST_DATA_BEGIN
87
 
88
  TEST_DATA
89
 
90
tdat:
91
tdat1:  .byte 0xef
92
tdat2:  .byte 0xef
93
tdat3:  .byte 0xef
94
tdat4:  .byte 0xef
95
tdat5:  .byte 0xef
96
tdat6:  .byte 0xef
97
tdat7:  .byte 0xef
98
tdat8:  .byte 0xef
99
tdat9:  .byte 0xef
100
tdat10: .byte 0xef
101
 
102
RVTEST_DATA_END

powered by: WebSVN 2.1.0

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