Skip to main content

Bitwise is a library for utilizing Python as a hardware description language

Project description

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:

>> a.value = 0
>> b.value = 0
>> sum_.value
0
>> carry_out.value
0
>> a.value = 1
>> sum_.value
1
>> carry_out.value
0
>> b.value = 1
>> sum_.value
0
>> carry_out.value
1

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

bitwise-0.3.tar.gz (27.9 kB view details)

Uploaded Source

File details

Details for the file bitwise-0.3.tar.gz.

File metadata

  • Download URL: bitwise-0.3.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.5

File hashes

Hashes for bitwise-0.3.tar.gz
Algorithm Hash digest
SHA256 ef158e8a26d4bb3d30117f4c405a04029c0d210384eb46ddcecc876420d5cef4
MD5 3c0f58844c7e6ee05dd3d8e1d83c8336
BLAKE2b-256 1e43e0569ef7a0a1886387fe7c81abfb9b6ee783fc2b96d7f7f2d71f0a1827f5

See more details on using hashes here.

Supported by

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