Compact Run Length Encoder & Decoder

This design includes a simple but extremely compact and fast run length encoder and decoder. The designs have deliberately been kept as simple as possible so they do not include any error checking. In particular, users must ensure that the maxRunLength parameter of the encoder is set to a sufficiently high value such that it is bigger than the longest run length that the encoder will see at its input, otherwise incorrect output data will be generated. For the decoder, users should avoid setting the RUN_LENGTH input to zero whilst VALID_IN is high, otherwise the internal counters will roll over and generate an output run of the maximum possible length.

A zip archive that includes all source files, testbenches, user guide and Tcl scripts is available here.

Run Length Encoder & Decoder

If you have any questions or comments about this design, please email me at