forked from riscv-non-isa/riscv-trace-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataTracePayload.tex
531 lines (474 loc) · 20.4 KB
/
dataTracePayload.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
\chapter{Data Trace Encoder Output Packets} \label{dataTracePackets}
Data trace packets must be differentiated from instruction trace packets, and the means by which
this is accomplished is dependent on the trace transport infrastructure. Several possibilities exist:
One option is for instruction and data trace to be issued using different IDs (for example, if using ATB transport,
different \textbf{ATID} values). Alternatively, an additional field as part of the packet encapsulation can be
used (Siemens uses a 2-bit \textbf{msg\_type} field to differentiate different trace types from the same source).
By default, all data trace packets include both address and data. However, provision is made for run-time
configuration options to exclude either the address or the data, in order to minimize trace bandwidth. For example,
if filtering has been configured to only trace from a specific data access address there is no need to report
the address in the trace. Alternatively, the user may want to know which locations are accessed but not care
about the data value. Information about whether address or data are omitted is not encoded in the packets
themselves as it does not change dynamically, and to do so would reduce encoding efficiency. The run-time
configuration should be reported in the Format 3, subformat 3 support packet (see section~\ref{sec:format33}).
The following sections include examples for all three cases.
As outlined in section~\ref{sec:DataInterfaceRequirements}, two different signaling protocols
between the RISC-V hart and the encoder are supported: \textit{unified} and \textit{split}.
Accordingly, both unified and split trace packets are defined.
Note: in the following tables, "clog2" is an abbreviation for "ceiling of log2".
\section{Load and Store} \label{sec:data-loadstore}
\begin{table}[htp]
\centering
\caption{Packet format for Unified load or store, with address and data}
\label{tab:te_datadx0y0}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 2 or 3 & Transaction type\newline
000: Unified load or split load address, aligned\newline
001: Unified load or split load address, unaligned\newline
010: Store, aligned address\newline
011: Store, unaligned address\newline
(other codes select other packet formats)\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes \\
\hline
\textbf{diff} & 2 & 00: Full address and data (sync)\newline
01: Differential address, XOR-compressed data\newline
10: Differential address, full data\newline
11: Differentail address, differential data\\
\hline
\textbf{data\_len} & \textbf{size} & Number of bytes of data is \textbf{data\_len} + 1 \\
\hline
\textbf{data} & 8 * (\textbf{data\_len} + 1) &
Data\\
\hline
\textbf{address} & \textit{daddress\_width\_p} & Byte address if format is unaligned, otherwise shift left by \textbf{size} to recover byte address \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Unified load or store, with address only}
\label{tab:te_datadx0y1}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 2 or 3 & Transaction type\newline
000: Unified load or split load address, aligned\newline
001: Unified load or split load address, unaligned\newline
010: Store, aligned address\newline
011: Store, unaligned address\newline
(other codes select other packet formats)\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes \\
\hline
\textbf{diff} & 1 & 0: Full address (sync) \newline
1: Differential address\\
\hline
\textbf{address} & \textit{daddress\_width\_p} & Byte address if format is unaligned, otherwise shift left by \textbf{size} to recover byte address \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Unified load or store, with data only}
\label{tab:te_datadx0y2}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 2 or 3 & Transaction type\newline
000: Unified load or split load address, aligned\newline
001: Unified load or split load address, unaligned\newline
010: Store, aligned address\newline
011: Store, unaligned address\newline
(other codes select other packet formats)\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes \\
\hline
\textbf{diff} & 1 or 2 & 00: Full data (sync)\newline
01: Compressed data (XOR if 2 bits) \newline
10: reserved \newline
11: Differential data\\
\hline
\textbf{data} & \textit{data\_width\_p} &
Data\\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Split load - Address only}
\label{tab:te_datadx0y3}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
000: Unified load or split load address, aligned\newline
001: Unified load or split load address, unaligned\newline
(other codes select other packet formats)\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes \\
\hline
\textbf{index} & \textit{index\_width\_p} & Transfer index\\
\hline
\textbf{diff} & 1 & 0: Full address (sync) \newline
1: Differential address\\
\hline
\textbf{address} & \textit{daddress\_width\_p} & Byte address if format is unaligned, otherwise shift left by \textbf{size} to recover byte address \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Split load - Data only}
\label{tab:te_datadx0y4}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
100: split load data\newline
(other codes select other packet formats)\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes \\
\hline
\textbf{index} & \textit{index\_width\_p} & Transfer index\\
\hline
\textbf{resp} & 2 &
00: Error (no data)\newline
01: XOR-compressed data\newline
10: Full data\newline
11: Differential data\\
\hline
\textbf{data} & \textit{data\_width\_p} &
Data\\
\hline
\end{tabulary}
\end{table}
\subsection{format field} \label{sec:loadstore-format}
Types of data trace packets are differentiated by the \textbf{format} field. This field is 2 bits wide if
only unified loads and stores are supported, or 3 bits otherwise.
Unified loads and split load request phase share the same code because the encoder will support one or the
other, indicated by a discoverable parameter.
Data accesses aligned to their size (e.g. 32-bit loads aligned to 32-bit word boundaries) are expected to
be commonplace, and in such cases, encoding efficiency can be improved by not reporting the redundant LSBs of the address.
\subsection{size field} \label{sec:loadstore-size}
The width of this field is 2 bits if max size is 64-bits (\textit{data\_width\_p} < 128), 3 bits if wider.
\subsection{diff field} \label{sec:loadstore-diff}
Unlike instruction trace, compression options for data trace are somewhat limited.
Following a synchronization instruction trace packet, the first data trace packet for a given access size must
include the full (unencoded) data access address. Thereafter, the address may be reported differentially (i.e.
address of this data access, minus the address of the previous data access of the same size).
Similarly, following a synchronization instruction trace packet, the first data trace packet for a given access size
must include the full (unencoded) data value. Beyond this, data may be encoded or unencoded depending on whichever
results in the most efficient represenation. Implementors may chose to offer one of XOR or differential compression,
or both. XOR compression will be simpler to implement, and avoids the need for performing subtraction of large
values.
If only one data compression type is offered, the \textbf{diff} field can be 1 bit wide rather than 2 for table \ref{tab:te_datadx0y2}.
\subsection{data\_len field} \label{sec:loadstore-datalen}
However the data is compressed, upper bytes that are all the same value do not need to be
included in the packet; the decoder can recreate the full-width value by sign extending from the most significant
received bit. In cases where \textbf{data} is not the final field in the packet, the width of \textbf{data} is
indicated by this field.
\FloatBarrier
\section{Atomic} \label{sec:data-atomic}
\begin{table}[htp]
\centering
\caption{Packet format for Unified atomic with address and data}
\label{tab:te_datadx0y5}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
110: Unified atomic or split atomic address\newline
(other codes other packet formats)\\
\hline
\textbf{subtype} & 3 & Atomic sub-type\newline
000: Swap\newline
001: ADD\newline
010: AND\newline
011: OR\newline
100: XOR\newline
101: MAX\newline
110: MIN\newline
111: reserved\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes\\
\hline
\textbf{diff} & 2 & 00: Full address and data (sync)\newline
01: Differential address, XOR-compressed data\newline
10: Differential address, full data\newline
11: Differential address, differential data\\
\hline
\textbf{op\_len} & \textbf{size} & Number of bytes of operand is \textbf{op\_len} + 1\\
\hline
\textbf{operand} & 8 * (\textbf{op\_len} + 1) & Operand. Value from rs2 before operator applied\\
\hline
\textbf{data\_len} & \textbf{size} & Number of bytes of data is \textbf{data\_len} + 1\\
\hline
\textbf{data} & 8 * (\textbf{data\_len} + 1) &
Data\\
\hline
\textbf{address} & \textit{daddress\_width\_p} & Address, aligned and encoded as per size \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Unified atomic with address only}
\label{tab:te_datadx0y6}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
110: Unified atomic or split atomic address\newline
(other codes other packet formats)\\
\hline
\textbf{subtype} & 3 & Atomic sub-type\newline
000: Swap\newline
001: ADD\newline
010: AND\newline
011: OR\newline
100: XOR\newline
101: MAX\newline
110: MIN\newline
111: conditional store failure\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes\\
\hline
\textbf{diff} & 1 & 0: Full address \newline
1: Differential address\\
\hline
\textbf{address} & \textit{daddress\_width\_p} & Address, aligned and encoded as per size \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Unified atomic with data only}
\label{tab:te_datadx0y7}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
110: Unified atomic or split atomic address\newline
(other codes other packet formats)\\
\hline
\textbf{subtype} & 3 & Atomic sub-type\newline
000: Swap\newline
001: ADD\newline
010: AND\newline
011: OR\newline
100: XOR\newline
101: MAX\newline
110: MIN\newline
111: reserved\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes\\
\hline
\textbf{diff} & 1 or 2 & 00: Full data (sync)\newline
01: Compressed data (XOR if 2 bits) \newline
10: reserved \newline
11: Differential data\\
\hline
\textbf{op\_len} & \textbf{size} & Number of bytes of operand is \textbf{op\_len} + 1\\
\hline
\textbf{operand} & 8 * (\textbf{op\_len} + 1) & Operand. Value from rs2 before operator applied\\
\hline
\textbf{data} & \textit{data\_width\_p} &
Data\\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Split atomic with operand only}
\label{tab:te_datadx0y8}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
110: Unified atomic or split atomic address\newline
(other codes other packet formats)\\
\hline
\textbf{subtype} & 3 & Atomic sub-type\newline
000: Swap\newline
001: ADD\newline
010: AND\newline
011: OR\newline
100: XOR\newline
101: MAX\newline
110: MIN\newline
111: reserved\\
\hline
\textbf{size} & max(1, clog2(clog2( \textit{data\_width\_p}/8 + 1)) & Transfer size is 2\textsuperscript{\textbf{size}} bytes bytes\\
\hline
\textbf{index} & \textit{index\_length\_p} & Transfer index\\
\hline
\textbf{diff} & 1 or 2 & 00: Full address and data (sync)\newline
01: Differential address, XOR-compressed data\newline
10: Differential address, full data\newline
11: Differential address, differential data\\
\hline
\textbf{op\_len} & \textbf{size} & Number of bytes of operand is \textbf{op\_len} + 1\\
\hline
\textbf{operand} & 8 * (\textbf{op\_len} + 1) & Operand. Value from rs2 before operator applied\\
\hline
\textbf{address} & \textit{daddress\_width\_p} &Address, aligned and encoded as per size \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Split atomic load data only}
\label{tab:te_datadx0y9}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
111: Split atomic data\newline
other codes other packet formats\\
\hline
\textbf{index} & \textit{index\_length\_p} & Transfer index\\
\hline
\textbf{resp} & 2 & 00: Error (no data)\newline
01: XOR-compressed data\newline
10: full data\newline
11: differential data\\
\hline
\textbf{data\_len} & \textbf{size} & Number of bytes of operand is \textit{data\_len + 1}. Not included if resp indicates an error (sign-extend \textbf{resp} MSB)\\
\hline
\textbf{data} & 8 * (\textbf{data\_len} + 1) & Data. Not included if resp indicates an error (sign-extend \textbf{resp} MSB)\\
\hline
\end{tabulary}
\end{table}
\subsection{size field} \label{sec:atomic-size}
Strictly, \textbf{size} could be just one bit as atomics are currently either 32 or 64 bits.
Defining as per regular loads and stores provisions for future extensions (proprietary or otherwise) that support smaller atomics.
\subsection{diff field} \label{sec:atomic-diff}
See section~\ref{sec:loadstore-diff}.
\subsection{operand field} \label{sec:atomic-operand}
The operand value for the atomic operation. Uncompressed, although upper bytes
that are all the same value do not need to be included in the packet; the decoder can recreate the
full-width value by sign extending from the most significant received bit; see section \ref{sec:atomic-datalen}.
\subsection{data\_len and op\_len fields} \label{sec:atomic-datalen}
Width of \textbf{data and \textbf{operand} fields respectively.
See section \ref{sec:loadstore-datalen}.}
\FloatBarrier
\section{CSR} \label{sec:data-csr}
\begin{table}[htp]
\centering
\caption{Packet format for Unified CSR, with address, data and operand}
\label{tab:te_datadx0y10}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
101: CSR\newline
(other codes other packet formats)\\
\hline
\textbf{subtype} & 2 & CSR sub-type\newline
00: RW\newline
01: RS\newline
10: RC\newline
11: reserved\\
\hline
\textbf{diff} & 1 or 2 & 00: Full data (sync)\newline
01: Compressed data (XOR if 2 bits) \newline
10: reserved \newline
11: Differential data\\
\hline
\textbf{data\_len} & 2 or 3 & Number of bytes of data is \textbf{data\_len} + 1\\
\hline
\textbf{data} & 8 * (\textbf{data\_len} + 1) & Data\\
\hline
\textbf{addr\_msbs} & 6 & Address[11:6]\\
\hline
\textbf{op\_len} & 2 or 3 & Number of bytes of operand is \textbf{op\_len} + 1\\
\hline
\textbf{operand} & 8 * (\textbf{op\_len} + 1) & Operand. Value from rs1 before operator applied\\
\hline
\textbf{addr\_lsbs} & 6 & Address[5:0] \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Unified CSR, with address and read-only data (as determined by addr[11:10] = 11)}
\label{tab:te_datadx0y11}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
101: CSR\newline
other codes other packet formats\\
\hline
\textbf{subtype} & 2 & CSR sub-type\newline
00: RW\newline
01: RS\newline
10: RC\newline
11: reserved\\
\hline
\textbf{diff} & 1 or 2 & 00: Full data (sync)\newline
01: Compressed data (XOR if 2 bits) \newline
10: reserved \newline
11: Differential data\\
\hline
\textbf{data\_len} & 2 or 3 & Number of bytes of data is \textbf{data\_len} + 1\\
\hline
\textbf{data} & 8 * (\textbf{data\_len} + 1) & Data\\
\hline
\textbf{addr\_msbs} & 6 & Address[11:6]\\
\hline
\textbf{addr\_lsbs} & 6 & Address[5:0] \\
\hline
\end{tabulary}
\end{table}
\begin{table}[htp]
\centering
\caption{Packet format for Unified CSR, with address only}
\label{tab:te_datadx0y12}
\begin{tabulary}{\textwidth}{|l|p{38mm}|p{92mm}|}
\hline
{\bf Field name} & {\bf Bits} & {\bf Description} \\
\hline
\textbf{format} & 3 & Transaction type\newline
101: CSR\newline
other codes other packet formats\\
\hline
\textbf{subtype} & 3 & CSR sub-type\newline
00: RW\newline
01: RS\newline
10: RC\newline
11: reserved\\
\hline
\textbf{diff} & 0 or 1 & 0: Full address\newline
1: Differential address\\
\hline
\textbf{addr\_msbs} & 6 & Address[11:6]\\
\hline
\textbf{addr\_lsbs} & 6 & Address[5:0] \\
\hline
\end{tabulary}
\end{table}
\subsection{diff field} \label{sec:csr-diff}
See section~\ref{sec:loadstore-diff}.
\subsection{operand field} \label{sec:csr-operand}
See section~\ref{sec:atomic-operand}.
\subsection{data\_len and op\_len fields} \label{sec:csr-datalen}
2 bits wide if hart has 32-bit CSRs, 3 bits if 64-bit. Width of
\textbf{data} and \textbf{operand} fields respectively. See section \ref{sec:loadstore-datalen}.
\subsection{addr fields} \label{sec:csr-addr}
The address is split into two parts, with the 6 LSBs output last as these are more likely to compress away.