diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2018-06-21 21:43:22 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2018-06-22 12:10:52 +0200 |
commit | aaaf37e1229ca414d4e077b3ce9d05cfd7b19e7f (patch) | |
tree | aafd8a1cf6dd69b4fd26283461f1e6420fceb033 /decoders/jtag_ejtag | |
parent | d1b7bd1b602149cef4183f5a05188c0467bcd280 (diff) | |
download | libsigrokdecode-aaaf37e1229ca414d4e077b3ce9d05cfd7b19e7f.tar.gz libsigrokdecode-aaaf37e1229ca414d4e077b3ce9d05cfd7b19e7f.zip |
jtag_ejtag: Simplify two code snippets.
Diffstat (limited to 'decoders/jtag_ejtag')
-rw-r--r-- | decoders/jtag_ejtag/pd.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/decoders/jtag_ejtag/pd.py b/decoders/jtag_ejtag/pd.py index 9af3ad7..38933ec 100644 --- a/decoders/jtag_ejtag/pd.py +++ b/decoders/jtag_ejtag/pd.py @@ -231,10 +231,7 @@ class Decoder(srd.Decoder): self.out_ann = self.register(srd.OUTPUT_ANN) def select_reg(self, ir_value: int): - if ir_value in ejtag_state_map: - self.state = ejtag_state_map[ir_value] - else: - self.state = State.RESET + self.state = ejtag_state_map.get(ir_value, State.RESET) def parse_pracc(self): control_in = bin_to_int(self.last_data['in']['data'][0]) @@ -270,12 +267,7 @@ class Decoder(srd.Decoder): def parse_control_reg(self, ann): reg_write = ann == Ann.CONTROL_FIELD_IN control_bit_positions = [] - data_select = '' - - if reg_write: - data_select = 'in' - else: - data_select = 'out' + data_select = 'in' if (reg_write) else 'out' control_bit_positions = self.last_data[data_select]['data'][1] control_data = self.last_data[data_select]['data'][0] |