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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_3/] [sw/] [verif/] [black_box/] [da/] [test.asm] - Blame information for rev 344

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

Line No. Rev Author Line
1 25 arniml
        ;; *******************************************************************
2 295 arniml
        ;; $Id: test.asm 295 2009-04-01 19:32:48Z arniml $
3 25 arniml
        ;;
4
        ;; Test DA A.
5
        ;; *******************************************************************
6
 
7
        INCLUDE "cpu.inc"
8
        INCLUDE "pass_fail.inc"
9
 
10
        ORG     0
11
 
12
        ;; Start of test
13
        mov     r7, #000H
14
 
15
        ;; testcase from "Single Component MCS-48 System"
16
        mov     a, #09BH
17
        da      a
18
        jnc     fail
19 46 arniml
        mov     r0, a
20
        mov     a, psw
21
        jb6     fail
22
        mov     a, r0
23 25 arniml
        cpl     a
24
        add     a, #001H
25
        cpl     a
26
        jnz     fail
27
 
28
        ;; a value that should not be changed
29
        ;; upper nibble: no overflow
30
        ;; lower nibble: no overflow
31
        mov     a, #037H
32
        add     a, r7           ; clear C and AC
33
        da      a
34
        jc      fail
35 46 arniml
        mov     r0, a
36
        mov     a, psw
37
        jb6     fail
38
        mov     a, r0
39 25 arniml
        cpl     a
40
        add     a, #037H
41
        cpl     a
42
        jnz     fail
43
 
44
        ;; upper nibble: no overflow
45
        ;; lower nibble: overflow
46
        mov     a, #04AH
47
        add     a, r7           ; clear C and AC
48
        da      a
49
        jc      fail
50 46 arniml
        mov     r0, a
51
        mov     a, psw
52
        jb6     fail
53
        mov     a, r0
54 25 arniml
        cpl     a
55
        add     a, #050H
56
        cpl     a
57
        jnz     fail
58
 
59
        ;; upper nibble: overflow
60
        ;; lower nibble: no overflow
61
        mov     a, #0C1H
62
        add     a, r7           ; clear C and AC
63
        da      a
64
        jnc     fail
65 46 arniml
        mov     r0, a
66
        mov     a, psw
67
        jb6     fail
68
        mov     a, r0
69 25 arniml
        cpl     a
70
        add     a, #021H
71
        cpl     a
72
        jnz     fail
73
 
74
        ;; upper nibble: overflow
75
        ;; lower nibble: overflow
76
        mov     a, #0DEH
77
        add     a, r7           ; clear C and AC
78
        da      a
79
        jnc     fail
80 46 arniml
        mov     r0, a
81
        mov     a, psw
82
        jb6     fail
83
        mov     a, r0
84 25 arniml
        cpl     a
85
        add     a, #044H
86
        cpl     a
87
        jnz     fail
88
 
89
 
90
        ;; ******************************************************************
91
        ;; Next round with Auxiliary Carry
92
        ;; ******************************************************************
93
 
94
        add     a, r7           ; clear C and AC
95
        ;; upper nibble: no overflow
96
        ;; lower nibble: no overflow
97
        mov     a, #029H        ; add two BCD numbers
98
        add     a, #019H        ; result: 042H, but should be 48 BCD
99
        jc      fail
100
        mov     r0, a
101
        mov     a, psw
102
        jb6     goon1
103
        jmp     fail
104
goon1:  mov     a, r0
105
        da      a
106
        jc      fail
107
        cpl     a
108
        add     a, #048H
109
        cpl     a
110
        jnz     fail
111
 
112
        add     a, r7           ; clear C and AC
113
        ;; upper nibble: overflow
114
        ;; lower nibble: no overflow
115
        mov     a, #067H        ; add two BCD numbers
116
        add     a, #059H        ; result: 0C0H, but should be 126 BCD
117
        jc      fail
118
        mov     r0, a
119
        mov     a, psw
120
        jb6     goon2
121
        jmp     fail
122
goon2:  mov     a, r0
123
        clr     c               ; clear Carry, make set Carry by da testable
124
        da      a
125
        jnc     fail
126
        cpl     a
127
        add     a, #026H
128
        cpl     a
129
        jnz     fail
130
 
131
        add     a, r7           ; clear C and AC
132
        ;; upper nibble: no overflow
133
        ;; lower nibble: overflow
134
        mov     a, #01FH        ; this is not a BCD number!
135
        add     a, #033H        ; reault: 052H, reveals 58 BCD
136
        jc      fail
137
        mov     r0, a
138
        mov     a, psw
139
        jb6     goon3
140
        jmp     fail
141
goon3:  mov     a, r0
142
        da      a
143
        jc      fail
144
        cpl     a
145
        add     a, #058H
146
        cpl     a
147
        jnz     fail
148
 
149
        add     a, r7           ; clear C and AC
150
        ;; upper nibble: overflow
151
        ;; lower nibble: overflow
152
        mov     a, #0EEH        ; this is not a BCD number!
153
        add     a, #0C5H        ; result: 1B3H. reveals 119 BCD
154
        jnc     fail
155
        mov     r0, a
156
        mov     a, psw
157
        jb6     goon4
158
        jmp     fail
159
goon4:  mov     a, r0
160
        clr     c               ; clear Carry, make set Carry by da testable
161
        da      a
162
        jnc     fail
163
        cpl     a
164
        add     a, #019H
165
        cpl     a
166
        jnz     fail
167
 
168
 
169
pass:   PASS
170
 
171
fail:   FAIL

powered by: WebSVN 2.1.0

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