This project implements a Binary Decision Diagram (BDD) β an efficient data structure to represent and synthesize Boolean logic functions from a truth table.
Consider the following Truth Table:
| x1 | x2 | x3 | f |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
- The function
fdepends on inputsx1,x2, andx3. - Using a BDD, we can efficiently represent and synthesize this function into a Boolean algebra expression.
- Load truth table data from a
.csvfile. - Generate Sum of Products (SOP) or Product of Sums (POS) Boolean expressions.
- Clear, human-readable Boolean algebra output.
x3'x2' + x3x2' + x3x2 + x2 + x1
( x3 + x2 ) . ( x3 + x2' ) . x1'
-
Clone the repository
git clone https://github.com/karthik-saiharsh/BDD.git
-
Navigate to the project directory
cd Binary_Decision_Diagram -
Create your Python file (in the same directory)
touch main.py
-
Import and use the BDD Synthesizer
from BDD import * bdd = BinaryDecisionDiagram() bdd.generateExpressionFromCSV("truthTable.csv", isSOP=False) # Set isSOP=True for SOP output
x1,x2,x3,f
0,0,0,0
0,0,1,1
0,1,0,1
0,1,1,0
1,0,0,1
1,0,1,0
1,1,0,1
1,1,1,1
| Contributor | Role |
|---|---|
| Adith | Core functionality implementation and usability improvements |
| Karthik Saiharsh | Original project creation and foundational architecture |