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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [dbg_uart_hwbrk0.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
/*                            DEBUG INTERFACE                                */
25
/*---------------------------------------------------------------------------*/
26
/* Test the debug interface:                                                 */
27
/*                        - Check Hardware breakpoint unit 0.                */
28 18 olivier.gi
/*                                                                           */
29
/* Author(s):                                                                */
30
/*             - Olivier Girard,    olgirard@gmail.com                       */
31
/*                                                                           */
32
/*---------------------------------------------------------------------------*/
33 19 olivier.gi
/* $Rev: 154 $                                                                */
34
/* $LastChangedBy: olivier.girard $                                          */
35
/* $LastChangedDate: 2012-10-15 22:44:20 +0200 (Mon, 15 Oct 2012) $          */
36 2 olivier.gi
/*===========================================================================*/
37
 
38
`define LONG_TIMEOUT
39
 
40
initial
41
   begin
42
      $display(" ===============================================");
43
      $display("|                 START SIMULATION              |");
44
      $display(" ===============================================");
45 111 olivier.gi
`ifdef DBG_EN
46 154 olivier.gi
`ifdef DBG_UART
47 111 olivier.gi
`ifdef DBG_HWBRK_0
48 106 olivier.gi
      #1 dbg_en = 1;
49 2 olivier.gi
      repeat(30) @(posedge mclk);
50
      stimulus_done = 0;
51
 
52
      // SEND UART SYNCHRONIZATION FRAME
53
      dbg_uart_tx(DBG_SYNC);
54
 
55 106 olivier.gi
   `ifdef DBG_RST_BRK_EN
56
      dbg_uart_wr(CPU_CTL,  16'h0002);  // RUN
57
   `endif
58
 
59 2 olivier.gi
 
60
      // HARDWARE BREAKPOINTS: INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES
61
      //----------------------------------------------------------------------
62
 
63
      // RESET & BREAK
64
      dbg_uart_wr(CPU_CTL, 16'h0060);
65
      dbg_uart_wr(CPU_CTL, 16'h0020);
66
 
67
      // CONFIGURE BREAKPOINT (DISABLED) & RUN
68 86 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, ('h10000-`PMEM_SIZE+'h04));
69
      dbg_uart_wr(BRK0_ADDR1, ('h10000-`PMEM_SIZE+'h18));
70 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h000C);
71
      dbg_uart_wr(CPU_CTL,    16'h0002);
72
      repeat(100) @(posedge mclk);
73
 
74
      // RESET & BREAK
75
      dbg_uart_wr(CPU_CTL,  16'h0060);
76
      dbg_uart_wr(CPU_CTL,  16'h0020);
77
      dbg_uart_wr(CPU_STAT, 16'h00ff);
78
 
79
      // CHECK
80
      if (mem200 === 16'h0000)  tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 1 =====");
81
 
82
      // CONFIGURE BREAKPOINT (ENABLED) & RUN
83 86 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, ('h10000-`PMEM_SIZE+'h04));
84
      dbg_uart_wr(BRK0_ADDR1, ('h10000-`PMEM_SIZE+'h18));
85 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h000D);
86
      dbg_uart_wr(CPU_CTL,    16'h0002);
87
      repeat(100) @(posedge mclk);
88
 
89
      // CHECK
90 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h04))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 2 =====");
91 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 3 =====");
92
      dbg_uart_rd(CPU_STAT);
93
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 4 =====");
94
      dbg_uart_rd(BRK0_STAT);
95
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 5 =====");
96
      dbg_uart_wr(BRK0_STAT, 16'h0001);
97
      dbg_uart_rd(CPU_STAT);
98
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 6 =====");
99
 
100
      // RE-RUN
101
      dbg_uart_wr(BRK0_ADDR0, 16'h0000);
102
      dbg_uart_wr(CPU_CTL,    16'h0002);
103
      repeat(100) @(posedge mclk);
104
 
105
      // RE-CHECK
106 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h18))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 7 =====");
107 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 8 =====");
108
      dbg_uart_rd(CPU_STAT);
109
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 9 =====");
110
      dbg_uart_rd(BRK0_STAT);
111
      if (dbg_uart_buf !== 16'h0004) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 10 =====");
112
      dbg_uart_wr(BRK0_STAT, 16'h0004);
113
      dbg_uart_rd(CPU_STAT);
114
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES: test 11 =====");
115
 
116
 
117
 
118
      // HARDWARE BREAKPOINTS: INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE
119
      //----------------------------------------------------------------------
120 58 olivier.gi
      if (`HWBRK_RANGE)
121
        begin
122
 
123 2 olivier.gi
      // RESET, BREAK & CLEAR STATUS
124
      dbg_uart_wr(CPU_CTL,    16'h0060);
125
      dbg_uart_wr(CPU_CTL,    16'h0020);
126
      dbg_uart_wr(BRK0_STAT,  16'h00ff);
127
      dbg_uart_wr(CPU_STAT,   16'h00ff);
128
 
129
      // CONFIGURE BREAKPOINT(ENABLED) & RUN
130 86 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, ('h10000-`PMEM_SIZE-'h100));
131
      dbg_uart_wr(BRK0_ADDR1, ('h10000-`PMEM_SIZE+'h20));
132 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h001D);
133
      dbg_uart_wr(CPU_CTL,    16'h0002);
134
      repeat(100) @(posedge mclk);
135
 
136
      // CHECK
137 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE: test 1 =====");
138 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE: test 2 =====");
139
      dbg_uart_rd(CPU_STAT);
140
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE: test 3 =====");
141
      dbg_uart_rd(BRK0_STAT);
142
      if (dbg_uart_buf !== 16'h0010) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE: test 4 =====");
143
      dbg_uart_wr(BRK0_STAT, 16'h0010);
144
      dbg_uart_rd(CPU_STAT);
145
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE: test 5 =====");
146 58 olivier.gi
        end
147 2 olivier.gi
 
148
 
149
      // HARDWARE BREAKPOINTS: DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ
150
      //----------------------------------------------------------------------------
151
 
152
      // RESET, BREAK & CLEAR STATUS
153
      dbg_uart_wr(CPU_CTL,    16'h0060);
154
      dbg_uart_wr(CPU_CTL,    16'h0020);
155
      dbg_uart_wr(BRK0_STAT,  16'h00ff);
156
      dbg_uart_wr(CPU_STAT,   16'h00ff);
157
 
158
 
159
      // CONFIGURE BREAKPOINT (ENABLED) & RUN
160 111 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, (`PER_SIZE+16'h0004));
161
      dbg_uart_wr(BRK0_ADDR1, (`PER_SIZE+16'h0008));
162 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h0005);
163
      dbg_uart_wr(CPU_CTL,    16'h0002);
164
      repeat(100) @(posedge mclk);
165
 
166
      // CHECK
167 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h18))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 1 =====");
168 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 2 =====");
169
      dbg_uart_rd(CPU_STAT);
170
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 3 =====");
171
      dbg_uart_rd(BRK0_STAT);
172
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 4 =====");
173
      dbg_uart_wr(BRK0_STAT, 16'h0001);
174
      dbg_uart_rd(CPU_STAT);
175
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 5 =====");
176
 
177
      // RE-RUN
178
      dbg_uart_wr(CPU_CTL,    16'h0002);
179
      repeat(100) @(posedge mclk);
180
 
181
      // RE-CHECK
182 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h1C))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ: test 6 =====");
183 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ: test 7 =====");
184
      dbg_uart_rd(CPU_STAT);
185
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ: test 8 =====");
186
      dbg_uart_rd(BRK0_STAT);
187
      if (dbg_uart_buf !== 16'h0004) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ: test 9 =====");
188
      dbg_uart_wr(BRK0_STAT, 16'h0004);
189
      dbg_uart_rd(CPU_STAT);
190
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ: test 10 =====");
191
 
192
      // RE-RUN
193
      dbg_uart_wr(CPU_CTL,    16'h0002);
194
      repeat(100) @(posedge mclk);
195
 
196
      // CHECK
197 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h18))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 11 =====");
198 2 olivier.gi
      if (mem200 !== 16'h0002)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 12 =====");
199
      dbg_uart_rd(CPU_STAT);
200
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 13 =====");
201
      dbg_uart_rd(BRK0_STAT);
202
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 14 =====");
203
      dbg_uart_wr(BRK0_STAT, 16'h0001);
204
      dbg_uart_rd(CPU_STAT);
205
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ: test 15 =====");
206
 
207 58 olivier.gi
 
208 2 olivier.gi
      // HARDWARE BREAKPOINTS: DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - WRITE
209
      //-----------------------------------------------------------------------------
210
 
211
      // RESET, BREAK & CLEAR STATUS
212
      dbg_uart_wr(CPU_CTL,    16'h0060);
213
      dbg_uart_wr(CPU_CTL,    16'h0020);
214
      dbg_uart_wr(BRK0_STAT,  16'h00ff);
215
      dbg_uart_wr(CPU_STAT,   16'h00ff);
216
 
217
 
218
      // CONFIGURE BREAKPOINT (ENABLED) & RUN
219 111 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, (`PER_SIZE+16'h0004));
220
      dbg_uart_wr(BRK0_ADDR1, (`PER_SIZE+16'h0008));
221 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h0006);
222
      dbg_uart_wr(CPU_CTL,    16'h0002);
223
      repeat(100) @(posedge mclk);
224
 
225
      // CHECK
226 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h3a))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - WRITE: test 1 =====");
227 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - WRITE: test 2 =====");
228
      dbg_uart_rd(CPU_STAT);
229
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - WRITE: test 3 =====");
230
      dbg_uart_rd(BRK0_STAT);
231
      if (dbg_uart_buf !== 16'h0002) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - WRITE: test 4 =====");
232
      dbg_uart_wr(BRK0_STAT, 16'h0002);
233
      dbg_uart_rd(CPU_STAT);
234
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - WRITE: test 5 =====");
235
 
236
      // RE-RUN
237
      dbg_uart_wr(CPU_CTL,    16'h0002);
238
      repeat(100) @(posedge mclk);
239
 
240
      // RE-CHECK
241 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h44))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 6 =====");
242 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 7 =====");
243
      dbg_uart_rd(CPU_STAT);
244
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 8 =====");
245
      dbg_uart_rd(BRK0_STAT);
246
      if (dbg_uart_buf !== 16'h0008) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 9 =====");
247
      dbg_uart_wr(BRK0_STAT, 16'h0008);
248
      dbg_uart_rd(CPU_STAT);
249
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 10 =====");
250
 
251
      // RE-RUN
252
      dbg_uart_wr(CPU_CTL,    16'h0002);
253
      repeat(100) @(posedge mclk);
254
 
255
      // RE-CHECK
256 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h0c))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 11 =====");
257 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 12 =====");
258
      dbg_uart_rd(CPU_STAT);
259
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 13 =====");
260
      dbg_uart_rd(BRK0_STAT);
261
      if (dbg_uart_buf !== 16'h0002) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 14 =====");
262
      dbg_uart_wr(BRK0_STAT, 16'h0002);
263
      dbg_uart_rd(CPU_STAT);
264
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 15 =====");
265
 
266
      // RE-RUN
267
      dbg_uart_wr(CPU_CTL,    16'h0002);
268
      repeat(100) @(posedge mclk);
269
 
270
      // RE-CHECK
271 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h14))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 16 =====");
272 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 17 =====");
273
      dbg_uart_rd(CPU_STAT);
274
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 18 =====");
275
      dbg_uart_rd(BRK0_STAT);
276
      if (dbg_uart_buf !== 16'h0008) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 19 =====");
277
      dbg_uart_wr(BRK0_STAT, 16'h0008);
278
      dbg_uart_rd(CPU_STAT);
279
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 20 =====");
280
 
281
      // RE-RUN
282
      dbg_uart_wr(CPU_CTL,    16'h0002);
283
      repeat(100) @(posedge mclk);
284
 
285
      // RE-CHECK
286 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h0c))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 21 =====");
287 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 22 =====");
288
      dbg_uart_rd(CPU_STAT);
289
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 23 =====");
290
      dbg_uart_rd(BRK0_STAT);
291
      if (dbg_uart_buf !== 16'h0002) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 24 =====");
292
      dbg_uart_wr(BRK0_STAT, 16'h0002);
293
      dbg_uart_rd(CPU_STAT);
294
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - WRITE: test 25 =====");
295
 
296 58 olivier.gi
 
297 2 olivier.gi
      // HARDWARE BREAKPOINTS: DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE
298
      //----------------------------------------------------------------------------------
299
 
300
      // RESET, BREAK & CLEAR STATUS
301
      dbg_uart_wr(CPU_CTL,    16'h0060);
302
      dbg_uart_wr(CPU_CTL,    16'h0020);
303
      dbg_uart_wr(BRK0_STAT,  16'h00ff);
304
      dbg_uart_wr(CPU_STAT,   16'h00ff);
305
 
306
 
307
      // CONFIGURE BREAKPOINT (ENABLED) & RUN
308 111 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, (`PER_SIZE+16'h0004));
309
      dbg_uart_wr(BRK0_ADDR1, (`PER_SIZE+16'h0008));
310 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h0007);
311
      dbg_uart_wr(CPU_CTL,    16'h0002);
312
      repeat(100) @(posedge mclk);
313
 
314
      // CHECK
315 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h3a))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 1 =====");
316 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 2 =====");
317
      dbg_uart_rd(CPU_STAT);
318
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 3 =====");
319
      dbg_uart_rd(BRK0_STAT);
320
      if (dbg_uart_buf !== 16'h0002) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 4 =====");
321
      dbg_uart_wr(BRK0_STAT, 16'h0002);
322
      dbg_uart_rd(CPU_STAT);
323
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 5 =====");
324
 
325
      // RE-RUN
326
      dbg_uart_wr(CPU_CTL,    16'h0002);
327
      repeat(100) @(posedge mclk);
328
 
329
      // RE-CHECK
330 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h44))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 6 =====");
331 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 7 =====");
332
      dbg_uart_rd(CPU_STAT);
333
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 8 =====");
334
      dbg_uart_rd(BRK0_STAT);
335
      if (dbg_uart_buf !== 16'h0008) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 9 =====");
336
      dbg_uart_wr(BRK0_STAT, 16'h0008);
337
      dbg_uart_rd(CPU_STAT);
338
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 10 =====");
339
 
340
      // RE-RUN
341
      dbg_uart_wr(CPU_CTL,    16'h0002);
342
      repeat(100) @(posedge mclk);
343
 
344
      // RE-CHECK
345 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h0c))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 11 =====");
346 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 12 =====");
347
      dbg_uart_rd(CPU_STAT);
348
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 13 =====");
349
      dbg_uart_rd(BRK0_STAT);
350
      if (dbg_uart_buf !== 16'h0002) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 14 =====");
351
      dbg_uart_wr(BRK0_STAT, 16'h0002);
352
      dbg_uart_rd(CPU_STAT);
353
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 15 =====");
354
 
355
      // RE-RUN
356
      dbg_uart_wr(CPU_CTL,    16'h0002);
357
      repeat(100) @(posedge mclk);
358
 
359
      // RE-CHECK
360 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h14))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 16 =====");
361 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 17 =====");
362
      dbg_uart_rd(CPU_STAT);
363
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 18 =====");
364
      dbg_uart_rd(BRK0_STAT);
365
      if (dbg_uart_buf !== 16'h0008) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 19 =====");
366
      dbg_uart_wr(BRK0_STAT, 16'h0008);
367
      dbg_uart_rd(CPU_STAT);
368
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 20 =====");
369
 
370
      // RE-RUN
371
      dbg_uart_wr(CPU_CTL,    16'h0002);
372
      repeat(100) @(posedge mclk);
373
 
374
      // CHECK
375 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h18))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 21 =====");
376 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 22 =====");
377
      dbg_uart_rd(CPU_STAT);
378
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 23 =====");
379
      dbg_uart_rd(BRK0_STAT);
380
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 24 =====");
381
      dbg_uart_wr(BRK0_STAT, 16'h0001);
382
      dbg_uart_rd(CPU_STAT);
383
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - SINGLE ADDRESSES - READ/WRITE: test 25 =====");
384
 
385
      // RE-RUN
386
      dbg_uart_wr(CPU_CTL,    16'h0002);
387
      repeat(100) @(posedge mclk);
388
 
389
      // RE-CHECK
390 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h1C))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 26 =====");
391 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 27 =====");
392
      dbg_uart_rd(CPU_STAT);
393
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 28 =====");
394
      dbg_uart_rd(BRK0_STAT);
395
      if (dbg_uart_buf !== 16'h0004) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 29 =====");
396
      dbg_uart_wr(BRK0_STAT, 16'h0004);
397
      dbg_uart_rd(CPU_STAT);
398
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - SINGLE ADDRESSES - READ/WRITE: test 30 =====");
399
 
400
 
401
      // HARDWARE BREAKPOINTS: DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ
402
      //----------------------------------------------------------------------------
403 58 olivier.gi
      if (`HWBRK_RANGE)
404
        begin
405 2 olivier.gi
 
406
      // RESET, BREAK & CLEAR STATUS
407
      dbg_uart_wr(CPU_CTL,    16'h0060);
408
      dbg_uart_wr(CPU_CTL,    16'h0020);
409
      dbg_uart_wr(BRK0_STAT,  16'h00ff);
410
      dbg_uart_wr(CPU_STAT,   16'h00ff);
411
 
412
 
413
      // CONFIGURE BREAKPOINT (ENABLED) & RUN
414 111 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, (`PER_SIZE+16'h0001));
415
      dbg_uart_wr(BRK0_ADDR1, (`PER_SIZE+16'h0005));
416 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h0015);
417
      dbg_uart_wr(CPU_CTL,    16'h0002);
418
      repeat(100) @(posedge mclk);
419
 
420
      // CHECK
421 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h18))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ: test 1 =====");
422 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ: test 2 =====");
423
      dbg_uart_rd(CPU_STAT);
424
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ: test 3 =====");
425
      dbg_uart_rd(BRK0_STAT);
426
      if (dbg_uart_buf !== 16'h0010) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ: test 4 =====");
427
      dbg_uart_wr(BRK0_STAT, 16'h0010);
428
      dbg_uart_rd(CPU_STAT);
429
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ: test 5 =====");
430
 
431
      // RE-RUN
432
      dbg_uart_wr(CPU_CTL,    16'h0002);
433
      repeat(100) @(posedge mclk);
434
 
435
      // RE-CHECK
436 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h18))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ: test 6 =====");
437 2 olivier.gi
      if (mem200 !== 16'h0002)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ: test 7 =====");
438
      dbg_uart_rd(CPU_STAT);
439
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ: test 8 =====");
440
      dbg_uart_rd(BRK0_STAT);
441
      if (dbg_uart_buf !== 16'h0010) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ: test 9 =====");
442
      dbg_uart_wr(BRK0_STAT, 16'h0010);
443
      dbg_uart_rd(CPU_STAT);
444
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ: test 10 =====");
445 58 olivier.gi
        end
446 2 olivier.gi
 
447
 
448 58 olivier.gi
      // HARDWARE BREAKPOINTS: DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - WRITE
449 2 olivier.gi
      //-----------------------------------------------------------------------------
450 58 olivier.gi
      if (`HWBRK_RANGE)
451
        begin
452 2 olivier.gi
 
453
      // RESET, BREAK & CLEAR STATUS
454
      dbg_uart_wr(CPU_CTL,    16'h0060);
455
      dbg_uart_wr(CPU_CTL,    16'h0020);
456
      dbg_uart_wr(BRK0_STAT,  16'h00ff);
457
      dbg_uart_wr(CPU_STAT,   16'h00ff);
458
 
459
 
460
      // CONFIGURE BREAKPOINT (ENABLED) & RUN
461 111 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, (`PER_SIZE+16'h0001));
462
      dbg_uart_wr(BRK0_ADDR1, (`PER_SIZE+16'h0005));
463 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h0016);
464
      dbg_uart_wr(CPU_CTL,    16'h0002);
465
      repeat(100) @(posedge mclk);
466
 
467
      // CHECK
468 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h36))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - WRITE: test 1 =====");
469 58 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - WRITE: test 2 =====");
470 2 olivier.gi
      dbg_uart_rd(CPU_STAT);
471 58 olivier.gi
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - WRITE: test 3 =====");
472 2 olivier.gi
      dbg_uart_rd(BRK0_STAT);
473 58 olivier.gi
      if (dbg_uart_buf !== 16'h0020) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - WRITE: test 4 =====");
474 2 olivier.gi
      dbg_uart_wr(BRK0_STAT, 16'h0020);
475
      dbg_uart_rd(CPU_STAT);
476 58 olivier.gi
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - WRITE: test 5 =====");
477 2 olivier.gi
 
478
      // RE-RUN
479
      dbg_uart_wr(CPU_CTL,    16'h0002);
480
      repeat(100) @(posedge mclk);
481
 
482
      // RE-CHECK
483 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h3a))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 6 =====");
484 58 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 7 =====");
485 2 olivier.gi
      dbg_uart_rd(CPU_STAT);
486 58 olivier.gi
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 8 =====");
487 2 olivier.gi
      dbg_uart_rd(BRK0_STAT);
488 58 olivier.gi
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 9 =====");
489 2 olivier.gi
      dbg_uart_wr(BRK0_STAT, 16'h0020);
490
      dbg_uart_rd(CPU_STAT);
491 58 olivier.gi
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 10 =====");
492 2 olivier.gi
 
493
      // RE-RUN
494
      dbg_uart_wr(CPU_CTL,    16'h0002);
495
      repeat(100) @(posedge mclk);
496
 
497
      // RE-CHECK
498 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h08))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 11 =====");
499 58 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 12 =====");
500 2 olivier.gi
      dbg_uart_rd(CPU_STAT);
501 58 olivier.gi
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 13 =====");
502 2 olivier.gi
      dbg_uart_rd(BRK0_STAT);
503 58 olivier.gi
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 14 =====");
504 2 olivier.gi
      dbg_uart_wr(BRK0_STAT, 16'h0020);
505
      dbg_uart_rd(CPU_STAT);
506 58 olivier.gi
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 15 =====");
507 2 olivier.gi
 
508
      // RE-RUN
509
      dbg_uart_wr(CPU_CTL,    16'h0002);
510
      repeat(100) @(posedge mclk);
511
 
512
      // RE-CHECK
513 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h0C))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 16 =====");
514 58 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 17 =====");
515 2 olivier.gi
      dbg_uart_rd(CPU_STAT);
516 58 olivier.gi
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 18 =====");
517 2 olivier.gi
      dbg_uart_rd(BRK0_STAT);
518 58 olivier.gi
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 19 =====");
519 2 olivier.gi
      dbg_uart_wr(BRK0_STAT, 16'h0020);
520
      dbg_uart_rd(CPU_STAT);
521 58 olivier.gi
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 20 =====");
522 2 olivier.gi
 
523
      // RE-RUN
524
      dbg_uart_wr(CPU_CTL,    16'h0002);
525
      repeat(100) @(posedge mclk);
526
 
527
      // RE-CHECK
528 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h08))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 21 =====");
529 58 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 22 =====");
530 2 olivier.gi
      dbg_uart_rd(CPU_STAT);
531 58 olivier.gi
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 23 =====");
532 2 olivier.gi
      dbg_uart_rd(BRK0_STAT);
533 58 olivier.gi
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 24 =====");
534 2 olivier.gi
      dbg_uart_wr(BRK0_STAT, 16'h0020);
535
      dbg_uart_rd(CPU_STAT);
536 58 olivier.gi
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - WRITE: test 25 =====");
537
        end
538
 
539 2 olivier.gi
 
540
      // HARDWARE BREAKPOINTS: DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE
541
      //----------------------------------------------------------------------------------
542 58 olivier.gi
      if (`HWBRK_RANGE)
543
        begin
544 2 olivier.gi
 
545
      // RESET, BREAK & CLEAR STATUS
546
      dbg_uart_wr(CPU_CTL,    16'h0060);
547
      dbg_uart_wr(CPU_CTL,    16'h0020);
548
      dbg_uart_wr(BRK0_STAT,  16'h00ff);
549
      dbg_uart_wr(CPU_STAT,   16'h00ff);
550
 
551
 
552
      // CONFIGURE BREAKPOINT (ENABLED) & RUN
553 111 olivier.gi
      dbg_uart_wr(BRK0_ADDR0, (`PER_SIZE+16'h0001));
554
      dbg_uart_wr(BRK0_ADDR1, (`PER_SIZE+16'h0005));
555 2 olivier.gi
      dbg_uart_wr(BRK0_CTL,   16'h0017);
556
      dbg_uart_wr(CPU_CTL,    16'h0002);
557
      repeat(100) @(posedge mclk);
558
 
559
      // CHECK
560 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h36))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 1 =====");
561 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 2 =====");
562
      dbg_uart_rd(CPU_STAT);
563
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 3 =====");
564
      dbg_uart_rd(BRK0_STAT);
565
      if (dbg_uart_buf !== 16'h0020) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 4 =====");
566
      dbg_uart_wr(BRK0_STAT, 16'h0020);
567
      dbg_uart_rd(CPU_STAT);
568
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 5 =====");
569
 
570
      // RE-RUN
571
      dbg_uart_wr(CPU_CTL,    16'h0002);
572
      repeat(100) @(posedge mclk);
573
 
574
      // RE-CHECK
575 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h3a))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 6 =====");
576 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 7 =====");
577
      dbg_uart_rd(CPU_STAT);
578
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 8 =====");
579
      dbg_uart_rd(BRK0_STAT);
580
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 9 =====");
581
      dbg_uart_wr(BRK0_STAT, 16'h0020);
582
      dbg_uart_rd(CPU_STAT);
583
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 10 =====");
584
 
585
      // RE-RUN
586
      dbg_uart_wr(CPU_CTL,    16'h0002);
587
      repeat(100) @(posedge mclk);
588
 
589
      // RE-CHECK
590 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h08))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 11 =====");
591 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 12 =====");
592
      dbg_uart_rd(CPU_STAT);
593
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 13 =====");
594
      dbg_uart_rd(BRK0_STAT);
595
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 14 =====");
596
      dbg_uart_wr(BRK0_STAT, 16'h0020);
597
      dbg_uart_rd(CPU_STAT);
598
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 15 =====");
599
 
600
      // RE-RUN
601
      dbg_uart_wr(CPU_CTL,    16'h0002);
602
      repeat(100) @(posedge mclk);
603
 
604
      // RE-CHECK
605 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h0C))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 16 =====");
606 2 olivier.gi
      if (mem200 !== 16'h0000)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 17 =====");
607
      dbg_uart_rd(CPU_STAT);
608
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 18 =====");
609
      dbg_uart_rd(BRK0_STAT);
610
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 19 =====");
611
      dbg_uart_wr(BRK0_STAT, 16'h0020);
612
      dbg_uart_rd(CPU_STAT);
613
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 20 =====");
614
 
615
      // RE-RUN
616
      dbg_uart_wr(CPU_CTL,    16'h0002);
617
      repeat(100) @(posedge mclk);
618
 
619
      // CHECK
620 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h18))           tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 21 =====");
621 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 22 =====");
622
      dbg_uart_rd(CPU_STAT);
623
      if (dbg_uart_buf !== 16'h0011) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 23 =====");
624
      dbg_uart_rd(BRK0_STAT);
625
      if (dbg_uart_buf !== 16'h0010) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 24 =====");
626
      dbg_uart_wr(BRK0_STAT, 16'h0010);
627
      dbg_uart_rd(CPU_STAT);
628
      if (dbg_uart_buf !== 16'h0001) tb_error("====== DATA FLOW (EXECUTION-UNIT) - ADDRESS RANGE - READ/WRITE: test 25 =====");
629
 
630
      // RE-RUN
631
      dbg_uart_wr(CPU_CTL,    16'h0002);
632
      repeat(100) @(posedge mclk);
633
 
634
      // RE-CHECK
635 86 olivier.gi
      if (r0 !== ('h10000-`PMEM_SIZE+'h08))           tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 26 =====");
636 2 olivier.gi
      if (mem200 !== 16'h0001)       tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 27 =====");
637
      dbg_uart_rd(CPU_STAT);
638
      if (dbg_uart_buf !== 16'h0011) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 28 =====");
639
      dbg_uart_rd(BRK0_STAT);
640
      if (dbg_uart_buf !== 16'h0020) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 29 =====");
641
      dbg_uart_wr(BRK0_STAT, 16'h0020);
642
      dbg_uart_rd(CPU_STAT);
643
      if (dbg_uart_buf !== 16'h0001) tb_error("====== INSTRUCTION FLOW (FRONTEND) - ADDRESS RANGE - READ/WRITE: test 30 =====");
644
 
645 58 olivier.gi
        end
646 2 olivier.gi
 
647
       // RE-RUN UNTIL END OF PATTERN
648
      dbg_uart_wr(BRK0_CTL,   16'h0000);
649
      dbg_uart_wr(CPU_CTL,    16'h0002);
650
      repeat(100) @(posedge mclk);
651
 
652
 
653
      stimulus_done = 1;
654 111 olivier.gi
`else
655
 
656
       $display(" ===============================================");
657
       $display("|               SIMULATION SKIPPED              |");
658
       $display("|   (hardware breakpoint unit 0 not included)   |");
659
       $display(" ===============================================");
660
       $finish;
661
`endif
662
`else
663
 
664
       $display(" ===============================================");
665
       $display("|               SIMULATION SKIPPED              |");
666 154 olivier.gi
       $display("|   (serial debug interface UART not included)  |");
667
       $display(" ===============================================");
668
       $finish;
669
`endif
670
`else
671
 
672
       $display(" ===============================================");
673
       $display("|               SIMULATION SKIPPED              |");
674 111 olivier.gi
       $display("|      (serial debug interface not included)    |");
675
       $display(" ===============================================");
676
       $finish;
677
`endif
678 2 olivier.gi
   end
679
 

powered by: WebSVN 2.1.0

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