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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [asm/] [testdiv.S] - Blame information for rev 42

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

Line No. Rev Author Line
1 41 dgisselq
entry:
2
        ; Set up a test program
3
        MOV     test_div_program(PC),uPC
4
        MOV     top_of_stack(PC),uSP
5
        ; Run it in user space
6
        RTU
7
        ; Check for how the result came back: R0 = 0 means success
8
        MOV     uR11,R11
9
        TST     -1,R11
10
        HALT.Z
11
        BUSY
12
 
13
test_div_program:
14
        SUB     1,SP
15
        ;
16
        LDI     1,R11
17
        LDI     5,R0
18
        LDI     1,R1
19
        LDI     5,R2
20
        LDI     0,R3
21
        MOV     __HERE__+3(PC),R4
22
        STO     R4,1(SP)
23
        BRA     test_divs
24
 
25
        ;
26
        LDI     2,R11
27
        LDI     5,R0
28
        LDI     2,R1
29
        LDI     2,R2
30
        LDI     1,R3
31
        MOV     __HERE__+3(PC),R4
32
        STO     R4,1(SP)
33
        BRA     test_divs
34
 
35
        ;
36
        LDI     3,R11
37
        LDI     0xb53d0,R0
38
        LDI     0x2d,R1
39
        LDI     16496,R2
40
        LDI     32,R3
41
        MOV     __HERE__+3(PC),R4
42
        STO     R4,1(SP)
43
        BRA     test_divs
44
 
45
        ;
46
        LDI     4,R11
47
        LDI     2031890191,R0
48
        LDI     120193795,R1
49
        LDI     16,R2
50
        LDI     108789471,R3
51
        MOV     __HERE__+3(PC),R4
52
        STO     R4,1(SP)
53
        BRA     test_divs
54
 
55
        ;
56
        LDI     5,R11
57
        LDI     203553,R0
58
        LDI     142580994,R1
59
        LDI     0,R2
60
        LDI     203553,R3
61
        MOV     __HERE__+3(PC),R4
62
        STO     R4,1(SP)
63
        BRA     test_divs
64
 
65
        ;
66
        LDI     6,R11
67
        LDI     142580994,R0
68
        LDI     203553,R1
69
        LDI     700,R2
70
        LDI     93894,R3
71
        MOV     __HERE__+3(PC),R4
72
        STO     R4,1(SP)
73
        BRA     test_divs
74
 
75
        ;
76
        LDI     7,R11
77
        LDI     142580994,R0
78
        LDI     2499,R1
79
        LDI     57055,R2
80
        LDI     549,R3
81
        MOV     __HERE__+3(PC),R4
82
        STO     R4,1(SP)
83
        BRA     test_divs
84
 
85
        ;
86
        LDI     8,R11
87
        LDI     -142580994,R0
88
        LDI     2499,R1
89
        LDI     -57055,R2
90
        LDI     -549,R3
91
        MOV     __HERE__+3(PC),R4
92
        STO     R4,1(SP)
93
        BRA     test_divs
94
 
95
        ;
96
        LDI     9,R11
97
        LDI     142580994,R0
98
        LDI     -2499,R1
99
        LDI     -57055,R2
100
        LDI     549,R3
101
        MOV     __HERE__+3(PC),R4
102
        STO     R4,1(SP)
103
        BRA     test_divs
104
 
105
        ;
106
        LDI     10,R11
107
        LDI     -142580994,R0
108
        LDI     -2499,R1
109
        LDI     57055,R2
110
        LDI     -549,R3
111
        MOV     __HERE__+3(PC),R4
112
        STO     R4,1(SP)
113
        BRA     test_divs
114
 
115
        ;
116
        CLR     R11
117
        TRAP    0
118
 
119
test_divs:
120
        ;       R0 = Numerator
121
        ;       R1 = Denominator
122
        ;       R2 = Integer result
123
        ;       R3 = Remainder
124
        ;       R11= Test failure ID
125
        SUB     1,SP
126
        MOV     R2,R4
127
        MOV     R3,R5
128
        MOV     __HERE__+3(PC),R2
129
        STO     R2,1(SP)
130
        BRA     divs
131
        CMP     R0,R4
132
        BNZ     test_failure
133
        CMP     R1,R5
134
        BNZ     test_failure
135
        ADD     1,SP
136
        RETN
137
 
138
test_failure:
139
        TRAP    0
140
        NOOP
141
        BUSY
142
 

powered by: WebSVN 2.1.0

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