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 166

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 18 olivier.gi
/*                                                                           */
28
/* Author(s):                                                                */
29
/*             - Olivier Girard,    olgirard@gmail.com                       */
30
/*                                                                           */
31
/*---------------------------------------------------------------------------*/
32 19 olivier.gi
/* $Rev: 134 $                                                                */
33
/* $LastChangedBy: olivier.girard $                                          */
34
/* $LastChangedDate: 2012-03-22 21:31:06 +0100 (Thu, 22 Mar 2012) $          */
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 134 olivier.gi
      if (r2 !==16'h0002) tb_error("R2  initialization");
68 2 olivier.gi
      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
      // MOV: Check when source is Rn
82
      //--------------------------------------------------------
83
      @(r15==16'h2000);
84
 
85
      if (r3     !==16'h4444) tb_error("====== MOV Rn Rm    =====");
86
      if (r4     ===16'h0000) tb_error("====== MOV Rn PC    =====");
87
      if (mem210 !==16'h1234) tb_error("====== MOV Rn x(Rm) =====");
88
      if (mem200 !==16'h5678) tb_error("====== MOV Rn EDE   =====");
89
      if (mem204 !==16'h9abc) tb_error("====== MOV Rn &EDE  =====");
90
 
91
      // MOV: Check when source is @Rn
92
      //--------------------------------------------------------
93
      @(r15==16'h3000);
94
 
95
      if (r3     !==16'h1234) tb_error("====== MOV @Rn Rm    =====");
96
      if (r4     ===16'h0000) tb_error("====== MOV @Rn PC    =====");
97
      if (mem210 !==16'h9abc) tb_error("====== MOV @Rn x(Rm) =====");
98
      if (mem200 !==16'hfedc) tb_error("====== MOV @Rn EDE   =====");
99
      if (mem204 !==16'hf1d2) tb_error("====== MOV @Rn &EDE  =====");
100
 
101
 
102
      // MOV: Check when source is @Rn+
103
      //--------------------------------------------------------
104
      @(r15==16'h4000);
105
 
106 111 olivier.gi
      if (r4     !==(`PER_SIZE+16'h0002)) tb_error("====== MOV @Rn+ Rm    =====");
107
      if (r5     !==16'h1111)             tb_error("====== MOV @Rn+ Rm    =====");
108 2 olivier.gi
 
109 111 olivier.gi
      if (r6     !==(`PER_SIZE+16'h0006)) tb_error("====== MOV @Rn+ PC    =====");
110 2 olivier.gi
 
111 111 olivier.gi
      if (r7     !==(`PER_SIZE+16'h0018)) tb_error("====== MOV @Rn+ x(Rm) =====");
112
      if (mem220 !==16'hdef0)             tb_error("====== MOV @Rn+ x(Rm) =====");
113 2 olivier.gi
 
114 111 olivier.gi
      if (r8     !==(`PER_SIZE+16'h0014)) tb_error("====== MOV @Rn+ EDE   =====");
115
      if (mem200 !==16'h5678)             tb_error("====== MOV @Rn+ EDE   =====");
116 2 olivier.gi
 
117 111 olivier.gi
      if (r9     !==(`PER_SIZE+16'h0012)) tb_error("====== MOV @Rn+ &EDE  =====");
118
      if (mem214 !==16'h1234)             tb_error("====== MOV @Rn+ &EDE  =====");
119 2 olivier.gi
 
120
 
121
      // MOV: Check when source is #N
122
      //--------------------------------------------------------
123
      @(r15==16'h5000);
124
 
125
      if (r4     !==16'h3210) tb_error("====== MOV #N  Rm    =====");
126
      if (r5     ===16'h0000) tb_error("====== MOV #N  PC    =====");
127
      if (mem230 !==16'h5a5a) tb_error("====== MOV #N  x(Rm) =====");
128
      if (mem210 !==16'h1a2b) tb_error("====== MOV #N  EDE   =====");
129
      if (mem206 !==16'h3c4d) tb_error("====== MOV #N  &EDE  =====");
130
 
131
 
132
      // MOV: Check when source is x(Rn)
133
      //--------------------------------------------------------
134
      @(r15==16'h6000);
135
 
136
      if (r5     !==16'h8347) tb_error("====== MOV x(Rn) Rm    =====");
137
      if (r6     ===16'h0000) tb_error("====== MOV x(Rn) PC    =====");
138
      if (mem214 !==16'h4231) tb_error("====== MOV x(Rn) x(Rm) =====");
139
      if (mem220 !==16'h7238) tb_error("====== MOV x(Rn) EDE   =====");
140
      if (mem208 !==16'h98b2) tb_error("====== MOV x(Rn) &EDE  =====");
141
 
142
      // MOV: Check when source is EDE
143
      //--------------------------------------------------------
144
      @(r15==16'h7000);
145
 
146
      if (r4     !==16'hc3d6) tb_error("====== MOV EDE Rm    =====");
147
      if (r6     ===16'h0000) tb_error("====== MOV EDE PC    =====");
148
      if (mem214 !==16'hf712) tb_error("====== MOV EDE x(Rm) =====");
149
      if (mem216 !==16'hb3a9) tb_error("====== MOV EDE EDE   =====");
150
      if (mem212 !==16'h837a) tb_error("====== MOV EDE &EDE  =====");
151
 
152
 
153
      // MOV: Check when source is &EDE
154
      //--------------------------------------------------------
155
      @(r15==16'h8000);
156
 
157
      if (r4     !==16'h23d4) tb_error("====== MOV &EDE Rm    =====");
158
      if (r6     ===16'h0000) tb_error("====== MOV &EDE PC    =====");
159
      if (mem214 !==16'h481c) tb_error("====== MOV &EDE x(Rm) =====");
160
      if (mem218 !==16'h5c1f) tb_error("====== MOV &EDE EDE   =====");
161
      if (mem202 !==16'hc16e) tb_error("====== MOV &EDE &EDE  =====");
162
 
163
 
164
      // MOV: Check when source is CONST
165
      //--------------------------------------------------------
166
      @(r15==16'h9000);
167
 
168
      if (r4     !==16'h0000) tb_error("====== MOV #+0 Rm    =====");
169
      if (r5     !==16'h0001) tb_error("====== MOV #+1 Rm    =====");
170
      if (r6     !==16'h0002) tb_error("====== MOV #+2 Rm    =====");
171
      if (r7     !==16'h0004) tb_error("====== MOV #+4 Rm    =====");
172
      if (r8     !==16'h0008) tb_error("====== MOV #+8 Rm    =====");
173
      if (r9     !==16'hffff) tb_error("====== MOV #-1 Rm    =====");
174
 
175
      if (mem210 !==16'h0000) tb_error("====== MOV #+0 x(Rm) =====");
176
      if (mem212 !==16'h0001) tb_error("====== MOV #+1 x(Rm) =====");
177
      if (mem214 !==16'h0002) tb_error("====== MOV #+2 x(Rm) =====");
178
      if (mem216 !==16'h0004) tb_error("====== MOV #+4 x(Rm) =====");
179
      if (mem218 !==16'h0008) tb_error("====== MOV #+8 x(Rm) =====");
180
      if (mem21A !==16'hffff) tb_error("====== MOV #-1 x(Rm) =====");
181
 
182
      if (mem220 !==16'h0000) tb_error("====== MOV #+0 EDE =====");
183
      if (mem222 !==16'h0001) tb_error("====== MOV #+1 EDE =====");
184
      if (mem224 !==16'h0002) tb_error("====== MOV #+2 EDE =====");
185
      if (mem226 !==16'h0004) tb_error("====== MOV #+4 EDE =====");
186
      if (mem228 !==16'h0008) tb_error("====== MOV #+8 EDE =====");
187
      if (mem22A !==16'hffff) tb_error("====== MOV #-1 EDE =====");
188
 
189
      if (mem230 !==16'h0000) tb_error("====== MOV #+0 &EDE =====");
190
      if (mem232 !==16'h0001) tb_error("====== MOV #+1 &EDE =====");
191
      if (mem234 !==16'h0002) tb_error("====== MOV #+2 &EDE =====");
192
      if (mem236 !==16'h0004) tb_error("====== MOV #+4 &EDE =====");
193
      if (mem238 !==16'h0008) tb_error("====== MOV #+8 &EDE =====");
194
      if (mem23A !==16'hffff) tb_error("====== MOV #-1 &EDE =====");
195
 
196
//    ---------------- TEST WHEN SOURCE IS CONSTANT IN BYTE MODE ------ */
197
//    #
198
//    # NOTE: The following section would not fit in the smallest ROM
199
//    #       configuration for the "two-op_mov-b.v" pattern.
200
//    #       It is therefore executed here.
201
//    #
202
      @(r15==16'hA000);
203
 
204
      if (mem250 !==16'h4400) tb_error("====== MOV.B #+0 &EDE =====");
205
      if (mem252 !==16'h5501) tb_error("====== MOV.B #+1 &EDE =====");
206
      if (mem254 !==16'h6602) tb_error("====== MOV.B #+2 &EDE =====");
207
      if (mem256 !==16'h7704) tb_error("====== MOV.B #+4 &EDE =====");
208
      if (mem258 !==16'h3508) tb_error("====== MOV.B #+8 &EDE =====");
209
      if (mem25A !==16'h99ff) tb_error("====== MOV.B #-1 &EDE =====");
210
      if (mem25C !==16'h00aa) tb_error("====== MOV.B #+0 &EDE =====");
211
      if (mem25E !==16'h01bb) tb_error("====== MOV.B #+1 &EDE =====");
212
      if (mem260 !==16'h02cc) tb_error("====== MOV.B #+2 &EDE =====");
213
      if (mem262 !==16'h04dd) tb_error("====== MOV.B #+4 &EDE =====");
214
      if (mem264 !==16'h08ee) tb_error("====== MOV.B #+8 &EDE =====");
215
      if (mem266 !==16'hff33) tb_error("====== MOV.B #-1 &EDE =====");
216
 
217
 
218
      stimulus_done = 1;
219
   end
220
 

powered by: WebSVN 2.1.0

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