move pin-adding into separate function in JTAG class
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 28 Nov 2021 11:22:27 +0000 (11:22 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 28 Nov 2021 11:22:27 +0000 (11:22 +0000)
src/spec/jtag.py

index e9bc75d5565442b9a7677f6e64dd3b40a514ffae..56aadbb839707b8041cf6fa4fede354508790bf2 100644 (file)
@@ -80,11 +80,7 @@ class JTAG(TAP, Pins):
         # we store the boundary scan register offset in the IOConn record
         self.ios = {} # these are enumerated in external_ports
         self.scan_len = 0
-        for fn, pin, iotype, pin_name, scan_idx in list(self):
-            io = self.add_io(iotype=iotype, name=pin_name)
-            io._scan_idx = scan_idx # hmm shouldn't really do this
-            self.scan_len += scan_idx # record full length of boundary scan
-            self.ios[pin_name] = io
+        self.add_pins(list(self))
 
         # this is redundant.  or maybe part of testing, i don't know.
         self.sr = self.add_shiftreg(ircode=4, length=3,
@@ -111,6 +107,13 @@ class JTAG(TAP, Pins):
         self.sr_en = self.add_shiftreg(ircode=11, length=len(en_sigs),
                                        domain=domain)
 
+    def add_pins(self, pinlist):
+        for fn, pin, iotype, pin_name, scan_idx in pinlist:
+            io = self.add_io(iotype=iotype, name=pin_name)
+            io._scan_idx = scan_idx # hmm shouldn't really do this
+            self.scan_len += scan_idx # record full length of boundary scan
+            self.ios[pin_name] = io
+
     def elaborate(self, platform):
         m = super().elaborate(platform)
         m.d.comb += self.sr.i.eq(self.sr.o) # loopback as part of test?