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