Skip to main content

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.

Release files for fsr-tools 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fsr-tools 1.0.0
File Size Uploaded
fsr_tools-1.0.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fsr-tools 1.0.0
File Interpreter ABI Platform
fsr_tools-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / fsr_tools-1.0.0.tar.gz

Download URL fsr_tools-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b4bb5187d0d9e291c20e4f1ab5c085dcd9b32499a50736e726ef3b7f8983268e
BLAKE2b-256 checksum
How to use checksums
3f0a392ffaadb6fc37b94ae296f8f2dbfe6739d4b50ef615005f75acdb07a418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2025.

Transparency log

Release files / fsr_tools-1.0.0-py3-none-any.whl

Download URL fsr_tools-1.0.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9abd8c8de9e2e9fbcfdc61b3b889a17652fceeba1a22f0aab509088f8fc7886
BLAKE2b-256 checksum
How to use checksums
49aadbdd6cfc9c0a51f793a6b795d3ed7a81aadf9edb484f9ea016f0822d9792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page