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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [two-op_mov-b.v] - Blame information for rev 18

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

Line No. Rev Author Line
1 2 olivier.gi
/*===========================================================================*/
2
/* Copyright (C) 2001 Authors                                                */
3
/*                                                                           */
4
/* This source file may be used and distributed without restriction provided */
5
/* that this copyright statement is not removed from the file and that any   */
6
/* derivative work contains the original copyright notice and the associated */
7
/* disclaimer.                                                               */
8
/*                                                                           */
9
/* This source file is free software; you can redistribute it and/or modify  */
10
/* it under the terms of the GNU Lesser General Public License as published  */
11
/* by the Free Software Foundation; either version 2.1 of the License, or    */
12
/* (at your option) any later version.                                       */
13
/*                                                                           */
14
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
15
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     */
16
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public       */
17
/* License for more details.                                                 */
18
/*                                                                           */
19
/* You should have received a copy of the GNU Lesser General Public License  */
20
/* along with this source; if not, write to the Free Software Foundation,    */
21
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA        */
22
/*                                                                           */
23
/*===========================================================================*/
24
/*                   TWO-OPERAND ARITHMETIC: MOV.B INSTRUCTION               */
25
/*---------------------------------------------------------------------------*/
26
/* Test the MOV.B instruction with all addressing modes                      */
27 18 olivier.gi
/*                                                                           */
28
/* Author(s):                                                                */
29
/*             - Olivier Girard,    olgirard@gmail.com                       */
30
/*                                                                           */
31
/*---------------------------------------------------------------------------*/
32
/* $Rev: 17 $                                                                */
33
/* $LastChangedBy: olivier.girard $                                          */
34
/* $LastChangedDate: 2009-08-04 23:15:39 +0200 (Tue, 04 Aug 2009) $          */
35 2 olivier.gi
/*===========================================================================*/
36
 
37
initial
38
   begin
39
      $display(" ===============================================");
40
      $display("|                 START SIMULATION              |");
41
      $display(" ===============================================");
42
      repeat(5) @(posedge mclk);
43
      stimulus_done = 0;
44
 
45
      // Check reset values
46
      //--------------------------------------------------------
47
      if (r2 !==16'h0000) tb_error("R2  reset value");
48
      if (r3 !==16'h0000) tb_error("R3  reset value");
49
      if (r4 !==16'h0000) tb_error("R4  reset value");
50
      if (r5 !==16'h0000) tb_error("R5  reset value");
51
      if (r6 !==16'h0000) tb_error("R6  reset value");
52
      if (r7 !==16'h0000) tb_error("R7  reset value");
53
      if (r8 !==16'h0000) tb_error("R8  reset value");
54
      if (r9 !==16'h0000) tb_error("R9  reset value");
55
      if (r10!==16'h0000) tb_error("R10 reset value");
56
      if (r11!==16'h0000) tb_error("R11 reset value");
57
      if (r12!==16'h0000) tb_error("R12 reset value");
58
      if (r13!==16'h0000) tb_error("R13 reset value");
59
      if (r14!==16'h0000) tb_error("R14 reset value");
60
      if (r15!==16'h0000) tb_error("R15 reset value");
61
 
62
 
63
      // Make sure initialization worked fine
64
      //--------------------------------------------------------
65
      @(r15==16'h1000);
66
 
67
      if (r2 !==16'h0022) tb_error("R2  initialization");
68
      if (r3 !==16'h3333) tb_error("R3  initialization");
69
      if (r4 !==16'h4444) tb_error("R4  initialization");
70
      if (r5 !==16'h5555) tb_error("R5  initialization");
71
      if (r6 !==16'h6666) tb_error("R6  initialization");
72
      if (r7 !==16'h7777) tb_error("R7  initialization");
73
      if (r8 !==16'h8888) tb_error("R8  initialization");
74
      if (r9 !==16'h9999) tb_error("R9  initialization");
75
      if (r10!==16'haaaa) tb_error("R10 initialization");
76
      if (r11!==16'hbbbb) tb_error("R11 initialization");
77
      if (r12!==16'hcccc) tb_error("R12 initialization");
78
      if (r13!==16'hdddd) tb_error("R13 initialization");
79
      if (r14!==16'heeee) tb_error("R14 initialization");
80
 
81
 
82
      // MOV.B: Check when source is Rn
83
      //--------------------------------------------------------
84
      @(r15==16'h2000);
85
 
86
      if (r4     !==16'h0055) tb_error("====== MOV.B Rn Rm    =====");
87
      if (mem210 !==16'haa34) tb_error("====== MOV.B Rn x(Rm) =====");
88
      if (mem212 !==16'h7855) tb_error("====== MOV.B Rn x(Rm) =====");
89
      if (mem214 !==16'h11cd) tb_error("====== MOV.B Rn EDE   =====");
90
      if (mem216 !==16'h1299) tb_error("====== MOV.B Rn EDE   =====");
91
      if (mem218 !==16'h772e) tb_error("====== MOV.B Rn &EDE  =====");
92
      if (mem21A !==16'h4c33) tb_error("====== MOV.B Rn &EDE  =====");
93
 
94
 
95
      // MOV.B: Check when source is @Rn
96
      //--------------------------------------------------------
97
      @(r15==16'h3000);
98
 
99
      if (r5     !==16'h0033) tb_error("====== MOV.B @Rn Rm    =====");
100
      if (r6     !==16'h0044) tb_error("====== MOV.B @Rn Rm    =====");
101
 
102
      if (mem210 !==16'haa22) tb_error("====== MOV.B @Rn x(Rm) =====");
103
      if (mem212 !==16'h4455) tb_error("====== MOV.B @Rn x(Rm) =====");
104
      if (mem214 !==16'h5a55) tb_error("====== MOV.B @Rn x(Rm) =====");
105
      if (mem216 !==16'h77a5) tb_error("====== MOV.B @Rn x(Rm) =====");
106
 
107
      if (mem218 !==16'h11aa) tb_error("====== MOV.B @Rn EDE =====");
108
      if (mem21A !==16'hccee) tb_error("====== MOV.B @Rn EDE =====");
109
      if (mem21C !==16'h1edd) tb_error("====== MOV.B @Rn EDE =====");
110
      if (mem21E !==16'hffe1) tb_error("====== MOV.B @Rn EDE =====");
111
 
112
      if (mem220 !==16'h2233) tb_error("====== MOV.B @Rn &EDE  =====");
113
      if (mem222 !==16'h55dd) tb_error("====== MOV.B @Rn &EDE  =====");
114
      if (mem224 !==16'h2d66) tb_error("====== MOV.B @Rn &EDE  =====");
115
      if (mem226 !==16'h88d2) tb_error("====== MOV.B @Rn &EDE  =====");
116
 
117
 
118
      // MOV.B: Check when source is @Rn+
119
      //--------------------------------------------------------
120
      @(r15==16'h4000);
121
 
122
 
123
      if (r4     !==16'h0211) tb_error("====== MOV.B @Rn+ Rm    =====");
124
      if (r5     !==16'h0033) tb_error("====== MOV.B @Rn+ Rm    =====");
125
      if (r6     !==16'h0214) tb_error("====== MOV.B @Rn+ Rm    =====");
126
      if (r7     !==16'h0044) tb_error("====== MOV.B @Rn+ Rm    =====");
127
 
128
      if (mem210 !==16'haa22) tb_error("====== MOV.B @Rn+ x(Rm) =====");
129
      if (mem212 !==16'h4455) tb_error("====== MOV.B @Rn+ x(Rm) =====");
130
      if (mem214 !==16'h5a55) tb_error("====== MOV.B @Rn+ x(Rm) =====");
131
      if (mem216 !==16'h77a5) tb_error("====== MOV.B @Rn+ x(Rm) =====");
132
      if (r9     !==16'h0208) tb_error("====== MOV.B @Rn+ x(Rm) =====");
133
 
134
      if (mem218 !==16'h11aa) tb_error("====== MOV.B @Rn+ EDE =====");
135
      if (mem21A !==16'hccee) tb_error("====== MOV.B @Rn+ EDE =====");
136
      if (mem21C !==16'h1edd) tb_error("====== MOV.B @Rn+ EDE =====");
137
      if (mem21E !==16'hffe1) tb_error("====== MOV.B @Rn+ EDE =====");
138
      if (r10    !==16'h0208) tb_error("====== MOV.B @Rn+ EDE =====");
139
 
140
      if (mem220 !==16'h2233) tb_error("====== MOV.B @Rn+ &EDE  =====");
141
      if (mem222 !==16'h55dd) tb_error("====== MOV.B @Rn+ &EDE  =====");
142
      if (mem224 !==16'h2d66) tb_error("====== MOV.B @Rn+ &EDE  =====");
143
      if (mem226 !==16'h88d2) tb_error("====== MOV.B @Rn+ &EDE  =====");
144
      if (r11    !==16'h0208) tb_error("====== MOV.B @Rn+ &EDE  =====");
145
 
146
 
147
      // MOV.B: Check when source is #N
148
      //--------------------------------------------------------
149
      @(r15==16'h5000);
150
 
151
      if (r4     !==16'h0034) tb_error("====== MOV.B #N  Rm    =====");
152
 
153
      if (mem210 !==16'haa22) tb_error("====== MOV.B #N  x(Rm) =====");
154
      if (mem212 !==16'h4455) tb_error("====== MOV.B #N  x(Rm) =====");
155
      if (mem214 !==16'h5a66) tb_error("====== MOV.B #N  x(Rm) =====");
156
      if (mem216 !==16'h88a5) tb_error("====== MOV.B #N  x(Rm) =====");
157
 
158
      if (mem218 !==16'h11aa) tb_error("====== MOV.B #N  EDE =====");
159
      if (mem21A !==16'hccee) tb_error("====== MOV.B #N  EDE =====");
160
      if (mem21C !==16'h1eee) tb_error("====== MOV.B #N  EDE =====");
161
      if (mem21E !==16'h11e1) tb_error("====== MOV.B #N  EDE =====");
162
 
163
      if (mem220 !==16'haa33) tb_error("====== MOV.B #N  &EDE  =====");
164
      if (mem222 !==16'h55ee) tb_error("====== MOV.B #N  &EDE  =====");
165
      if (mem224 !==16'hae77) tb_error("====== MOV.B #N  &EDE  =====");
166
      if (mem226 !==16'h99ea) tb_error("====== MOV.B #N  &EDE  =====");
167
 
168
 
169
      // MOV.B: Check when source is x(Rn)
170
      //--------------------------------------------------------
171
      @(r15==16'h6000);
172
 
173
      if (r5     !==16'h0033) tb_error("====== MOV.B x(Rn) Rm    =====");
174
      if (r6     !==16'h0044) tb_error("====== MOV.B x(Rn) Rm    =====");
175
 
176
      if (mem210 !==16'haa22) tb_error("====== MOV.B x(Rn) x(Rm) =====");
177
      if (mem212 !==16'h4455) tb_error("====== MOV.B x(Rn) x(Rm) =====");
178
      if (mem214 !==16'h5a55) tb_error("====== MOV.B x(Rn) x(Rm) =====");
179
      if (mem216 !==16'h77a5) tb_error("====== MOV.B x(Rn) x(Rm) =====");
180
 
181
      if (mem218 !==16'h11aa) tb_error("====== MOV.B x(Rn) EDE =====");
182
      if (mem21A !==16'hccee) tb_error("====== MOV.B x(Rn) EDE =====");
183
      if (mem21C !==16'h1edd) tb_error("====== MOV.B x(Rn) EDE =====");
184
      if (mem21E !==16'hffe1) tb_error("====== MOV.B x(Rn) EDE =====");
185
 
186
      if (mem220 !==16'h2233) tb_error("====== MOV.B x(Rn) &EDE  =====");
187
      if (mem222 !==16'h55dd) tb_error("====== MOV.B x(Rn) &EDE  =====");
188
      if (mem224 !==16'h2d66) tb_error("====== MOV.B x(Rn) &EDE  =====");
189
      if (mem226 !==16'h88d2) tb_error("====== MOV.B x(Rn) &EDE  =====");
190
 
191
 
192
      // MOV.B: Check when source is EDE
193
      //--------------------------------------------------------
194
      @(r15==16'h7000);
195
 
196
      if (r5     !==16'h0033) tb_error("====== MOV.B EDE  Rm    =====");
197
      if (r6     !==16'h0044) tb_error("====== MOV.B EDE  Rm    =====");
198
 
199
      if (mem210 !==16'haa22) tb_error("====== MOV.B EDE  x(Rm) =====");
200
      if (mem212 !==16'h4455) tb_error("====== MOV.B EDE  x(Rm) =====");
201
      if (mem214 !==16'h5a55) tb_error("====== MOV.B EDE  x(Rm) =====");
202
      if (mem216 !==16'h77a5) tb_error("====== MOV.B EDE  x(Rm) =====");
203
 
204
      if (mem218 !==16'h11aa) tb_error("====== MOV.B EDE  EDE =====");
205
      if (mem21A !==16'hccee) tb_error("====== MOV.B EDE  EDE =====");
206
      if (mem21C !==16'h1edd) tb_error("====== MOV.B EDE  EDE =====");
207
      if (mem21E !==16'hffe1) tb_error("====== MOV.B EDE  EDE =====");
208
 
209
      if (mem220 !==16'h2233) tb_error("====== MOV.B EDE  &EDE  =====");
210
      if (mem222 !==16'h55dd) tb_error("====== MOV.B EDE  &EDE  =====");
211
      if (mem224 !==16'h2d66) tb_error("====== MOV.B EDE  &EDE  =====");
212
      if (mem226 !==16'h88d2) tb_error("====== MOV.B EDE  &EDE  =====");
213
 
214
 
215
      // MOV.B: Check when source is &EDE
216
      //--------------------------------------------------------
217
      @(r15==16'h8000);
218
 
219
      if (r5     !==16'h0033) tb_error("====== MOV.B &EDE  Rm    =====");
220
      if (r6     !==16'h0044) tb_error("====== MOV.B &EDE  Rm    =====");
221
 
222
      if (mem210 !==16'haa22) tb_error("====== MOV.B &EDE  x(Rm) =====");
223
      if (mem212 !==16'h4455) tb_error("====== MOV.B &EDE  x(Rm) =====");
224
      if (mem214 !==16'h5a55) tb_error("====== MOV.B &EDE  x(Rm) =====");
225
      if (mem216 !==16'h77a5) tb_error("====== MOV.B &EDE  x(Rm) =====");
226
 
227
      if (mem218 !==16'h11aa) tb_error("====== MOV.B &EDE  EDE   =====");
228
      if (mem21A !==16'hccee) tb_error("====== MOV.B &EDE  EDE   =====");
229
      if (mem21C !==16'h1edd) tb_error("====== MOV.B &EDE  EDE   =====");
230
      if (mem21E !==16'hffe1) tb_error("====== MOV.B &EDE  EDE   =====");
231
 
232
      if (mem220 !==16'h2233) tb_error("====== MOV.B &EDE  &EDE  =====");
233
      if (mem222 !==16'h55dd) tb_error("====== MOV.B &EDE  &EDE  =====");
234
      if (mem224 !==16'h2d66) tb_error("====== MOV.B &EDE  &EDE  =====");
235
      if (mem226 !==16'h88d2) tb_error("====== MOV.B &EDE  &EDE  =====");
236
 
237
 
238
      // MOV.B: Check when source is CONST
239
      //--------------------------------------------------------
240
      @(r15==16'h9000);
241
 
242
      if (r4     !==16'h0000) tb_error("====== MOV.B #+0 Rm    =====");
243
      if (r5     !==16'h0001) tb_error("====== MOV.B #+1 Rm    =====");
244
      if (r6     !==16'h0002) tb_error("====== MOV.B #+2 Rm    =====");
245
      if (r7     !==16'h0004) tb_error("====== MOV.B #+4 Rm    =====");
246
      if (r8     !==16'h0008) tb_error("====== MOV.B #+8 Rm    =====");
247
      if (r9     !==16'h00ff) tb_error("====== MOV.B #-1 Rm    =====");
248
 
249
      if (mem210 !==16'h4400) tb_error("====== MOV.B #+0 x(Rm) =====");
250
      if (mem212 !==16'h5501) tb_error("====== MOV.B #+1 x(Rm) =====");
251
      if (mem214 !==16'h6602) tb_error("====== MOV.B #+2 x(Rm) =====");
252
      if (mem216 !==16'h7704) tb_error("====== MOV.B #+4 x(Rm) =====");
253
      if (mem218 !==16'h3508) tb_error("====== MOV.B #+8 x(Rm) =====");
254
      if (mem21A !==16'h99ff) tb_error("====== MOV.B #-1 x(Rm) =====");
255
      if (mem21C !==16'h00aa) tb_error("====== MOV.B #+0 x(Rm) =====");
256
      if (mem21E !==16'h01bb) tb_error("====== MOV.B #+1 x(Rm) =====");
257
      if (mem220 !==16'h02cc) tb_error("====== MOV.B #+2 x(Rm) =====");
258
      if (mem222 !==16'h04dd) tb_error("====== MOV.B #+4 x(Rm) =====");
259
      if (mem224 !==16'h08ee) tb_error("====== MOV.B #+8 x(Rm) =====");
260
      if (mem226 !==16'hff33) tb_error("====== MOV.B #-1 x(Rm) =====");
261
 
262
      if (mem230 !==16'h4400) tb_error("====== MOV.B #+0 EDE =====");
263
      if (mem232 !==16'h5501) tb_error("====== MOV.B #+1 EDE =====");
264
      if (mem234 !==16'h6602) tb_error("====== MOV.B #+2 EDE =====");
265
      if (mem236 !==16'h7704) tb_error("====== MOV.B #+4 EDE =====");
266
      if (mem238 !==16'h3508) tb_error("====== MOV.B #+8 EDE =====");
267
      if (mem23A !==16'h99ff) tb_error("====== MOV.B #-1 EDE =====");
268
      if (mem23C !==16'h00aa) tb_error("====== MOV.B #+0 EDE =====");
269
      if (mem23E !==16'h01bb) tb_error("====== MOV.B #+1 EDE =====");
270
      if (mem240 !==16'h02cc) tb_error("====== MOV.B #+2 EDE =====");
271
      if (mem242 !==16'h04dd) tb_error("====== MOV.B #+4 EDE =====");
272
      if (mem244 !==16'h08ee) tb_error("====== MOV.B #+8 EDE =====");
273
      if (mem246 !==16'hff33) tb_error("====== MOV.B #-1 EDE =====");
274
 
275
//      #
276
//      # NOTE: The following section would not fit in the smallest ROM
277
//      #       configuration. Therefore, it is executed at the end of
278
//      #       the "two-op_mov.v" pattern.
279
//      #
280
 
281
//      if (mem250 !==16'h4400) tb_error("====== MOV.B #+0 &EDE =====");
282
//      if (mem252 !==16'h5501) tb_error("====== MOV.B #+1 &EDE =====");
283
//      if (mem254 !==16'h6602) tb_error("====== MOV.B #+2 &EDE =====");
284
//      if (mem256 !==16'h7704) tb_error("====== MOV.B #+4 &EDE =====");
285
//      if (mem258 !==16'h3508) tb_error("====== MOV.B #+8 &EDE =====");
286
//      if (mem25A !==16'h99ff) tb_error("====== MOV.B #-1 &EDE =====");
287
//      if (mem25C !==16'h00aa) tb_error("====== MOV.B #+0 &EDE =====");
288
//      if (mem25E !==16'h01bb) tb_error("====== MOV.B #+1 &EDE =====");
289
//      if (mem260 !==16'h02cc) tb_error("====== MOV.B #+2 &EDE =====");
290
//      if (mem262 !==16'h04dd) tb_error("====== MOV.B #+4 &EDE =====");
291
//      if (mem264 !==16'h08ee) tb_error("====== MOV.B #+8 &EDE =====");
292
//      if (mem266 !==16'hff33) tb_error("====== MOV.B #-1 &EDE =====");
293
 
294
 
295
 
296
      stimulus_done = 1;
297
   end
298
 

powered by: WebSVN 2.1.0

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