summaryrefslogtreecommitdiff
path: root/decoders/parallel/pd.py
AgeCommit message (Collapse)Author
2020-11-11parallel: adjust Python output to match its documentationGerhard Sittig
The parallel decoder documented the layout of the Python output but used to emit something different (mere data values). Add the bit width of data items and the bus cycle count for demultiplexed words, to match the documented layout. No harm was done, there are no in-tree decoders which stack on top of the parallel decoder.
2020-11-11parallel: rephrase word accumulation after reset introductionGerhard Sittig
Straighten the accumulation of words from bit chunks that are spread across several bus cycles (multiplexed transmission). Simplify the PD's instance variables, keep more state in local vars and explicitly pass related information to API calls. This also unobfuscates the emission of annotations and simplifies future maintenance. Split the accumulation of word data and the emission of its annotation such that reset related activity can flush accumulated data. Introduce a warning when word data gets emitted which does not match the configured word width (early de-assertion of select/enable, or unexpected reset). Presenting this data and amending it with a warning is considered more desirable than not seeing the data at all. This does not affect previous use cases since support for the reset signal was only introduced lately. Also emit annotations in a more logical order. It's unexpected to see the resulting word before its last item is seen. Graphical presentation may not care but automated processing of the decoder output will. This is the previous order of annotation emission which is surprising and got fixed in this commit: 3768240-4118229 parallel: item: "3" 3768240-4468218 parallel: word: "33" 4118229-4468218 parallel: item: "3" 4468218-4818202 parallel: item: "3" 4468218-5268189 parallel: word: "32" 4818202-5268189 parallel: item: "2" 5268189-5368185 parallel: item: "2" 5268189-5568180 parallel: word: "28" 5368185-5568180 parallel: item: "8" 5568180-5668176 parallel: item: "0" 5568180-5868171 parallel: word: "08" 5668176-5868171 parallel: item: "8" 5868171-5968166 parallel: item: "0" 5868171-6168162 parallel: word: "01" 5968166-6168162 parallel: item: "1" 6168162-6268157 parallel: item: "0" 6168162-6468152 parallel: word: "0c" 6268157-6468152 parallel: item: "c" This adjusted emission order won't pass the current test implementation, but manual inspection of the output reveals that all the expected data is present and matches previously extracted information: parallel/hd44780_word_demux/annotation ..................................... Output mismatch Testcase: parallel/hd44780_word_demux/annotation Test output mismatch: + 4118229-4468218 parallel: item: "3" - 4118229-4468218 parallel: item: "3" + 4818202-5268189 parallel: item: "2" - 4818202-5268189 parallel: item: "2" + 5368185-5568180 parallel: item: "8" - 5368185-5568180 parallel: item: "8" + 5668176-5868171 parallel: item: "8" - 5668176-5868171 parallel: item: "8" + 5968166-6168162 parallel: item: "1" - 5968166-6168162 parallel: item: "1" + 6268157-6468152 parallel: item: "c" - 6268157-6468152 parallel: item: "c"
2020-11-11parallel: add support for optional reset/enable/select signalGerhard Sittig
Add an optional 'reset' signal of user configurable polarity. When the signal is asserted, the data lines are not interpreted. Assertion will flush previously accumulated data bits and words. Deassertion can help synchronize to input streams when the capture started in the middle of a word. Despite the "reset" name this signal can also be thought of as "enable" or "select", and increases the versatility and usefulness of the parallel decoder beyond strictly parallel memory busses. Construct the list of .wait() conditions and track the positions of individual terms in that list. This is necessary because "always false" conditions are not available, thus pin/channel indices and .matched[] indices don't correspond for sparse input signal assignments. Accept when previously gathered information became void again, and re-use existing initialization code for reset related activity.
2020-11-11parallel: add option to sample data on either clock edgeGerhard Sittig
Add 'either' as another choice in addition to rising and falling clock edge. This is useful since parallel busses exist which communicate at double data rate (DDR). Unobfuscate the mapping between displayed option text and .wait() condition codes while we are here.
2020-11-11parallel: rephrase handling of data lines, symbolic upper boundGerhard Sittig
Strictly speaking this decoder considers all input signals as optional. The previous version accepted clock alone. Though reading values from zero data bits is of limited. Tighten the check for connected inputs. Inline the declaration of all channels in the decoder boiler plate, the helper routine was only used in a single spot. Change the order of the data lines stripe details and the .wait() conditions, improve locality of assignment and use of related variables. Don't assume that "all channels but clock" are data lines. Use a symbolic upper bound for the data lines partition, to prepare the introduction of a reset/enable signal.
2020-11-07parallel: symbolic names for pins and annotation classesGerhard Sittig
Concentrate tunables at the top of the source code. Eliminate magic numbers by replacing them with symbolic identifiers.
2020-01-01All PDs: Consistently use singular/plural for annotation classes/rows.Uwe Hermann
2019-03-15decoders: Add/update tags for each PD.Uwe Hermann
2019-03-13Add PD tags handling and some tagsSoeren Apel
2018-02-13parallel: expand 'wordsize' description (bits vs cycles)Gerhard Sittig
Users may not know which unit the "wordsize" is supposed to get specified in. Especially when it's not a number of bits, but instead the number of bus cycles. Expand the description text accordingly.
2018-01-01parallel: implement consistent number formattingGerhard Sittig
Print all annotations for individual data bit items and for the de-multiplexed words in a consistent style with leading zeros and constant width. This shall lend itself better to quick navigation during visual inspection, as well as automatic processing.
2018-01-01parallel: unbreak and improve "word" de-multiplexingGerhard Sittig
The previous implementation prepared but never fully enabled the accumulation of several multi-bit items into words that span multiple bus cycles (think: address or data de-multiplexing on memory busses). Complete the accumulation, and fixup the end samplenumber for word annotations. Fixup the endianess logic (the condition was inverted). Rephrase calculation to be more Python idiomatic. Default to word size zero, and only emit word annotations for non-zero word size specs. This keeps the implementation backwards compatible and still passes the test suite. Default behaviour is most appropriate for interactive use in GUI environments, while automated processing will find consistent behaviour across all setups (non-multiplexed busses, and multiplexed busses with "words" that span one or multiple cycles).
2018-01-01parallel: cope with sparse input mappings, assume zero for not-connected pinsGerhard Sittig
Cope when users only provide e.g. input lines D0 and D2 to the parallel decoder. Assume that not-connected pins are "always zero". Rephrase the .decode() logic which determines .wait() conditions while we are here, to slightly unobfuscate the implementation. This fixes bug #1088.
2018-01-01parallel: address minor style nits, no change in behaviourGerhard Sittig
Remove the redundant .itemcount variable, which exactly corresponds to the length of the .items array. Arrange retrieval of options and their evaluation closer to each other for improved readability. Use common logic to construct "words" from several multi-bit "items". Arrange for endianess support by optionally reversing the array before traversal.
2018-01-01parallel: unify decode() code paths with and without clock signalGerhard Sittig
Instead of implementing two main loops for operation in the presence and in the absence of a clock line, use a common main loop which operates on pre-determined wait conditions.
2017-12-22all decoders: introduce a reset() methodGerhard Sittig
Move initialization code of protocol decoders from the constructor to a new reset() helper method. The libsigrokdecode backend could run this method several times to clear the decoder's internal state, before new data from another acquisition gets fed to decode() calls.
2017-06-05Add srd_inst_initial_pins_set_all() and support code.Uwe Hermann
This allows frontends to set the assumed initial pins (i.e., the assumed state of the pins before the first sample of a capture) to user-specified values. The assumed initial pins can be either low, or high, or "use same value as the first sample of the capture". The special self.initial_pins decoder attribute is now removed.
2017-03-03Drop obsolete workarounds in PDs.Uwe Hermann
Some PDs were using a temporary workaround for (as it turned out) a refcounting issue that was fixed in 066fbafdc3ba734a73b5f7fcfa1dbae67ddebf8a.
2017-01-07license: remove FSF postal address from boiler plate license textGerhard Sittig
Remove the FSF postal address as it might change (it did in the past). Reference the gnu.org website instead which is more stable.
2016-12-07parallel: Convert to PD API version 3.Uwe Hermann
2014-08-14parallel: Enforce that at least one pin must be provided.Uwe Hermann
2014-07-15All PDs: Minor whitespace and consistency fixes.Uwe Hermann
- No newlines at the end of files. - No trailing ';' characters. - Comparison with None: Use 'is None' or 'is not None'. - Comparison with True/False: Use 'if cond:' or 'if not cond:'. - Various minor whitespace fixes.
2014-07-09All PDs: Drop unneeded exceptions.Uwe Hermann
In all current PDs it is not necessary to raise an exception upon invalid states (of the PD's state machine), since we can guarantee that no such invalid state can ever be reached in these PDs.
2014-04-15All PDs: Bump api_version to 2.Uwe Hermann
Older libsigrokdecode versions are no longer able to use the current versions of the PDs (various changes in syntax etc).
2014-04-13Rename 'probe' to 'channel' everywhere.Uwe Hermann
Variables of type 'struct srd_channel *' are consistently named 'pdch' to make them easily distinguishable from libsigrok's 'struct sr_channel *' variables that are consistently named 'ch'.
2014-03-12Various PDs: Minor option related fixes.Uwe Hermann
2014-03-10Probes, optional probes and annotations now take a tuple.Bert Vermeulen
Annotation entries also consist of a tuple, not a list.
2014-03-10Remove unused probes and optionsBert Vermeulen
2014-03-10Change PD options to be a tuple of dictionaries.Bert Vermeulen
Each option consists of a dictionary with the following keys: id The option id, which is passed in when setting a value. desc A description of the option, suitable for display. def The default value for this option. values (optional) If present, a tuple containing values the option may take. They must be of the same type as the default. Valid types for the options are UTF-8-encoded strings, integers, and floating point values.
2014-01-30s/out_proto/out_python/.Uwe Hermann
The output type is now called OUTPUT_PYTHON, adapt all PDs to that.
2014-01-28All PDs: Drop unneeded comments.Uwe Hermann
The single comment re-stating the PD's name / description / purpose in each pd.py file is not really needed, that info is available in the Decoder class' attributes already.
2014-01-13parallel: Make CLK probe optional.Uwe Hermann
When no CLK probe is supplied to this PD, handle any transition on any of the supplied data probes as if there had been a CLK transition. (based on a suggestion/patch by "bmx" from the #sigrok channel, thanks!)
2013-12-04parallel: start(): Drop obsoleted metadata parameter.Uwe Hermann
This fixes bug #202.
2013-11-15Drop obsolete report() method.Bert Vermeulen
2013-11-15Use the new Decoder.register() APIBert Vermeulen
2013-11-07Rename inter-PD output type to SRD_OUTPUT_PYTHONBert Vermeulen
This better reflects what it is: a python object generated and processed by python code.
2013-10-21parallel: Limit number of probes to 8 for now.Uwe Hermann
This will be increased again at some later point.
2013-10-20Add initial sync parallel bus decoder.Uwe Hermann