diff options
author | Konrad Beckmann <konrad.beckmann@gmail.com> | 2020-06-22 03:55:07 +0200 |
---|---|---|
committer | Konrad Beckmann <konrad.beckmann@gmail.com> | 2020-06-23 21:25:28 +0200 |
commit | 36d499e09aaf4e6145a32b732632a99fec1b3d57 (patch) | |
tree | f70c0890fe7bd0ed0d0011b725256c57932ecc4d /decoders/jtag | |
parent | 40d8835137935cd71127823e4627a11abc71b72d (diff) | |
download | libsigrokdecode-36d499e09aaf4e6145a32b732632a99fec1b3d57.tar.gz libsigrokdecode-36d499e09aaf4e6145a32b732632a99fec1b3d57.zip |
jtag: Use list.append instead of insert
Improve processing time by appending bits
instead of inserting them to the lists.
Diffstat (limited to 'decoders/jtag')
-rw-r--r-- | decoders/jtag/pd.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/decoders/jtag/pd.py b/decoders/jtag/pd.py index 00602bb..5fa63ab 100644 --- a/decoders/jtag/pd.py +++ b/decoders/jtag/pd.py @@ -183,18 +183,18 @@ class Decoder(srd.Decoder): self.ss_bitstring = self.samplenum self.first_bit = False else: - self.putx([16, [str(self.bits_tdi[0])]]) - self.putx([17, [str(self.bits_tdo[0])]]) + self.putx([16, [str(self.bits_tdi[-1])]]) + self.putx([17, [str(self.bits_tdo[-1])]]) # Use self.samplenum as ES of the previous bit. - self.bits_samplenums_tdi[0][1] = self.samplenum - self.bits_samplenums_tdo[0][1] = self.samplenum + self.bits_samplenums_tdi[-1][1] = self.samplenum + self.bits_samplenums_tdo[-1][1] = self.samplenum - self.bits_tdi.insert(0, tdi) - self.bits_tdo.insert(0, tdo) + self.bits_tdi.append(tdi) + self.bits_tdo.append(tdo) # Use self.samplenum as SS of the current bit. - self.bits_samplenums_tdi.insert(0, [self.samplenum, -1]) - self.bits_samplenums_tdo.insert(0, [self.samplenum, -1]) + self.bits_samplenums_tdi.append([self.samplenum, -1]) + self.bits_samplenums_tdo.append([self.samplenum, -1]) # Output all TDI/TDO bits if we just switched to UPDATE-*. if self.state.value.startswith('UPDATE-'): @@ -202,6 +202,8 @@ class Decoder(srd.Decoder): self.es_bitstring = self.samplenum t = self.state.value[-2:] + ' TDI' + self.bits_tdi.reverse() + self.bits_samplenums_tdi.reverse() 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' @@ -211,6 +213,8 @@ class Decoder(srd.Decoder): self.bits_samplenums_tdi = [] t = self.state.value[-2:] + ' TDO' + self.bits_tdo.reverse() + self.bits_samplenums_tdo.reverse() 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' |