Threshold Logic Circuits
Collection
Boolean gates, voting functions, modular arithmetic, and adders as threshold networks.
•
248 items
•
Updated
•
1
8-to-3 priority encoder. Outputs 3-bit binary encoding of highest-priority active input.
priority_encode(i7..i0) -> (y2, y1, y0, valid)
Layer 1: 8 neurons (h7..h0)
Each hk detects "ik is the highest active input":
Layer 2: 4 neurons
| Inputs | 8 |
| Outputs | 4 |
| Neurons | 12 |
| Layers | 2 |
| Parameters | 108 |
| Magnitude | 68 |
from safetensors.torch import load_file
import torch
w = load_file('model.safetensors')
# (see model.py for full implementation)
# Example: i5 is highest active (index 5 = 101)
# priority_encode(0,0,1,0,0,0,0,0, w) -> (1, 0, 1, 1)
MIT