b739440a178cedbdfa2b881eb689b4b14b454086
[pinmux.git] / src / spec / simple_gpio.py
1 """Simple GPIO peripheral on wishbone
2
3 This is an extremely simple GPIO peripheral intended for use in XICS
4 testing, however it could also be used as an actual GPIO peripheral
5
6 Modified for use with pinmux, will probably change the class name later.
7 """
8 from random import randint
9 from math import ceil, floor
10 from nmigen import Elaboratable, Module, Signal, Record, Array, Cat, Const
11 from nmigen.hdl.rec import Layout
12 from nmigen.utils import log2_int
13 from nmigen.cli import rtlil
14 from soc.minerva.wishbone import make_wb_layout
15 from nmutil.util import wrap
16 from soc.bus.test.wb_rw import wb_read, wb_write
17
18 from nmutil.gtkw import write_gtkw
19
20 cxxsim = False
21 if cxxsim:
22 from nmigen.sim.cxxsim import Simulator, Settle
23 else:
24 from nmigen.sim import Simulator, Settle
25
26 # Layout of 8-bit configuration word:
27 # bank[2:0] i/o | pden puen ien oe
28 NUMBANKBITS = 3 # max 3 bits, only supporting 4 banks (0-3)
29 csrbus_layout = (("oe", 1),
30 ("ie", 1),
31 ("puen", 1),
32 ("pden", 1),
33 ("io", 1),
34 ("bank", NUMBANKBITS)
35 )
36
37 gpio_layout = (("i", 1),
38 ("oe", 1),
39 ("o", 1),
40 ("puen", 1),
41 ("pden", 1),
42 ("bank", NUMBANKBITS)
43 )
44
45 class SimpleGPIO(Elaboratable):
46
47 def __init__(self, wordsize=4, n_gpio=16):
48 self.wordsize = wordsize
49 self.n_gpio = n_gpio
50 self.n_rows = ceil(self.n_gpio / self.wordsize)
51 print("SimpleGPIO: WB Data # of bytes: {0}, #GPIOs: {1}, Rows: {2}"
52 .format(self.wordsize, self.n_gpio, self.n_rows))
53 class Spec: pass
54 spec = Spec()
55 spec.addr_wid = 30
56 spec.mask_wid = 4
57 spec.reg_wid = wordsize*8 # 32
58 self.bus = Record(make_wb_layout(spec), name="gpio_wb")
59
60 temp = []
61 for i in range(self.n_gpio):
62 name = "gpio{}".format(i)
63 temp.append(Record(name=name, layout=gpio_layout))
64 self.gpio_ports = Array(temp)
65
66 def elaborate(self, platform):
67 m = Module()
68 comb, sync = m.d.comb, m.d.sync
69
70 bus = self.bus
71 wb_rd_data = bus.dat_r
72 wb_wr_data = bus.dat_w
73 wb_ack = bus.ack
74
75 gpio_ports = self.gpio_ports
76
77 # MultiCSR read and write buses
78 rd_multi = []
79 for i in range(self.wordsize):
80 name = "rd_word%d" % i
81 rd_multi.append(Record(name=name, layout=csrbus_layout))
82
83 wr_multi = []
84 for i in range(self.wordsize):
85 name = "wr_word%d" % i
86 wr_multi.append(Record(name=name, layout=csrbus_layout))
87
88 # Connecting intermediate signals to the WB data buses
89 # allows the use of Records/Layouts
90 # Split the WB data into bytes for use with individual GPIOs
91 comb += Cat(*wr_multi).eq(wb_wr_data)
92 # Connect GPIO config bytes to form a single word
93 comb += wb_rd_data.eq(Cat(*rd_multi))
94
95 # Flag for indicating rd/wr transactions
96 new_transaction = Signal(1)
97
98 # One address used to configure CSR, set output, read input
99 with m.If(bus.cyc & bus.stb):
100 sync += new_transaction.eq(1)
101
102 with m.If(~bus.we): # read
103 # Update the read multi bus with current GPIO configs
104 # not ack'ing as we need to wait 1 clk cycle before data ready
105 for i in range(len(bus.sel)):
106 GPIO_num = Signal(16) # fixed for now
107 comb += GPIO_num.eq(bus.adr*len(bus.sel)+i)
108 with m.If(bus.sel[i]):
109 sync += rd_multi[i].oe.eq(gpio_ports[GPIO_num].oe)
110 sync += rd_multi[i].ie.eq(~gpio_ports[GPIO_num].oe)
111 sync += rd_multi[i].puen.eq(gpio_ports[GPIO_num].puen)
112 sync += rd_multi[i].pden.eq(gpio_ports[GPIO_num].pden)
113 with m.If (gpio_ports[GPIO_num].oe):
114 sync += rd_multi[i].io.eq(gpio_ports[GPIO_num].o)
115 with m.Else():
116 sync += rd_multi[i].io.eq(gpio_ports[GPIO_num].i)
117 sync += rd_multi[i].bank.eq(gpio_ports[GPIO_num].bank)
118 with m.Else():
119 sync += rd_multi[i].oe.eq(0)
120 sync += rd_multi[i].ie.eq(0)
121 sync += rd_multi[i].puen.eq(0)
122 sync += rd_multi[i].pden.eq(0)
123 sync += rd_multi[i].io.eq(0)
124 sync += rd_multi[i].bank.eq(0)
125 sync += wb_ack.eq(1) # ack after latching data
126 with m.Else():
127 sync += new_transaction.eq(0)
128 sync += wb_ack.eq(0)
129
130 # Delayed from the start of transaction by 1 clk cycle
131 with m.If(new_transaction):
132 # Update the GPIO configs with sent parameters
133 with m.If(bus.we):
134 for i in range(len(bus.sel)):
135 GPIO_num = Signal(16) # fixed for now
136 comb += GPIO_num.eq(bus.adr*len(bus.sel)+i)
137 with m.If(bus.sel[i]):
138 sync += gpio_ports[GPIO_num].oe.eq(wr_multi[i].oe)
139 sync += gpio_ports[GPIO_num].puen.eq(wr_multi[i].puen)
140 sync += gpio_ports[GPIO_num].pden.eq(wr_multi[i].pden)
141 with m.If (wr_multi[i].oe):
142 sync += gpio_ports[GPIO_num].o.eq(wr_multi[i].io)
143 with m.Else():
144 sync += gpio_ports[GPIO_num].o.eq(0)
145 sync += gpio_ports[GPIO_num].bank.eq(wr_multi[i].bank)
146 sync += wb_ack.eq(1) # ack after latching data
147 # No need as rd data is can be outputed on the first clk
148 # with m.Else():
149 # sync += wb_ack.eq(1) # Delay ack until rd data is ready!
150 return m
151
152 def __iter__(self):
153 for field in self.bus.fields.values():
154 yield field
155 for gpio in range(len(self.gpio_ports)):
156 for field in self.gpio_ports[gpio].fields.values():
157 yield field
158
159 def ports(self):
160 return list(self)
161
162 """
163 def gpio_test_in_pattern(dut, pattern):
164 num_gpios = len(dut.gpio_ports)
165 print("Test pattern:")
166 print(pattern)
167 for pat in range(0, len(pattern)):
168 for gpio in range(0, num_gpios):
169 yield gpio_set_in_pad(dut, gpio, pattern[pat])
170 yield
171 temp = yield from gpio_rd_input(dut, gpio)
172 print("Pattern: {0}, Reading {1}".format(pattern[pat], temp))
173 assert (temp == pattern[pat])
174 pat += 1
175 if pat == len(pattern):
176 break
177 """
178
179 def test_gpio_single(dut, gpio, use_random=True):
180 oe = 1
181 ie = 0
182 output = 0
183 puen = 0
184 pden = 0
185 if use_random:
186 bank = randint(0, (2**NUMBANKBITS)-1)
187 print("Random bank select: {0:b}".format(bank))
188 else:
189 bank = 3 # not special, chose for testing
190
191 gpio_csr = yield from gpio_config(dut, gpio, oe, ie, puen, pden, output,
192 bank, check=True)
193 # Enable output
194 output = 1
195 gpio_csr = yield from gpio_config(dut, gpio, oe, ie, puen, pden, output,
196 bank, check=True)
197
198 # Shadow reg container class
199 class GPIOConfigReg():
200 def __init__(self, shift_dict):
201 self.shift_dict = shift_dict
202 self.oe=0
203 self.ie=1 # By default gpio set as input
204 self.puen=0
205 self.pden=0
206 self.io=0
207 self.bank=0
208 self.packed=0
209
210 def set(self, oe=0, ie=0, puen=0, pden=0, io=0, bank=0):
211 self.oe=oe
212 self.ie=ie
213 self.puen=puen
214 self.pden=pden
215 self.io=io
216 self.bank=bank
217 self.pack() # Produce packed byte for sending
218
219 def set_out(self, outval):
220 self.io=outval
221 self.pack() # Produce packed byte for sending
222
223 # Take config parameters of specified GPIOs, and combine them to produce
224 # bytes for sending via WB bus
225 def pack(self):
226 self.packed = ((self.oe << self.shift_dict['oe'])
227 | (self.ie << self.shift_dict['ie'])
228 | (self.puen << self.shift_dict['puen'])
229 | (self.pden << self.shift_dict['pden'])
230 | (self.io << self.shift_dict['io'])
231 | (self.bank << self.shift_dict['bank']))
232
233 #print("GPIO Packed CSR: {0:x}".format(self.packed))
234
235 # Object for storing each gpio's config state
236
237 class GPIOManager():
238 def __init__(self, dut, layout, wb_bus):
239 self.dut = dut
240 self.wb_bus = wb_bus
241 # arrangement of config bits making up csr word
242 self.csr_layout = layout
243 self.shift_dict = self._create_shift_dict()
244 self.n_gpios = len(self.dut.gpio_ports)
245 print(dir(self.dut))
246 # Get the number of bits of the WB sel signal
247 # indicates the number of gpios per address
248 self.n_gp_per_adr = len(self.dut.bus.sel)
249 # Shows if data is byte/half-word/word/qword addressable?
250 self.granuality = len(self.dut.bus.dat_w) // self.n_gp_per_adr
251 self.n_rows = ceil(self.n_gpios / self.n_gp_per_adr)
252 self.shadow_csr = []
253 for i in range(self.n_gpios):
254 self.shadow_csr.append(GPIOConfigReg(self.shift_dict))
255
256 def print_info(self):
257 print("----------")
258 print("GPIO Block Info:")
259 print("Number of GPIOs: %d" % self.n_gpios)
260 print("GPIOs per WB data word: %d" % self.n_gp_per_adr)
261 print("WB data granuality: %d" % self.granuality)
262 print("Number of address rows: %d" % self.n_rows)
263 print("----------")
264
265 # The shifting of control bits in the configuration word is dependent on the
266 # defined layout. To prevent maintaining the shift constants in a separate
267 # location, the same layout is used to generate a dictionary of bit shifts
268 # with which the configuration word can be produced!
269 def _create_shift_dict(self):
270 shift = 0
271 shift_dict = {}
272 for i in range(0, len(self.csr_layout)):
273 shift_dict[self.csr_layout[i][0]] = shift
274 shift += self.csr_layout[i][1]
275 print(shift_dict)
276 return shift_dict
277
278 def _parse_gpio_arg(self, gpio_str):
279 # TODO: No input checking!
280 print("Given GPIO/range string: {}".format(gpio_str))
281 if gpio_str == "all":
282 start = 0
283 end = self.n_gpios
284 elif '-' in gpio_str:
285 start, end = gpio_str.split('-')
286 start = int(start)
287 end = int(end) + 1
288 if (end < start) or (end > self.n_gpios):
289 raise Exception("Second GPIO must be higher than first and"
290 + " must be lower or equal to last available GPIO.")
291 else:
292 start = int(gpio_str)
293 if start >= self.n_gpios:
294 raise Exception("GPIO must be less/equal to last GPIO.")
295 end = start + 1
296 print("Parsed GPIOs {0} until {1}".format(start, end))
297 return start, end
298
299 # Take a combined word and update shadow reg's
300 # TODO: convert hard-coded sizes to use the csrbus_layout (or dict?)
301 def update_single_shadow(self, csr_byte, gpio):
302 oe = (csr_byte >> self.shift_dict['oe']) & 0x1
303 ie = (csr_byte >> self.shift_dict['ie']) & 0x1
304 puen = (csr_byte >> self.shift_dict['puen']) & 0x1
305 pden = (csr_byte >> self.shift_dict['pden']) & 0x1
306 io = (csr_byte >> self.shift_dict['io']) & 0x1
307 bank = (csr_byte >> self.shift_dict['bank']) & 0x3
308
309 print("csr={0:x} | oe={1}, ie={2}, puen={3}, pden={4}, io={5}, bank={6}"
310 .format(csr_byte, oe, ie, puen, pden, io, bank))
311
312 self.shadow_csr[gpio].set(oe, ie, puen, pden, io, bank)
313 return oe, ie, puen, pden, io, bank
314
315 # Update multiple configuration registers
316 def wr(self, gp_start, gp_end, check=False):
317 # Some maths to determine how many transactions, and at which
318 # address to start transmitting
319 n_gp_config = gp_end - gp_start
320 adr_start = gp_start // self.n_gp_per_adr
321 n_adr = ceil(n_gp_config / self.n_gp_per_adr)
322
323 curr_gpio = gp_start
324 # cycle through addresses, each iteration is a WB tx
325 for adr in range(adr_start, adr_start + n_adr):
326 tx_sel = 0
327 tx_word = 0
328 # cycle through every WB sel bit, and add configs of
329 # corresponding gpios
330 for i in range(0, self.n_gp_per_adr):
331 # if current gpio's location in the WB data word matches sel bit
332 if (curr_gpio % self.n_gp_per_adr) == i:
333 print("gpio%d" % curr_gpio)
334 tx_sel += 1 << i
335 tx_word += (self.shadow_csr[curr_gpio].packed
336 << (self.granuality * i))
337 curr_gpio += 1
338 # stop if we processed all required gpios
339 if curr_gpio >= gp_end:
340 break
341 print("Adr: %x | Sel: %x | TX Word: %x" % (adr, tx_sel, tx_word))
342 yield from wb_write(self.wb_bus, adr, tx_word, tx_sel)
343 yield # Allow one clk cycle to propagate
344
345 if(check):
346 row_word = yield from wb_read(self.wb_bus, adr, tx_sel)
347 assert config_word == read_word
348
349 def rd(self, gp_start, gp_end):
350 # Some maths to determine how many transactions, and at which
351 # address to start transmitting
352 n_gp_config = gp_end - gp_start
353 adr_start = gp_start // self.n_gp_per_adr
354 n_adr = ceil(n_gp_config / self.n_gp_per_adr)
355
356 curr_gpio = gp_start
357 # cycle through addresses, each iteration is a WB tx
358 for adr in range(adr_start, adr_start + n_adr):
359 tx_sel = 0
360 # cycle through every WB sel bit, and add configs of
361 # corresponding gpios
362 for i in range(0, self.n_gp_per_adr):
363 # if current gpio's location in the WB data word matches sel bit
364 if (curr_gpio % self.n_gp_per_adr) == i:
365 print("gpio%d" % curr_gpio)
366 tx_sel += 1 << i
367 curr_gpio += 1
368 # stop if we processed all required gpios
369 if curr_gpio >= gp_end:
370 break
371 print("Adr: %x | Sel: %x " % (adr, tx_sel))
372 row_word = yield from wb_read(self.wb_bus, adr, tx_sel)
373
374 mask = (2**self.granuality) - 1
375 for i in range(self.n_gp_per_adr):
376 if ((tx_sel >> i) & 1) == 1:
377 single_csr = (row_word >> (i*self.granuality)) & mask
378 curr_gpio = adr*self.n_gp_per_adr + i
379 #print("rd gpio%d" % curr_gpio)
380 self.update_single_shadow(single_csr, curr_gpio)
381
382 # Write all shadow registers to GPIO block
383 def wr_all(self, check=False):
384 for row in range(0, self.n_rows):
385 yield from self.wr(0, self.n_gpios, check)
386
387 # Read all GPIO block row addresses and update shadow reg's
388 def rd_all(self, check=False):
389 for row in range(0, self.n_rows):
390 yield from self.rd(0, self.n_gpios)
391
392 def config(self, gpio_str, oe, ie, puen, pden, outval, bank, check=False):
393 start, end = self._parse_gpio_arg(gpio_str)
394 # Update the shadow configuration
395 for gpio in range(start, end):
396 # print(oe, ie, puen, pden, outval, bank)
397 self.shadow_csr[gpio].set(oe, ie, puen, pden, outval, bank)
398 # TODO: only update the required rows?
399 #yield from self.wr_all()
400 yield from self.wr(start, end)
401
402 # Set/Clear the output bit for single or group of GPIOs
403 def set_out(self, gpio_str, outval):
404 start, end = self._parse_gpio_arg(gpio_str)
405 for gpio in range(start, end):
406 self.shadow_csr[gpio].set_out(outval)
407
408 if start == end:
409 print("Setting GPIO{0} output to {1}".format(start, outval))
410 else:
411 print("Setting GPIOs {0}-{1} output to {2}"
412 .format(start, end-1, outval))
413
414 yield from self.wr(start, end)
415
416 def rd_input(self, gpio_str):
417 start, end = self._parse_gpio_arg(gpio_str)
418 #read_data = [0] * self.n_rows
419 #for row in range(0, self.n_rows):
420 # read_data[row] = yield from self.rd_row(row)
421 yield from self.rd(start, end)
422
423 num_to_read = (end - start)
424 read_in = [0] * num_to_read
425 curr_gpio = 0
426 for i in range(0, num_to_read):
427 read_in[i] = self.shadow_csr[curr_gpio].io
428 curr_gpio += 1
429
430 print("GPIOs %d until %d, i=%s".format(start, end, read_in))
431 return read_in
432
433 # TODO: There's probably a cleaner way to clear the bit...
434 def sim_set_in_pad(self, gpio_str, in_val):
435 start, end = self._parse_gpio_arg(gpio_str)
436 for gpio in range(start, end):
437 old_in_val = yield self.dut.gpio_ports[gpio].i
438 print(old_in_val)
439 print("GPIO{0} Previous i: {1:b} | New i: {2:b}"
440 .format(gpio, old_in_val, in_val))
441 yield self.dut.gpio_ports[gpio].i.eq(in_val)
442 yield # Allow one clk cycle to propagate
443
444 def rd_shadow(self):
445 shadow_csr = [0] * self.n_gpios
446 for gpio in range(0, self.n_gpios):
447 shadow_csr[gpio] = self.shadow_csr[gpio].packed
448
449 hex_str = ""
450 for reg in shadow_csr:
451 hex_str += " "+hex(reg)
452 print("Shadow reg's: ", hex_str)
453
454 return shadow_csr
455
456
457 def sim_gpio(dut, use_random=True):
458 #print(dut)
459 #print(dir(dut.gpio_ports))
460 #print(len(dut.gpio_ports))
461
462 gpios = GPIOManager(dut, csrbus_layout)
463 gpios.print_info()
464 # TODO: not working yet
465 #test_pattern = []
466 #for i in range(0, (num_gpios * 2)):
467 # test_pattern.append(randint(0,1))
468 #yield from gpio_test_in_pattern(dut, test_pattern)
469
470 #yield from gpio_config(dut, start_gpio, oe, ie, puen, pden, outval, bank, end_gpio, check=False, wordsize=4)
471 #reg_val = 0xC56271A2
472 #reg_val = 0xFFFFFFFF
473 #yield from reg_write(dut, 0, reg_val)
474 #yield from reg_write(dut, 0, reg_val)
475 #yield
476
477 #csr_val = yield from wb_read(dut.bus, 0)
478 #print("CSR Val: {0:x}".format(csr_val))
479 print("Finished the simple GPIO block test!")
480
481 def gen_gtkw_doc(n_gpios, wordsize, filename):
482 # GTKWave doc generation
483 wb_data_width = wordsize*8
484 n_rows = ceil(n_gpios/wordsize)
485 style = {
486 '': {'base': 'hex'},
487 'in': {'color': 'orange'},
488 'out': {'color': 'yellow'},
489 'debug': {'module': 'top', 'color': 'red'}
490 }
491
492 # Create a trace list, each block expected to be a tuple()
493 traces = []
494 wb_traces = ('Wishbone Bus', [
495 ('gpio_wb__cyc', 'in'),
496 ('gpio_wb__stb', 'in'),
497 ('gpio_wb__we', 'in'),
498 ('gpio_wb__adr[27:0]', 'in'),
499 ('gpio_wb__sel[3:0]', 'in'),
500 ('gpio_wb__dat_w[{}:0]'.format(wb_data_width-1), 'in'),
501 ('gpio_wb__dat_r[{}:0]'.format(wb_data_width-1), 'out'),
502 ('gpio_wb__ack', 'out'),
503 ])
504 traces.append(wb_traces)
505
506 gpio_internal_traces = ('Internal', [
507 ('clk', 'in'),
508 ('new_transaction'),
509 ('rst', 'in')
510 ])
511 traces.append(gpio_internal_traces)
512
513 traces.append({'comment': 'Multi-byte GPIO config read bus'})
514 for word in range(0, wordsize):
515 prefix = "rd_word{}__".format(word)
516 single_word = []
517 word_signals = []
518 single_word.append('Word{}'.format(word))
519 word_signals.append((prefix+'bank[{}:0]'.format(NUMBANKBITS-1)))
520 word_signals.append((prefix+'ie'))
521 word_signals.append((prefix+'io'))
522 word_signals.append((prefix+'oe'))
523 word_signals.append((prefix+'pden'))
524 word_signals.append((prefix+'puen'))
525 single_word.append(word_signals)
526 traces.append(tuple(single_word))
527
528 traces.append({'comment': 'Multi-byte GPIO config write bus'})
529 for word in range(0, wordsize):
530 prefix = "wr_word{}__".format(word)
531 single_word = []
532 word_signals = []
533 single_word.append('Word{}'.format(word))
534 word_signals.append((prefix+'bank[{}:0]'.format(NUMBANKBITS-1)))
535 word_signals.append((prefix+'ie'))
536 word_signals.append((prefix+'io'))
537 word_signals.append((prefix+'oe'))
538 word_signals.append((prefix+'pden'))
539 word_signals.append((prefix+'puen'))
540 single_word.append(word_signals)
541 traces.append(tuple(single_word))
542
543 for gpio in range(0, n_gpios):
544 prefix = "gpio{}__".format(gpio)
545 single_gpio = []
546 gpio_signals = []
547 single_gpio.append('GPIO{} Port'.format(gpio))
548 gpio_signals.append((prefix+'bank[{}:0]'.format(NUMBANKBITS-1), 'out'))
549 gpio_signals.append( (prefix+'i', 'in') )
550 gpio_signals.append( (prefix+'o', 'out') )
551 gpio_signals.append( (prefix+'oe', 'out') )
552 gpio_signals.append( (prefix+'pden', 'out') )
553 gpio_signals.append( (prefix+'puen', 'out') )
554 single_gpio.append(gpio_signals)
555 traces.append(tuple(single_gpio))
556
557 #print(traces)
558
559 #module = "top.xics_icp"
560 module = "bench.top.xics_icp"
561 write_gtkw(filename+".gtkw", filename+".vcd", traces, style,
562 module=module)
563
564 def test_gpio():
565 filename = "test_gpio" # Doesn't include extension
566 n_gpios = 8
567 wordsize = 4 # Number of bytes in the WB data word
568 dut = SimpleGPIO(wordsize, n_gpios)
569 vl = rtlil.convert(dut, ports=dut.ports())
570 with open(filename+".il", "w") as f:
571 f.write(vl)
572
573 m = Module()
574 m.submodules.xics_icp = dut
575
576 sim = Simulator(m)
577 sim.add_clock(1e-6)
578
579 #sim.add_sync_process(wrap(sim_gpio(dut, use_random=False)))
580 sim.add_sync_process(wrap(test_gpioman(dut)))
581 sim_writer = sim.write_vcd(filename+".vcd")
582 with sim_writer:
583 sim.run()
584
585 gen_gtkw_doc(n_gpios, wordsize, filename)
586
587 def test_gpioman(dut):
588 print("------START----------------------")
589 gpios = GPIOManager(dut, csrbus_layout, dut.bus)
590 gpios.print_info()
591 #gpios._parse_gpio_arg("all")
592 #gpios._parse_gpio_arg("0")
593 #gpios._parse_gpio_arg("1-3")
594 #gpios._parse_gpio_arg("20")
595
596 oe = 1
597 ie = 0
598 puen = 0
599 pden = 1
600 outval = 0
601 bank = 3
602 yield from gpios.config("0-1", oe=1, ie=0, puen=0, pden=1, outval=0, bank=2)
603 ie = 1
604 yield from gpios.config("5-7", oe=0, ie=1, puen=0, pden=1, outval=0, bank=6)
605 yield from gpios.set_out("0-1", outval=1)
606
607 #yield from gpios.rd_all()
608 yield from gpios.sim_set_in_pad("6-7", 1)
609 print("----------------------------")
610 yield from gpios.rd_input("4-7")
611
612 gpios.rd_shadow()
613
614 if __name__ == '__main__':
615 test_gpio()
616