update
[libreriscv.git] / pinmux / pinmux_chennai_2018.tex
1 \documentclass[slidestop]{beamer}
2 \usepackage{beamerthemesplit}
3 \usepackage{graphics}
4 \usepackage{pstricks}
5
6 \title{Pin Multiplexer}
7 \author{Rishabh Jain}
8 \author{Luke Kenneth Casson Leighton}
9
10
11 \begin{document}
12
13 \frame{
14 \begin{center}
15 \huge{Pin Multiplexer}\\
16 \vspace{32pt}
17 \Large{Auto-generating documentation, code \\
18 and resources for a Pinmux}\\
19 \vspace{16pt}
20 \Large{Saving time and money for SoC / EC designers\\
21 in the RISC-V Ecosystem and beyond}\\
22 \vspace{24pt}
23 \Large{[proposed for] Chennai 9th RISC-V Workshop}\\
24 \vspace{16pt}
25 \large{\today}
26 \end{center}
27 }
28
29
30 \frame{\frametitle{Credits and Acknowledgements}
31
32 \begin{itemize}
33 \item TODO\vspace{10pt}
34 \end{itemize}
35 }
36
37
38 \frame{\frametitle{Glossary}
39
40 \begin{itemize}
41 \item GPIO: general-purpose reconfigureable I/O (Input/Output).
42 \item Pin: an I/O pad. May be driven (input) or may drive (output).
43 \item FN: term for a single-wire "function", such as UART\_TX,
44 I2C\_SDA, SDMMC\_D0 etc. may be an input, output or both
45 (bi-directional case: two wires are {\bf always} allocated, one
46 for input to the function and one for output from the function).
47 \item Bus: a group of bi-directional functions (SDMMC D0 to D3)
48 where the direction is ganged and {\bf under the Bus's control}
49 \item Input Priority Muxer: a multiplexer with N selector
50 wires and N associated inputs. The lowest (highest?) indexed
51 "selector" enabled results in its
52 input being routed to the output.
53 \item Output Muxer: a many-to-one "redirector" where any one
54 output "routed" to the input, based on a selector "address".
55 \end{itemize}
56 }
57
58
59 \frame{\frametitle{Why, How and What is a Pinmux?}
60
61 \begin{itemize}
62 \item Why? To save cost, increase yield, and to target multiple
63 markets with the same design, thereby increasing uptake
64 and consequently taking advantage of volume pricing.\vspace{4pt}
65 \\
66 Summary: it's all about making more money!\vspace{4pt}
67 \item How? By multiplexing many more functions (100 to 1,200) than there
68 are actual available pins (48 to 500), the required chip package
69 is far less costly and the chip more desirable\vspace{4pt}
70 \item What? A many-to-many dynamically-configureable router of
71 I/O functions to I/O pins\vspace{4pt}
72 \item \bf{Note: actual muxing is deceptively simple, but like
73 a DRAM cell it's actually about the ancillaries / extras}
74 \end{itemize}
75 }
76
77
78 \frame{\frametitle{What options are available (at time of writing)?}
79
80 \begin{itemize}
81 \item Commercial licensed. Cost: unknown. Flexibility: unknown.
82 Language: unknown. Capability for auto-generation of Docs:
83 unknown. Capability for auto-generation of ancillary
84 resources: unknown.
85 Suitability for wide range of systems: unknown.
86 \vspace{4pt}
87 \\
88 Suitability for saving RISC-V ecosystem money: { \bf NONE }\\
89 Suitability for collaboration: {\bf ZERO} (i.e. don't bother)
90 \item SiFive IOF. License: Good! Flexibility: not so good.
91 Language: chisel3. Capability for auto-generation of Docs:
92 none. Capability for auto-generation of ancillary resources: partial.
93 Suitability for wide range of systems: not so good.
94 \vspace{4pt}
95 \\
96 Suitability for saving RISC-V ecosystem money: { \bf Low }\\
97 Suitability for collaboration: {\bf GOOD} (but: written in Chisel3)
98 \item \bf{Summary: NO suitable Libre-licensed pinmux code exists}
99
100 \end{itemize}
101 }
102
103
104 \frame{\frametitle{Associated Extras}
105
106 \begin{itemize}
107 \item Design Specification (what markets to target)
108 \item Scenario analysis ({\bf whether} the chip will fit "markets")
109 \item Documentation: Summary sheet, Technical Reference Manual.
110 \item Test suites
111 \item Control Interface (AXI4 / Wishbone / TileLink / other)
112 \item Simulation
113 \item Linux kernel drivers, DTB, libopencm3, Arduino libraries etc.
114 \end{itemize}
115 Example context:
116 \begin{itemize}
117 \item Shakti M-Class has 160 pins with a 99.5\% full 4-way mux
118 \item Almost 640-way routing, 6 "scenarios" (7th TBD),
119 100+ page Manual needed,
120 \bf{17,500 lines of auto-generated code}
121 \end{itemize}
122 }
123
124
125 \frame{
126 \vspace{30pt}
127 \begin{center}
128 {\Huge
129 ALL of these\vspace{20pt}\\
130 can be\vspace{20pt}\\
131 auto-generated\vspace{30pt}
132 }
133 \\
134 (from the Design Specification, after Scenario Analysis)
135 \end{center}
136
137 }
138
139
140 \frame{\frametitle{Example: 7 banks, 4-way mux, 160 pins}
141 \begin{center}
142 \includegraphics[height=1.5in]{example_pinmux.jpg}\\
143 7 "banks" with separate VCC. Each no more than 32 bits
144 \end{center}
145 \begin{itemize}
146 \item { \bf 17,500 lines of auto-generated HDL (and climbing)}
147 \item { \bf 12,500 lines of auto-generated Summary/Analysis}
148 \item Technical Reference Manual expected to be 100+ pages
149 \end{itemize}
150 }
151
152
153 \frame{\frametitle{Reduce workload, reduce duplication, reduce risk and cost}
154
155 \begin{itemize}
156 \item Auto-generate everything: documentation, code, libraries etc.
157 \vspace{10pt}
158 \item Standardise: similar to PLIC, propose GPIO and Pinmux\\
159 saves engineering effort, design effort and much more
160 \vspace{10pt}
161 \item Standardise format of configuration registers:
162 saves code duplication effort (multiple software environments)
163 \vspace{10pt}
164 \item Add support for multiple code formats: Chisel3 (SiFive IOF),
165 BSV (Bluespec), Verilog, VHDL, MyHDL.
166 \vspace{10pt}
167 \item Multiple auto-generated code-formats permits cross-validation:\\
168 auto-generated test suite in one HDL can validate a muxer
169 generated for a different target HDL.
170 \vspace{10pt}
171 \end{itemize}
172 }
173
174
175 \frame{\frametitle{Design Spec and Scenario Analysis}
176
177 \begin{itemize}
178 \item Analyse the target markets (scenarios) that the chip will sell in\\
179 (multiple markets increases sales volume, reduces chip cost)
180 \vspace{4pt}
181 \item Scenarios represent target markets: ICs to be connected\\
182 (GPS, NAND IC, WIFI etc. May require prototype schematics
183 drawn up, or client-supplied schematics analysed).
184 \vspace{4pt}
185 \item Create a formal (python-based) specification for the pinmux
186 \vspace{4pt}
187 \item Add scenarios (in python), check that they meet requirements\\
188 { \bf (before spending money on hardware engineers!) }
189 \vspace{4pt}
190 \item Analyse the scenarios: if pins are missing, alter and repeat.\\
191 \vspace{4pt}
192 \item Eventually the pinmux meets all requirements...\\
193 { \bf without spending USD \$5-50m to find out it doesn't!}
194 \end{itemize}
195 }
196
197
198
199 \frame{\frametitle{Muxer cases to handle (One/Many to One/Many) etc.}
200
201 \begin{itemize}
202 \item One FN outputs to Many Pins: no problem\\
203 (weird configuration by end-user, but no damage to ASIC)
204 \item One Pin to Many FN inputs: no problem\\
205 (weird configuration by end-user, but no damage to ASIC)
206 \item Many Pins to One FN input: {\bf Priority Mux needed}\\
207 No priority mux: Pin1 = HI, Pin0 = LO, ASIC is damaged
208 \item Many FN outputs simultaneously to one Pin: {\bf does not occur}\\
209 (not desirable and not possible, as part of the pinmux design)
210 \item Some FNs (I2C\_SDA, SD\_D0..3) are I/O Buses\\
211 Bi-directional control of the Pin must be handed to the
212 FN
213 \item Nice to have: Bus sets pintype, signal strength etc.\\
214 e.g. selecting SD/MMC doesn't need manual pin-config.\\
215 \bf{caveat: get that wrong and the ASIC can't be sold}
216 \end{itemize}
217 }
218
219
220 \frame{\frametitle{Pin Configuration, input and output}
221
222 In/out: {\bf Note: these all require multiplexing }
223 \begin{itemize}
224 \item Output-Enable (aka Input disable): switches pad to In or Out
225 \item Output (actually an input wire controlling pin's level, HI/LO)
226 \item Input (actually an output wire set based on pin's driven level)
227 \end{itemize}
228 Characteristics: {\bf Note: these do not require multiplexing }
229 \begin{itemize}
230 \item Output current level: 10mA / 20mA / 30mA / 40mA
231 \item Input hysteresis: low / middle / high. Stops signal noise
232 \item Pin characteristics: CMOS Push-Push / Open-Drain
233 \item Pull-up enable: built-in 10k (50k?) resistor
234 \item Pull-down enable: built-in 10k (50k?) resistor
235 \item Muxing and IRQ Edge-detection not part of the I/O pin
236 \item Other? (impedance? not normally part of commercial pinmux)
237 \end{itemize}
238 }
239
240
241 \frame{\frametitle{Standard GPIO 4-way in/out Mux and I/O pad}
242 \begin{center}
243 \includegraphics[height=2.5in]{../shakti/m_class/mygpiomux.jpg}\\
244 {\bf 4-in, 4-out, pullup/down, hysteresis, edge-detection (EINT)}
245 \end{center}
246 }
247
248 \frame{\frametitle{Separating Pin Configuration, input and output}
249
250 \begin{itemize}
251 \item Standard Mux design {\bf cannot deal with many-to-one inputs}\\
252 (SiFive IOF source code from Freedom U310 cannot, either)
253 \vspace{4pt}
254 \item I/O pad configuration conflated with In-Muxer conflated with
255 Out-Muxer conflated with GPIO conflated with EINT.
256 \vspace{4pt}
257 \end{itemize}
258 {\bf IMPORTANT to separate all of these out:
259 \vspace{4pt}}
260 \begin{itemize}
261 \item EINTs to be totally separate FNs. managed by RISC-V PLIC\\
262 (If every GPIO was an EINT it would mean 100+ IRQs)
263 \vspace{4pt}
264 \item GPIO In/Out/Direction treated just like any other FN\\
265 (but happen to have AXI4 - or other - memory-mapping)
266 \vspace{4pt}
267 \item Pad configuration separated and given one-to-one Registers\\
268 (SRAMs set by AXI4 to control mux, pullup, current etc.)
269 \end{itemize}
270 }
271
272 \frame{\frametitle{Register-to-pad "control" settings}
273 \begin{center}
274 \includegraphics[height=2.5in]{reg_gpio_cap_ctrl.jpg}\\
275 {\bf pullup/down, hysteresis, current, edge-detection}
276 \end{center}
277 }
278
279
280 \frame{\frametitle{GPIO (only): Simplified I/O pad Diagram (FN only)}
281 \begin{center}
282 \includegraphics[height=2.5in]{reg_gpio_pinblock.jpg}\\
283 {\bf 3 wires: IN, OUT, OUTEN (also = !INEN) }
284 \end{center}
285 }
286
287
288 \frame{\frametitle{Output Muxer (very simple)}
289 \begin{center}
290 \includegraphics[height=1.1in]{reg_gpio_out_mux.jpg}\\
291 {\bf Ouput Muxer using 2-bit address selection}\\
292 \end{center}
293 \begin{itemize}
294 \item Very straightforward (deceptively so, like SRAM cells)
295 \item Used in both OUT routing and Direction-control routing\\
296 (same address for each, connected to same FNs)
297 \item More complex pinmux will have 3-bit addressing (8 FNs)\\
298 (Note: not all outputs will be connected, depends on pinmux)
299 \end{itemize}
300 }
301
302
303 \frame{\frametitle{In/Out muxing, direction control: GPIO just a FN}
304 \begin{center}
305 \includegraphics[height=2.5in]{reg_gpio_fn_ctrl.jpg}\\
306 {\bf Note: function can control I/O direction (bus)}
307 \end{center}
308 }
309
310
311 \frame{\frametitle{Direction Control: Function not bi-directional (bus)}
312 \begin{center}
313 \includegraphics[height=2.5in]{reg_gpio_fn_ctrl2.jpg}\\
314 Note: Function {\bf does not} control I/O direction
315 \end{center}
316 }
317
318
319 \frame{\frametitle{Output (and OUTEN) Wiring. 2 pins, 2 GPIO, 2 Fns}
320 \begin{center}
321 \includegraphics[height=2.5in]{reg_gpio_out_wiring.jpg}\\
322 {\bf Reg0 for Pin0, Reg1 for Pin1, Output and OUTEN same mux }
323 \end{center}
324 }
325
326
327 \frame{\frametitle{Input Selection and Priority Muxing}
328 \begin{center}
329 \includegraphics[height=0.75in]{reg_gpio_comparator.jpg}\\
330 {\bf Muxer enables input selection}\\
331 \vspace{10pt}
332 \includegraphics[height=1.25in]{reg_gpio_in_prioritymux.jpg}\\
333 {\bf However multiple inputs must be prioritised }
334 \end{center}
335 }
336
337
338 \frame{\frametitle{Input Priority-Mux Wiring: very different from Out-Mux}
339 \begin{center}
340 \includegraphics[height=2.5in]{reg_gpio_in_wiring.jpg}\\
341 {\bf Pin Mux selection vals NOT same as FN selection vals}
342 \end{center}
343 }
344
345
346 \frame{\frametitle{Input Priority-Mux Wiring}
347
348 \begin{itemize}
349 \item In-Muxer selection number (0,1,2,3) obviously has to match
350 with Out-Muxer order (otherwise a bi-directional FN
351 needs different Mux-register settings for
352 selecting either IN or OUT)
353 \vspace{6pt}
354 \item Priority-mux selection values do not actually matter,
355 and have nothing to do with the actual Muxer settings.
356 \vspace{6pt}
357 \item GPIO FN's input muxer is nothing more than an AND gate\\
358 (you never route more than one pin to one GPIO)
359 \vspace{6pt}
360 \item Any other FN with only 1:1 on its IN also just an AND gate \\
361 (this just always happens to be true for GPIO)
362 \vspace{6pt}
363 \item Not all FNs have input capability: clearly they will not
364 be included in the In-Muxing.
365 \end{itemize}
366 }
367
368
369 \frame{\frametitle{Summary}
370
371 \begin{itemize}
372 \item Value of Libre/Open pimux dramatically underestimated\\
373 (and does not presently exist: SiFive's IOF not suitable as-is)\\
374 {\bf Only current option: license a commercial Pinmux }
375 \item Actual muxing (like SRAM cells) is deceptively simple
376 \item Actual pinmuxes are enormous: auto-generation essential
377 \item HDLs completely unsuited to auto-generation task\\
378 (TRM, docs): {\bf Modern OO language needed i.e. python}
379 \item Scenario Analysis / Verification and auto-generation of
380 different HDLs far easier in a Modern OO language\\
381 (better libraries, more developers)
382 \item Standardisation for RISC-V saves implementors from huge
383 duplication cost (HDL, firmware, docs, maintenance)
384 \item { \bf Ultimately it's about saving money and reducing risk }
385 \end{itemize}
386 }
387
388
389 \frame{
390 \begin{center}
391 {\Huge The end\vspace{20pt}\\
392 Thank you\vspace{20pt}\\
393 Questions?\vspace{20pt}
394 }
395 \end{center}
396
397 \begin{itemize}
398 \item http://libre-riscv.org/shakti/m\_class/pinmux/
399 \end{itemize}
400 }
401
402
403 \end{document}