Skip to main content

Bitwise

Bitwise is a Python library intended to make hardware design and simulation more accessible for software engineers. While it can never replace a true hardware description language, it aims to serve as a useful tool in the hardware design process, allowing a user to build and test their digital circuits in a high-level programming language (i.e. with simpler syntax and more flexible semantics) before implementing them using an HDL.

Getting Started

Refer to the documentation for installation instructions, usage examples, API reference, and more.

Quick Example

The following code creates a half-adder circuit:

"""
Create a half-adder.
"""
import bitwise as bw

def main():
    # initialize inputs
    a = bw.wire.Wire()
    b = bw.wire.Wire()

    # initialize outputs
    sum_ = bw.wire.Wire()
    carry_out = bw.wire.Wire()

    # create circuit
    bw.gate.XORGate2(a, b, sum_)  # XORs a and b and puts the result into sum_
    bw.gate.ANDGate2(a, b, carry_out)  # ANDs a and b and puts the result into carry_out

if __name__ == "__main__":
    main()

Interacting with it in a Python session:

In [1]: a.value = 0

In [2]: b.value = 0

In [3]: sum_.value
Out[3]: 0

In [4]: carry_out.value
Out[4]: 0

In [5]: a.value = 1

In [6]: sum_.value
Out[6]: 1

In [7]: carry_out.value
Out[7]: 0

In [8]: b.value = 1

In [9]: sum_.value
Out[9]: 0

In [10]: carry_out.value
Out[10]: 1

Metadata

Release files for bitwise 1.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 bitwise 1.0
File Size Uploaded
bitwise-1.0.tar.gz 58.1 kB Details

Release files / bitwise-1.0.tar.gz

Download URL bitwise-1.0.tar.gz
Size 58.1 kB
Tags Source
SHA-256 checksum
How to use checksums
74a97e9f6d6dfa599f93504c117401e32abd29be37e56f884dce3a388daeb6f4
BLAKE2b-256 checksum
How to use checksums
57fe4684e2f17e00db68e3cc6a7e9cdc5399897cac1fadee626a92d91c23c5d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.5

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

0.3

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

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