Handle case with zero IO cells for boundary scan.
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 22 Oct 2020 17:13:57 +0000 (18:13 +0100)
committerStaf Verhaegen <staf@stafverhaegen.be>
Wed, 21 Apr 2021 17:06:47 +0000 (19:06 +0200)
c4m/nmigen/jtag/tap.py

index 13a78b235b7310bce65c0868cb3d33f69509692d..9e260c3d9df74086331d1d6aa59f10625a54e6a0 100755 (executable)
@@ -399,8 +399,9 @@ class TAP(Elaboratable):
             m.d.comb += tdo.eq(irblock.tdo)
         with m.Elif(select_id):
             m.d.comb += tdo.eq(idblock.tdo)
-        with m.Elif(select_io):
-            m.d.comb += tdo.eq(io_tdo)
+        if io_tdo is not None:
+            with m.Elif(select_io):
+                m.d.comb += tdo.eq(io_tdo)
 
         # shiftregs block
         self._elaborate_shiftregs(
@@ -438,6 +439,8 @@ class TAP(Elaboratable):
             IOType.InTriOut: 3,
         }
         length = sum(connlength[conn._iotype] for conn in self._ios)
+        if length == 0:
+            return None
 
         io_sr = Signal(length)
         io_bd = Signal(length)
@@ -499,7 +502,6 @@ class TAP(Elaboratable):
 
         return io_sr[-1]
 
-
     def add_shiftreg(self, *, ircode, length, domain="sync", name=None, src_loc_at=0):
         """Add a shift register to the JTAG interface