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

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [firmware/] [test002.asm] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 ring0_mipt
/*
2
 * This test calculates a few Fibonacci sequence members
3
 * end compares them to pre-calculated values.
4
 */
5
 
6
        lc r100, 0x10000000 // test result output pointer
7
        lc r101, halt
8
 
9
// Calculate Fibonacci sequence members
10
        mov r16, 0 // current member
11
        mov r17, 1 // next member
12
        lc r18, 0 // counter
13
        lc r19, 0x00008000 // destination pointer
14
        lc r32, calc_loop
15
 
16
calc_loop:
17
        sw r19, r16
18
        add r19, r19, 4
19
        add r18, r18, 1
20
        add r0, r16, r17
21
        mov r16, r17
22
        mov r17, r0
23
        cjmpul r32, r18, 40
24
 
25
// Compare
26
        lc r16, 0x00008000
27
        lc r17, expected
28
        mov r18, 0 // counter
29
        lc r32, comp_loop
30
        lc r33, comp_differ
31
 
32
comp_loop:
33
        lw r0, r16
34
        lw r1, r17
35
        cjmpne r33, r0, r1
36
        add r16, r16, 4
37
        add r17, r17, 4
38
        add r18, r18, 1
39
        cjmpul r32, r18, 40
40
 
41
// Everything seems to be OK
42
        sw r100, 1
43
 
44
halt:
45
        hlt
46
        jmp r101
47
 
48
comp_differ:
49
        sw r100, 2
50
        jmp r101
51
 
52
// Expected (pre-calculated) values
53
expected:
54
        .word 0
55
        .word 1
56
        .word 1
57
        .word 2
58
        .word 3
59
        .word 5
60
        .word 8
61
        .word 13
62
        .word 21
63
        .word 34
64
        .word 55
65
        .word 89
66
        .word 144
67
        .word 233
68
        .word 377
69
        .word 610
70
        .word 987
71
        .word 1597
72
        .word 2584
73
        .word 4181
74
        .word 6765
75
        .word 10946
76
        .word 17711
77
        .word 28657
78
        .word 46368
79
        .word 75025
80
        .word 121393
81
        .word 196418
82
        .word 317811
83
        .word 514229
84
        .word 832040
85
        .word 1346269
86
        .word 2178309
87
        .word 3524578
88
        .word 5702887
89
        .word 9227465
90
        .word 14930352
91
        .word 24157817
92
        .word 39088169
93
        .word 63245986

powered by: WebSVN 2.1.0

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