Skip to main content

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 F4PGA 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 F4PGA Verilog to Routing fork, but we hope to get it merged upstream sometime soon.

It is also used by Project X-Ray.

Release files for fasm 0.0.2.post100

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

Built distributions (wheels)

Table of built distributions (wheels) for fasm 0.0.2.post100
File
fasm-0.0.2.post100-pp37-pypy37_pp73-win_amd64.whl PyPy 3.7 PyPy 3.7 7.3 Windows x86-64 Details
fasm-0.0.2.post100-pp37-pypy37_pp73-macosx_11_0_x86_64.whl PyPy 3.7 PyPy 3.7 7.3 macOS 11.0+ x86-64 Details
fasm-0.0.2.post100-pp36-pypy36_pp73-win32.whl PyPy 3.6 PyPy 3.6 7.3 Windows x86-32 Details
fasm-0.0.2.post100-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
fasm-0.0.2.post100-cp39-cp39-macosx_11_0_x86_64.whl CPython 3.9 CPython 3.9 macOS 11.0+ x86-64 Details
fasm-0.0.2.post100-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
fasm-0.0.2.post100-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
fasm-0.0.2.post100-cp38-cp38-macosx_11_0_x86_64.whl CPython 3.8 CPython 3.8 macOS 11.0+ x86-64 Details
fasm-0.0.2.post100-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
fasm-0.0.2.post100-cp37-cp37m-macosx_11_0_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 11.0+ x86-64 Details
fasm-0.0.2.post100-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
fasm-0.0.2.post100-cp36-cp36m-macosx_11_0_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 11.0+ x86-64 Details

Total release size: 3.3 MB

Release files / fasm-0.0.2.post100-pp37-pypy37_pp73-win_amd64.whl

Download URL fasm-0.0.2.post100-pp37-pypy37_pp73-win_amd64.whl
Size 73.8 kB
Tags PyPy 3.7 PyPy 3.7 7.3 Windows x86-64
SHA-256 checksum
How to use checksums
ae97ccf86628133ae2f6701b2dfd525b4a9251005b4f5c408a98d1296df3f52f
BLAKE2b-256 checksum
How to use checksums
e12ee9724c6bd019ba5794ece14d9ec7607ff359077eed1a166550e8002fa7f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 PyPy/7.3.9

Release files / fasm-0.0.2.post100-pp37-pypy37_pp73-macosx_11_0_x86_64.whl

Download URL fasm-0.0.2.post100-pp37-pypy37_pp73-macosx_11_0_x86_64.whl
Size 399.0 kB
Tags PyPy 3.7 PyPy 3.7 7.3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
48fedde002a0f4dd909223f78f70e77d01180aecb1a97b61d82728ac00932499
BLAKE2b-256 checksum
How to use checksums
ca367538de4a8029c1466cdb5ae07c4e289f4cf65b6011f1ead05bafef89fbc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 PyPy/7.3.9

Release files / fasm-0.0.2.post100-pp36-pypy36_pp73-win32.whl

Download URL fasm-0.0.2.post100-pp36-pypy36_pp73-win32.whl
Size 73.8 kB
Tags PyPy 3.6 PyPy 3.6 7.3 Windows x86-32
SHA-256 checksum
How to use checksums
bea2862225219f1dab75c6d2102b0b12f3a904472285f97ca6e576d47a47de8a
BLAKE2b-256 checksum
How to use checksums
76f9bddb55dd29858ab3cc5035acfd697c77cfbe09b42759ecd068eba167d12e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 PyPy/7.3.3

Release files / fasm-0.0.2.post100-cp39-cp39-win_amd64.whl

Download URL fasm-0.0.2.post100-cp39-cp39-win_amd64.whl
Size 73.8 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
83c017fa45dbd98684410a64d2babae2f9cfbcc5649b26adb2f0dead2e365024
BLAKE2b-256 checksum
How to use checksums
fd881e34854e09eab7025110128fa025fa675128bb651bbff57067ebcdb9edb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / fasm-0.0.2.post100-cp39-cp39-macosx_11_0_x86_64.whl

Download URL fasm-0.0.2.post100-cp39-cp39-macosx_11_0_x86_64.whl
Size 420.4 kB
Tags CPython 3.9 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
f0992a6216eddfd4a25d1332a08f9b8daa36a67ee84dee4c084921ed9355ff29
BLAKE2b-256 checksum
How to use checksums
cd1e272517e26b3052181bd7132a6805445a3d910bead28dcb0d8280cd761fe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / fasm-0.0.2.post100-cp38-cp38-win_amd64.whl

Download URL fasm-0.0.2.post100-cp38-cp38-win_amd64.whl
Size 73.8 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
590a54e7d4e4897f02ad2e67edbfb825dd3f629cd07e88aeac37622c1da164d5
BLAKE2b-256 checksum
How to use checksums
258ae56d03dc90fe310ed52f183da094ee65e68e4cf54563d63468babac8c11d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / fasm-0.0.2.post100-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Download URL fasm-0.0.2.post100-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Size 820.3 kB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
c73de7af79b5271bd5344c39f293d3728ee69dcc69aef4115f529af82ca88adb
BLAKE2b-256 checksum
How to use checksums
807890c58394b5f3307a40c4c6737ae6099d4103ddb822f6980269837097d4d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / fasm-0.0.2.post100-cp38-cp38-macosx_11_0_x86_64.whl

Download URL fasm-0.0.2.post100-cp38-cp38-macosx_11_0_x86_64.whl
Size 419.0 kB
Tags CPython 3.8 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
2054935da2b2d04587069ce415e3cc6cf425cf2352405e3c81917edc9a49c19d
BLAKE2b-256 checksum
How to use checksums
cb7b2001a45749453288f73e90280f722d6ccf96029701165097c9741f79b6ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / fasm-0.0.2.post100-cp37-cp37m-win_amd64.whl

Download URL fasm-0.0.2.post100-cp37-cp37m-win_amd64.whl
Size 73.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
456b9a30c3d6f94df45cf93e733aae6907223b1493015569b933928b142128b0
BLAKE2b-256 checksum
How to use checksums
fe7fe567b4d01ec48a894bebbc3f65e51d64583c5c497c6f1b764c3221c81897
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.9

Release files / fasm-0.0.2.post100-cp37-cp37m-macosx_11_0_x86_64.whl

Download URL fasm-0.0.2.post100-cp37-cp37m-macosx_11_0_x86_64.whl
Size 418.1 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
fa5e32ed5a642e93149d3a521f338d14e7b039d47fb70996f575ddc7b2a7e869
BLAKE2b-256 checksum
How to use checksums
dd5bb84df15d1842b8ac08e7756989ae4e3a779824a1a9ce5cfef9a201d3800f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / fasm-0.0.2.post100-cp36-cp36m-win_amd64.whl

Download URL fasm-0.0.2.post100-cp36-cp36m-win_amd64.whl
Size 73.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
13bc3c1c474975dc456e595b5e6ab61d2d2d39f5f025a16e09d9b389da4f137e
BLAKE2b-256 checksum
How to use checksums
fe4c894220036974fbae2d924f1569885274490c5866d3ee681885e11cbccbae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

Release files / fasm-0.0.2.post100-cp36-cp36m-macosx_11_0_x86_64.whl

Download URL fasm-0.0.2.post100-cp36-cp36m-macosx_11_0_x86_64.whl
Size 417.3 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
b670a194a13a7934c3d8689cdf0c1d71a105e8996add2dedab6db6a7d15461e4
BLAKE2b-256 checksum
How to use checksums
a4d6cbd0a7b6f3adf711b7ec0176b8562bb0ac31cad2d264381a11079e42b383
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15
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