initial
[fpgammix.git] / regression-tests / test-div / test-divu-kernel.mms
blob41b490d949a0238561da78dc90e5811c0d2fff00
1 % Run some simple tests on DIVU (unsigned)
3 % This depends on working GETA, LDOU, PUT
4 % TRAP, SETL, CMP, BZ
6         LOC     #80000000
8 Main    GETA    $255,Traphandler
9         BNN     $255,1F
10         PUT     rT,$255                 % We only try this in supervisor mode
11 1H      GETA    $255,FailMsg
12         GETA    $0,Numbers
13 Loop    PUT     rA,0                    % clear current exception
14         LDOU    $8,$0,0                 % Upper quotient
15         LDOU    $1,$0,8                 % Quotient
16         LDOU    $2,$0,16                % Divisor
17         LDOU    $3,$0,24                % Expected result
18         LDOU    $4,$0,32                % Expected remainder
19         LDOU    $7,$0,40                % Expected exception
21         PUT     rD,$8
22         DIVU    $5,$1,$2
23         CMPU    $6,$5,$3                % check result
24         BNZ     $6,Done
26         GET     $5,rR                   % check remainder
27         CMPU    $6,$5,$4
28         BNZ     $6,Done
30         GET     $5,rA                   % check current exception
31         AND     $5,$5,(1<<6)|(1<<7)     % keep only DV bits
32         CMPU    $6,$5,$7
33         BNZ     $6,Done
35         ADDU    $0,$0,48                % move to next data tuple
36         GETA    $1,End
37         CMP     $1,$0,$1
38         BNZ     $1,Loop
40         GETA    $255,PassMsg
42 Done    TRAP    0,Fputs,StdOut
43         TRAP    0,Halt,0
45 PassMsg BYTE    "Passed",#a,0
46 FailMsg BYTE    "Failed!",#a,0
48 Numbers OCTA            0
49         OCTA    -17092006
50         OCTA        -2020
51         OCTA            0
52         OCTA    -17092006
53         OCTA    0
55         OCTA         1233
56         OCTA     17092006
57         OCTA            0
58         OCTA         1233
59         OCTA     17092006
60         OCTA    0
62         OCTA    #1
63         OCTA    #1
64         OCTA    #1
65         OCTA    #1
66         OCTA    #1
67         OCTA    0
69         OCTA    #FFFFFFFFFFFFFFF
70         OCTA    #FFFFFFFFFFFFFFF
71         OCTA    #FFFFFFFFFFFFFFF
72         OCTA    #FFFFFFFFFFFFFFF
73         OCTA    #FFFFFFFFFFFFFFF
74         OCTA    0
76         OCTA    #FFFFFFFFFFFFFFFF
77         OCTA    #FFFFFFFFFFFFFFFF
78         OCTA    #FFFFFFFFFFFFFFFF
79         OCTA    #FFFFFFFFFFFFFFFF
80         OCTA    #FFFFFFFFFFFFFFFF
81         OCTA    0
83         OCTA            0
84         OCTA    -17092006
85         OCTA         2020
86         OCTA    #20718d6f046eea
87         OCTA    #3f2
88         OCTA    0
90         OCTA            0
91         OCTA     17092006
92         OCTA        -2020
93         OCTA    0
94         OCTA    #104cda6
95         OCTA    0
97         OCTA            0
98         OCTA    #8000000000000017
99         OCTA    #0
100         OCTA    #0
101         OCTA    #8000000000000017
102         OCTA    0
104         OCTA           0
105         OCTA    20060917
106         OCTA        1646
107         OCTA       12187
108         OCTA        1115
109         OCTA           0
111         OCTA    0
112         OCTA    #8000000000000000
113         OCTA    #FFFFFFFFFFFFFFFF
114         OCTA    0
115         OCTA    #8000000000000000
116         OCTA    0
118         OCTA            0
119         OCTA    -17092006
120         OCTA        -2020
121         OCTA            0
122         OCTA    #fffffffffefb325a
123         OCTA    0
125         OCTA       123456
126         OCTA     17092006
127         OCTA         2020
128         OCTA    #1e240
129         OCTA    #104cda6
130         OCTA    0
132         OCTA         2020
133         OCTA     17092006
134         OCTA         2020
135         OCTA    #7e4
136         OCTA    #104cda6
137         OCTA    0
141 End     OCTA    0
144 % This has no impact on mmix simulation, but is for RTL
145 Traphandler     GET     $255,rBB
146                 LDBU    $0,$255
147                 SETH    $1,1
148 1H              LDO     $2,$1
149                 PBOD    $2,1B
150                 STO     $0,$1
151                 PUT     255,255