Threshold Logic Circuits
Collection
Boolean gates, voting functions, modular arithmetic, and adders as threshold networks.
β’
248 items
β’
Updated
β’
1
SR (Set-Reset) latch next-state logic as threshold circuit. Computes next state given current inputs and previous state.
S βββ
R βββΌβββΊ SR Latch βββ¬βββΊ Q
Q_prev βββ ββββΊ Qn
| S | R | Q_prev | Q | Qn | Mode |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | Hold |
| 0 | 0 | 1 | 1 | 0 | Hold |
| 0 | 1 | X | 0 | 1 | Reset |
| 1 | 0 | X | 1 | 0 | Set |
| 1 | 1 | X | 0 | 0 | Invalid |
S βββ¬βββΊ[NOR]βββΊ Qn
β β²
β β
β βββββββ
β β
R βββ΄βββΊ[NOR]βββΊ Q
β² β
β β
βββββββββ
Cross-coupled NOR gates create feedback loop.
This circuit models the next-state function:
True latch behavior requires feeding Q output back to Q_prev over time.
| Component | Neurons |
|---|---|
| Input inversions | 6 |
| Hold logic | 2 |
| Output gates | 3 |
Total: 11 neurons, 39 parameters, 4 layers
from safetensors.torch import load_file
w = load_file('model.safetensors')
# Simulate latch over time:
q = 0
for s, r in [(1,0), (0,0), (0,1), (0,0)]:
q_next = compute_q(s, r, q, w)
q = q_next
threshold-sr-latch/
βββ model.safetensors
βββ create_safetensors.py
βββ config.json
βββ README.md
MIT