8B10B Encoding and Decoding
Project description
encdec8b10b
Encode and decode 8B10B encoding
Get
python3 -m pip install encdec8b10b
Usage
Encode Data Byte
from encdec8b10b import EncDec8B10B
running_disp = 0
byte_to_enc = 0xf
running_disp, encoded = EncDec8B10B.enc_8b10b(byte_to_enc, running_disp)
print(hex(encoded))
Output >> 0xba
Encode Control Byte
from encdec8b10b import EncDec8B10B
running_disp = 0
byte_to_enc = 0xbc # comma
ctrl = 1
running_disp, encoded = EncDec8B10B.enc_8b10b(byte_to_enc, running_disp, ctrl)
print(hex(encoded))
Output >> 0x17c
Decode Data Byte
from encdec8b10b import EncDec8B10B
byte_to_dec = 0xba
ctrl, decoded = EncDec8B10B.dec_8b10b(byte_to_dec)
print(hex(decoded))
Output >> 0xf
# ctrl variable confirm that it was a data byte
print(ctrl)
Output >> 0
Decode Control Byte
from encdec8b10b import EncDec8B10B
byte_to_dec = 0x17c # comma encoded
ctrl, decoded = EncDec8B10B.dec_8b10b(byte_to_dec)
print(hex(decoded))
Output >> 0xbc
# ctrl variable confirm that it was a control byte
print(ctrl)
Output >> 1
Verbosity
Both functions have a verbose-mode to make it easier to confirm everything that's happening:
from encdec8b10b import EncDec8B10B
running_disp = 0
byte_to_enc = 0xA0
running_disp, encoded = EncDec8B10B.enc_8b10b(byte_to_enc, running_disp, verbose=True)
Output >> Encoder - In: A0 - Encoded: 146 - Running Disparity: 0
ctrl, decoded = EncDec8B10B.dec_8b10b(encoded, verbose=True)
Output >> Decoded: A0 - Control: 0
8B10B
8B10B Encoding were implemented by Al Widmer and Peter Franaszek in 1983. It is still widely used in high-speed electronics.
Thanks
- Ryu Shinhyung for creating the tables used in this module
- Chuck Benz for creating awesome combinational 8B10B modules
- Alex Forencich for his 8B10B Matlab script
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
encdec8b10b-1.0.tar.gz
(21.5 kB
view details)
Built Distribution
encdec8b10b-1.0-py3-none-any.whl
(43.2 kB
view details)
File details
Details for the file encdec8b10b-1.0.tar.gz
.
File metadata
- Download URL: encdec8b10b-1.0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 253c9db4465694513a49ca4a01f3ed74b806dc901dbbd4c06e7ea654f468a882 |
|
MD5 | 88a9970d16c5e8a2db3036a4a24895bf |
|
BLAKE2b-256 | 844e062bb8887b6646e2b8826ad0e5d4b68e1fe2fe9da8be3252e5801a97305e |
File details
Details for the file encdec8b10b-1.0-py3-none-any.whl
.
File metadata
- Download URL: encdec8b10b-1.0-py3-none-any.whl
- Upload date:
- Size: 43.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cc5a16c3695d0bc8dd4ccf63ff92e5b59b52a67eedcd5b9d180710fa25427ae |
|
MD5 | d6ed5d4dac8045c5f3c57ec20c96fab8 |
|
BLAKE2b-256 | 9e940bee06e78719cee450726739aa98af8b34deca6864089839b8760cb1ad08 |