
LogicB - Python Digital Logic Simulator
=======================================

LogicB is a full-featured digital logic library written in pure Python.
It allows you to simulate combinational and sequential circuits, perform
binary arithmetic, work with multi-bit adders/subtractors/multipliers/dividers,
and build custom encoders/decoders and counters. You can also connect
logic gates together to create complete circuits.

Features
--------
1. Logic Gates:
   - AND, OR, NOT, NAND, NOR, XOR, XNOR

2. Converters:
   - Binary <-> Hexadecimal
   - Binary <-> Decimal
   - Decimal <-> Hexadecimal

3. Multi-bit Arithmetic:
   - Adders, Subtractors, Multipliers, Dividers

4. Circuit System:
   - Gate class to connect inputs and outputs recursively
   - Create complex circuits from simple gates

5. Multiplexers / Demultiplexers:
   - 2:1 MUX, 1:2 DEMUX (expandable)

6. Encoders / Decoders:
   - Custom mappings from input to binary output and vice versa

7. Sequential Circuits:
   - Flip-flops: D, T, JK, SR
   - Shift Registers: serial-in/serial-out, parallel-in/parallel-out

8. Counters:
   - Binary counter
   - Ring counter
   - Johnson counter

9. Utilities:
   - Truth table generator
   - Multi-bit circuit simulation

Installation
------------
LogicB can be installed via PyPI (see instructions below):

    pip install LogicB

Usage
-----
```python
from LogicB import AND, OR, Gate, DFlipFlop, adder, truth_table

# Simple gates
print(AND(1,0))    # Output: 0
print(OR(1,0))     # Output: 1

# Multi-bit adder
print(adder("1010","0111"))  # Output: "10001"

# Circuit system
a, b = 1, 0
g1 = Gate(AND)
g1.connect(a, b)
print(g1.output())  # Output: 0

# Flip-flop example
dff = DFlipFlop()
print(dff.clock(1)) # Output: 1