https://github.com/vafdaf12/transistor
Educational tool for building boolean logic circuits
https://github.com/vafdaf12/transistor
boolean-algebra cpp sfml
Last synced: 12 months ago
JSON representation
Educational tool for building boolean logic circuits
- Host: GitHub
- URL: https://github.com/vafdaf12/transistor
- Owner: Vafdaf12
- License: mit
- Created: 2023-11-22T19:56:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-12T20:52:22.000Z (over 2 years ago)
- Last Synced: 2025-01-21T14:29:10.758Z (over 1 year ago)
- Topics: boolean-algebra, cpp, sfml
- Language: C++
- Homepage:
- Size: 11.3 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Transistor
Transistor is an attempt to make a high-performance digital logic simulator that can be used in an educational context to showcase the complex circuitry behind the concepts taught in computer architecure classes. It uses SFML for Graphics and nlohmann's JSON library for saving circuits.

# Building
Building this project requires CMake. In most cases you should be able to configure and build the project with
```sh
cmake -S . --preset default
cmake --build build
```
The build output can be found in `build/src/`. The exact location of the binary depends on your generator
# Usage
By default, Transistor will attempt to open a the file `data/world.json`. This can be overridden by passing a path as an argument when executing Transistor:
```
./Transistor path/to/world.json
```
The basic controls of Transistor are as follows:
- `Up/Down Arrow` increases/decreases the number of output pins respectively
- `Alt +Up/Down Arrow` increases/decreases the number of input pins respectively
- `Control+C`/`Control+V` copies/pastes the selected circuits respectively
- `Delete` deletes the selected circuits
Primitive gates can be dragged and dropped into the world from the top bar.
## Custom Circuits
Custom circuits are loaded from a a JSON file in the `data` folder. In general, if you have a file `data/xxx.json`, it corresponds to the custom circuit type `xxx`. Currently there is no way to add custom circuits in Transistor through the GUI, requiring some manual text editing:
1. Open a circuit file in the `data` folder, e.g. `data/my_custom_circuit.json`
2. Edit the circuit as you see fit
3. In a different circuit file, manually add the custom circuit in the file by using the format:
```json
{
"id": "",
"type": "my_custom_circuit",
"position": { "x": 0, "y": 0 }
}
```
4. Once loaded into the world, you can use copy-paste to retrieve multiple circuits