File size: 1,193 Bytes
ff90a24 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
---
license: mit
tags:
- pytorch
- safetensors
- threshold-logic
- neuromorphic
---
# threshold-absolutevalue4
Absolute value of 4-bit 2's complement signed integer.
## Function
abs4(a) = |a| where a is interpreted as 4-bit 2's complement (-8 to +7)
## Truth Table
| Input | Signed | |Abs| | Output |
|-------|--------|------|--------|
| 0000 | +0 | 0 | 0000 |
| 0001 | +1 | 1 | 0001 |
| 0010 | +2 | 2 | 0010 |
| 0011 | +3 | 3 | 0011 |
| 0100 | +4 | 4 | 0100 |
| 0101 | +5 | 5 | 0101 |
| 0110 | +6 | 6 | 0110 |
| 0111 | +7 | 7 | 0111 |
| 1000 | -8 | 8 | 1000 |
| 1001 | -7 | 7 | 0111 |
| 1010 | -6 | 6 | 0110 |
| 1011 | -5 | 5 | 0101 |
| 1100 | -4 | 4 | 0100 |
| 1101 | -3 | 3 | 0011 |
| 1110 | -2 | 2 | 0010 |
| 1111 | -1 | 1 | 0001 |
## Architecture
5-layer circuit implementing conditional 2's complement negation:
- For positive (a3=0): output = input
- For negative (a3=1): output = ~input + 1
Key formulas for negative path:
- o0 = a0 (always)
- o1 = ~a1 XOR ~a0
- o2 = ~a2 XOR (~a1 AND ~a0)
- o3 = 1 only for input 1000 (-8)
## Parameters
| | |
|---|---|
| Inputs | 4 |
| Outputs | 4 |
| Neurons | 23 |
| Layers | 5 |
| Parameters | 145 |
| Magnitude | 64 |
## License
MIT
|