master
c
44 lines
732 Bytes
|
1
|
#include<stdio.h> |
|
2
|
#include<assert.h> |
|
3
|
|
|
4
|
int main() |
|
5
|
{ |
|
6
|
int dsp, sum; |
|
7
|
int result; |
|
8
|
|
|
9
|
dsp = 0x20; |
|
10
|
sum = 0x01; |
|
11
|
result = 0x02; |
|
12
|
|
|
13
|
__asm |
|
14
|
("wrdsp %1\n\t" |
|
15
|
"bposge32 test1\n\t" |
|
16
|
"nop\n\t" |
|
17
|
"addi %0, 0xA2\n\t" |
|
18
|
"nop\n\t" |
|
19
|
"test1:\n\t" |
|
20
|
"addi %0, 0x01\n\t" |
|
21
|
: "+r"(sum) |
|
22
|
: "r"(dsp) |
|
23
|
); |
|
24
|
assert(sum == result); |
|
25
|
|
|
26
|
dsp = 0x10; |
|
27
|
sum = 0x01; |
|
28
|
result = 0xA4; |
|
29
|
|
|
30
|
__asm |
|
31
|
("wrdsp %1\n\t" |
|
32
|
"bposge32 test2\n\t" |
|
33
|
"nop\n\t" |
|
34
|
"addi %0, 0xA2\n\t" |
|
35
|
"nop\n\t" |
|
36
|
"test2:\n\t" |
|
37
|
"addi %0, 0x01\n\t" |
|
38
|
: "+r"(sum) |
|
39
|
: "r"(dsp) |
|
40
|
); |
|
41
|
assert(sum == result); |
|
42
|
|
|
43
|
return 0; |
|
44
|
} |