Skip to main content

PyAIG: A simpe Python AIG and Truth Table package

AIG

And-Inverter Graph (AIG) is a data structure for logic synthesis and verification. The code follows the AIGER conventions.

Installation

Install using pip:

pip install .

Truth Tables example

Import the package

from pyaig import *

Create the truth table manger - the max number of variables is required

m = truth_tables(6, "ABCDEF")

If the second parameter to truth_tables is provided, it automatically inserts the sequence of names into the global namespace

Build truth tables with operator overloading

f = A.ite(B, C ^ D) & E | F

The truth table support |, &, ^, and ~ for OR, AND, XOR, INVERT, respectively. It also supports ite (if-then-else), iff (if-and-only-if, or EXOR) and implies (logical implication).

Output the truth table

print(f)

Will print the truth as a prime-irredudant cover, in this case:

A&B&E + ~A&C&~D&E + ~A&~C&D&E + F

Or,

print(f.SOP())

Resulting in

-----1 1
0-011- 1
0-101- 1
11--1- 1

Or

print(f.isop())

Resulting in

[{1, 2, 5}, {3, -4, 5, -1}, {-3, 4, 5, -1}, {6}]

All three are the same cover. The first is a human-readable expression. The second is similar to Espresso and BLIF formats, and the third is the list of cubes where negative means negation and the nubmer is the variable number starting from 0.

Manipulate truth tables

In addition to the above, it supports permuting and negating inputs and the output, generating the list of all NPN-equivalent functions and a few other operations.

Release files for pyaig 1.0.13

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 pyaig 1.0.13
File Interpreter ABI Platform
pyaig-1.0.13-py3-none-any.whl Python 3 none any Details
pyaig-1.0.13-py2-none-any.whl Python 2 none any Details

Total release size: 46.3 kB

Release files / pyaig-1.0.13-py3-none-any.whl

Download URL pyaig-1.0.13-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f0cb283cabe88a44a8b28c784a522326233e0775d45954f449fe8e01d0b18c7
BLAKE2b-256 checksum
How to use checksums
8c5c31ce26e260282dd8fc0289f1df25e0c843bbafeba8bfcd19ed1cde71ee5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / pyaig-1.0.13-py2-none-any.whl

Download URL pyaig-1.0.13-py2-none-any.whl
Size 23.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
8f0115c47a1254ca6b28288de9fce0ed4cc69dc4d06c06ba9e87e527cc72f874
BLAKE2b-256 checksum
How to use checksums
12b72c8677e87a42f942f2753f9785a83a738c7c43b9ce2b03641129d7edbc73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.0.13 This release

2 release files

1.0.11

2 release files

1.0.8

1 release file

1.0.7

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.2

1 release file

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