Linear Feedback Shift Registers in pure Python3
Project description
FSR-Tools: Feedback/Feedforward Shift Registers in Python
Designed to test FSR Mathematically for verification of Verilog Design. This package provides an abstract base class for Feedback/Feedforward Shift Registers (FSRs) and two concrete implementations:
- Fibonacci LFSR (linear feedback)
- Galois LFSR (linear feedforward)
Supports:
- Custom characteristic polynomials
- Arbitrary initial states
- State table generation
- Algebraic polynomial form
- Bitwise access to register positions
Installation
Clone the repo and place the module in your project:
git clone https://github.com/anubhav-narayan/fsr-tools.git
Use poetry
poetry install
Usage
General Usage
from fsr_tools import Galois_LFSR as LFSR
lfsr = LFSR(poly=0b10011, state=0b1010)
# Get full cycle of states
print(lfsr.state_table)
# Access bits
print(lfsr[0]) # Read a bit
lfsr[4] = lfsr[3] & 0b1 # Write a bit
Usage with CoCoTB
from fsr_tools import Galois_LFSR as LFSR
from cocotb import BinaryValue
lfsr = LFSR(poly=0b10011, state=0b1010)
# Assign state
dut.lfsr.value = BinaryValue(lfsr.state, n_bits=lfsr.field_order)
Extend the FSR Abstract Class to create custom Feedback/Feedforward Shift Registers. Just override the round function.
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 fsr_tools-1.0.0.tar.gz.
File metadata
- Download URL: fsr_tools-1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4bb5187d0d9e291c20e4f1ab5c085dcd9b32499a50736e726ef3b7f8983268e
|
|
| MD5 |
d356e4f363b5a6b73eab3bc27fd7e2ff
|
|
| BLAKE2b-256 |
3f0a392ffaadb6fc37b94ae296f8f2dbfe6739d4b50ef615005f75acdb07a418
|
Provenance
The following attestation bundles were made for fsr_tools-1.0.0.tar.gz:
Publisher:
python-publish.yml on anubhav-narayan/fsr-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fsr_tools-1.0.0.tar.gz -
Subject digest:
b4bb5187d0d9e291c20e4f1ab5c085dcd9b32499a50736e726ef3b7f8983268e - Sigstore transparency entry: 413638918
- Sigstore integration time:
-
Permalink:
anubhav-narayan/fsr-tools@f168758d5e7b605362351809ea2fab94dbd44d4a -
Branch / Tag:
refs/heads/master - Owner: https://github.com/anubhav-narayan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f168758d5e7b605362351809ea2fab94dbd44d4a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file fsr_tools-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fsr_tools-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9abd8c8de9e2e9fbcfdc61b3b889a17652fceeba1a22f0aab509088f8fc7886
|
|
| MD5 |
0471624627ef4ee4e131444b1074e300
|
|
| BLAKE2b-256 |
49aadbdd6cfc9c0a51f793a6b795d3ed7a81aadf9edb484f9ea016f0822d9792
|
Provenance
The following attestation bundles were made for fsr_tools-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on anubhav-narayan/fsr-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fsr_tools-1.0.0-py3-none-any.whl -
Subject digest:
a9abd8c8de9e2e9fbcfdc61b3b889a17652fceeba1a22f0aab509088f8fc7886 - Sigstore transparency entry: 413638935
- Sigstore integration time:
-
Permalink:
anubhav-narayan/fsr-tools@f168758d5e7b605362351809ea2fab94dbd44d4a -
Branch / Tag:
refs/heads/master - Owner: https://github.com/anubhav-narayan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f168758d5e7b605362351809ea2fab94dbd44d4a -
Trigger Event:
workflow_dispatch
-
Statement type: