|
| 1 | += demux_generic(9) |
| 2 | + |
| 3 | +== NAME |
| 4 | + |
| 5 | +demux_generic - routes a single input signal to one of multiple outputs |
| 6 | + |
| 7 | +== SYNOPSIS |
| 8 | + |
| 9 | +**loadrt demux_generic config="**__<input_type><output_type><size>__[,__<input_type><output_type><size>__],...**"** |
| 10 | + |
| 11 | +Types: **b** = bit, **f** = float, **s** = signed integer, **u** = unsigned integer |
| 12 | + |
| 13 | +Example: |
| 14 | +**loadrt demux_generic config="**bb8,fu12**"** |
| 15 | + |
| 16 | + |
| 17 | +== FUNCTIONS |
| 18 | + |
| 19 | +**demux-gen.**_NN_ Depending on the data types can run in either a floating point or non-floating point thread. |
| 20 | + |
| 21 | +== PINS |
| 22 | + |
| 23 | + demux-gen.NN.sel-bit-00 ───────────────────┐ |
| 24 | + ... ─────────────────┐ │ |
| 25 | + demux-gen.NN.sel-bit-BB ───────────────┐ │ │ |
| 26 | + demux-gen.NN.sel-int ─────────────┐ │ │ │ |
| 27 | + ┌───────┴─┴─┴─┴───────┐ |
| 28 | + │ / o───── ├───── demux-gen.NN.out-[bit/float/s32/u32]-00 |
| 29 | +demux-gen.NN.in-[bit/float/s32/u32] ─────┤ ─────o o───── ├───── ... |
| 30 | + │ o───── ├───── demux-gen.NN.out-[bit/float/s32/u32]-MM |
| 31 | + demux-gen.NN.suppress-no-input ─────┤ │ |
| 32 | + demux-gen.NN.debounce-us ─────┤ │ |
| 33 | + └─────────────────────┘ |
| 34 | + |
| 35 | +**demux-gen**.__N__.**suppress-no-input** bit in:: |
| 36 | + This suppresses changing the output if all select lines are false. |
| 37 | + This stops unwanted jumps in output between transitions of input but makes in00 unavailable. |
| 38 | +**demux-gen**.__N__.**debounce-us** unsigned in:: |
| 39 | + sets debounce time in microseconds, e.g. 100000 = a tenth of a second. |
| 40 | + The selection inputs must be stable this long before the output |
| 41 | + changes. This helps to ignore 'noisy' switches. |
| 42 | +**demux-gen**.__N__.**sel-bit-**__BB__ bit in (BB=0..bit width of _size_):: |
| 43 | +**demux-gen**.__N__.**sel-int** unsigned in:: |
| 44 | + The sel-bit pins are only created when the size of the demux_gen |
| 45 | + component is an integer power of two. |
| 46 | + Together, these determine to which **out**-__MM__ the **in** value is forwarded. |
| 47 | + The bit pins are interpreted as binary bits, and the result is simply |
| 48 | + added on to the integer pin input. It is expected that either one or |
| 49 | + the other would normally be used. However, the possibility exists to |
| 50 | + use a higher-order bit to "shift" the values set by the integer pin. |
| 51 | +**demux-gen**.__N__.**in-**[**bit**/**float**/**s32**/**u32**] variable-type in:: |
| 52 | + The input value which is routed to an output depending on the selection pins. |
| 53 | +**demux-gen**.__N__.**out-**[**bit**/**float**/**s32**/**u32**]**-**__MM__ variable-type out (M=0..size-1):: |
| 54 | + According to the selection bits and/or the selection number, the selected output |
| 55 | + follows the **in** value. The other outputs retain the values they had before |
| 56 | + resp. zero if they have not been selected yet. Values will be |
| 57 | + converted/truncated according to standard C rules. This means, for |
| 58 | + example that a float input greater than 2147483647 will give an S32 |
| 59 | + output of -2147483648. |
| 60 | + |
| 61 | +== PARAMETERS |
| 62 | + |
| 63 | +**demux-gen**.__N__.**elapsed** float r:: |
| 64 | + Current value of the internal debounce timer for debugging. |
| 65 | +**demux-gen**.__N__.**selected** s32 r:: |
| 66 | + Current value of the internal selection variable after conversion for debugging. |
| 67 | + Possibly useful for setting up gray-code switches. |
| 68 | + |
| 69 | +== DESCRIPTION |
| 70 | + |
| 71 | +This component is a general demultiplexer component. |
| 72 | +It allows the creation of arbitrary-size demultiplexers (up to |
| 73 | +1024 entries) and also supports differing data types on the input and |
| 74 | +output pins. The configuration string is a comma-separated list of |
| 75 | +code-letters and numbers, such as "bb4,fu12". This would create a |
| 76 | +4-element bit-to-bit demux and a 12-element float-to-unsigned demux. |
| 77 | +The code letters are: |
| 78 | + |
| 79 | +**b** = bit, |
| 80 | +**f** = float, |
| 81 | +**s** = signed integer and |
| 82 | +**u** = unsigned integer. |
| 83 | + |
| 84 | +The first letter code is the input type, the second is the |
| 85 | +output type. The codes are not case-sensitive. The order of the letters |
| 86 | +is significant but the position in the string is not. Do not insert any |
| 87 | +spaces in the config string. Any non-zero float value will be converted |
| 88 | +to a "true" output in bit form. Be wary that float datatypes can be |
| 89 | +very, very, close to zero and not actually be equal to zero. |
| 90 | + |
| 91 | +Each demux has its own HAL function and must be added to a thread |
| 92 | +separately. If neither input nor output is of type float then the |
| 93 | +function is base-thread (non floating-point) safe. Any demux_generic with |
| 94 | +a floating point input or output can only be added to a floating-point |
| 95 | +thread. |
| 96 | + |
| 97 | +== SEE ALSO |
| 98 | + |
| 99 | +mux_generic(9) |
| 100 | + |
| 101 | +== AUTHOR |
| 102 | + |
| 103 | +Hans Unzner |
| 104 | + |
| 105 | +== LICENSE |
| 106 | + |
| 107 | +GPL |
| 108 | + |
0 commit comments