Skip to main content

FPGA Assembly (FASM) Parser and Generation library

Project description

FPGA Assembly (FASM) Parser and Generation library

This repository documents the FASM file format and provides parsing libraries and simple tooling for working with FASM files.

It provides both a pure Python parser based on textx and a significantly faster C parser based on ANTLR. The library will try and use the ANTLR parser first and fall back to the textx parser if the compiled module is not found.

Which parsers are supported by your currently install can be found via python3 -c "import fasm.parser as p; print(p.available). The currently in use parser can be found via fasm.parser.implementation.

It is highly recommended to use the ANTLR parser as it is about 15 times faster.

functions for parsing and generating FASM files.

Build Instructions

CMake is required, and ANTLR has a few dependencies:

sudo apt install cmake default-jre-headless uuid-dev libantlr4-runtime-dev

Pull dependencies in third_party:

git submodule update --init

Build:

make build

Test with:

python setup.py test

The ANTLR runtime can either be linked statically or as a shared library. Use the --antlr-runtime=[static|shared] flag to select between the two modes e.g.:

python setup.py install --antlr-runtime=shared

Or, using pip:

pip install . --install-option="--antlr-runtime=shared" --no-use-pep517

The runtime will be built and statically linked by default. This flag is available in the build_ext, build, develop, and install commands.

The --no-use-pep517 flag is needed because there is currently no way to pass flags with PEP517.
Relevant issue: https://github.com/pypa/pip/issues/5771

FPGA Assembly (FASM)

FPGA Assembly is a file format designed by the SymbiFlow Project developers to provide a plain text file format for configuring the internals of an FPGA.

It is designed to allow FPGA place and route to not care about the actual bitstream format used on an FPGA.

FASM Ecosystem Diagram

Properties

  • Removing a line from a FASM file leaves you with a valid FASM file.
  • Allow annotation with human readable comments.
  • Allow annotation with "computer readable" comments.
  • Has syntactic sugar for expressing memory / lut init bits / other large arrays of data.
  • Has a canonical form.
  • Does not require any specific bitstream format.

Supported By

FASM is currently supported by the SymbiFlow Verilog to Routing fork, but we hope to get it merged upstream sometime soon.

It is also used by Project X-Ray.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fasm-0.0.2.post78.tar.gz (80.4 kB view hashes)

Uploaded Source

Built Distributions

fasm-0.0.2.post78-pp37-pypy37_pp73-win_amd64.whl (67.1 kB view hashes)

Uploaded PyPy Windows x86-64

fasm-0.0.2.post78-pp37-pypy37_pp73-macosx_10_15_x86_64.whl (395.6 kB view hashes)

Uploaded PyPy macOS 10.15+ x86-64

fasm-0.0.2.post78-pp36-pypy36_pp73-win32.whl (67.1 kB view hashes)

Uploaded PyPy Windows x86

fasm-0.0.2.post78-pp36-pypy36_pp73-macosx_10_15_x86_64.whl (395.6 kB view hashes)

Uploaded PyPy macOS 10.15+ x86-64

fasm-0.0.2.post78-cp39-cp39-win_amd64.whl (67.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

fasm-0.0.2.post78-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (788.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

fasm-0.0.2.post78-cp39-cp39-macosx_10_15_x86_64.whl (416.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.15+ x86-64

fasm-0.0.2.post78-cp38-cp38-win_amd64.whl (67.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

fasm-0.0.2.post78-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (810.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

fasm-0.0.2.post78-cp38-cp38-macosx_10_15_x86_64.whl (415.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

fasm-0.0.2.post78-cp37-cp37m-win_amd64.whl (67.1 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

fasm-0.0.2.post78-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (759.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

fasm-0.0.2.post78-cp37-cp37m-macosx_10_15_x86_64.whl (414.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.15+ x86-64

fasm-0.0.2.post78-cp36-cp36m-win_amd64.whl (67.1 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

fasm-0.0.2.post78-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (761.9 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

fasm-0.0.2.post78-cp36-cp36m-macosx_10_15_x86_64.whl (413.6 kB view hashes)

Uploaded CPython 3.6m macOS 10.15+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page