def test_conversion(self): bs = BitSequence(0xCA, msb=True, length=8) self.assertEqual('%02x' % bs.tobyte(False), '53') self.assertEqual('%02x' % bs.tobyte(True), 'ca') self.assertEqual(bs, BitSequence(bs.tobyte(True), msb=True, length=8)) self.assertRaises(BitSequenceError, BitZSequence.__int__, self.bzs5) self.assertRaises(BitSequenceError, BitZSequence.tobyte, self.bzs5) self.assertRaises(BitSequenceError, BitZSequence.tobytes, self.bzs5) bzs = BitZSequence(0xaa) self.assertEqual(int(bzs), 0xaa)
def _change_state(self, tms): """Change the TAP controller state""" if not isinstance(tms, BitSequence): raise Exception('Expect a BitSequence') length = len(tms) if not (0 < length < 8): raise Exception('Invalid TMS length') out = BitSequence(tms, length=8) # apply the last TDO bit if self._last is not None: out[7] = self._last # print("TMS", tms, (self._last is not None) and 'w/ Last' or '') # reset last bit self._last = None cmd = array('B', (Ftdi.WRITE_BITS_TMS_NVE, length-1, out.tobyte())) self._stack_cmd(cmd)
def write_tms(self, tms): """Change the TAP controller state""" if not isinstance(tms, BitSequence): raise JtagError("Expect a BitSequence") length = len(tms) if not (0 < length < 8): raise JtagError("Invalid TMS length") out = BitSequence(tms, length=8) # apply the last TDO bit if self._last is not None: out[7] = self._last # print_("TMS", tms, (self._last is not None) and 'w/ Last' or '') # reset last bit self._last = None cmd = Array("B", (Ftdi.WRITE_BITS_TMS_NVE, length - 1, out.tobyte())) self._stack_cmd(cmd) self.sync()
def write_tms(self, tms): """Change the TAP controller state""" if not isinstance(tms, BitSequence): raise JtagError('Expect a BitSequence') length = len(tms) if not (0 < length < 8): raise JtagError('Invalid TMS length') out = BitSequence(tms, length=8) # apply the last TDO bit if self._last is not None: out[7] = self._last # print "TMS", tms, (self._last is not None) and 'w/ Last' or '' # reset last bit self._last = None cmd = Array('B', [Ftdi.WRITE_BITS_TMS_NVE, length - 1, out.tobyte()]) self._stack_cmd(cmd) self.sync()