threshold-sr-latch

SR (Set-Reset) latch next-state logic as threshold circuit. Computes next state given current inputs and previous state.

Circuit

S      ──┐
R      ──┼──► SR Latch ──┬──► Q
Q_prev β”€β”€β”˜               └──► Qn

Truth Table

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

Classic NOR Implementation

     S ──┬──►[NOR]──► Qn
         β”‚      β–²
         β”‚      β”‚
         β”‚      └─────┐
         β”‚            β”‚
     R ──┴──►[NOR]──► Q
              β–²       β”‚
              β”‚       β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”˜

Cross-coupled NOR gates create feedback loop.

Combinational Representation

This circuit models the next-state function:

  • Input: S, R, and Q_prev (previous Q)
  • Output: Q_next, Qn_next

True latch behavior requires feeding Q output back to Q_prev over time.

Architecture

Component Neurons
Input inversions 6
Hold logic 2
Output gates 3

Total: 11 neurons, 39 parameters, 4 layers

Usage

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

Files

threshold-sr-latch/
β”œβ”€β”€ model.safetensors
β”œβ”€β”€ create_safetensors.py
β”œβ”€β”€ config.json
└── README.md

License

MIT

Downloads last month
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including phanerozoic/threshold-sr-latch