Sync with GitHub, license metadata from LICENSE files, commercial license notice
Browse filesmetadata license: None -> other (snapkitty-tri-license)
README: License section appended
README: GitHub source link added
README.md
CHANGED
|
@@ -1,162 +1,184 @@
|
|
| 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 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
``
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
;
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
##
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: snapkitty-tri-license
|
| 4 |
+
license_link: https://huggingface.co/Snapkitty/MACROGROK/blob/main/LICENSE.tri
|
| 5 |
+
tags:
|
| 6 |
+
- snapkitty
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
> Source: [github.com/SNAPKITTYWEST/MACROGROK](https://github.com/SNAPKITTYWEST/MACROGROK)
|
| 10 |
+
|
| 11 |
+
# MACROGROK β AGC-Inspired Fixed-Point Macro-Model
|
| 12 |
+
|
| 13 |
+
Patent Pending β BEL ESPRIT D ACCORD TRUST HOLDINGS INC.
|
| 14 |
+
|
| 15 |
+
Extremely constrained, narrow-task models for 15-bit / Qm.n environments. Code lives in ROM, state in ~2K erasable words. Every bit is budgeted.
|
| 16 |
+
|
| 17 |
+
## 1. Model Purpose & Scope
|
| 18 |
+
|
| 19 |
+
* Single, narrowly defined task: attitude correction, trajectory offset, binary/multi-class decision, low-dimensional control law.
|
| 20 |
+
* No general-purpose LM or large feature spaces.
|
| 21 |
+
* Input/output dimensions very small (typically β€ 8β16).
|
| 22 |
+
|
| 23 |
+
## 2. Numeric Representation
|
| 24 |
+
|
| 25 |
+
* Word: 15-bit data (modern 16-bit with 1-bit reserved).
|
| 26 |
+
* Fixed-point Qm.n (e.g., Q1.14, Q3.12, Q7.8) chosen per variable, scale documented per quantity.
|
| 27 |
+
* Double/triple precision only where required.
|
| 28 |
+
* Saturation handling: clamp, wrap, or flag β defined per variable.
|
| 29 |
+
|
| 30 |
+
## 3. Memory Layout
|
| 31 |
+
|
| 32 |
+
**Erasable (RAM) β ~2K words target:**
|
| 33 |
+
State vector, input buffer, accumulators, flags/mode bits, tiny stack.
|
| 34 |
+
|
| 35 |
+
**Fixed (ROM) β majority:**
|
| 36 |
+
Model constants (weights/biases, lookup tables, scale factors), code/macros, pre-computed coefficients. Bank/segment switching optional.
|
| 37 |
+
|
| 38 |
+
## 4. Core Data Structures
|
| 39 |
+
|
| 40 |
+
```
|
| 41 |
+
STATE : fixed-point vector (persistent)
|
| 42 |
+
INPUT : fixed-point vector (current observation)
|
| 43 |
+
OUTPUT : fixed-point vector or discrete command
|
| 44 |
+
ACC : accumulator(s) β single/double precision
|
| 45 |
+
SCALES : constant scale factors
|
| 46 |
+
FLAGS : mode, validity, saturation bits
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## 5. Macro Routine Categories
|
| 50 |
+
|
| 51 |
+
`LOAD_INPUT` / `SCALE_INPUT` Β· `MATVEC_TINY` / `DOT_PRODUCT_FIXED` (unrolled) Β· `LOOKUP_SEGMENT` / `PIECEWISE_LINEAR` Β· `ACTIVATE` (clip/ReLU/threshold) Β· `UPDATE_STATE` Β· `NORMALIZE`/`RESCALE` Β· `SATURATE` Β· `EMIT_OUTPUT`
|
| 52 |
+
|
| 53 |
+
Macros expand to shifts, adds, MUL16, and table lookups β no floating point.
|
| 54 |
+
|
| 55 |
+
## 6. Forward Pass
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
1. Acquire and scale input β INPUT
|
| 59 |
+
2. Optional tiny feature transform
|
| 60 |
+
3. Core block(s) (mat-vec + nonlinearity, macro-expanded)
|
| 61 |
+
4. State update (if recurrent)
|
| 62 |
+
5. Output scaling + saturation
|
| 63 |
+
6. Write command / flags
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
All steps use fixed-point ops and explicit erasable temporaries.
|
| 67 |
+
|
| 68 |
+
## 7. Initialization
|
| 69 |
+
|
| 70 |
+
Weights/biases/tables in fixed storage; init routine copies needed values to erasable once. Constants never modified at runtime.
|
| 71 |
+
|
| 72 |
+
## 8. Executive Wrapper (Optional)
|
| 73 |
+
|
| 74 |
+
Cyclic/priority executive, ability to skip non-critical sections under pressure, watchdog/validity flags.
|
| 75 |
+
|
| 76 |
+
## 9. Documentation Requirement
|
| 77 |
+
|
| 78 |
+
For every variable and macro: Qm.n format, physical units, scale, valid range, overflow behavior, memory location (erasable bank or fixed address).
|
| 79 |
+
|
| 80 |
+
## 10. Example Skeleton
|
| 81 |
+
|
| 82 |
+
```
|
| 83 |
+
; FIXED (ROM)
|
| 84 |
+
WEIGHTS_Q3_12 ...
|
| 85 |
+
BIAS_Q3_12 ...
|
| 86 |
+
SCALE_IN ... SCALE_OUT ...
|
| 87 |
+
|
| 88 |
+
; ERASABLE (RAM)
|
| 89 |
+
STATE DS 4 ; Q3.12
|
| 90 |
+
INPUT DS 4
|
| 91 |
+
OUTPUT DS 2
|
| 92 |
+
ACC DS 2 ; double precision
|
| 93 |
+
|
| 94 |
+
; MACROS
|
| 95 |
+
MACRO DOT4 ; 4-element dot
|
| 96 |
+
MACRO SAT_Q3_12
|
| 97 |
+
MACRO UPDATE_STATE
|
| 98 |
+
|
| 99 |
+
INFER
|
| 100 |
+
LOAD_INPUT
|
| 101 |
+
SCALE_INPUT
|
| 102 |
+
DOT4 WEIGHTS_Q3_12, INPUT, ACC
|
| 103 |
+
ADD BIAS
|
| 104 |
+
SAT_Q3_12
|
| 105 |
+
UPDATE_STATE
|
| 106 |
+
SCALE_OUTPUT
|
| 107 |
+
STORE OUTPUT
|
| 108 |
+
RETURN
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
## Design Principles
|
| 112 |
+
|
| 113 |
+
Every bit budgeted β tables + interpolation over general arithmetic β unrolled tiny loops β minimal contiguous mutable state β specialized routine, not general engine.
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
## Fixed-Point Contract (INFER4 Example)
|
| 118 |
+
|
| 119 |
+
4-input binary decision, Q format per quantity, saturate to 32-bit ACC.
|
| 120 |
+
|
| 121 |
+
| Symbol | Format | Role | Overflow |
|
| 122 |
+
|---|---|---|---|
|
| 123 |
+
| `INPUT[4]` | Q1.14 | sensors [-1,1) | clamp |
|
| 124 |
+
| `WEIGHTS[4]` | Q1.14 | ROM coefficients | const |
|
| 125 |
+
| `BIAS` | Q3.12 | offset | const |
|
| 126 |
+
| `ACC` | Q7.24 32-bit | dot accumulator | saturate |
|
| 127 |
+
| `STATE` | Q3.12 | smoothed output | clamp |
|
| 128 |
+
| `OUTPUT` | Q1.14 | command | clamp |
|
| 129 |
+
| `FLAGS` | bits | validity/sat/decision | β |
|
| 130 |
+
|
| 131 |
+
Q1.14 * Q1.14 β Q2.28 β >>4 β Q3.24 (4 products in 32-bit), >>12 β Q3.12 + `BIAS`.
|
| 132 |
+
|
| 133 |
+
## Memory Map
|
| 134 |
+
|
| 135 |
+
```
|
| 136 |
+
; FIXED / ROM
|
| 137 |
+
WEIGHTS_Q1_14: DC 2458, -1638, 819, 3277
|
| 138 |
+
BIAS_Q3_12: DC -256
|
| 139 |
+
ALPHA_Q1_14: DC 12288 ; 0.75
|
| 140 |
+
ONE_Q1_14: DC 16384
|
| 141 |
+
OUT_MIN_Q1_14: DC -16384
|
| 142 |
+
OUT_MAX_Q1_14: DC 16383
|
| 143 |
+
SCORE_MIN_Q3_12: DC -8192 ; -2.0 Q3.12
|
| 144 |
+
SCORE_MAX_Q3_12: DC 8191 ; +2.0
|
| 145 |
+
|
| 146 |
+
; ERASABLE / RAM
|
| 147 |
+
INPUT: DS 4
|
| 148 |
+
STATE: DS 1 ; Q3.12
|
| 149 |
+
OUTPUT: DS 1
|
| 150 |
+
ACC_HI: DS 1 ; 32-bit hi
|
| 151 |
+
ACC_LO: DS 1 ; 32-bit lo
|
| 152 |
+
TMP0: DS 1
|
| 153 |
+
TMP1: DS 1
|
| 154 |
+
FLAGS: DS 1
|
| 155 |
+
FLAG_VALID=0001 FLAG_SAT=0002 FLAG_POSITIVE=0004
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
## Primitive Macros
|
| 159 |
+
|
| 160 |
+
See `examples/infer4.asm` for full `CLR_ACC`, `MAC_Q1_14` (preserves `PROD_HI:PROD_LO` before `ADD32`), `ACC_TO_Q3_12`, `SAT_Q3_12`, `DOT4_Q1_14`, `THRESHOLD_Q3_12` (+1.0/-1.0), `UPDATE_STATE_3_4` (`(3*STATE+TARGET)/4`).
|
| 161 |
+
|
| 162 |
+
## INFER4 Routine
|
| 163 |
+
|
| 164 |
+
`examples/infer4.asm` β `INFER4: CLR FLAGS β DOT4 β ACC_TO_Q3_12 β ADD BIAS β SAT β THRESHOLD β UPDATE_STATE_3_4 β OUTPUT=STATE β FLAG_VALID β RET`
|
| 165 |
+
|
| 166 |
+
Simulator: `python src/sim.py` (Q1.14/Q3.12 fixed-point, matches assembly semantics).
|
| 167 |
+
|
| 168 |
+
## References
|
| 169 |
+
|
| 170 |
+
[1] Virtual AGC Manual β ibiblio.org/apollo/assembly_language_manual.html
|
| 171 |
+
[2] AGC β Wikipedia
|
| 172 |
+
[3] Block II: 2048 erasable + 36864 fixed words, 15 data bits + parity
|
| 173 |
+
|
| 174 |
+
---
|
| 175 |
+
|
| 176 |
+
## License
|
| 177 |
+
|
| 178 |
+
Licensed under **SnapKitty Tri-License**. Full text: [LICENSE.tri](LICENSE.tri).
|
| 179 |
+
|
| 180 |
+
### πΌ Commercial License
|
| 181 |
+
|
| 182 |
+
Snapkitty code is free and open under **AGPL-3.0** for open-source use. Building a commercial product or service? A **proprietary commercial license** from Snapkitty Collective LLC lets you ship this code without the AGPL's source-sharing and network-use obligations.
|
| 183 |
+
|
| 184 |
+
**[β Get a commercial license](mailto:A.parr@belespritdaccord.uk?subject=Commercial%20license:%20MACROGROK)** Β· A.parr@belespritdaccord.uk
|