-
Notifications
You must be signed in to change notification settings - Fork 0
/
programmer_model.tex
275 lines (223 loc) · 6.66 KB
/
programmer_model.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
\section{\proto Programmer's Model}
\label{sec:programmer}
This section documents the \bus and \proto MMIO interface used in the M3
system.
\subsection{Accessing \proto Registers [simple method]}
\label{prog:proto-registers-simple}
The \proto registers are mapped directly into the MMIO address space. Since
\proto registers are only 24~bits wide, the top 8~bits of data are always
RZWI.
\subsubsection{\proto Registers}
\label{prog:mmap:proto-registers-simple}
\begin{tabular}{p{9cm} c}
\vspace{-4em}
These registers map directly to \proto registers. For details of each
register's behavior, see \nameref{cmd:mmap}. Registers below \#192 are
chip-specific registers.
&
\begin{tabular}{r l}
Bits Required & Purpose \\
\hline
\hline
\multicolumn{1}{l}{\em Address} & \\
24 & Memory Map Location \\
8 & \proto Register \\
\multicolumn{1}{l}{\em Data} & \\
24 & Register contents \\
\end{tabular}
\\
\end{tabular}
\begin{figure}[!h]
\begin{centering}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt Address}
\colorbitbox{lightgreen}{8}{0xAX}
\colorbitbox{lightergreen}{16}{0x0001}
\bitbox{8}{\proto Addr}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt ~~~Data}
\colorbitbox{lightgray}{8}{Reserved}
\bitbox{24}{Register contents}
\end{leftwordgroup} \\
\end{bytefield}
\end{centering}
\end{figure}
\subsection{Accessing \proto Registers [efficient method]}
\label{prog:proto-registers-efficient}
\hl{%
This is just a thought. It reduces a lot of masking and shifting on the CPU
side, but requires the HW to access either 2 or 4 registers on each MMIO
operation.
}
As \proto registers are 24~bits wide and machine words are 32~bits wide, we
can map 4~\proto registers onto 3~MMIO words. We define a \emph{bank} of
\proto registers as a set of four \proto registers. Each bank has a
\texttt{TOP}, \texttt{LOW}, and \texttt{HIGH} register.
\begin{quote}
\texttt{BANK0\_T: \{R3[23:16], R2[23:16], R1[23:16], R0[23:16]\}} \\
\texttt{BANK0\_L: \{R1[15:0], R0[15:0]\}} \\
\texttt{BANK0\_H: \{R3[15:0], R2[15:0]\}}
\end{quote}
There are 256~\proto registers, and thus 64~banks.
\subsubsection{\proto Registers}
\label{prog:mmap:proto-registers-efficient}
\begin{tabular}{p{9cm} c}
\vspace{-4em}
These registers map directly to \proto registers. For details of each
register's behavior, see \nameref{cmd:mmap}. Registers below \#192 are
chip-specific registers.
&
\begin{tabular}{r l}
Bits Required & Purpose \\
\hline
\hline
\multicolumn{1}{l}{\em Address} & \\
24 & Memory Map Location \\
6 & Bank ID \\
2 & Top/Low/High \\
\multicolumn{1}{l}{\em Data} & \\
32 & Bank register contents \\
\end{tabular}
\\
\end{tabular}
\begin{figure}[!h]
\begin{centering}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt Address}
\colorbitbox{lightgreen}{8}{0xAX}
\colorbitbox{lightergreen}{16}{0x0002}
\bitbox{6}{Bank ID}
\bitbox{2}{\scriptsize TLH}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt ~~~Data}
\bitbox{32}{Bank register contents}
\end{leftwordgroup} \\
\end{bytefield}
\end{centering}
\end{figure}
\newpage
\subsection{Sending \bus Transactions}
\label{prog:send-txn}
The core issues \bus transactions by emulating incoming \bus transactions. For
example, to issue a DMA transaction to another node (a memory \emph{write}),
the core emulates a memory \emph{read} request from the destination node. This
can be tricky to reason about, especially for writing general-purpose
transactions. System designers are highly encouraged to use the provided
\texttt{mbus.c} library.
\subsubsection{\texttt{CMD0, CMD1, CMD2}}
\label{prog:mmap:cmd}
\begin{tabular}{p{9cm} c}
\vspace{-4em}
These three registers hold the data ``from'' the bus. Bits ``arrive in
order'', that is, the MSB of \texttt{CMD0} is the first \emph{data} bit to
arrive on the bus. The address is not included. The destination
prefix is omitted, and the FUID is specified by the
\nameref{prog:mmap:fuid-len} register.
&
\begin{tabular}{r l}
Bits Required & Purpose \\
\hline
\hline
\multicolumn{1}{l}{\em Address} & \\
32 & Memory Map Location \\
\multicolumn{1}{l}{\em Data} & \\
32 & Payload \\
\end{tabular}
\\
\end{tabular}
\begin{figure}[!h]
\begin{centering}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt Address}
\colorbitbox{lightgreen}{8}{0xAX}
\colorbitbox{lightergreen}{24}{0x000000}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt ~~~Data}
\bitbox{32}{Payload bits 0--31}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt Address}
\colorbitbox{lightgreen}{8}{0xAX}
\colorbitbox{lightergreen}{24}{0x000004}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt ~~~Data}
\bitbox{32}{Payload bits 32--63}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt Address}
\colorbitbox{lightgreen}{8}{0xAX}
\colorbitbox{lightergreen}{24}{0x000008}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt ~~~Data}
\bitbox{32}{Payload bits 64--95}
\end{leftwordgroup} \\
\end{bytefield}
\end{centering}
\end{figure}
\subsubsection{\texttt{FUID\_LEN} [write only]}
\label{prog:mmap:fuid-len}
\begin{tabular}{p{9cm} c}
\vspace{-4em}
This register specifies the FUID of the received message and the length of the
\texttt{MBUS\_CMD} that is valid. A write to this register will issue the
transaction.
&
\begin{tabular}{r l}
Bits Required & Purpose \\
\hline
\hline
\multicolumn{1}{l}{\em Address} & \\
32 & Memory Map Location \\
\multicolumn{1}{l}{\em Data} & \\
4 & FUID \\
2 & Length (in words) \\
\end{tabular}
\\
\end{tabular}
\begin{figure}[!h]
\begin{centering}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt Address}
\colorbitbox{lightgreen}{8}{0xAX}
\colorbitbox{lightergreen}{24}{0x00000C}
\end{leftwordgroup} \\
\end{bytefield}
\begin{bytefield}{32}
\bitheader{0-31} \\
\begin{leftwordgroup}{\tt ~~~Data}
\colorbitbox{lightgray}{26}{Reserved}
\bitbox{2}{Len}
\bitbox{4}{FUID}
\end{leftwordgroup} \\
\end{bytefield}
\end{centering}
\end{figure}
\subsection{Interrupts}
\label{prog:interrupts}
\nameref{cmd:conf-proto-int} controls what events generate interrupts.
Interrupt handlers should read
\hyperref[cmd:status-register-summary]{Reg \#240[23:16]} to determine the
interrupt source.