KMap is an interactive Karnaugh Map solver, Boolean algebra minimizer, and logic circuit prototyping suite. Build maps visually, experiment with minterms and don't-cares, compute exact minimal SOP and POS representations, inspect full truth tables, and synthesize 2-level logic gate implementations in real time.
The project is built entirely in Java with a custom Swing UI engine targeting zero external dependencies and universal cross-platform compatibility.
- Interactive 2, 3, and 4-variable Karnaugh Map matrix editors
- Click-to-toggle cell state cycling (
0$\rightarrow$ 1$\rightarrow$ X) with real-time text synchronization - Exact Boolean minimization using Quine-McCluskey tabular reduction and Petrick's minimal cover algorithm
- Minimal Sum of Products (SOP) and Product of Sums (POS) equations with one-click clipboard copying
- Color-coded rectangular group decompositions with support for wrapped borders (cylindrical, corner, and toroidal topologies)
- Interactive implicant group inspector with hover highlights
- Interactive 2-level logic circuit diagram synthesis:
- Basic Gates: AND, OR, and NOT gate configurations
- Universal Logic: All-NAND and All-NOR equivalent circuit implementations
- Real-time circuit complexity metrics, gate counts, and transformed Boolean expressions
- Comprehensive Truth Table generator with tabular clipboard export
- One-click map operations: preset test cases, grid invert, fill, and reset
- Java Runtime Environment (JRE) or Java Development Kit (JDK) 8 or higher
- No third-party dependencies or external build tools required
Run the pre-packaged executable JAR:
java -jar KMap.jarOr on Windows:
.\run.batjava -cp out src.KMapInput.\build.batCompile all Java sources targeting Java 8 bytecode compatibility:
javac --release 8 -d out src/*.javaCreate the executable JAR:
jar --create --file KMap.jar --manifest META-INF/MANIFEST.MF -C out src- Click Logic Diagram (Gates) from the solution window.
- Select your desired canonical representation:
- SOP (Sum of Products)
- POS (Product of Sums)
- Choose your gate family:
- Basic (AND, OR, NOT): Direct two-level sum-of-products or product-of-sums realization.
- Universal (Only NAND): De Morgan converted NAND-NAND implementation.
- Universal (Only NOR): De Morgan converted NOR-NOR implementation.
- Inspect the generated schematic, gate counts, and transformed Boolean formula.
- Click Copy Expression to export the transformed algebraic notation.
An automated CI/CD pipeline is configured in .github/workflows/build.yml.
Every push to master or main automatically compiles the codebase with --release 8, tests the packaging, and uploads a fresh KMap.jar artifact under the Actions tab for instant download.
Pushing a version tag automatically generates a GitHub Release with the standalone executable JAR attached:
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0- Strict Java 8 compatibility is maintained across all components (no Java 9+ only syntax).
- Bytecode is compiled with
--release 8so thatKMap.jarexecutes seamlessly across Java 8 through Java 24+ withoutUnsupportedClassVersionError. - Group rectangular decomposition supports wrapped cells across rows and columns.
- The circuit schematic renderer uses custom Java2D vector paths and anti-aliasing hints for crisp high-DPI rendering.
- 5-variable and 6-variable overlay map support
- Export circuit diagrams as PNG and SVG vector formats
- Direct Verilog and VHDL hardware description export
- Step-by-step Quine-McCluskey Prime Implicant Table visualization
- Timing diagram and propagation delay simulator
See the open issues for a full list of proposed features.
This repository is licensed under the MIT License. Feel free to use and modify the code as you see fit.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Make focused changes.
- Run
build.batorjavac --release 8 -d out src/*.javato ensure clean compilation. - Open a pull request with a concise description of your changes.