X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fjtag%2Fpd.py;h=2bbe9a474886b00eee8c6f2da98bb9b2147e322a;hb=c5213e2632847750695bca0b3a97b5b03573435e;hp=7f784eb138dbe19a28571978ece928ce011624d0;hpb=10aeb8ea8b183394cebc0033f048f49f4262b57d;p=libsigrokdecode.git diff --git a/decoders/jtag/pd.py b/decoders/jtag/pd.py index 7f784eb..2bbe9a4 100644 --- a/decoders/jtag/pd.py +++ b/decoders/jtag/pd.py @@ -62,6 +62,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['jtag'] + tags = ['Debug/trace'] channels = ( {'id': 'tdi', 'name': 'TDI', 'desc': 'Test data input'}, {'id': 'tdo', 'name': 'TDO', 'desc': 'Test data output'}, @@ -82,8 +83,8 @@ class Decoder(srd.Decoder): annotation_rows = ( ('bits-tdi', 'Bits (TDI)', (16,)), ('bits-tdo', 'Bits (TDO)', (17,)), - ('bitstrings-tdi', 'Bitstring (TDI)', (18,)), - ('bitstrings-tdo', 'Bitstring (TDO)', (19,)), + ('bitstrings-tdi', 'Bitstrings (TDI)', (18,)), + ('bitstrings-tdo', 'Bitstrings (TDO)', (19,)), ('states', 'States', tuple(range(15 + 1))), ) @@ -178,8 +179,9 @@ class Decoder(srd.Decoder): self.putx([jtag_states.index(self.oldstate), [self.oldstate]]) self.putp(['NEW STATE', self.state]) - # Upon SHIFT-IR/SHIFT-DR collect the current TDI/TDO values. - if self.state.startswith('SHIFT-'): + # Upon SHIFT-*/EXIT1-* collect the current TDI/TDO values. + if self.oldstate.startswith('SHIFT-') or \ + self.oldstate.startswith('EXIT1-'): if self.first_bit: self.ss_bitstring = self.samplenum self.first_bit = False @@ -197,31 +199,26 @@ class Decoder(srd.Decoder): self.bits_samplenums_tdi.insert(0, [self.samplenum, -1]) self.bits_samplenums_tdo.insert(0, [self.samplenum, -1]) - # Output all TDI/TDO bits if we just switched from SHIFT-* to EXIT1-*. - if self.oldstate.startswith('SHIFT-') and \ - self.state.startswith('EXIT1-'): + # Output all TDI/TDO bits if we just switched to UPDATE-*. + if self.state.startswith('UPDATE-'): self.es_bitstring = self.samplenum t = self.state[-2:] + ' TDI' - b = ''.join(map(str, self.bits_tdi)) - h = ' (0x%x' % int('0b' + b, 2) + ')' - s = t + ': ' + b + h + ', ' + str(len(self.bits_tdi)) + ' bits' + b = ''.join(map(str, self.bits_tdi[1:])) + h = ' (0x%x' % int('0b0' + b, 2) + ')' + s = t + ': ' + b + h + ', ' + str(len(self.bits_tdi[1:])) + ' bits' self.putx_bs([18, [s]]) - self.bits_samplenums_tdi[0][1] = self.samplenum # ES of last bit. - self.putp_bs([t, [b, self.bits_samplenums_tdi]]) - self.putx([16, [str(self.bits_tdi[0])]]) # Last bit. + self.putp_bs([t, [b, self.bits_samplenums_tdi[1:]]]) self.bits_tdi = [] self.bits_samplenums_tdi = [] t = self.state[-2:] + ' TDO' - b = ''.join(map(str, self.bits_tdo)) - h = ' (0x%x' % int('0b' + b, 2) + ')' - s = t + ': ' + b + h + ', ' + str(len(self.bits_tdo)) + ' bits' + b = ''.join(map(str, self.bits_tdo[1:])) + h = ' (0x%x' % int('0b0' + b, 2) + ')' + s = t + ': ' + b + h + ', ' + str(len(self.bits_tdo[1:])) + ' bits' self.putx_bs([19, [s]]) - self.bits_samplenums_tdo[0][1] = self.samplenum # ES of last bit. - self.putp_bs([t, [b, self.bits_samplenums_tdo]]) - self.putx([17, [str(self.bits_tdo[0])]]) # Last bit. + self.putp_bs([t, [b, self.bits_samplenums_tdo[1:]]]) self.bits_tdo = [] self.bits_samplenums_tdo = []