ECCGen: Error Correcting Code Generator
Project description
ECCGen: Error Correcting Code Generator
A Python tool that solves for a valid ECC construction given some input parameters and writes the generator (G) and parity-check (H) matrices to plain text output files. You can use the generator matrix to implement an encoder and the parity-check matrix to implement the complementary decoder.
Usage (uv)
Setup:
uv sync
Run the installed CLI:
uv run eccgen --help
uv run eccgen --scheme hsiao_secded --message-size 42 --generator-matrix-output "$(pwd)/G.txt" --parity-check-matrix-output "$(pwd)/H.txt"
Or run it as a module:
uv run python -m eccgen --help
uv run python -m eccgen -s hsiao_secded -k 42 -G "$(pwd)/G.txt" -H "$(pwd)/H.txt"
Build distributable artifacts:
uv build
Install the built wheel into another environment:
uv pip install dist/eccgen-*.whl
Run the Python tests:
uv run python -m unittest eccgen.hsiao_secded_test eccgen.matrix_parser_test
Run lint and formatting:
uv run ruff check . --fix
uv run ruff format .
uv run pre-commit run --all-files
You can find pre-generated G-H pairs for powers-of-2 message and codeword sizes in eccgen/matrices.
Usage (Bazel)
You can use Bazel to run and test the tool, as well as depend on it from your own Bazel-based projects with Bzlmod. Bazel tests are currently the source of truth for the repo.
Run the tool:
bazel run //eccgen:eccgen -- --scheme hsiao_secded --message-size 42 --generator-matrix-output "$(pwd)/G.txt" --parity-check-matrix-output "$(pwd)/H.txt"
Run the unit tests:
bazel test //...
To depend on the tool from your own Bazel-based project, add the following to your MODULE.bazel file:
bazel_dep(name = "eccgen", version = "0.1.0")
git_override(
module_name = "eccgen",
commit = <FILL IN SHA HERE>,
remote = "https://github.com/xlsynth/eccgen",
)
(At some point, we'll publish to the Bazel Central Registry.)
Hsiao Codes
Currently, the tool only supports Hsiao single-error-correcting, double-error-detecting (SECDED) codes, which are commonly found in digital circuit designs. The tool can be extended to support other codes.
The Hsiao code solver is based on the algorithms from the following papers:
We only use the optimal solver up to k = 256; beyond that, we use a greedy solution which is still SECDED, but does not qualify as a Hsiao code.
Contributing
We welcome your contributions. Please feel free to open an issue or submit a pull request.
We use GitHub Actions for CI: we run the pre-commit checks and all the Bazel tests. For local Python dependency management we use uv; if you change Python dependencies, regenerate the Bazel lockfile with bazel run //:requirements_3_12.update.
License
This project is licensed under the Apache License 2.0.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eccgen-0.1.2.tar.gz.
File metadata
- Download URL: eccgen-0.1.2.tar.gz
- Upload date:
- Size: 61.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3b3a82470f4a39219109aa13a8ed8c10ffae9f3058b7e497f68a7f896bedb32
|
|
| MD5 |
c4466a14c37699a299873fee1653b407
|
|
| BLAKE2b-256 |
d650a2c1a0c5282f9c58de457a2d22b15a4108528c1fb9cefcbcf88a8dec8e61
|
File details
Details for the file eccgen-0.1.2-py3-none-any.whl.
File metadata
- Download URL: eccgen-0.1.2-py3-none-any.whl
- Upload date:
- Size: 79.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d976387f1ede76f0c04eef24d75d1d4975c0436d7e343a91ed53cb03f5a748e
|
|
| MD5 |
4edc756c6887c5d765cb587a123f0f16
|
|
| BLAKE2b-256 |
40cbc24541e144ad3b6761e7b741b692aa518bfc2c06e1e3b9cb0a13c91a29a5
|