Added note about granuality in the code.
[libreriscv.git] / docs / pinmux.mdwn
1 # Pinmux, IO Pads, and JTAG Boundary scan
2
3 Links:
4
5 * <http://www2.eng.cam.ac.uk/~dmh/4b7/resource/section14.htm>
6 * <https://www10.edacafe.com/book/ASIC/CH02/CH02.7.php>
7 * <https://ftp.libre-soc.org/Pin_Control_Subsystem_Overview.pdf>
8 * <https://bugs.libre-soc.org/show_bug.cgi?id=50>
9 * <https://bugs.libre-soc.org/show_bug.cgi?id=750>
10 * <https://bugs.libre-soc.org/show_bug.cgi?id=762>
11 * <https://git.libre-soc.org/?p=c4m-jtag.git;a=tree;hb=HEAD>
12 * Extra info: [[/docs/pinmux/temp_pinmux_info]]
13
14 Managing IO on an ASIC is nowhere near as simple as on an FPGA.
15 An FPGA has built-in IO Pads, the wires terminate inside an
16 existing silicon block which has been tested for you.
17 In an ASIC, you are going to have to do everything yourself.
18 In an ASIC, a bi-directional IO Pad requires three wires (in, out,
19 out-enable) to be routed right the way from the ASIC, all
20 the way to the IO PAD, where only then does a wire bond connect
21 it to a single external pin.
22
23 Below, therefore is a (simplified) diagram of what is
24 usually contained in an FPGA's bi-directional IO Pad,
25 and consequently this is what you must also provide, and explicitly
26 wire up in your ASIC's HDL.
27
28 [[!img asic_iopad_gen.svg]]
29
30 Designing an ASIC, there is no guarantee that the IO pad is
31 working when manufactured. Worse, the peripheral could be
32 faulty. How can you tell what the cause is? There are two
33 possible faults, but only one symptom ("it dunt wurk").
34 This problem is what JTAG Boundary Scan is designed to solve.
35 JTAG can be operated from an external digital clock,
36 at very low frequencies (5 khz is perfectly acceptable)
37 so there is very little risk of clock skew during that testing.
38
39 Additionally, an SoC is designed to be low cost, to use low cost
40 packaging. ASICs are typically only 32 to 128 pins QFP
41 in the Embedded
42 Controller range, and between 300 to 650 FBGA in the Tablet /
43 Smartphone range, absolute maximum of 19 mm on a side.
44 2 to 3 in square 1,000 pin packages common to Intel desktop processors are
45 absolutely out of the question.
46
47 (*With each pin wire bond smashing
48 into the ASIC using purely heat of impact to melt the wire,
49 cracks in the die can occur. The more times
50 the bonding equipment smashes into the die, the higher the
51 chances of irreversible damage, hence why larger pin packaged
52 ASICs are much more expensive: not because of their manufacturing
53 cost but because far more of them fail due to having been
54 literally hit with a hammer many more times*)
55
56 Yet, the expectation from the market is to be able to fit 1,000+
57 pins worth of peripherals into only 200 to 400 worth of actual
58 IO Pads. The solution here: a GPIO Pinmux, described in some
59 detail here <https://ftp.libre-soc.org/Pin_Control_Subsystem_Overview.pdf>
60
61 This page goes over the details and issues involved in creating
62 an ASIC that combines **both** JTAG Boundary Scan **and** GPIO
63 Muxing, down to layout considerations using coriolis2.
64
65 # Resources, Platforms and Pins
66
67 When creating nmigen HDL as Modules, they typically know nothing about FPGA
68 Boards or ASICs. They especially do not know anything about the
69 Peripheral ICs (UART, I2C, USB, SPI, PCIe) connected to a given FPGA
70 on a given PCB, and they should not have to.
71
72 Through the Resources, Platforms and Pins API, a level of abstraction
73 between peripherals, boards and HDL designs is provided. Peripherals
74 may be given `(name, number)` tuples, the HDL design may "request"
75 a peripheral, which is described in terms of Resources, managed
76 by a ResourceManager, and a Platform may provide that peripheral.
77 The Platform is given
78 the resposibility to wire up the Pins to the correct FPGA (or ASIC)
79 IO Pads, and it is the HDL design's responsibility to connect up
80 those same named Pins, on the other side, to the implementation
81 of the PHY/Controller, in the HDL.
82
83 Here is a function that defines a UART Resource:
84
85 #!/usr/bin/env python3
86 from nmigen.build.dsl import Resource, Subsignal, Pins
87
88 def UARTResource(*args, rx, tx):
89 io = []
90 io.append(Subsignal("rx", Pins(rx, dir="i", assert_width=1)))
91 io.append(Subsignal("tx", Pins(tx, dir="o", assert_width=1)))
92 return Resource.family(*args, default_name="uart", ios=io)
93
94 Note that the Subsignal is given a convenient name (tx, rx) and that
95 there are Pins associated with it.
96 UARTResource would typically be part of a larger function that defines,
97 for either an FPGA or an ASIC, a full array of IO Connections:
98
99 def create_resources(pinset):
100 resources = []
101 resources.append(UARTResource('uart', 0, tx='A20', rx='A21'))
102 # add clock and reset
103 clk = Resource("clk", 0, Pins("sys_clk", dir="i"))
104 rst = Resource("rst", 0, Pins("sys_rst", dir="i"))
105 resources.append(clk)
106 resources.append(rst)
107 return resources
108
109 For an FPGA, the Pins names are typically the Ball Grid Array
110 Pad or Pin name: A12, or N20. ASICs can do likewise: it is
111 for convenience when referring to schematics, to use the most
112 recogniseable well-known name.
113
114 Next, these Resources need to be handed to a ResourceManager or
115 a Platform (Platform derives from ResourceManager)
116
117 from nmigen.build.plat import TemplatedPlatform
118
119 class ASICPlatform(TemplatedPlatform):
120 def __init__(self, resources):
121 super().__init__()
122 self.add_resources(resources)
123
124 An HDL Module may now be created, which, if given
125 a platform instance during elaboration, may request
126 a UART (caveat below):
127
128 from nmigen import Elaboratable, Module, Signal
129
130 class Blinker(Elaboratable):
131 def elaborate(self, platform):
132 m = Module()
133 # get the UART resource, mess with the output tx
134 uart = platform.request('uart')
135 intermediary = Signal()
136 m.d.comb += uart.tx.eq(~intermediary) # invert, for fun
137 m.d.comb += intermediary.eq(uart.rx) # pass rx to tx
138
139 return m
140
141 The caveat here is that the Resources of the platform actually
142 have to have a UART in order for it to be requestable! Thus:
143
144 resources = create_resources() # contains resource named "uart"
145 asic = ASICPlatform(resources)
146 hdl = Blinker()
147 asic.build(hdl)
148
149 Finally the association between HDL, Resources, and ASIC Platform
150 is made:
151
152 * The Resources contain the abstract expression of the
153 type of peripheral, its port names, and the corresponding
154 names of the IO Pads associated with each port.
155 * The HDL which knows nothing about IO Pad names requests
156 a Resource by name
157 * The ASIC Platform, given the list of Resources, takes care
158 of connecting requests for Resources to actual IO Pads.
159
160 This is the simple version. When JTAG Boundary Scan needs
161 to be added, it gets a lot more complex.
162
163 # JTAG Boundary Scan
164
165 JTAG Scanning is a (paywalled) IEEE Standard: 1149.1 which with
166 a little searching can be found online. Its purpose is to allow
167 a well-defined method of testing ASIC IO pads that a Foundry or
168 ASIC test house may apply easily with off-the-shelf equipment.
169 Scan chaining can also connect multiple ASICs together so that
170 the same test can be run on a large batch of ASICs at the same
171 time.
172
173 IO Pads generally come in four primary different types:
174
175 * Input
176 * Output
177 * Output with Tristate (enable)
178 * Bi-directional Tristate Input/Output with direction enable
179
180 Interestingly these can all be synthesised from one
181 Bi-directional Tristate IO Pad. Other types such as Differential
182 Pair Transmit may also be constructed from an inverter and a pair
183 of IO Pads. Other more advanced features include pull-up
184 and pull-down resistors, Schmidt triggering for interrupts,
185 different drive strengths, and so on, but the basics are
186 that the Pad is either an input, or an output, or both.
187
188 The JTAG Boundary Scan therefore needs to know what type
189 each pad is (In/Out/Bi) and has to "insert" itself in between
190 *all* the Pad's wires, which may be just an input, or just an output,
191 and, if bi-directional, an "output enable" line.
192
193 The "insertion" (or, "Tap") into those wires requires a
194 pair of Muxes for each wire. Under normal operation
195 the Muxes bypass JTAG entirely: the IO Pad is connected,
196 through the two Muxes,
197 directly to the Core (a hardware term for a "peripheral",
198 in Software terminology).
199
200 When JTAG Scan is enabled, then for every pin that is
201 "tapped into", the Muxes flip such that:
202
203 * The IO Pad is connected directly to latches controlled
204 by the JTAG Shift Register
205 * The Core (peripheral) likewise but to *different bits*
206 from those that the Pad is connected to
207
208 In this way, not only can JTAG control or read the IO Pad,
209 but it can also read or control the Core (peripheral).
210 This is its entire purpose: interception to allow for the detection
211 and triaging of faults.
212
213 * Software may be uploaded and run which sets a bit on
214 one of the peripheral outputs (UART Tx for example).
215 If the UART TX IO Pad was faulty, no possibility existd
216 without Boundary Scan to determine if the peripheral
217 was at fault. With the UART TX pin function being
218 redirected to a JTAG Shift Register, the results of the
219 software setting UART Tx may be detected by checking
220 the appropriate Shift Register bit.
221 * Likewise, a voltage may be applied to the UART RX Pad,
222 and the corresponding SR bit checked to see if the
223 pad is working. If the UART Rx peripheral was faulty
224 this would not be possible.
225
226 [[!img jtag-block.svg ]]
227
228 ## C4M JTAG TAP
229
230 Staf Verhaegen's Chips4Makers JTAG TAP module includes everything
231 needed to create JTAG Boundary Scan Shift Registers,
232 as well as the IEEE 1149.1 Finite State Machine to access
233 them through TMS, TDO, TDI and TCK Signalling. However,
234 connecting up cores (a hardware term: the equivalent software
235 term is "peripherals") on one side and the pads on the other is
236 especially confusing, but deceptively simple. The actual addition
237 to the Scan Shift Register is this straightforward:
238
239 from c4m.nmigen.jtag.tap import IOType, TAP
240
241 class JTAG(TAP):
242 def __init__(self):
243 TAP.__init__(self, ir_width=4)
244 self.u_tx = self.add_io(iotype=IOType.Out, name="tx")
245 self.u_rx = self.add_io(iotype=IOType.In, name="rx")
246
247 This results in the creation of:
248
249 * Two Records, one of type In named rx, the other an output
250 named tx
251 * Each Record contains a pair of sub-Records: one core-side
252 and the other pad-side
253 * Entries in the Boundary Scan Shift Register which if set
254 may control (or read) either the peripheral / core or
255 the IO PAD
256 * A suite of Muxes (as shown in the diagrams above) which
257 allow either direct connection between pad and core
258 (bypassing JTAG) or interception
259
260 During Interception Mode (Scanning) pad and core are connected
261 to the Shift Register. During "Production" Mode, pad and
262 core are wired directly to each other (on a per-pin basis,
263 for every pin. Clearly this is a lot of work).
264
265 It is then your responsibility to:
266
267 * connect up each and every peripheral input and output
268 to the right IO Core Record in your HDL
269 * connect up each and every IO Pad input and output
270 to the right IO Pad in the Platform.
271 * **This does not happen automatically and is not the
272 responsibility of the TAP Interface, it is yours**
273
274 The TAP interface connects the **other** side of the pads
275 and cores Records: **to the Muxes**. You **have** to
276 connect **your** side of both core and pads Records in
277 order for the Scan to be fully functional.
278
279 Both of these tasks are painstaking and tedious in the
280 extreme if done manually, and prone to either sheer boredom,
281 transliteration errors, dyslexia triggering or just utter
282 confusion. Despite this, let us proceed, and, augmenting
283 the Blinky example, wire up a JTAG instance:
284
285 class Blinker(Elaboratable):
286 def elaborate(self, platform):
287 m = Module()
288 m.submodules.jtag = jtag = JTAG()
289
290 # get the records from JTAG instance
291 utx, urx = jtag.u_tx, jtag.u_rx
292 # get the UART resource, mess with the output tx
293 p_uart = platform.request('uart')
294
295 # uart core-side from JTAG
296 intermediary = Signal()
297 m.d.comb += utx.core.o.eq(~intermediary) # invert, for fun
298 m.d.comb += intermediary.eq(urx.core.i) # pass rx to tx
299
300 # wire up the IO Pads (in right direction) to Platform
301 m.d.comb += uart.rx.eq(utx.pad.i) # receive rx from JTAG input pad
302 m.d.comb += utx.pad.o.eq(uart.tx) # transmit tx to JTAG output pad
303 return m
304
305 Compared to the non-scan-capable version, which connected UART
306 Core Tx and Rx directly to the Platform Resource (and the Platform
307 took care of wiring to IO Pads):
308
309 * Core HDL is instead wired to the core-side of JTAG Scan
310 * JTAG Pad side is instead wired to the Platform
311 * (the Platform still takes care of wiring to actual IO Pads)
312
313 JTAG TAP capability on UART TX and RX has now been inserted into
314 the chain. Using openocd or other program it is possible to
315 send TDI, TMS, TDO and TCK signals according to IEEE 1149.1 in order
316 to intercept both the core and IO Pads, both input and output,
317 and confirm the correct functionality of one even if the other is
318 broken, during ASIC testing.
319
320 ## Libre-SOC Automatic Boundary Scan
321
322 Libre-SOC's JTAG TAP Boundary Scan system is a little more sophisticated:
323 it hooks into (replaces) ResourceManager.request(), intercepting the request
324 and recording what was requested. The above manual linkup to JTAG TAP
325 is then taken care of **automatically and transparently**, but to
326 all intents and purposes looking exactly like a Platform even to
327 the extent of taking the exact same list of Resources.
328
329 class Blinker(Elaboratable):
330 def __init__(self, resources):
331 self.jtag = JTAG(resources)
332
333 def elaborate(self, platform):
334 m = Module()
335 m.submodules.jtag = jtag = self.jtag
336
337 # get the UART resource, mess with the output tx
338 uart = jtag.request('uart')
339 intermediary = Signal()
340 m.d.comb += uart.tx.eq(~intermediary) # invert, for fun
341 m.d.comb += intermediary.eq(uart.rx) # pass rx to tx
342
343 return jtag.boundary_elaborate(m, platform)
344
345 Connecting up and building the ASIC is as simple as a non-JTAG,
346 non-scanning-aware Platform:
347
348 resources = create_resources()
349 asic = ASICPlatform(resources)
350 hdl = Blinker(resources)
351 asic.build(hdl)
352
353 The differences:
354
355 * The list of resources was also passed to the HDL Module
356 such that JTAG may create a complete identical list
357 of both core and pad matching Pins
358 * Resources were requested from the JTAG instance,
359 not the Platform
360 * A "magic function" (JTAG.boundary_elaborate) is called
361 which wires up all of the seamlessly intercepted
362 Platform resources to the JTAG core/pads Resources,
363 where the HDL connected to the core side, exactly
364 as if this was a non-JTAG-Scan-aware Platform.
365 * ASICPlatform still takes care of connecting to actual
366 IO Pads, except that the Platform.resource requests were
367 triggered "behind the scenes". For that to work it
368 is absolutely essential that the JTAG instance and the
369 ASICPlatform be given the exact same list of Resources.
370
371
372 ## Clock synchronisation
373
374 Take for example USB ULPI:
375
376 <img src="https://www.crifan.com/files/pic/serial_story/other_site/p_blog_bb.JPG"
377 width=400 />
378
379 Here there is an external incoming clock, generated by the PHY, to which
380 both Received *and Transmitted* data and control is synchronised. Notice
381 very specifically that it is *not the main processor* generating that clock
382 Signal, but the external peripheral (known as a PHY in Hardware terminology)
383
384 Firstly: note that the Clock will, obviously, also need to be routed
385 through JTAG Boundary Scan, because, after all, it is being received
386 through just another ordinary IO Pad, after all. Secondly: note that
387 if it didn't, then clock skew would occur for that peripheral because
388 although the Data Wires went through JTAG Boundary Scan MUXes, the
389 clock did not. Clearly this would be a problem.
390
391 However, clocks are very special signals: they have to be distributed
392 evenly to all and any Latches (DFFs) inside the peripheral so that
393 data corruption does not occur because of tiny delays.
394 To avoid that scenario, Clock Domain Crossing (CDC) is used, with
395 Asynchronous FIFOs:
396
397 rx_fifo = stream.AsyncFIFO([("data", 8)], self.rx_depth, w_domain="ulpi", r_domain="sync")
398 tx_fifo = stream.AsyncFIFO([("data", 8)], self.tx_depth, w_domain="sync", r_domain="ulpi")
399 m.submodules.rx_fifo = rx_fifo
400 m.submodules.tx_fifo = tx_fifo
401
402 However the entire FIFO must be covered by two Clock H-Trees: one
403 by the ULPI external clock, and the other the main system clock.
404 The size of the ULPI clock H-Tree, and consequently the size of
405 the PHY on-chip, will result in more Clock Tree Buffers being
406 inserted into the chain, and, correspondingly, matching buffers
407 on the ULPI data input side likewise must be inserted so that
408 the input data timing precisely matches that of its clock.
409
410 The problem is not receiving of data, though: it is transmission
411 on the output ULPI side. With the ULPI Clock Tree having buffers
412 inserted, each buffer creates delay. The ULPI output FIFO has to
413 correspondingly be synchronised not to the original incoming clock
414 but to that clock *after going through H Tree Buffers*. Therefore,
415 there will be a lag on the output data compared to the incoming
416 (external) clock
417
418 # Pinmux GPIO Block
419
420 The following diagram is an example of a GPIO block with switchable banks and comes from the Ericson presentation on a GPIO architecture.
421
422 [[!img gpio-block.svg size="800x"]]
423
424 ## Our Pinmux Block
425
426 The block we are developing is very similar, but is lacking some of
427 configuration of the former (due to complexity and time constraints).
428
429 The implemented pinmux consists of two sub-blocks:
430
431 1. A Wishbone controlled N-GPIO block.
432
433 1. Bank selectable N-port I/O multiplexer (for current usecase set to 4
434 ports/banks).
435
436 ## The GPIO block
437
438 [[!img n-gpio.svg size="600x"]]
439
440 The GPIO module is multi-GPIO block integral to the pinmux system.
441 To make the block flexible, it has a variable number of of I/Os based on an
442 input parameter.
443
444 ### Configuration Word
445
446 After a discussion with Luke on IRC (14th January 2022), new layout of the
447 8-bit data word for configuring the GPIO (through WB):
448
449 * oe - Output Enable (see the Ericson presentation for the GPIO diagram)
450 * ie - Input Enable *(Not used, as IOPad only supports i/o/oe)*
451 * puen - Pull-Up resistor enable
452 * pden - Pull-Down resistor enable
453 * i/o - When configured as output (oe set), this bit sets/clears output. When
454 configured as input, shows the current state of input (read-only)
455 * bank[2:0] - Bank Select *(only 4 banks used, bank[2] used for JTAG chain)*
456
457 ### Simultaneous/Packed Configuration
458
459 To make the configuration more efficient, multiple GPIOs can be configured with
460 one data word. The number of GPIOs in one "row" is dependent on the WB data bus
461 *width* and *granuality* (see Wishbone B4 spec, section 3.5 Data Organization
462 for more details).
463
464 If for example, the data bus is 64-bits wide and granuality is 8, eight GPIO
465 configuration bytes - and thus eight GPIOs - can be configured in one go.
466 To configure only certain GPIOs, the WB sel signal can be used (see next
467 section).
468
469 *(NOTE: Currently the code doesn't support granuality higher than 8)*
470
471 The diagram below shows the layout of the configuration byte.
472
473 [[!img gpio-config-word.jpg size="600x"]]
474
475 If the block is created with more GPIOs than can fit in a single data word,
476 the next set of GPIOs can be accessed by incrementing the address.
477 For example, if 16 GPIOs are instantiated and 64-bit data bus is used, GPIOs
478 0-7 are accessed via address 0, whereas GPIOs 8-15 are accessed by address 1.
479
480 ### Example Memory Map
481
482 [[!img gpio-mem-layout.jpg size="600x"]]
483
484 The diagrams above show the difference in memory layout between 16-GPIO block
485 implemented with 64-bit and 32-bit WB data buses.
486 The 64-bit case shows there are two rows with eight GPIOs in each, and it will
487 take two writes (assuming simple WB write) to completely configure all 16 GPIOs.
488 The 32-bit on the other hand has four address rows, and so will take four write transactions.
489
490 64-bit:
491
492 * 0x00 - Configure GPIOs 0-7 - requires 8-bit `sel` one bit per GPIO
493 * 0x01 - Configure GPIOs 8-15 - requires 8-bit `sel` one bit per GPIO
494
495 32-bit:
496
497 * 0x00 - Configure GPIOs 0-3 - requires 4-bit `sel` one bit per GPIO
498 * 0x01 - Configure GPIOs 4-7 - requires 4-bit `sel` one bit per GPIO
499 * 0x02 - Configure GPIOs 8-11 - requires 4-bit `sel` one bit per GPIO
500 * 0x03 - Configure GPIOs 12-15 - requires 4-bit `sel` one bit per GPIO
501
502 Here is the pseudocode for reading the GPIO
503 data structs:
504
505 read_bytes = []
506 for i in range(len(sel)):
507 GPIO_num = adr*len(sel)+i
508 if sel[i]:
509 read_bytes.append(GPIO[GPIO_num])
510 else:
511 read_bytes.append(Const(0, 8))
512 if not wen:
513 dat_r.eq(Cat(read_bytes))
514
515 and for writing, slightly different style:
516
517 if wen:
518 write_bytes = []
519 for i in range(len(sel)):
520 GPIO_num = adr*len(sel)+i
521 write_byte = dat_w.bit_select(i*8, 8)
522 if sel[i]:
523 GPIO[GPIO_num].eq(write_byte)
524
525 As explained in this video <https://m.youtube.com/watch?v=Pf6gmDQnw_4>
526 if each GPIO is mapped to one single byte, and it is assumed that
527 the `sel` lines are enough to **always** give byte-level read/write
528 then the GPIO number *becomes* the Memory-mapped byte number, hence
529 the use of `len(sel)` above. `len(dat_r)//8` would do as well
530 because these should be equal.
531
532
533 ## The IO Mux block
534
535 [[!img iomux-4bank.svg size="600x"]]
536
537 This block is an N-to-1 (4 bank shown above) mux and it simultaneously connects:
538
539 * o/oe signals from one of N peripheral ports, to the pad output port
540
541 * i pad port signal to one of N peripheral ports (the rest being set to 0).
542
543 *(NOTE: an N-pin 4-bank IOMux has not been implemented yet - do it within the pinmux instead?)*
544
545 ## Combined Block
546
547 [[!img pinmux-1pin.svg size="600x"]]
548
549 The GPIO and IOMux blocks are combined in a single block called the
550 Pinmux block.
551
552 By default, bank 0 is hard-wired to the memory-mapped WB bus GPIO. The CPU
553 core can just write the configuration word to the GPIO row address. From this
554 perspective, it is no different to a conventional GPIO block.
555
556 Bank select, allows to switch over the control of the IO pad to
557 another peripheral. The peripheral will be given sole connectivity to the
558 o/oe/i signals, while additional parameters such as pull up/down will either
559 be automatically configured (as the case for I2C), or will be configurable
560 via the WB bus. *(This has not been implemented yet, so open to discussion)*
561
562 ### Bank Select Options
563
564 * bank 0 - WB bus has full control (GPIO peripheral)
565 * bank 1,2,3 - WB bus only controls puen/pden, periphal gets o/oe/i
566 (whether ie should be routed out is not finalised yet)
567
568
569 ### Adding JTAG BS Chain to the Pinmux block (In Progress)
570
571 The JTAG BS chain need to have access to the bank select bits, to allow
572 selecting different peripherals during testing. At the same time, JTAG may
573 also require access to the WB bus to access GPIO configuration options
574 not available to bank 1/2/3 peripherals.
575
576 The proposed JTAG BS chain is as follows:
577
578 * Connect puen/pden/bank from GPIO block to the IOMux through JTAG BS chain.
579 * Connect the i/o/oe pad port from IOMux via JTAG BS chain.
580 * (?) Test port for configuring GPIO without WB? - utilising bank bit 2?
581 * (?) Way to drive WB via JTAG?
582
583 Such a setup would allow the JTAG chain to control the bank select when testing
584 connectivity of the peripherals, as well as give full control to the GPIO
585 configuration when bank select bit 2 is set.
586
587 For the purposes of muxing peripherals, bank select bit 2 is ignored. This
588 means that even if JTAG is handed over full control, the peripheral is
589 still connected to the GPIO block (via the BS chain).
590
591 Signals for various ports:
592
593 * WB bus or Periph0: WB data read, data write, address, sel, cyc, stb, ack
594 * Periph1/2/3: o,oe,i (puen/pden are only controlled by WB, test port, or
595 fixed by functionality; ie not used yet)
596 * (?) Test port: bank[2:0], o,oe,i,ie,puen,pden. In addition, internal
597 address to access individual GPIOs will be available (this will consist of a
598 few bits, as more than 16 GPIOs per block is likely to be to big).
599
600 As you can see by the above list, the pinmux block is becoming quite a complex
601 beast. If there are suggestions to simplify or reduce some of the signals,
602 that will be helpful.
603
604 The diagrams above showed 1-bit GPIO connectivity. Below you'll find the
605 4-bit case *(NOT IMPLEMENTED YET)*.
606
607 [[!img gpio_jtag_4bit.jpg size="600x"]]
608
609 # Core/Pad Connection + JTAG Mux
610
611 Diagram constructed from the nmigen plat.py file.
612
613 [[!img i_o_io_tristate_jtag.svg ]]
614