add JTAG module to test example
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 13 Nov 2021 22:10:15 +0000 (22:10 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 13 Nov 2021 22:10:15 +0000 (22:10 +0000)
src/spec/testing_stage1.py

index 74109dd68be20964eeb602440e49b7fee41a92c0..1f4e9e8c3698d62c4585f89bb448ff45b8f993e5 100644 (file)
@@ -3,6 +3,7 @@ from nmigen.build.dsl import Resource, Subsignal, Pins
 from nmigen.build.plat import TemplatedPlatform
 from nmigen import Elaboratable, Signal, Module, Instance
 from collections import OrderedDict
+from jtag import JTAG
 
 # Was thinking of using these functions, but skipped for simplicity for now
 # XXX nope.  the output from JSON file.
@@ -95,10 +96,12 @@ def I2CResource(*args, scl, sda):
 # ridiculously-simple top-level module.  doesn't even have a sync domain
 # and can't have one until a clock has been established by DummyPlatform.
 class Blinker(Elaboratable):
-    def __init__(self):
-        pass
+    def __init__(self, pinset):
+        self.jtag = JTAG(pinset, "sync")
+
     def elaborate(self, platform):
         m = Module()
+        m.submodules.jtag = self.jtag
         count = Signal(5)
         m.d.sync += count.eq(5)
         print ("resources", platform.resources.items())
@@ -216,5 +219,5 @@ resources = create_resources(pinset)
 print(pinset)
 print(resources)
 p = DummyPlatform (resources)
-p.build(Blinker())
+p.build(Blinker(pinset))