clean up unused python import statements
[c4m-jtag.git] / sim / cocotb / c4m_jtag.py
index 5deb89a1362f05293fecfac467ca24d2baa5b63a..fe014f381182feacf050b22dbd55cb6785ce305d 100644 (file)
@@ -1,8 +1,10 @@
 import cocotb
 from cocotb.triggers import Timer
 import cocotb
 from cocotb.triggers import Timer
-from cocotb.utils import get_sim_steps
 from cocotb.binary import BinaryValue
 
 from cocotb.binary import BinaryValue
 
+class JTAGException(Exception):
+    pass
+
 class JTAG_Clock(object):
     """
     Class for the JTAG clock, run cycle by cycle
 class JTAG_Clock(object):
     """
     Class for the JTAG clock, run cycle by cycle
@@ -62,7 +64,7 @@ class JTAG_Master(object):
 
     @cocotb.coroutine
     def cycle_clock(self, cycles=1):
 
     @cocotb.coroutine
     def cycle_clock(self, cycles=1):
-        if self.state == "Run" and self.tms:
+        if self.state == "Run" and self.tms == 1:
             self.state = "Scan"
         yield self.clkgen.Cycle(cycles)
 
             self.state = "Scan"
         yield self.clkgen.Cycle(cycles)
 
@@ -84,6 +86,12 @@ class JTAG_Master(object):
 
     @cocotb.coroutine
     def change_state(self, tms_list):
 
     @cocotb.coroutine
     def change_state(self, tms_list):
+        """
+        Put TAP in other state by giving a TMS sequence
+        This function does not detect if one ends up in reset or run
+        state afterwards, self.state has to be updated by caller
+        if that is the case.
+        """
         tms_copy = list(tms_list)
         while tms_copy:
             self.tms <= tms_copy.pop()
         tms_copy = list(tms_list)
         while tms_copy:
             self.tms <= tms_copy.pop()