Threshold Logic Circuits
Collection
Boolean gates, voting functions, modular arithmetic, and adders as threshold networks.
β’
248 items
β’
Updated
β’
1
D latch (level-sensitive) next-state logic as threshold circuit.
E ββββββββ
D ββββββββΌβββΊ D-Latch βββ¬βββΊ Q
Q_prev βββ ββββΊ Qn
| E | D | Q_prev | Q | Qn | Mode |
|---|---|---|---|---|---|
| 0 | X | 0 | 0 | 1 | Hold |
| 0 | X | 1 | 1 | 0 | Hold |
| 1 | 0 | X | 0 | 1 | Transparent |
| 1 | 1 | X | 1 | 0 | Transparent |
Q = (E AND D) OR (NOT_E AND Q_prev)
Qn = (E AND NOT_D) OR (NOT_E AND NOT_Q_prev)
| Layer | Neurons |
|---|---|
| 1 | e_and_d, e_and_notd, note_and_qprev, note_and_notqprev |
| 2 | Q, Qn |
Total: 6 neurons, 26 parameters, 2 layers
D-latches are simpler but can cause timing issues (race conditions) if not carefully designed. Flip-flops are safer for synchronous designs.
| Inputs | 3 |
| Outputs | 2 |
| Neurons | 6 |
| Layers | 2 |
| Parameters | 26 |
| Magnitude | 18 |
from safetensors.torch import load_file
w = load_file('model.safetensors')
# Simulate latch behavior
q = 0
for e, d in [(1, 1), (1, 0), (0, 1), (0, 0)]:
q_next = compute(e, d, q, w)
q = q_next
MIT