Skip to content

HusaamKhan1/Logic-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”Œ Logic Circuit Simulator in C

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.


πŸš€ Features

  • βœ… Parse .circ files with INPUT, 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)

πŸ“ File Structure

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)

πŸŽ“ Why This Project Matters

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

πŸ‘€ Author

Husaam Khan
GitHub β€’ LinkedIn

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published