Handle case with zero IO cells for boundary scan.
[c4m-jtag.git] / 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