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

Subversion Repositories openmsp430

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

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 INSTRUCTION                 */
25
/*---------------------------------------------------------------------------*/
26
/* Test the MOV instruction with all addressing modes                        */
27
/*===========================================================================*/
28
 
29
initial
30
   begin
31
      $display(" ===============================================");
32
      $display("|                 START SIMULATION              |");
33
      $display(" ===============================================");
34
      repeat(5) @(posedge mclk);
35
      stimulus_done = 0;
36
 
37
      // Check reset values
38
      //--------------------------------------------------------
39
      if (r2 !==16'h0000) tb_error("R2  reset value");
40
      if (r3 !==16'h0000) tb_error("R3  reset value");
41
      if (r4 !==16'h0000) tb_error("R4  reset value");
42
      if (r5 !==16'h0000) tb_error("R5  reset value");
43
      if (r6 !==16'h0000) tb_error("R6  reset value");
44
      if (r7 !==16'h0000) tb_error("R7  reset value");
45
      if (r8 !==16'h0000) tb_error("R8  reset value");
46
      if (r9 !==16'h0000) tb_error("R9  reset value");
47
      if (r10!==16'h0000) tb_error("R10 reset value");
48
      if (r11!==16'h0000) tb_error("R11 reset value");
49
      if (r12!==16'h0000) tb_error("R12 reset value");
50
      if (r13!==16'h0000) tb_error("R13 reset value");
51
      if (r14!==16'h0000) tb_error("R14 reset value");
52
      if (r15!==16'h0000) tb_error("R15 reset value");
53
 
54
 
55
      // Make sure initialization worked fine
56
      //--------------------------------------------------------
57
      @(r15==16'h1000);
58
 
59
      if (r2 !==16'h0022) tb_error("R2  initialization");
60
      if (r3 !==16'h3333) tb_error("R3  initialization");
61
      if (r4 !==16'h4444) tb_error("R4  initialization");
62
      if (r5 !==16'h5555) tb_error("R5  initialization");
63
      if (r6 !==16'h6666) tb_error("R6  initialization");
64
      if (r7 !==16'h7777) tb_error("R7  initialization");
65
      if (r8 !==16'h8888) tb_error("R8  initialization");
66
      if (r9 !==16'h9999) tb_error("R9  initialization");
67
      if (r10!==16'haaaa) tb_error("R10 initialization");
68
      if (r11!==16'hbbbb) tb_error("R11 initialization");
69
      if (r12!==16'hcccc) tb_error("R12 initialization");
70
      if (r13!==16'hdddd) tb_error("R13 initialization");
71
      if (r14!==16'heeee) tb_error("R14 initialization");
72
 
73
      // MOV: Check when source is Rn
74
      //--------------------------------------------------------
75
      @(r15==16'h2000);
76
 
77
      if (r3     !==16'h4444) tb_error("====== MOV Rn Rm    =====");
78
      if (r4     ===16'h0000) tb_error("====== MOV Rn PC    =====");
79
      if (mem210 !==16'h1234) tb_error("====== MOV Rn x(Rm) =====");
80
      if (mem200 !==16'h5678) tb_error("====== MOV Rn EDE   =====");
81
      if (mem204 !==16'h9abc) tb_error("====== MOV Rn &EDE  =====");
82
 
83
      // MOV: Check when source is @Rn
84
      //--------------------------------------------------------
85
      @(r15==16'h3000);
86
 
87
      if (r3     !==16'h1234) tb_error("====== MOV @Rn Rm    =====");
88
      if (r4     ===16'h0000) tb_error("====== MOV @Rn PC    =====");
89
      if (mem210 !==16'h9abc) tb_error("====== MOV @Rn x(Rm) =====");
90
      if (mem200 !==16'hfedc) tb_error("====== MOV @Rn EDE   =====");
91
      if (mem204 !==16'hf1d2) tb_error("====== MOV @Rn &EDE  =====");
92
 
93
 
94
      // MOV: Check when source is @Rn+
95
      //--------------------------------------------------------
96
      @(r15==16'h4000);
97
 
98
      if (r4     !==16'h0202) tb_error("====== MOV @Rn+ Rm    =====");
99
      if (r5     !==16'h1111) tb_error("====== MOV @Rn+ Rm    =====");
100
 
101
      if (r6     !==16'h0206) tb_error("====== MOV @Rn+ PC    =====");
102
 
103
      if (r7     !==16'h0218) tb_error("====== MOV @Rn+ x(Rm) =====");
104
      if (mem220 !==16'hdef0) tb_error("====== MOV @Rn+ x(Rm) =====");
105
 
106
      if (r8     !==16'h0214) tb_error("====== MOV @Rn+ EDE   =====");
107
      if (mem200 !==16'h5678) tb_error("====== MOV @Rn+ EDE   =====");
108
 
109
      if (r9     !==16'h0212) tb_error("====== MOV @Rn+ &EDE  =====");
110
      if (mem214 !==16'h1234) tb_error("====== MOV @Rn+ &EDE  =====");
111
 
112
 
113
      // MOV: Check when source is #N
114
      //--------------------------------------------------------
115
      @(r15==16'h5000);
116
 
117
      if (r4     !==16'h3210) tb_error("====== MOV #N  Rm    =====");
118
      if (r5     ===16'h0000) tb_error("====== MOV #N  PC    =====");
119
      if (mem230 !==16'h5a5a) tb_error("====== MOV #N  x(Rm) =====");
120
      if (mem210 !==16'h1a2b) tb_error("====== MOV #N  EDE   =====");
121
      if (mem206 !==16'h3c4d) tb_error("====== MOV #N  &EDE  =====");
122
 
123
 
124
      // MOV: Check when source is x(Rn)
125
      //--------------------------------------------------------
126
      @(r15==16'h6000);
127
 
128
      if (r5     !==16'h8347) tb_error("====== MOV x(Rn) Rm    =====");
129
      if (r6     ===16'h0000) tb_error("====== MOV x(Rn) PC    =====");
130
      if (mem214 !==16'h4231) tb_error("====== MOV x(Rn) x(Rm) =====");
131
      if (mem220 !==16'h7238) tb_error("====== MOV x(Rn) EDE   =====");
132
      if (mem208 !==16'h98b2) tb_error("====== MOV x(Rn) &EDE  =====");
133
 
134
      // MOV: Check when source is EDE
135
      //--------------------------------------------------------
136
      @(r15==16'h7000);
137
 
138
      if (r4     !==16'hc3d6) tb_error("====== MOV EDE Rm    =====");
139
      if (r6     ===16'h0000) tb_error("====== MOV EDE PC    =====");
140
      if (mem214 !==16'hf712) tb_error("====== MOV EDE x(Rm) =====");
141
      if (mem216 !==16'hb3a9) tb_error("====== MOV EDE EDE   =====");
142
      if (mem212 !==16'h837a) tb_error("====== MOV EDE &EDE  =====");
143
 
144
 
145
      // MOV: Check when source is &EDE
146
      //--------------------------------------------------------
147
      @(r15==16'h8000);
148
 
149
      if (r4     !==16'h23d4) tb_error("====== MOV &EDE Rm    =====");
150
      if (r6     ===16'h0000) tb_error("====== MOV &EDE PC    =====");
151
      if (mem214 !==16'h481c) tb_error("====== MOV &EDE x(Rm) =====");
152
      if (mem218 !==16'h5c1f) tb_error("====== MOV &EDE EDE   =====");
153
      if (mem202 !==16'hc16e) tb_error("====== MOV &EDE &EDE  =====");
154
 
155
 
156
      // MOV: Check when source is CONST
157
      //--------------------------------------------------------
158
      @(r15==16'h9000);
159
 
160
      if (r4     !==16'h0000) tb_error("====== MOV #+0 Rm    =====");
161
      if (r5     !==16'h0001) tb_error("====== MOV #+1 Rm    =====");
162
      if (r6     !==16'h0002) tb_error("====== MOV #+2 Rm    =====");
163
      if (r7     !==16'h0004) tb_error("====== MOV #+4 Rm    =====");
164
      if (r8     !==16'h0008) tb_error("====== MOV #+8 Rm    =====");
165
      if (r9     !==16'hffff) tb_error("====== MOV #-1 Rm    =====");
166
 
167
      if (mem210 !==16'h0000) tb_error("====== MOV #+0 x(Rm) =====");
168
      if (mem212 !==16'h0001) tb_error("====== MOV #+1 x(Rm) =====");
169
      if (mem214 !==16'h0002) tb_error("====== MOV #+2 x(Rm) =====");
170
      if (mem216 !==16'h0004) tb_error("====== MOV #+4 x(Rm) =====");
171
      if (mem218 !==16'h0008) tb_error("====== MOV #+8 x(Rm) =====");
172
      if (mem21A !==16'hffff) tb_error("====== MOV #-1 x(Rm) =====");
173
 
174
      if (mem220 !==16'h0000) tb_error("====== MOV #+0 EDE =====");
175
      if (mem222 !==16'h0001) tb_error("====== MOV #+1 EDE =====");
176
      if (mem224 !==16'h0002) tb_error("====== MOV #+2 EDE =====");
177
      if (mem226 !==16'h0004) tb_error("====== MOV #+4 EDE =====");
178
      if (mem228 !==16'h0008) tb_error("====== MOV #+8 EDE =====");
179
      if (mem22A !==16'hffff) tb_error("====== MOV #-1 EDE =====");
180
 
181
      if (mem230 !==16'h0000) tb_error("====== MOV #+0 &EDE =====");
182
      if (mem232 !==16'h0001) tb_error("====== MOV #+1 &EDE =====");
183
      if (mem234 !==16'h0002) tb_error("====== MOV #+2 &EDE =====");
184
      if (mem236 !==16'h0004) tb_error("====== MOV #+4 &EDE =====");
185
      if (mem238 !==16'h0008) tb_error("====== MOV #+8 &EDE =====");
186
      if (mem23A !==16'hffff) tb_error("====== MOV #-1 &EDE =====");
187
 
188
//    ---------------- TEST WHEN SOURCE IS CONSTANT IN BYTE MODE ------ */
189
//    #
190
//    # NOTE: The following section would not fit in the smallest ROM
191
//    #       configuration for the "two-op_mov-b.v" pattern.
192
//    #       It is therefore executed here.
193
//    #
194
      @(r15==16'hA000);
195
 
196
      if (mem250 !==16'h4400) tb_error("====== MOV.B #+0 &EDE =====");
197
      if (mem252 !==16'h5501) tb_error("====== MOV.B #+1 &EDE =====");
198
      if (mem254 !==16'h6602) tb_error("====== MOV.B #+2 &EDE =====");
199
      if (mem256 !==16'h7704) tb_error("====== MOV.B #+4 &EDE =====");
200
      if (mem258 !==16'h3508) tb_error("====== MOV.B #+8 &EDE =====");
201
      if (mem25A !==16'h99ff) tb_error("====== MOV.B #-1 &EDE =====");
202
      if (mem25C !==16'h00aa) tb_error("====== MOV.B #+0 &EDE =====");
203
      if (mem25E !==16'h01bb) tb_error("====== MOV.B #+1 &EDE =====");
204
      if (mem260 !==16'h02cc) tb_error("====== MOV.B #+2 &EDE =====");
205
      if (mem262 !==16'h04dd) tb_error("====== MOV.B #+4 &EDE =====");
206
      if (mem264 !==16'h08ee) tb_error("====== MOV.B #+8 &EDE =====");
207
      if (mem266 !==16'hff33) tb_error("====== MOV.B #-1 &EDE =====");
208
 
209
 
210
      stimulus_done = 1;
211
   end
212
 

powered by: WebSVN 2.1.0

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