forked from riscv/riscv-debug-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebugger_implementation.tex
587 lines (499 loc) · 20.3 KB
/
debugger_implementation.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
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
\chapter{Debugger Implementation}
This section details how an external debugger might use the described debug
interface to perform some common operations on RISC-V cores using the JTAG DTM
described in Section~\ref{sec:jtagdtm}.
All these examples assume a 32-bit core but it should be easy to adapt the
examples to 64- or 128-bit cores.
To keep the examples readable, they all assume that everything succeeds, and
that they complete faster than the debugger can perform the next access. This
will be the case in a typical JTAG setup. However, the debugger must always
check the sticky error status bits after performing a sequence of actions. If
it sees any that are set, then it should attempt the same actions again,
possibly while adding in some delay, or explicit checks for status bits.
\section{Debug Module Interface Access} \label{dmiaccess}
To read an arbitrary Debug Module register, select \RdtmDmi, and scan in a value
with \FdtmDmiOp set to 1, and \FdmSbaddressZeroAddress set to the desired register address. In
Update-DR the operation will start, and in Capture-DR its results will be
captured into \FdmSbdataZeroData. If the operation didn't complete in time, \FdtmDmiOp will be 3
and the value in \FdmSbdataZeroData must be ignored. The busy condition must be cleared by
writing \FdtmDtmcsDmireset in \RdtmDtmcs, and then the second scan scan must be performed again.
This process must be repeated until \FdtmDmiOp returns 0.
In later operations the debugger should allow for more time between Capture-DR and
Update-DR.
To write an arbitrary Debug Bus register, select \RdtmDmi, and scan in a value
with \FdtmDmiOp set to 2, and \FdmSbaddressZeroAddress and \FdmSbdataZeroData set to the desired register
address and data respectively. From then on everything happens exactly as with
a read, except that a write is performed instead of the read.
It should almost never be necessary to scan IR, avoiding a big part of the
inefficiency in typical JTAG use.
\section{Checking for Halted Harts}
A user will want to know as quickly as possible when a hart is halted (e.g.\ due
to a breakpoint). To efficiently determine which harts are halted when there
are many harts, the debugger uses the {\tt haltsum} registers. Assuming the
maximum number of harts exist, first it checks \RdmHaltsumThree. For each bit set
there, it writes \Fhartsel, and checks \RdmHaltsumTwo. This process repeats
through \RdmHaltsumOne and \RdmHaltsumZero. Depending on how many harts exist, the
process should start at one of the lower {\tt haltsum} registers.
\section{Halting} \label{deb:halt}
To halt one or more harts, the debugger selects them, sets \FdmDmcontrolHaltreq, and then
waits for \FdmDmstatusAllhalted to indicate the harts are halted. Then it can clear
\FdmDmcontrolHaltreq to 0, or leave it high to catch a hart that resets while halted.
\section{Running}
First, the debugger should restore any registers that it has overwritten.
Then it can let the selected harts run by setting \FdmDmcontrolResumereq. Once
\FdmDmstatusAllresumeack is set, the debugger knows the hart has resumed, and it can
clear \FdmDmcontrolResumereq. Harts might halt very quickly after resuming (e.g.
by hitting a software breakpoint) so the debugger cannot use
\FdmDmstatusAllhalted/\FdmDmstatusAnyhalted to check whether the hart resumed.
\section{Single Step}
Using the hardware single step feature is almost the same as regular running.
The debugger just sets \FcsrDcsrStep in \RcsrDcsr before letting the hart run. The hart
behaves exactly as in the running case, except that interrupts may be disabled
(depending on \FcsrDcsrStepie) and it only fetches and executes a single instruction
before re-entering Debug Mode.
\section{Accessing Registers}
\subsection{Using Abstract Command} \label{deb:abstractreg}
\noindent Read \Szero using abstract command:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmCommand & \FacAccessregisterAarsize$=2$, \FacAccessregisterTransfer, \FacAccessregisterRegno = 0x1008 & Read \Szero \\
\hline
Read & \RdmDataZero & - & Returns value that was in \Szero \\
\hline
\end{tabular}
\medskip
\noindent Write \Rmstatus using abstract command:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmDataZero & new value & \\
\hline
Write & \RdmCommand & \FacAccessregisterAarsize$=2$, \FacAccessregisterTransfer, \FacAccessregisterWrite, \FacAccessregisterRegno = 0x300 & Write \Rmstatus \\
\hline
\end{tabular}
\medskip
\subsection{Using Program Buffer} \label{deb:regprogbuf}
Abstract commands are used to exchange data with GPRs. Using this mechanism, other
registers can be accessed by moving their value into/out of GPRs.
\noindent Write \Rmstatus using program buffer:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt csrw s0, MSTATUS} & \\
\hline
Write & {\tt progbuf1} & {\tt ebreak} & \\
\hline
Write & \RdmDataZero & new value & \\
\hline
Write & \RdmCommand & \FacAccessregisterAarsize$=2$, \FacAccessregisterPostexec, \FacAccessregisterTransfer, \FacAccessregisterWrite, \FacAccessregisterRegno = 0x1008 &
Write \Szero, then execute program buffer \\
\hline
\end{tabular}
\medskip
\noindent Read \Fone using program buffer:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt fmv.x.s s0, f1} & \\
\hline
Write & {\tt progbuf1} & {\tt ebreak} & \\
\hline
Write & \RdmCommand & \FacAccessregisterPostexec & Execute program buffer \\
\hline
Write & \RdmCommand & \FacAccessregisterTransfer, \FacAccessregisterRegno = 0x1008 & read \Szero \\
\hline
Read & \RdmDataZero & - & Returns the value that was in \Fone \\
\hline
\end{tabular}
\medskip
\section{Reading Memory}
\subsection{Using System Bus Access} \label{deb:mrsysbus}
With system bus access, addresses are physical system bus addresses.
\noindent Read a word from memory using system bus access:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmSbcs & \FdmSbcsSbaccess$=2$, \FdmSbcsSbreadonaddr & Setup \\
\hline
Write & \RdmSbaddressZero & address & \\
\hline
Read & \RdmSbdataZero & - & Value read from memory \\
\hline
\end{tabular}
\medskip
\noindent Read block of memory using system bus access:
\begin{tabular}{|r|r|p{13em}|l|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmSbcs & \FdmSbcsSbaccess$=2$, \FdmSbcsSbreadonaddr, \FdmSbcsSbreadondata, \FdmSbcsSbautoincrement &
Turn on autoread and autoincrement \\
\hline
Write & \RdmSbaddressZero & address & Writing address triggers read and increment \\
\hline
Read & \RdmSbdataZero & - & Value read from memory \\
\hline
Read & \RdmSbdataZero & - & Next value read from memory \\
\hline
... & ... & ... & ... \\
\hline
Write & \RdmSbcs & 0 & Disable autoread \\
\hline
Read & \RdmSbdataZero & - & Get last value read from memory. \\
\hline
\end{tabular}
\medskip
\subsection{Using Program Buffer} \label{deb:mrprogbuf}
Through the Program Buffer, the hart performs the memory accesses. Addresses
are physical or virtual (depending on \FcsrDcsrMprven and other system
configuration).
\noindent Read a word from memory using program buffer:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt lw s0, 0(s0)} & \\
\hline
Write & {\tt progbuf1} & {\tt ebreak} & \\
\hline
Write & \RdmDataZero & address & \\
\hline
Write & \RdmCommand & \FacAccessregisterWrite, \FacAccessregisterPostexec, \FacAccessregisterRegno = 0x1008 & Write \Szero, then execute program buffer \\
\hline
Write & \RdmCommand & \FacAccessregisterRegno = 0x1008 & Read \Szero \\
\hline
Read & \RdmDataZero & - & Value read from memory \\
\hline
\end{tabular}
\medskip
\noindent Read block of memory using program buffer:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt lw s1, 0(s0)} & \\
\hline
Write & {\tt progbuf1} & {\tt addi s0, s0, 4} & \\
\hline
Write & {\tt progbuf2} & {\tt ebreak} & \\
\hline
Write & \RdmDataZero & address & \\
\hline
Write & \RdmCommand & \FacAccessregisterWrite, \FacAccessregisterPostexec, \FacAccessregisterRegno = 0x1008 & Write \Szero, then execute program buffer \\
\hline
Write & \RdmCommand & \FacAccessregisterPostexec, \FacAccessregisterRegno = 0x1009 & Read \Sone, then execute program buffer \\
\hline
Write & \RdmAbstractauto & \FdmAbstractautoAutoexecdata[0] & Set \FdmAbstractautoAutoexecdata[0] \\
\hline
Read & \RdmDataZero & - & Get value read from memory, then execute program buffer \\
\hline
Read & \RdmDataZero & - & Get next value read from memory, then execute program buffer \\
\hline
... & ... & ... & ... \\
\hline
Write & \RdmAbstractauto & 0 & Clear \FdmAbstractautoAutoexecdata[0] \\
\hline
Read & \RdmDataZero & - & Get last value read from memory. \\
\hline
\end{tabular}
\medskip
\subsection{Using Abstract Memory Access} \label{deb:mrabstract}
Abstract memory accesses act as if they are performed by the hart, although the
actual implementation may differ.
\noindent Read a word from memory using abstract memory access:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \Rdataone & address & \\
\hline
Write & \RdmCommand & cmdtype=2, \FacAccessmemoryAamsize=2 & \\
\hline
Read & \RdmDataZero & - & Value read from memory \\
\hline
\end{tabular}
\medskip
\noindent Read block of memory using abstract memory access:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmAbstractauto & 1 & Re-execute the command when \RdmDataZero is accessed \\
\hline
Write & \Rdataone & address & \\
\hline
Write & \RdmCommand & cmdtype=2, \FacAccessmemoryAamsize=2, \FacAccessmemoryAampostincrement=1 & \\
\hline
Read & \RdmDataZero & - & Read value, and trigger reading of next address \\
\hline
... & ... & ... & ... \\
\hline
Write & \RdmAbstractauto & 0 & Disable auto-exec \\
\hline
Read & \RdmDataZero & - & Get last value read from memory. \\
\hline
\end{tabular}
\medskip
\section{Writing Memory} \label{writemem}
\subsection{Using System Bus Access} \label{deb:mrsysbus}
With system bus access, addresses are physical system bus addresses.
\noindent Write a word to memory using system bus access:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmSbaddressZero & address & \\
\hline
Write & \RdmSbdataZero & value & \\
\hline
\end{tabular}
\medskip
\noindent Write a block of memory using system bus access:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmSbcs & \FdmSbcsSbaccess$=2$, \FdmSbcsSbautoincrement & Turn on autoincrement \\
\hline
Write & \RdmSbaddressZero & address & \\
\hline
Write & \RdmSbdataZero & value0 & \\
\hline
Write & \RdmSbdataZero & value1 & \\
\hline
... & ... & ... & ... \\
\hline
Write & \RdmSbdataZero & valueN & \\
\hline
\end{tabular}
\medskip
\subsection{Using Program Buffer} \label{deb:mrprogbuf}
Through the Program Buffer, the hart performs the memory accesses. Addresses
are physical or virtual (depending on \FcsrDcsrMprven and other system
configuration).
\noindent Write a word to memory using program buffer:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt sw s1, 0(s0)} & \\
\hline
Write & {\tt progbuf1} & {\tt ebreak} & \\
\hline
Write & \RdmDataZero & address & \\
\hline
Write & \RdmCommand & \FacAccessregisterWrite, \FacAccessregisterRegno = 0x1008 & Write \Szero \\
\hline
Write & \RdmDataZero & value & \\
\hline
Write & \RdmCommand & \FacAccessregisterWrite, \FacAccessregisterPostexec, \FacAccessregisterRegno = 0x1009 & Write \Sone, then execute program buffer \\
\hline
\end{tabular}
\medskip
\noindent Write block of memory using program buffer:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt sw s1, 0(s0)} & \\
\hline
Write & {\tt progbuf1} & {\tt addi s0, s0, 4} & \\
\hline
Write & {\tt progbuf2} & {\tt ebreak} & \\
\hline
Write & \RdmDataZero & address & \\
\hline
Write & \RdmCommand & \FacAccessregisterWrite, \FacAccessregisterRegno = 0x1008 & Write \Szero \\
\hline
Write & \RdmDataZero & value0 & \\
\hline
Write & \RdmCommand & \FacAccessregisterWrite, \FacAccessregisterPostexec, \FacAccessregisterRegno = 0x1009 & Write \Sone, then execute program buffer \\
\hline
Write & \RdmAbstractauto & \FdmAbstractautoAutoexecdata[0] & Set \FdmAbstractautoAutoexecdata[0] \\
\hline
Write & \RdmDataZero & value1 & \\
\hline
... & ... & ... & ... \\
\hline
Write & \RdmDataZero & valueN & \\
\hline
Write & \RdmAbstractauto & 0 & Clear \FdmAbstractautoAutoexecdata[0] \\
\hline
\end{tabular}
\medskip
\subsection{Using Abstract Memory Access} \label{deb:mwabstract}
Abstract memory accesses act as if they are performed by the hart, although the
actual implementation may differ.
\noindent Write a word to memory using abstract memory access:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \Rdataone & address & \\
\hline
Write & \RdmDataZero & value & \\
\hline
Write & \RdmCommand & cmdtype=2, \FacAccessmemoryAamsize=2, write=1 & \\
\hline
\end{tabular}
\medskip
\noindent Write a block of memory using abstract memory access:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \Rdataone & address & \\
\hline
Write & \RdmDataZero & value0 & \\
\hline
Write & \RdmCommand & cmdtype=2, \FacAccessmemoryAamsize=2, write=1, \FacAccessmemoryAampostincrement=1 & \\
\hline
Write & \RdmAbstractauto & 1 & Re-execute the command when \RdmDataZero is accessed \\
\hline
Write & \RdmDataZero & value1 & \\
\hline
Write & \RdmDataZero & value2 & \\
\hline
... & ... & ... & ... \\
\hline
Write & \RdmDataZero & valueN & \\
\hline
Write & \RdmAbstractauto & 0 & Disable auto-exec \\
\hline
\end{tabular}
\medskip
\section{Triggers}
A debugger can use hardware triggers to halt a hart when a certain event
occurs. Below are some examples, but as there is no requirement on the number
of features of the triggers implemented by a hart, these examples might not be
applicable to all implementations. When a debugger wants to set a trigger, it
writes the desired configuration, and then reads back to see if that
configuration is supported.
\noindent Enter Debug Mode just before the instruction at 0x80001234 is
executed, to be used as an instruction breakpoint in ROM:
\begin{tabulary}{\textwidth}{|r|r|L|}
\hline
\RcsrTdataOne & 0x105c & action=1, match=0, m=1, s=1, u=1, execute=1 \\
\hline
\RcsrTdataTwo & 0x80001234 & address \\
\hline
\end{tabulary}
\medskip
\noindent Enter Debug Mode right after the value at 0x80007f80 is read:
\begin{tabulary}{\textwidth}{|r|r|L|}
\hline
\RcsrTdataOne & 0x4159 & timing=1, action=1, match=0, m=1, s=1, u=1, load=1 \\
\hline
\RcsrTdataTwo & 0x80007f80 & address \\
\hline
\end{tabulary}
\medskip
\noindent Enter Debug Mode right before a write to an address between
0x80007c80 and 0x80007cef (inclusive):
\begin{tabulary}{\textwidth}{|r|r|L|}
\hline
\RcsrTdataOne 0 & 0x195a & action=1, chain=1, match=2, m=1, s=1, u=1, store=1 \\
\hline
\RcsrTdataTwo 0 & 0x80007c80 & start address (inclusive) \\
\hline
\RcsrTdataOne 1 & 0x11da & action=1, match=3, m=1, s=1, u=1, store=1 \\
\hline
\RcsrTdataTwo 1 & 0x80007cf0 & end address (exclusive) \\
\hline
\end{tabulary}
\medskip
\noindent Enter Debug Mode right before a write to an address between
0x81230000 and 0x8123ffff (inclusive):
\begin{tabulary}{\textwidth}{|r|r|L|}
\hline
\RcsrTdataOne & 0x10da & action=1, match=1, m=1, s=1, u=1, store=1 \\
\hline
\RcsrTdataTwo & 0x81237fff & 16 bits to match exactly, then 0, then all ones. \\
\hline
\end{tabulary}
\medskip
\noindent Enter Debug Mode right after a read from an address between
0x86753090 and 0x8675309f or between 0x96753090 and 0x9675309f (inclusive):
\begin{tabulary}{\textwidth}{|r|r|L|}
\hline
\RcsrTdataOne 0 & 0x41a59 & timing=1, action=1, chain=1, match=4, m=1, s=1, u=1, load=1 \\
\hline
\RcsrTdataTwo 0 & 0xfff03090 & Mask for low half, then match for low half \\
\hline
\RcsrTdataOne 1 & 0x412d9 & timing=1, action=1, match=5, m=1, s=1, u=1, load=1 \\
\hline
\RcsrTdataTwo 1 & 0xefff8675 & Mask for high half, then match for high half \\
\hline
\end{tabulary}
\medskip
\section{Handling Exceptions}
Generally the debugger can avoid exceptions by being careful with the programs
it writes. Sometimes they are unavoidable though, e.g.\ if the user asks to
access memory or a CSR that is not implemented. A typical debugger will not
know enough about the hardware platform to know what's going to happen, and must attempt
the access to determine the outcome.
When an exception occurs while executing the Program Buffer, \FdmAbstractcsCmderr becomes
set. The debugger can check this field to see whether a program encountered an
exception. If there was an exception, it's left to the debugger to know what
must have caused it.
\section{Quick Access} \label{quickaccess}
There are a variety of instructions to transfer data between GPRs and the {\tt
data} registers. They are either loads/stores or CSR reads/writes. The specific
addresses also vary. This is all specified in \RdmHartinfo. The examples here use
the pseudo-op {\tt transfer dest, src} to represent all these options.
Halt the hart for a minimum amount of time to perform a single memory write:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt transfer arg2, s0} & Save \Szero \\
\hline
Write & {\tt progbuf1} & {\tt transfer s0, arg0} & Read first argument (address) \\
\hline
Write & {\tt progbuf2} & {\tt transfer arg0, s1} & Save \Sone \\
\hline
Write & {\tt progbuf3} & {\tt transfer s1, arg1} & Read second argument (data) \\
\hline
Write & {\tt progbuf4} & {\tt sw s1, 0(s0)} & \\
\hline
Write & {\tt progbuf5} & {\tt transfer s1, arg0} & Restore \Sone \\
\hline
Write & {\tt progbuf6} & {\tt transfer s0, arg2} & Restore \Szero \\
\hline
Write & {\tt progbuf7} & {\tt ebreak} & \\
\hline
Write & \RdmDataZero & address & \\
\hline
Write & {\tt data1} & data & \\
\hline
Write & \RdmCommand & 0x10000000 & Perform quick access \\
\hline
\end{tabular}
This shows an example of setting the \FcsrMcontrolM bit in \RcsrMcontrol to
enable a hardware breakpoint in M-mode.
Similar quick access instructions could have been used previously
to configure the trigger that is being enabled here:
\begin{tabular}{|c|r|p{0.3\textwidth}|p{0.3\textwidth}|}
\hline
Op & Address & Value & Comment \\
\hline
Write & \RdmProgbufZero & {\tt transfer arg0, s0} & Save \Szero \\
\hline
Write & {\tt progbuf1} & {\tt li s0, (1 << 6)} & Form the mask for \FcsrMcontrolM bit \\
\hline
Write & {\tt progbuf2} & {\tt csrrs x0, \RcsrTdataOne, s0} & Apply the mask to \RcsrMcontrol \\
\hline
Write & {\tt progbuf3} & {\tt transfer s0, arg2} & Restore \Szero \\
\hline
Write & {\tt progbuf4} & {\tt ebreak} & \\
\hline
Write & \RdmCommand & 0x10000000 & Perform quick access \\
\hline
\end{tabular}
\medskip