add extra slide
[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{Associated Extras}
79
80 \begin{itemize}
81 \item Design Specification
82 \item Scenario analysis (whether the chip will fit "markets")
83 \item Documentation: Summary sheet, Technical Reference Manual.
84 \item Test suites
85 \item Control Interface (AXI4 / Wishbone / TileLink / other)
86 \item Simulation
87 \item Linux kernel drivers, DTB, libopencm3, Arduino libraries etc.
88 \end{itemize}
89 Example context:
90 \begin{itemize}
91 \item Shakti M-Class has 160 pins with a 99.5\% full 4-way mux
92 \item Almost 640-way routing, 6 "scenarios" (7th TBD),
93 100+ page Manual needed,
94 \bf{17,500 lines of auto-generated code}
95 \end{itemize}
96 }
97
98
99 \frame{
100 \vspace{30pt}
101 \begin{center}
102 {\Huge
103 ALL of these\vspace{20pt}\\
104 can be\vspace{20pt}\\
105 auto-generated\vspace{30pt}
106 }
107 \\
108 (from the Design Specification, after Scenario Analysis)
109 \end{center}
110
111 }
112
113 \frame{\frametitle{Reduce workload, reduce duplication, reduce risk and cost}
114
115 \begin{itemize}
116 \item Auto-generate everything: documentation, code, libraries etc.
117 \vspace{10pt}
118 \item Standardise: similar to PLIC, propose GPIO and Pinmux\\
119 saves engineering effort, design effort and much more
120 \vspace{10pt}
121 \item Standardise format of configuration registers:
122 saves code duplication effort (multiple software environments)
123 \vspace{10pt}
124 \item Add support for multiple code formats: Chisel3 (SiFive IOF),
125 BSV (Bluespec), Verilog, VHDL, MyHDL.
126 \vspace{10pt}
127 \item Multiple auto-generated code-formats permits cross-validation:\\
128 auto-generated test suite in one HDL can validate a muxer
129 generated for a different target HDL.
130 \vspace{10pt}
131 \end{itemize}
132 }
133
134
135 \frame{\frametitle{Design Spec and Scenario Analysis}
136
137 \begin{itemize}
138 \item Analyse the target markets that the chip will sell in\\
139 (multiple markets increases sales volume, reduces chip cost)
140 \vspace{4pt}
141 \item Create a formal (python-based) specification for the pinmux
142 \vspace{4pt}
143 \item Add scenarios then check that they meet the requirements\\
144 { \bf (before spending money on hardware engineers!) }
145 \vspace{4pt}
146 \item Scenarios represent target markets: ICs to be connected\\
147 (GPS, NAND IC, WIFI etc. May require draft schematics
148 drawn up, or client-supplied schematics analysed).
149 \vspace{4pt}
150 \item Analyse the scenarios: if pins are missing, alter and repeat.\\
151 \vspace{4pt}
152 \item Eventually the pinmux meets all requirements...\\
153 { \bf without spending USD \$5-50m to find out it doesn't!}
154 \end{itemize}
155 }
156
157
158 \frame{\frametitle{Muxer cases to handle (One/Many to One/Many) etc.}
159
160 \begin{itemize}
161 \item One FN outputs to Many Pins: no problem\\
162 (weird configuration by end-user, but no damage to ASIC)
163 \item One Pin to Many FN inputs: no problem\\
164 (weird configuration by end-user, but no damage to ASIC)
165 \item Many Pins to One FN input: {\bf Priority Mux needed}\\
166 No priority mux: Pin1 = HI, Pin0 = LO, ASIC is damaged
167 \item Many FN outputs simultaneously to one Pin: {\bf does not occur}\\
168 (not desirable and not possible, as part of the pinmux design)
169 \item Some FNs (I2C\_SDA, SD\_D0..3) are I/O Buses\\
170 Bi-directional control of the Pin must be handed to the
171 FN
172 \item Nice to have: Bus sets pintype, signal strength etc.\\
173 e.g. selecting SD/MMC doesn't need manual pin-config.\\
174 \bf{caveat: get that wrong and the ASIC can't be sold}
175 \end{itemize}
176 }
177
178
179 \frame{\frametitle{Pin Configuration, input and output}
180
181 In/out: {\bf Note: these all require multiplexing }
182 \begin{itemize}
183 \item Output-Enable (aka Input disable): switches pad to In or Out
184 \item Output (actually an input wire controlling pin's level, HI/LO)
185 \item Input (actually an output wire set based on pin's driven level)
186 \end{itemize}
187 Characteristics: {\bf Note: these do not require multiplexing }
188 \begin{itemize}
189 \item Output current level: 10mA / 20mA / 30mA / 40mA
190 \item Input hysteresis: low / middle / high. Stops signal noise
191 \item Pin characteristics: CMOS Push-Push / Open-Drain
192 \item Pull-up enable: built-in 10k (50k?) resistor
193 \item Pull-down enable: built-in 10k (50k?) resistor
194 \item Muxing and IRQ Edge-detection not part of the I/O pin
195 \end{itemize}
196 }
197
198
199 \frame{\frametitle{Standard GPIO 4-way in/out Mux and I/O pad}
200 \begin{center}
201 \includegraphics[height=2.5in]{../shakti/m_class/mygpiomux.jpg}\\
202 {\bf 4-in, 4-out, pullup/down, hysteresis, edge-detection (EINT)}
203 \end{center}
204 }
205
206 \frame{\frametitle{Separating Pin Configuration, input and output}
207
208 \begin{itemize}
209 \item Standard Mux design {\bf cannot deal with many-to-one inputs}\\
210 (SiFive IOF source code from Freedom U310 cannot, either)
211 \vspace{4pt}
212 \item I/O pad configuration conflated with In-Muxer conflated with
213 Out-Muxer conflated with GPIO conflated with EINT.
214 \vspace{4pt}
215 \end{itemize}
216 {\bf IMPORTANT to separate all of these out:
217 \vspace{4pt}}
218 \begin{itemize}
219 \item EINTs to be totally separate FNs. managed by RISC-V PLIC\\
220 (If every GPIO was an EINT it would mean 100+ IRQs)
221 \vspace{4pt}
222 \item GPIO In/Out/Direction treated just like any other FN\\
223 (but happen to have AXI4 - or other - memory-mapping)
224 \vspace{4pt}
225 \item Pad configuration separated and given one-to-one Registers\\
226 (SRAMs set by AXI4 to control mux, pullup, current etc.)
227 \end{itemize}
228 }
229
230 \frame{\frametitle{Register-to-pad "control" settings}
231 \begin{center}
232 \includegraphics[height=2.5in]{reg_gpio_cap_ctrl.jpg}\\
233 {\bf pullup/down, hysteresis, current, edge-detection}
234 \end{center}
235 }
236
237
238 \frame{\frametitle{GPIO (only): Simplified I/O pad Diagram (FN only)}
239 \begin{center}
240 \includegraphics[height=2.5in]{reg_gpio_pinblock.jpg}\\
241 {\bf 3 wires: IN, OUT, OUTEN (also = !INEN) }
242 \end{center}
243 }
244
245
246 \frame{\frametitle{Output Muxer (very simple)}
247 \begin{center}
248 \includegraphics[height=1.1in]{reg_gpio_out_mux.jpg}\\
249 {\bf Ouput Muxer using 2-bit address selection}\\
250 \end{center}
251 \begin{itemize}
252 \item Very straightforward (deceptively so, like SRAM cells)
253 \item Used in both OUT routing and Direction-control routing\\
254 (same address for each, connected to same FNs)
255 \item More complex pinmux will have 3-bit addressing (8 FNs)\\
256 (Note: not all outputs will be connected, depends on pinmux)
257 \end{itemize}
258 }
259
260
261 \frame{\frametitle{In/Out muxing, direction control: GPIO just a FN}
262 \begin{center}
263 \includegraphics[height=2.5in]{reg_gpio_fn_ctrl.jpg}\\
264 {\bf Note: function can control I/O direction (bus)}
265 \end{center}
266 }
267
268
269 \frame{\frametitle{Direction Control: Function not bi-directional (bus)}
270 \begin{center}
271 \includegraphics[height=2.5in]{reg_gpio_fn_ctrl2.jpg}\\
272 Note: Function {\bf does not} control I/O direction
273 \end{center}
274 }
275
276
277 \frame{\frametitle{Output (and OUTEN) Wiring. 2 pins, 2 GPIO, 2 Fns}
278 \begin{center}
279 \includegraphics[height=2.5in]{reg_gpio_out_wiring.jpg}\\
280 {\bf Reg0 for Pin0, Reg1 for Pin1, Output and OUTEN same mux }
281 \end{center}
282 }
283
284
285 \frame{\frametitle{Input Selection and Priority Muxing}
286 \begin{center}
287 \includegraphics[height=0.75in]{reg_gpio_comparator.jpg}\\
288 {\bf Muxer enables input selection}\\
289 \vspace{10pt}
290 \includegraphics[height=1.25in]{reg_gpio_in_prioritymux.jpg}\\
291 {\bf However multiple inputs must be prioritised }
292 \end{center}
293 }
294
295
296 \frame{\frametitle{Input Priority-Mux Wiring: very different from Out-Mux}
297 \begin{center}
298 \includegraphics[height=2.5in]{reg_gpio_in_wiring.jpg}\\
299 {\bf Pin Mux selection vals NOT same as FN selection vals}
300 \end{center}
301 }
302
303
304 \frame{\frametitle{Input Priority-Mux Wiring}
305
306 \begin{itemize}
307 \item In-Muxer selection number (0,1,2,3) obviously has to match
308 with Out-Muxer order (otherwise a bi-directional FN
309 needs different Mux-register settings for
310 selecting either IN or OUT)
311 \vspace{6pt}
312 \item Priority-mux selection values do not actually matter,
313 and have nothing to do with the actual Muxer settings.
314 \vspace{6pt}
315 \item GPIO FN's input muxer is nothing more than an AND gate\\
316 (you never route more than one pin to one GPIO)
317 \vspace{6pt}
318 \item Any other FN with only 1:1 In also an AND gate \\
319 (this just always happens to be true for GPIO)
320 \vspace{6pt}
321 \item Not all FNs have input capability: clearly they will not
322 be included in the In-Muxing.
323 \end{itemize}
324 }
325
326
327 \frame{\frametitle{Summary}
328
329 \begin{itemize}
330 \item TODO
331 \end{itemize}
332 }
333
334
335 \frame{
336 \begin{center}
337 {\Huge The end\vspace{20pt}\\
338 Thank you\vspace{20pt}\\
339 Questions?\vspace{20pt}
340 }
341 \end{center}
342
343 \begin{itemize}
344 \item http://libre-riscv.org/shakti/m\_class/pinmux/
345 \end{itemize}
346 }
347
348
349 \end{document}