Reproduce digital electronics in Python

This project is an attempt to reproduce digital electronics in Python. Its ultimate goal is to be able to build an actual CPU by simulating the core components of a real, physical, processor (using Transistors to build Logic Gates, using Logic Gates to build a Half Adder, using Half Adders to build Full Adders, and so on and so forth...).

By adding more components to the project, you will be helping achieve that goal!

Getting Started


Make sure you have virtualenv and Poetry installed.


  1. Clone the repogit clone
  2. Create the virtualenvvirtualenv venv
  3. Use itsource venv/bin/activate
  4. Install packagespoetry install


The project is yet in its infancy, so there is not much to show for apart from some components.

Coding Guidelines

This project uses Black, Prospector, and Pytest. It is set to enforce all the linting rules and 100% test coverage when running:



See the open issues for a list of proposed features (and known issues).

It's tough to provide a real roadmap at this stage, since I'm still learning about digital electronics. Nonetheless, there are a few concepts that should be thought about to allow the project to grow:

  • Memory: All computers need memory. Whether D-Type FlipFlops, or SR Latches, we will need these components to build more complex components...
  • ...such as registers!
  • Speaking of memory... We need to build the concept of time!
  • Unified Interfaces: It would be nice to have some utilities baked into all the components that can give us some stats:
  • Number of Transistors in this component
  • Total Number of Transistors,
  • Timing functions to measure performance
  • Etc
  • and more!


Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Do your magic
  4. Make sure tests pass with 100% coverage, as well as static validation (./
  5. Commit your Changes (git commit -m 'Add some AmazingFeature')
  6. Push to the Branch (git push origin feature/AmazingFeature)
  7. Open a Pull Request


GitHub - fgarci03/pylectronics: Reproduce digital electronics in Python
Reproduce digital electronics in Python. Contribute to fgarci03/pylectronics development by creating an account on GitHub.