A terminal-based digital logic circuit simulator written in pure C.
This project reads simple text-based .circ files that define circuits, simulates logic gates like AND/OR/NOT/XOR, generates complete truth tables, renders ASCII waveform diagrams, and exports results to CSV β all with zero external dependencies.
- β
Parse
.circfiles withINPUT,AND,OR,NOT,XOR,NAND,NOR - β Simulate logic gate networks from scratch
- β Print full truth tables for all input combinations
- β Generate waveform diagrams (ASCII-based)
- β
Export results to
truth_table.csv(Excel-compatible) - β
Built with modular C (
make-based, portable on macOS/Linux)
logic_simulator/
βββ Makefile
βββ example.circ # sample input circuit
βββ logic_simulator # compiled binary
βββ truth_table.csv # CSV output after run
βββ src/ # C source files
β βββ main.c
β βββ parser.c / parser.h
β βββ circuit.c / circuit.h
β βββ truth_table.c / truth_table.h
β βββ waveform.c / waveform.h
βββ obj/ # object files (auto-generated)
This project is a full implementation of a digital logic interpreter. It demonstrates:
- Manual parsing of custom file formats
- Graph-based circuit simulation using pointers and structs
- Truth table and waveform generation using basic C
- Real-world C programming: file I/O, data modeling, ASCII drawing