1 |
2 |
mohor |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// dbg_tb.v ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// This file is part of the SoC/OpenRISC Development Interface ////
|
7 |
|
|
//// http://www.opencores.org/cores/DebugInterface/ ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// Author(s): ////
|
11 |
|
|
//// Igor Mohor ////
|
12 |
|
|
//// igorm@opencores.org ////
|
13 |
|
|
//// ////
|
14 |
|
|
//// ////
|
15 |
|
|
//// All additional information is avaliable in the README.txt ////
|
16 |
|
|
//// file. ////
|
17 |
|
|
//// ////
|
18 |
|
|
//////////////////////////////////////////////////////////////////////
|
19 |
|
|
//// ////
|
20 |
|
|
//// Copyright (C) 2000,2001 Authors ////
|
21 |
|
|
//// ////
|
22 |
|
|
//// This source file may be used and distributed without ////
|
23 |
|
|
//// restriction provided that this copyright statement is not ////
|
24 |
|
|
//// removed from the file and that any derivative work contains ////
|
25 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
26 |
|
|
//// ////
|
27 |
|
|
//// This source file is free software; you can redistribute it ////
|
28 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
29 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
30 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
31 |
|
|
//// later version. ////
|
32 |
|
|
//// ////
|
33 |
|
|
//// This source is distributed in the hope that it will be ////
|
34 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
35 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
36 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
37 |
|
|
//// details. ////
|
38 |
|
|
//// ////
|
39 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
40 |
|
|
//// Public License along with this source; if not, download it ////
|
41 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
42 |
|
|
//// ////
|
43 |
|
|
//////////////////////////////////////////////////////////////////////
|
44 |
|
|
//
|
45 |
|
|
// CVS Revision History
|
46 |
|
|
//
|
47 |
|
|
// $Log: not supported by cvs2svn $
|
48 |
|
|
// Revision 1.3 2001/06/01 22:23:40 mohor
|
49 |
|
|
// This is a backup. It is not a fully working version. Not for use, yet.
|
50 |
|
|
//
|
51 |
|
|
// Revision 1.2 2001/05/18 13:10:05 mohor
|
52 |
|
|
// Headers changed. All additional information is now avaliable in the README.txt file.
|
53 |
|
|
//
|
54 |
|
|
// Revision 1.1.1.1 2001/05/18 06:35:15 mohor
|
55 |
|
|
// Initial release
|
56 |
|
|
//
|
57 |
|
|
//
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
`include "dbg_timescale.v"
|
61 |
|
|
`include "dbg_defines.v"
|
62 |
|
|
`include "dbg_tb_defines.v"
|
63 |
|
|
|
64 |
|
|
// Test bench
|
65 |
|
|
module dbg_tb;
|
66 |
|
|
|
67 |
|
|
parameter Tp = 1;
|
68 |
|
|
parameter Tclk = 50; // Clock half period (Clok period = 100 ns => 10 MHz)
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
reg P_TMS, P_TCK;
|
72 |
|
|
reg P_TRST, P_TDI;
|
73 |
|
|
reg P_PowerONReset;
|
74 |
|
|
reg Mclk;
|
75 |
|
|
|
76 |
|
|
reg [10:0] Wp;
|
77 |
|
|
reg Bp;
|
78 |
|
|
reg [3:0] LsStatus;
|
79 |
|
|
reg [1:0] IStatus;
|
80 |
|
|
|
81 |
|
|
wire P_TDO;
|
82 |
|
|
wire [31:0] ADDR_RISC;
|
83 |
|
|
wire [31:0] DATAIN_RISC; // DATAIN_RISC is connect to DATAOUT
|
84 |
|
|
wire RISC_CS;
|
85 |
|
|
wire RISC_RW;
|
86 |
|
|
|
87 |
|
|
wire [31:0] DATAOUT_RISC; // DATAOUT_RISC is connect to DATAIN
|
88 |
|
|
|
89 |
|
|
wire [`OPSELECTWIDTH-1:0] OpSelect;
|
90 |
|
|
|
91 |
|
|
// Connecting TAP module
|
92 |
|
|
dbg_top dbgTAP1(.P_TMS(P_TMS), .P_TCK(P_TCK), .P_TRST(P_TRST), .P_TDI(P_TDI),
|
93 |
|
|
.P_TDO(P_TDO), .P_PowerONReset(P_PowerONReset), .Mclk(Mclk),
|
94 |
|
|
.RISC_ADDR(ADDR_RISC), .RISC_DATA_IN(DATAOUT_RISC), .RISC_DATA_OUT(DATAIN_RISC),
|
95 |
|
|
.RISC_CS(RISC_CS), .RISC_RW(RISC_RW), .Wp(Wp), .Bp(Bp),
|
96 |
|
|
.OpSelect(OpSelect), .LsStatus(LsStatus), .IStatus(IStatus)
|
97 |
|
|
);
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
reg TestEnabled;
|
101 |
|
|
//integer i;
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
initial
|
106 |
|
|
begin
|
107 |
|
|
TestEnabled<=#Tp 0;
|
108 |
|
|
P_TMS<=#Tp 0;
|
109 |
|
|
P_TCK<=#Tp 0;
|
110 |
|
|
P_TDI<=#Tp 0;
|
111 |
|
|
P_TRST<=#Tp 1;
|
112 |
|
|
|
113 |
|
|
Wp<=#Tp 0;
|
114 |
|
|
Bp<=#Tp 0;
|
115 |
|
|
LsStatus<=#Tp 0;
|
116 |
|
|
IStatus<=#Tp 0;
|
117 |
|
|
|
118 |
|
|
P_PowerONReset<=#Tp 1;
|
119 |
|
|
#100 P_PowerONReset<=#Tp 0; // PowerONReset is active low
|
120 |
|
|
#100 P_PowerONReset<=#Tp 1;
|
121 |
|
|
#Tp TestEnabled<=#Tp 1;
|
122 |
|
|
end
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
// Generating master clock (RISC clock) 200 MHz
|
126 |
|
|
initial
|
127 |
|
|
begin
|
128 |
|
|
Mclk<=#Tp 0;
|
129 |
|
|
#1 forever #`RISC_CLOCK Mclk<=~Mclk;
|
130 |
|
|
end
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
// Generating random number for use in DATAOUT_RISC[31:0]
|
134 |
|
|
reg [31:0] RandNumb;
|
135 |
|
|
always @ (posedge Mclk or negedge P_PowerONReset) // PowerONReset is active low
|
136 |
|
|
begin
|
137 |
|
|
if(~P_PowerONReset)
|
138 |
|
|
RandNumb[31:0]<=#Tp 0;
|
139 |
|
|
else
|
140 |
|
|
RandNumb[31:0]<=#Tp RandNumb[31:0] + 1;
|
141 |
|
|
end
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
assign DATAOUT_RISC[31:0] = RandNumb[31:0];
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
always @ (posedge TestEnabled)
|
149 |
|
|
begin
|
150 |
|
|
ResetTAP;
|
151 |
|
|
GotoRunTestIdle;
|
152 |
|
|
|
153 |
|
|
// Testing read and write to RISC registers
|
154 |
|
|
SetInstruction(`CHAIN_SELECT);
|
155 |
|
|
ChainSelect(`RISC_DEBUG_CHAIN, 8'h38); // {chain, crc}
|
156 |
|
|
SetInstruction(`DEBUG);
|
157 |
|
|
ReadRISCRegister(32'h12345ead, 8'hbf); // {addr, crc}
|
158 |
|
|
WriteRISCRegister(32'h11223344, 32'h12345678, 8'haf); // {data, addr, crc}
|
159 |
|
|
//
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
// Testing read and write to internal registers
|
164 |
|
|
SetInstruction(`IDCODE);
|
165 |
|
|
ReadIDCode;
|
166 |
|
|
|
167 |
|
|
SetInstruction(`CHAIN_SELECT);
|
168 |
|
|
ChainSelect(`REGISTER_SCAN_CHAIN, 8'h0e); // {chain, crc}
|
169 |
|
|
SetInstruction(`DEBUG);
|
170 |
|
|
|
171 |
|
|
//
|
172 |
|
|
ReadRegister(`MODER_ADR, 8'h00); // {addr, crc}
|
173 |
|
|
ReadRegister(`TSEL_ADR, 8'h64); // {addr, crc}
|
174 |
|
|
ReadRegister(`QSEL_ADR, 8'h32); // {addr, crc}
|
175 |
|
|
ReadRegister(`SSEL_ADR, 8'h56); // {addr, crc}
|
176 |
|
|
ReadRegister(`RECWP0_ADR, 8'hc4); // {addr, crc}
|
177 |
|
|
ReadRegister(`RECWP1_ADR, 8'ha0); // {addr, crc}
|
178 |
|
|
ReadRegister(`RECWP2_ADR, 8'hf6); // {addr, crc}
|
179 |
|
|
ReadRegister(`RECWP3_ADR, 8'h92); // {addr, crc}
|
180 |
|
|
ReadRegister(`RECWP4_ADR, 8'hdd); // {addr, crc}
|
181 |
|
|
ReadRegister(`RECWP5_ADR, 8'hb9); // {addr, crc}
|
182 |
|
|
ReadRegister(`RECWP6_ADR, 8'hef); // {addr, crc}
|
183 |
|
|
ReadRegister(`RECWP7_ADR, 8'h8b); // {addr, crc}
|
184 |
|
|
ReadRegister(`RECWP8_ADR, 8'h4b); // {addr, crc}
|
185 |
|
|
ReadRegister(`RECWP9_ADR, 8'h2f); // {addr, crc}
|
186 |
|
|
ReadRegister(`RECWP10_ADR, 8'h79); // {addr, crc}
|
187 |
|
|
ReadRegister(`RECBP0_ADR, 8'h1d); // {addr, crc}
|
188 |
|
|
ReadRegister(5'h1f, 8'h04); // {addr, crc} // Register address don't exist. Read should return high-Z.
|
189 |
|
|
ReadRegister(5'h1f, 8'h04); // {addr, crc} // Register address don't exist. Read should return high-Z.
|
190 |
|
|
|
191 |
|
|
WriteRegister(32'h00000001, `MODER_ADR, 8'h53); // {data, addr, crc}
|
192 |
|
|
WriteRegister(32'h00000020, `TSEL_ADR, 8'h5e); // {data, addr, crc}
|
193 |
|
|
WriteRegister(32'h00000300, `QSEL_ADR, 8'hdd); // {data, addr, crc}
|
194 |
|
|
WriteRegister(32'h00004000, `SSEL_ADR, 8'he2); // {data, addr, crc}
|
195 |
|
|
WriteRegister(32'h00050000, `RECWP0_ADR, 8'hbe); // {data, addr, crc}
|
196 |
|
|
WriteRegister(32'h00600000, `RECWP1_ADR, 8'hbc); // {data, addr, crc}
|
197 |
|
|
WriteRegister(32'h07000000, `RECWP2_ADR, 8'h3a); // {data, addr, crc}
|
198 |
|
|
WriteRegister(32'h80000000, `RECWP3_ADR, 8'hf7); // {data, addr, crc}
|
199 |
|
|
WriteRegister(32'h09000000, `RECWP4_ADR, 8'h46); // {data, addr, crc}
|
200 |
|
|
WriteRegister(32'h00a00000, `RECWP5_ADR, 8'h9a); // {data, addr, crc}
|
201 |
|
|
WriteRegister(32'h000b0000, `RECWP6_ADR, 8'h37); // {data, addr, crc}
|
202 |
|
|
WriteRegister(32'h0000c000, `RECWP7_ADR, 8'h54); // {data, addr, crc}
|
203 |
|
|
WriteRegister(32'h00000d00, `RECWP8_ADR, 8'hc3); // {data, addr, crc}
|
204 |
|
|
WriteRegister(32'h000000e0, `RECWP9_ADR, 8'h2f); // {data, addr, crc}
|
205 |
|
|
WriteRegister(32'h0000000f, `RECWP10_ADR, 8'h18); // {data, addr, crc}
|
206 |
|
|
WriteRegister(32'hdeadbeef, `RECBP0_ADR, 8'h80); // {data, addr, crc}
|
207 |
|
|
|
208 |
|
|
ReadRegister(`MODER_ADR, 8'h00); // {addr, crc}
|
209 |
|
|
ReadRegister(`TSEL_ADR, 8'h64); // {addr, crc}
|
210 |
|
|
ReadRegister(`QSEL_ADR, 8'h32); // {addr, crc}
|
211 |
|
|
ReadRegister(`SSEL_ADR, 8'h56); // {addr, crc}
|
212 |
|
|
ReadRegister(`RECWP0_ADR, 8'hc4); // {addr, crc}
|
213 |
|
|
ReadRegister(`RECWP1_ADR, 8'ha0); // {addr, crc}
|
214 |
|
|
ReadRegister(`RECWP2_ADR, 8'hf6); // {addr, crc}
|
215 |
|
|
ReadRegister(`RECWP3_ADR, 8'h92); // {addr, crc}
|
216 |
|
|
ReadRegister(`RECWP4_ADR, 8'hdd); // {addr, crc}
|
217 |
|
|
ReadRegister(`RECWP5_ADR, 8'hb9); // {addr, crc}
|
218 |
|
|
ReadRegister(`RECWP6_ADR, 8'hef); // {addr, crc}
|
219 |
|
|
ReadRegister(`RECWP7_ADR, 8'h8b); // {addr, crc}
|
220 |
|
|
ReadRegister(`RECWP8_ADR, 8'h4b); // {addr, crc}
|
221 |
|
|
ReadRegister(`RECWP9_ADR, 8'h2f); // {addr, crc}
|
222 |
|
|
ReadRegister(`RECWP10_ADR, 8'h79); // {addr, crc}
|
223 |
|
|
ReadRegister(`RECBP0_ADR, 8'h1d); // {addr, crc}
|
224 |
|
|
ReadRegister(5'h1f, 8'h04); // {addr, crc} // Register address don't exist. Read should return high-Z.
|
225 |
|
|
ReadRegister(5'h1f, 8'h04); // {addr, crc} // Register address don't exist. Read should return high-Z.
|
226 |
|
|
//
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
// testing trigger and qualifier
|
230 |
|
|
`ifdef TRACE_ENABLED
|
231 |
|
|
/* Watchpoint Wp[0] starts trigger, anything starts qualifier
|
232 |
|
|
#1000 WriteRegister(`WPTRIG_0 | `WPTRIGVALID | `TRIGOP_AND, `TSEL_ADR, 8'h9c); // Wp[0] starts trigger, anything starts qualifier
|
233 |
|
|
#1000 WriteRegister(`ENABLE, `MODER_ADR, 8'hf9); // {data, addr, crc}
|
234 |
|
|
#2000 Wp=11'h001;
|
235 |
|
|
*/
|
236 |
|
|
|
237 |
|
|
/* Watchpoint Wp[10] & (IStatus[1:0] == IS_FETCH) start trigger, anything starts qualifier
|
238 |
|
|
#1000 WriteRegister(`WPTRIG_10 | `IS_FETCH | `WPTRIGVALID | `ISTRIGVALID | `TRIGOP_AND, `TSEL_ADR, 8'haf); // Wp[10] & IStatus = IS_FETCH start trigger, anything starts qualifier
|
239 |
|
|
#1000 WriteRegister(`ENABLE | `CONTIN, `MODER_ADR, 8'hc8); // {data, addr, crc}
|
240 |
|
|
#2000 Wp=11'h001; // Wp[0] is active
|
241 |
|
|
#2000 IStatus=2'b01; // IStatus = IS_FETCH
|
242 |
|
|
#1999 Wp=11'h400; // Wp[10] is active
|
243 |
|
|
*/
|
244 |
|
|
|
245 |
|
|
/* Watchpoint Wp[10] & IStatus[1:0] = IS_BRANCH start trigger, anything starts qualifier
|
246 |
|
|
#1000 WriteRegister(`WPTRIG_10 | `IS_BRANCH | `WPTRIGVALID | `ISTRIGVALID | `TRIGOP_AND, `TSEL_ADR, 8'hd1); // Wp[10] & IStatus = IS_BRANCH start trigger, anything starts qualifier
|
247 |
|
|
#1000 WriteRegister(`ENABLE, `MODER_ADR, 8'hf9); // {data, addr, crc}
|
248 |
|
|
#2000 Wp=11'h001; // Wp[0] is active
|
249 |
|
|
#2000 IStatus=2'b10; // IStatus = IS_BRANCH
|
250 |
|
|
#1999 Wp=11'h400; // Wp[10] is active
|
251 |
|
|
*/
|
252 |
|
|
|
253 |
|
|
/* Watchpoint Wp[5] starts qualifier, anything starts trigger
|
254 |
|
|
#1000 WriteRegister(`WPQUALIF_5 | `WPQUALIFVALID | `QUALIFOP_AND, `QSEL_ADR, 8'ha3); // Wp[5] starts Qualifier, anything starts trigger
|
255 |
|
|
#1000 WriteRegister(`ENABLE, `MODER_ADR, 8'hf9); // {data, addr, crc}
|
256 |
|
|
#2000 Wp=11'h020; // Wp[5] is active
|
257 |
|
|
*/
|
258 |
|
|
|
259 |
|
|
// igor !!! od tu naprej je test TRACE-A, ki sem ga zakomentiral, ker moram najprej urediti read/write registrov
|
260 |
|
|
// Breakpoint Bp & LsStatus[1] start qualifier, anything starts trigger
|
261 |
|
|
#1000 WriteRegister(32'h12345673, `RECBP0_ADR, 8'hfe); // Ta je brez veze in mora iti ven. tu je le zato, da bi se videlo ali se registri berejo ok
|
262 |
|
|
#1000 WriteRegister(32'h00000003, `RECBP0_ADR, 8'hd5); // Breakpoint Bp selects two samples for recording
|
263 |
|
|
#100 WriteRegister(32'h80000801, `SSEL_ADR, 8'ha0); // Watchpoint Wp0 stops recording
|
264 |
|
|
// #1000 WriteRegister(`BPQUALIF | `LSS_LOADBYTE_ZEROEXT | `BPQUALIFVALID | `LSSQUALIFVALID | `QUALIFOP_AND, `QSEL_ADR, 8'h50); // Breakpoint Bp & LsStatus[1] start qualifier, anything starts trigger
|
265 |
|
|
#1000 WriteRegister(`ENABLE, `MODER_ADR, 8'hf9); // {data, addr, crc}
|
266 |
|
|
#2000 Bp=1; // Bp is active
|
267 |
|
|
// #2000 LsStatus[3:0]=4'h2; // LsStatus = LSS_LOADBYTE_ZEROEXT
|
268 |
|
|
#2000 LsStatus[3:0]=4'h2; // LsStatus = LSS_LOADBYTE_ZEROEXT
|
269 |
|
|
#45 LsStatus[3:0]=4'h1; // LsStatus != LSS_LOADBYTE_ZEROEXT ()
|
270 |
|
|
#90 LsStatus[3:0]=4'h2; // LsStatus = LSS_LOADBYTE_ZEROEXT
|
271 |
|
|
WriteRegister(32'h0000000c, `RECWP5_ADR, 8'h72); // Watchpoint Wp5 selects two samples for recording
|
272 |
|
|
#45 LsStatus[3:0]=4'h1; // LsStatus != LSS_LOADBYTE_ZEROEXT ()
|
273 |
|
|
#45 LsStatus[3:0]=4'h2; // LsStatus = LSS_LOADBYTE_ZEROEXT
|
274 |
|
|
Bp=0; // Bp is active
|
275 |
|
|
Wp=11'h020; // Wp[5] is active
|
276 |
|
|
#250 Wp=11'h021; // Wp[0] and Wp[5] are active. Wp[0] will stop recording
|
277 |
|
|
|
278 |
|
|
|
279 |
|
|
#45 LsStatus[3:0]=4'h1; // LsStatus != LSS_LOADBYTE_ZEROEXT ()
|
280 |
|
|
#45 LsStatus[3:0]=4'h2; // LsStatus = LSS_LOADBYTE_ZEROEXT
|
281 |
|
|
#1000 LsStatus[3:0]=4'h1; // LsStatus != LSS_LOADBYTE_ZEROEXT ()
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
//
|
287 |
|
|
|
288 |
|
|
#1000 WriteRegister(0, `MODER_ADR, 8'h62); // {data, addr, crc} Disable Trace
|
289 |
|
|
SetInstruction(`CHAIN_SELECT);
|
290 |
|
|
ChainSelect(`TRACE_TEST_CHAIN, 8'h24); // {chain, crc}
|
291 |
|
|
SetInstruction(`DEBUG);
|
292 |
|
|
ReadTraceBuffer;
|
293 |
|
|
ReadTraceBuffer;
|
294 |
|
|
ReadTraceBuffer;
|
295 |
|
|
ReadTraceBuffer;
|
296 |
|
|
ReadTraceBuffer;
|
297 |
|
|
ReadTraceBuffer;
|
298 |
|
|
ReadTraceBuffer;
|
299 |
|
|
ReadTraceBuffer;
|
300 |
|
|
ReadTraceBuffer;
|
301 |
|
|
ReadTraceBuffer;
|
302 |
|
|
ReadTraceBuffer;
|
303 |
|
|
ReadTraceBuffer;
|
304 |
|
|
|
305 |
|
|
// for(i=0;i<1500;i=i+1)
|
306 |
|
|
// ReadTraceBuffer;
|
307 |
|
|
|
308 |
|
|
// // igor !!! konec zakomentiranega trace-a
|
309 |
|
|
`endif // TRACE_ENABLED
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
#5000 GenClk(1); // One extra TCLK for debugging purposes
|
315 |
|
|
#100 $stop;
|
316 |
|
|
|
317 |
|
|
end
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
// Generation of the TCLK signal
|
322 |
|
|
task GenClk;
|
323 |
|
|
input [7:0] Number;
|
324 |
|
|
integer i;
|
325 |
|
|
begin
|
326 |
|
|
for(i=0; i<Number; i=i+1)
|
327 |
|
|
begin
|
328 |
|
|
#Tclk P_TCK<=1;
|
329 |
|
|
#Tclk P_TCK<=0;
|
330 |
|
|
end
|
331 |
|
|
end
|
332 |
|
|
endtask
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
// TAP reset
|
336 |
|
|
task ResetTAP;
|
337 |
|
|
begin
|
338 |
|
|
P_TMS<=#Tp 1;
|
339 |
|
|
GenClk(7);
|
340 |
|
|
end
|
341 |
|
|
endtask
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
// Goes to RunTestIdle state
|
345 |
|
|
task GotoRunTestIdle;
|
346 |
|
|
begin
|
347 |
|
|
P_TMS<=#Tp 0;
|
348 |
|
|
GenClk(1);
|
349 |
|
|
end
|
350 |
|
|
endtask
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
// sets the instruction to the IR register and goes to the RunTestIdle state
|
354 |
|
|
task SetInstruction;
|
355 |
|
|
input [3:0] Instr;
|
356 |
|
|
integer i;
|
357 |
|
|
|
358 |
|
|
begin
|
359 |
|
|
P_TMS<=#Tp 1;
|
360 |
|
|
GenClk(2);
|
361 |
|
|
P_TMS<=#Tp 0;
|
362 |
|
|
GenClk(2); // we are in shiftIR
|
363 |
|
|
|
364 |
|
|
for(i=0; i<`IR_LENGTH-1; i=i+1)
|
365 |
|
|
begin
|
366 |
|
|
P_TDI<=#Tp Instr[i];
|
367 |
|
|
GenClk(1);
|
368 |
|
|
end
|
369 |
|
|
|
370 |
|
|
P_TDI<=#Tp Instr[i]; // last shift
|
371 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
372 |
|
|
GenClk(1);
|
373 |
|
|
P_TDI<=#Tp 'hz; // tri-state
|
374 |
|
|
GenClk(1);
|
375 |
|
|
P_TMS<=#Tp 0;
|
376 |
|
|
GenClk(1); // we are in RunTestIdle
|
377 |
|
|
end
|
378 |
|
|
endtask
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
// sets the selected scan chain and goes to the RunTestIdle state
|
382 |
|
|
task ChainSelect;
|
383 |
|
|
input [3:0] Data;
|
384 |
|
|
input [7:0] Crc;
|
385 |
|
|
integer i;
|
386 |
|
|
|
387 |
|
|
begin
|
388 |
|
|
P_TMS<=#Tp 1;
|
389 |
|
|
GenClk(1);
|
390 |
|
|
P_TMS<=#Tp 0;
|
391 |
|
|
GenClk(2); // we are in shiftDR
|
392 |
|
|
|
393 |
|
|
for(i=0; i<`CHAIN_ID_LENGTH; i=i+1)
|
394 |
|
|
begin
|
395 |
|
|
P_TDI<=#Tp Data[i];
|
396 |
|
|
GenClk(1);
|
397 |
|
|
end
|
398 |
|
|
|
399 |
|
|
for(i=0; i<`CRC_LENGTH-1; i=i+1)
|
400 |
|
|
begin
|
401 |
|
|
P_TDI<=#Tp Crc[i];
|
402 |
|
|
GenClk(1);
|
403 |
|
|
end
|
404 |
|
|
|
405 |
|
|
P_TDI<=#Tp Crc[i]; // last shift
|
406 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
407 |
|
|
GenClk(1);
|
408 |
|
|
P_TDI<=#Tp 'hz; // tri-state
|
409 |
|
|
GenClk(1);
|
410 |
|
|
P_TMS<=#Tp 0;
|
411 |
|
|
GenClk(1); // we are in RunTestIdle
|
412 |
|
|
end
|
413 |
|
|
endtask
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
// Reads the ID code
|
417 |
|
|
task ReadIDCode;
|
418 |
|
|
begin
|
419 |
|
|
P_TMS<=#Tp 1;
|
420 |
|
|
GenClk(1);
|
421 |
|
|
P_TMS<=#Tp 0;
|
422 |
|
|
GenClk(2); // we are in shiftDR
|
423 |
|
|
|
424 |
|
|
P_TDI<=#Tp 0;
|
425 |
|
|
GenClk(31);
|
426 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
427 |
|
|
GenClk(1);
|
428 |
|
|
P_TDI<=#Tp 'hz; // tri-state
|
429 |
|
|
GenClk(1);
|
430 |
|
|
P_TMS<=#Tp 0;
|
431 |
|
|
GenClk(1); // we are in RunTestIdle
|
432 |
|
|
end
|
433 |
|
|
endtask
|
434 |
|
|
|
435 |
|
|
|
436 |
|
|
// Reads sample from the Trace Buffer
|
437 |
|
|
task ReadTraceBuffer;
|
438 |
|
|
begin
|
439 |
|
|
P_TMS<=#Tp 1;
|
440 |
|
|
GenClk(1);
|
441 |
|
|
P_TMS<=#Tp 0;
|
442 |
|
|
GenClk(2); // we are in shiftDR
|
443 |
|
|
|
444 |
|
|
P_TDI<=#Tp 0;
|
445 |
|
|
GenClk(47);
|
446 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
447 |
|
|
GenClk(1);
|
448 |
|
|
P_TDI<=#Tp 'hz; // tri-state
|
449 |
|
|
GenClk(1);
|
450 |
|
|
P_TMS<=#Tp 0;
|
451 |
|
|
GenClk(1); // we are in RunTestIdle
|
452 |
|
|
end
|
453 |
|
|
endtask
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
// Reads the RISC register and latches the data so it is ready for reading
|
457 |
|
|
task ReadRISCRegister;
|
458 |
|
|
input [31:0] Address;
|
459 |
|
|
input [7:0] Crc;
|
460 |
|
|
integer i;
|
461 |
|
|
|
462 |
|
|
begin
|
463 |
|
|
P_TMS<=#Tp 1;
|
464 |
|
|
GenClk(1);
|
465 |
|
|
P_TMS<=#Tp 0;
|
466 |
|
|
GenClk(2); // we are in shiftDR
|
467 |
|
|
|
468 |
|
|
for(i=0; i<32; i=i+1)
|
469 |
|
|
begin
|
470 |
|
|
P_TDI<=#Tp Address[i]; // Shifting address
|
471 |
|
|
GenClk(1);
|
472 |
|
|
end
|
473 |
|
|
|
474 |
|
|
P_TDI<=#Tp 0; // shifting RW bit = read
|
475 |
|
|
GenClk(1);
|
476 |
|
|
|
477 |
|
|
for(i=0; i<32; i=i+1)
|
478 |
|
|
begin
|
479 |
|
|
P_TDI<=#Tp 0; // Shifting data. Data is not important in read cycle.
|
480 |
|
|
GenClk(1);
|
481 |
|
|
end
|
482 |
|
|
|
483 |
|
|
for(i=0; i<`CRC_LENGTH-1; i=i+1)
|
484 |
|
|
begin
|
485 |
|
|
P_TDI<=#Tp Crc[i]; // Shifting CRC.
|
486 |
|
|
GenClk(1);
|
487 |
|
|
end
|
488 |
|
|
|
489 |
|
|
P_TDI<=#Tp Crc[i]; // Shifting last bit of CRC.
|
490 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
491 |
|
|
GenClk(1);
|
492 |
|
|
P_TDI<=#Tp 'hz; // Tristate TDI.
|
493 |
|
|
GenClk(1);
|
494 |
|
|
|
495 |
|
|
P_TMS<=#Tp 0;
|
496 |
|
|
GenClk(1); // we are in RunTestIdle
|
497 |
|
|
end
|
498 |
|
|
endtask
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
// Write the RISC register
|
502 |
|
|
task WriteRISCRegister;
|
503 |
|
|
input [31:0] Data;
|
504 |
|
|
input [31:0] Address;
|
505 |
|
|
input [`CRC_LENGTH-1:0] Crc;
|
506 |
|
|
integer i;
|
507 |
|
|
|
508 |
|
|
begin
|
509 |
|
|
P_TMS<=#Tp 1;
|
510 |
|
|
GenClk(1);
|
511 |
|
|
P_TMS<=#Tp 0;
|
512 |
|
|
GenClk(2); // we are in shiftDR
|
513 |
|
|
|
514 |
|
|
for(i=0; i<32; i=i+1)
|
515 |
|
|
begin
|
516 |
|
|
P_TDI<=#Tp Address[i]; // Shifting address
|
517 |
|
|
GenClk(1);
|
518 |
|
|
end
|
519 |
|
|
|
520 |
|
|
P_TDI<=#Tp 1; // shifting RW bit = write
|
521 |
|
|
GenClk(1);
|
522 |
|
|
|
523 |
|
|
for(i=0; i<32; i=i+1)
|
524 |
|
|
begin
|
525 |
|
|
P_TDI<=#Tp Data[i]; // Shifting data
|
526 |
|
|
GenClk(1);
|
527 |
|
|
end
|
528 |
|
|
|
529 |
|
|
for(i=0; i<`CRC_LENGTH-1; i=i+1)
|
530 |
|
|
begin
|
531 |
|
|
P_TDI<=#Tp Crc[i]; // Shifting CRC
|
532 |
|
|
GenClk(1);
|
533 |
|
|
end
|
534 |
|
|
|
535 |
|
|
P_TDI<=#Tp Crc[i]; // shifting last bit of CRC
|
536 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
537 |
|
|
GenClk(1);
|
538 |
|
|
P_TDI<=#Tp 'hz; // tristate TDI
|
539 |
|
|
GenClk(1);
|
540 |
|
|
|
541 |
|
|
P_TMS<=#Tp 0;
|
542 |
|
|
GenClk(1); // we are in RunTestIdle
|
543 |
|
|
|
544 |
|
|
GenClk(10); // Generating few clock cycles needed for the write operation to accomplish
|
545 |
|
|
end
|
546 |
|
|
endtask
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
// Reads the register and latches the data so it is ready for reading
|
550 |
|
|
task ReadRegister;
|
551 |
|
|
input [4:0] Address;
|
552 |
|
|
input [7:0] Crc;
|
553 |
|
|
integer i;
|
554 |
|
|
|
555 |
|
|
begin
|
556 |
|
|
P_TMS<=#Tp 1;
|
557 |
|
|
GenClk(1);
|
558 |
|
|
P_TMS<=#Tp 0;
|
559 |
|
|
GenClk(2); // we are in shiftDR
|
560 |
|
|
|
561 |
|
|
for(i=0; i<5; i=i+1)
|
562 |
|
|
begin
|
563 |
|
|
P_TDI<=#Tp Address[i]; // Shifting address
|
564 |
|
|
GenClk(1);
|
565 |
|
|
end
|
566 |
|
|
|
567 |
|
|
P_TDI<=#Tp 0; // shifting RW bit = read
|
568 |
|
|
GenClk(1);
|
569 |
|
|
|
570 |
|
|
for(i=0; i<32; i=i+1)
|
571 |
|
|
begin
|
572 |
|
|
P_TDI<=#Tp 0; // Shifting data. Data is not important in read cycle.
|
573 |
|
|
GenClk(1);
|
574 |
|
|
end
|
575 |
|
|
|
576 |
|
|
for(i=0; i<`CRC_LENGTH-1; i=i+1)
|
577 |
|
|
begin
|
578 |
|
|
P_TDI<=#Tp Crc[i]; // Shifting CRC. CRC is not important in read cycle.
|
579 |
|
|
GenClk(1);
|
580 |
|
|
end
|
581 |
|
|
|
582 |
|
|
P_TDI<=#Tp Crc[i]; // Shifting last bit of CRC.
|
583 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
584 |
|
|
GenClk(1);
|
585 |
|
|
P_TDI<=#Tp 'hz; // Tri state TDI
|
586 |
|
|
GenClk(1);
|
587 |
|
|
P_TMS<=#Tp 0;
|
588 |
|
|
GenClk(1); // we are in RunTestIdle
|
589 |
|
|
|
590 |
|
|
GenClk(10); // Generating few clock cycles needed for the read operation to accomplish
|
591 |
|
|
end
|
592 |
|
|
endtask
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
// Write the register
|
596 |
|
|
task WriteRegister;
|
597 |
|
|
input [31:0] Data;
|
598 |
|
|
input [4:0] Address;
|
599 |
|
|
input [`CRC_LENGTH-1:0] Crc;
|
600 |
|
|
integer i;
|
601 |
|
|
|
602 |
|
|
begin
|
603 |
|
|
P_TMS<=#Tp 1;
|
604 |
|
|
GenClk(1);
|
605 |
|
|
P_TMS<=#Tp 0;
|
606 |
|
|
GenClk(2); // we are in shiftDR
|
607 |
|
|
|
608 |
|
|
for(i=0; i<5; i=i+1)
|
609 |
|
|
begin
|
610 |
|
|
P_TDI<=#Tp Address[i]; // Shifting address
|
611 |
|
|
GenClk(1);
|
612 |
|
|
end
|
613 |
|
|
|
614 |
|
|
P_TDI<=#Tp 1; // shifting RW bit = write
|
615 |
|
|
GenClk(1);
|
616 |
|
|
|
617 |
|
|
for(i=0; i<32; i=i+1)
|
618 |
|
|
begin
|
619 |
|
|
P_TDI<=#Tp Data[i]; // Shifting data
|
620 |
|
|
GenClk(1);
|
621 |
|
|
end
|
622 |
|
|
|
623 |
|
|
for(i=0; i<`CRC_LENGTH-1; i=i+1)
|
624 |
|
|
begin
|
625 |
|
|
P_TDI<=#Tp Crc[i]; // Shifting CRC
|
626 |
|
|
GenClk(1);
|
627 |
|
|
end
|
628 |
|
|
|
629 |
|
|
P_TDI<=#Tp Crc[i]; // Shifting last bit of CRC
|
630 |
|
|
P_TMS<=#Tp 1; // going out of shiftIR
|
631 |
|
|
GenClk(1);
|
632 |
|
|
P_TDI<=#Tp 'hz; // Tri state TDI
|
633 |
|
|
GenClk(1);
|
634 |
|
|
|
635 |
|
|
P_TMS<=#Tp 0;
|
636 |
|
|
GenClk(1); // we are in RunTestIdle
|
637 |
|
|
end
|
638 |
|
|
endtask
|
639 |
|
|
|
640 |
|
|
|
641 |
|
|
|
642 |
|
|
/**********************************************************************************
|
643 |
|
|
* *
|
644 |
|
|
* Printing the information to the screen *
|
645 |
|
|
* *
|
646 |
|
|
**********************************************************************************/
|
647 |
|
|
|
648 |
|
|
// Print samples that are recorded to the trace buffer
|
649 |
|
|
`ifdef TRACE_ENABLED
|
650 |
|
|
always @ (posedge Mclk)
|
651 |
|
|
begin
|
652 |
|
|
if(dbg_tb.dbgTAP1.dbgTrace1.WriteSample)
|
653 |
|
|
$write("\n\tWritten to Trace buffer: WritePointer=0x%x, Data=0x%x", dbg_tb.dbgTAP1.dbgTrace1.WritePointer, {dbg_tb.dbgTAP1.dbgTrace1.RISC_DATA_IN, 1'b0, dbg_tb.dbgTAP1.dbgTrace1.OpSelect[`OPSELECTWIDTH-1:0]});
|
654 |
|
|
end
|
655 |
|
|
`endif
|
656 |
|
|
|
657 |
|
|
|
658 |
|
|
// Print selected instruction
|
659 |
|
|
reg UpdateIR_q;
|
660 |
|
|
always @ (posedge P_TCK)
|
661 |
|
|
begin
|
662 |
|
|
UpdateIR_q<=#Tp dbg_tb.dbgTAP1.UpdateIR;
|
663 |
|
|
end
|
664 |
|
|
|
665 |
|
|
always @ (posedge P_TCK)
|
666 |
|
|
begin
|
667 |
|
|
if(UpdateIR_q)
|
668 |
|
|
case(dbg_tb.dbgTAP1.JTAG_IR[`IR_LENGTH-1:0])
|
669 |
|
|
`EXTEST : $write("\n\tInstruction EXTEST");
|
670 |
|
|
`SAMPLE_PRELOAD : $write("\n\tInstruction SAMPLE_PRELOAD");
|
671 |
|
|
`IDCODE : $write("\n\tInstruction IDCODE");
|
672 |
|
|
`CHAIN_SELECT : $write("\n\tInstruction CHAIN_SELECT");
|
673 |
|
|
`INTEST : $write("\n\tInstruction INTEST");
|
674 |
|
|
`CLAMP : $write("\n\tInstruction CLAMP");
|
675 |
|
|
`CLAMPZ : $write("\n\tInstruction CLAMPZ");
|
676 |
|
|
`HIGHZ : $write("\n\tInstruction HIGHZ");
|
677 |
|
|
`DEBUG : $write("\n\tInstruction DEBUG");
|
678 |
|
|
`BYPASS : $write("\n\tInstruction BYPASS");
|
679 |
|
|
default : $write("\n\tInstruction not valid. Instruction BYPASS activated !!!");
|
680 |
|
|
endcase
|
681 |
|
|
end
|
682 |
|
|
|
683 |
|
|
|
684 |
|
|
|
685 |
|
|
// Print selected chain
|
686 |
|
|
always @ (posedge P_TCK)
|
687 |
|
|
begin
|
688 |
|
|
if(dbg_tb.dbgTAP1.CHAIN_SELECTSelected & dbg_tb.dbgTAP1.UpdateDR_q)
|
689 |
|
|
case(dbg_tb.dbgTAP1.Chain[`CHAIN_ID_LENGTH-1:0])
|
690 |
|
|
`GLOBAL_BS_CHAIN : $write("\nChain GLOBAL_BS_CHAIN");
|
691 |
|
|
`RISC_DEBUG_CHAIN : $write("\nChain RISC_DEBUG_CHAIN");
|
692 |
|
|
`RISC_TEST_CHAIN : $write("\nChain RISC_TEST_CHAIN");
|
693 |
|
|
`TRACE_TEST_CHAIN : $write("\nChain TRACE_TEST_CHAIN");
|
694 |
|
|
`REGISTER_SCAN_CHAIN : $write("\nChain REGISTER_SCAN_CHAIN");
|
695 |
|
|
endcase
|
696 |
|
|
end
|
697 |
|
|
|
698 |
|
|
|
699 |
|
|
// print RISC registers read/write
|
700 |
|
|
always @ (posedge Mclk)
|
701 |
|
|
begin
|
702 |
|
|
if(dbg_tb.dbgTAP1.RISC_CS)
|
703 |
|
|
if(dbg_tb.dbgTAP1.RISC_RW)
|
704 |
|
|
begin
|
705 |
|
|
$write("\n\t\tWrite to RISC Register (addr=0x%h, data=0x%h)", dbg_tb.dbgTAP1.ADDR[31:0], dbg_tb.dbgTAP1.DataOut[31:0]);
|
706 |
|
|
end
|
707 |
|
|
else
|
708 |
|
|
begin
|
709 |
|
|
$write("\n\t\tRead from RISC Register (addr=0x%h, data=0x%h)", dbg_tb.dbgTAP1.ADDR[31:0], dbg_tb.dbgTAP1.RISC_DATA_IN[31:0]);
|
710 |
|
|
end
|
711 |
|
|
end
|
712 |
|
|
|
713 |
|
|
|
714 |
|
|
// print registers read/write
|
715 |
|
|
always @ (posedge Mclk)
|
716 |
|
|
begin
|
717 |
|
|
if(dbg_tb.dbgTAP1.RegAccess_q & ~dbg_tb.dbgTAP1.RegAccess_q2)
|
718 |
|
|
begin
|
719 |
|
|
if(dbg_tb.dbgTAP1.RW)
|
720 |
|
|
$write("\n\t\tWrite to Register (addr=0x%h, data=0x%h)", dbg_tb.dbgTAP1.ADDR[4:0], dbg_tb.dbgTAP1.DataOut[31:0]);
|
721 |
|
|
else
|
722 |
|
|
$write("\n\t\tRead from Register (addr=0x%h, data=0x%h)", dbg_tb.dbgTAP1.ADDR[4:0], dbg_tb.dbgTAP1.RegDataIn[31:0]);
|
723 |
|
|
end
|
724 |
|
|
end
|
725 |
|
|
|
726 |
|
|
|
727 |
|
|
// print CRC error
|
728 |
|
|
`ifdef TRACE_ENABLED
|
729 |
|
|
wire CRCErrorReport = ~(dbg_tb.dbgTAP1.CrcMatch & (dbg_tb.dbgTAP1.CHAIN_SELECTSelected | dbg_tb.dbgTAP1.DEBUGSelected & dbg_tb.dbgTAP1.RegisterScanChain | dbg_tb.dbgTAP1.DEBUGSelected & dbg_tb.dbgTAP1.RiscDebugScanChain | dbg_tb.dbgTAP1.DEBUGSelected & dbg_tb.dbgTAP1.TraceTestScanChain));
|
730 |
|
|
`else // TRACE_ENABLED not enabled
|
731 |
|
|
wire CRCErrorReport = ~(dbg_tb.dbgTAP1.CrcMatch & (dbg_tb.dbgTAP1.CHAIN_SELECTSelected | dbg_tb.dbgTAP1.DEBUGSelected & dbg_tb.dbgTAP1.RegisterScanChain | dbg_tb.dbgTAP1.DEBUGSelected & dbg_tb.dbgTAP1.RiscDebugScanChain));
|
732 |
|
|
`endif
|
733 |
|
|
|
734 |
|
|
always @ (posedge P_TCK)
|
735 |
|
|
begin
|
736 |
|
|
if(dbg_tb.dbgTAP1.UpdateDR & ~dbg_tb.dbgTAP1.IDCODESelected)
|
737 |
|
|
begin
|
738 |
|
|
if(dbg_tb.dbgTAP1.CHAIN_SELECTSelected)
|
739 |
|
|
$write("\t\tCrcIn=0x%h, CrcOut=0x%h", dbg_tb.dbgTAP1.JTAG_DR_IN[11:4], dbg_tb.dbgTAP1.CalculatedCrcOut[`CRC_LENGTH-1:0]);
|
740 |
|
|
else
|
741 |
|
|
if(dbg_tb.dbgTAP1.RegisterScanChain & ~dbg_tb.dbgTAP1.CHAIN_SELECTSelected)
|
742 |
|
|
$write("\t\tCrcIn=0x%h, CrcOut=0x%h", dbg_tb.dbgTAP1.JTAG_DR_IN[45:38], dbg_tb.dbgTAP1.CalculatedCrcOut[`CRC_LENGTH-1:0]);
|
743 |
|
|
else
|
744 |
|
|
if(dbg_tb.dbgTAP1.RiscDebugScanChain & ~dbg_tb.dbgTAP1.CHAIN_SELECTSelected)
|
745 |
|
|
$write("\t\tCrcIn=0x%h, CrcOut=0x%h", dbg_tb.dbgTAP1.JTAG_DR_IN[72:65], dbg_tb.dbgTAP1.CalculatedCrcOut[`CRC_LENGTH-1:0]);
|
746 |
|
|
|
747 |
|
|
if(CRCErrorReport)
|
748 |
|
|
begin
|
749 |
|
|
$write("\n\t\t\t\tCrc Error when receiving data (read or write) !!! Crc should be: 0x%h\n", dbg_tb.dbgTAP1.CalculatedCrcIn);
|
750 |
|
|
#1000 $stop;
|
751 |
|
|
end
|
752 |
|
|
end
|
753 |
|
|
end
|
754 |
|
|
|
755 |
|
|
|
756 |
|
|
// Print shifted IDCode
|
757 |
|
|
reg [31:0] TempData;
|
758 |
|
|
always @ (posedge P_TCK)
|
759 |
|
|
begin
|
760 |
|
|
if(dbg_tb.dbgTAP1.IDCODESelected)
|
761 |
|
|
begin
|
762 |
|
|
if(dbg_tb.dbgTAP1.ShiftDR)
|
763 |
|
|
TempData[31:0]<=#Tp {dbg_tb.dbgTAP1.TDOData, TempData[31:1]};
|
764 |
|
|
else
|
765 |
|
|
if(dbg_tb.dbgTAP1.UpdateDR)
|
766 |
|
|
$write("\n\t\tIDCode = 0x%h", TempData[31:0]);
|
767 |
|
|
end
|
768 |
|
|
end
|
769 |
|
|
|
770 |
|
|
|
771 |
|
|
// Print data from the trace buffer
|
772 |
|
|
reg [47:0] TraceData;
|
773 |
|
|
always @ (posedge P_TCK)
|
774 |
|
|
begin
|
775 |
|
|
if(dbg_tb.dbgTAP1.DEBUGSelected & (dbg_tb.dbgTAP1.Chain==`TRACE_TEST_CHAIN))
|
776 |
|
|
begin
|
777 |
|
|
if(dbg_tb.dbgTAP1.ShiftDR)
|
778 |
|
|
TraceData[47:0]<=#Tp {dbg_tb.dbgTAP1.TDOData, TraceData[47:1]};
|
779 |
|
|
else
|
780 |
|
|
if(dbg_tb.dbgTAP1.UpdateDR)
|
781 |
|
|
$write("\n\t\TraceData = 0x%h + Crc = 0x%h", TraceData[39:0], TraceData[47:40]);
|
782 |
|
|
end
|
783 |
|
|
end
|
784 |
|
|
|
785 |
|
|
|
786 |
|
|
endmodule // TB
|
787 |
|
|
|
788 |
|
|
|