CharlesCNorton commited on
Commit
2bbc3fe
·
1 Parent(s): 56aed4a

Add execution model to README, remove tensors.txt and todo.md

Browse files

- Add architecture diagram and instruction set table
- Add design principles
- Remove tensors.txt
- Integrate todo.md content into README

Files changed (3) hide show
  1. README.md +77 -0
  2. tensors.txt +0 -3
  3. todo.md +0 -174
README.md CHANGED
@@ -39,6 +39,83 @@ A complete 8-bit processor where every operation—from Boolean logic to arithme
39
 
40
  ---
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ## Background
43
 
44
  ### Threshold Logic
 
39
 
40
  ---
41
 
42
+ ## Execution Model
43
+
44
+ A self-contained, autonomous computational machine:
45
+ - **Pure tensor computation**: State in, state out
46
+ - **Frozen circuits**: Integer weights, Heaviside activation
47
+ - **ACT execution**: Internal loop until HALT
48
+ - **No external orchestration**: One forward pass = complete program execution
49
+
50
+ ```
51
+ ┌─────────────────────────────┐
52
+ │ Initial State │
53
+ │ [PC|Regs|Flags|Memory...] │
54
+ └─────────────┬───────────────┘
55
+
56
+ ┌─────────────────────────────┐
57
+ │ │
58
+ │ Threshold Circuit Layer │
59
+ │ │
60
+ │ ┌───────────────────────┐ │
61
+ │ │ Fetch: PC → Instr │ │
62
+ │ ├───────────────────────┤ │
63
+ │ │ Decode: Opcode/Ops │ │
64
+ │ ├───────────────────────┤ │
65
+ │ │ Execute: ALU/Mem │ │
66
+ │ ├───────────────────────┤ │
67
+ │ │ Writeback: Results │ │
68
+ │ ├───────────────────────┤ │
69
+ │ │ PC Update │ │
70
+ │ └───────────┬───────────┘ │
71
+ │ │ │
72
+ │ ┌────▼────┐ │
73
+ │ │ HALTED? │ │
74
+ │ └────┬────┘ │
75
+ │ │ │
76
+ │ no ──┴── yes │
77
+ │ │ │ │
78
+ │ ▼ ▼ │
79
+ │ [loop] [exit] │
80
+ │ │
81
+ └─────────────┬───────────────┘
82
+
83
+ ┌─────────────────────────────┐
84
+ │ Final State │
85
+ │ [PC|Regs|Flags|Memory...] │
86
+ └─────────────────────────────┘
87
+ ```
88
+
89
+ ### Instruction Set
90
+
91
+ | Opcode | Mnemonic | Operation |
92
+ |--------|----------|-----------|
93
+ | 0x0 | ADD | R[d] = R[a] + R[b] |
94
+ | 0x1 | SUB | R[d] = R[a] - R[b] |
95
+ | 0x2 | AND | R[d] = R[a] & R[b] |
96
+ | 0x3 | OR | R[d] = R[a] \| R[b] |
97
+ | 0x4 | XOR | R[d] = R[a] ^ R[b] |
98
+ | 0x5 | SHL | R[d] = R[a] << 1 |
99
+ | 0x6 | SHR | R[d] = R[a] >> 1 |
100
+ | 0x7 | MUL | R[d] = R[a] * R[b] |
101
+ | 0x8 | DIV | R[d] = R[a] / R[b] |
102
+ | 0x9 | CMP | flags = R[a] - R[b] |
103
+ | 0xA | LOAD | R[d] = M[addr] |
104
+ | 0xB | STORE | M[addr] = R[s] |
105
+ | 0xC | JMP | PC = addr |
106
+ | 0xD | JZ/JNZ | PC = addr if flag |
107
+ | 0xE | CALL | push PC; PC = addr |
108
+ | 0xF | HALT | stop execution |
109
+
110
+ ### Design Principles
111
+
112
+ 1. **Autonomy**: Machine runs without external logic
113
+ 2. **Purity**: forward(state) → state', no side effects
114
+ 3. **Transparency**: All weights inspectable, all operations traceable
115
+ 4. **Universality**: Turing complete, runs arbitrary programs
116
+
117
+ ---
118
+
119
  ## Background
120
 
121
  ### Threshold Logic
tensors.txt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e01c8089229853c66c3d0e77b504a09fddd7e6e78c56018818c90f41c5a2a43e
3
- size 44592750
 
 
 
 
todo.md DELETED
@@ -1,174 +0,0 @@
1
- # Threshold Logic Neural Turing Machine
2
-
3
- ## Core Vision
4
-
5
- A self-contained, autonomous computational machine:
6
- - **Pure tensor computation**: State in, state out
7
- - **Frozen verified circuits**: Exhaustively tested, can't compute wrong
8
- - **ACT execution**: Internal loop until HALT
9
- - **No external orchestration**: One forward pass = complete program execution
10
-
11
- The machine runs. Callers just provide initial state and collect results.
12
-
13
- ## Architecture
14
-
15
- ```
16
- ┌─────────────────────────────┐
17
- │ Initial State │
18
- │ [PC|Regs|Flags|Memory...] │
19
- └─────────────┬───────────────┘
20
-
21
- ┌─────────────────────────────┐
22
- │ │
23
- │ Threshold Circuit Layer │
24
- │ │
25
- │ ┌───────────────────────┐ │
26
- │ │ Fetch: PC → Instr │ │
27
- │ ├───────────────────────┤ │
28
- │ │ Decode: Opcode/Ops │ │
29
- │ ├───────────────────────┤ │
30
- │ │ Execute: ALU/Mem │ │
31
- │ ├───────────────────────┤ │
32
- │ │ Writeback: Results │ │
33
- │ ├───────────────────────┤ │
34
- │ │ PC Update │ │
35
- │ └───────────┬───────────┘ │
36
- │ │ │
37
- │ ┌────▼────┐ │
38
- │ │ HALTED? │ │
39
- │ └────┬────┘ │
40
- │ │ │
41
- │ no ──┴── yes │
42
- │ │ │ │
43
- │ ▼ ▼ │
44
- │ [loop] [exit] │
45
- │ │
46
- └─────────────┬───────────────┘
47
-
48
- ┌─────────────────────────────┐
49
- │ Final State │
50
- │ [PC|Regs|Flags|Memory...] │
51
- └─────────────────────────────┘
52
- ```
53
-
54
- ## Memory Architecture
55
-
56
- ### State Tensor Layout
57
- ```
58
- ┌────────┬──────────┬───────┬────────┬─────────────────────┐
59
- │ PC [16] │ Regs[32] │Flags[4│Ctrl[4] │ Memory [N × 8] │
60
- └────────┴──────────┴───────┴────────┴─────────────────────┘
61
- 16 + 32 + 4 + 4 + N × 8 bits
62
- ```
63
-
64
- ### Memory Hierarchy
65
- | Level | Size | Tensors | Access |
66
- |-------|------|---------|--------|
67
- | Registers | 4 × 8-bit | Direct wiring | Immediate |
68
- | Main memory | 64KB | ~1.6M | 16-bit addressed |
69
-
70
- ### Full 64KB Configuration
71
- - Address space: 0x0000 - 0xFFFF
72
- - Routing circuits: ~1.64M tensors
73
- - State tensor: 88 + 524,288 = 524,376 bits per instance
74
-
75
- ## Phase 1: Memory Infrastructure
76
-
77
- 64KB memory circuits are implemented and pass comprehensive eval.
78
-
79
- | Component | Description | Tensors | Status |
80
- |-----------|-------------|---------|--------|
81
- | Address Decoder 16-bit | 16-bit → 65536 one-hot | 2 (packed) | Done |
82
- | Memory Read MUX 64K | 65536-to-1 × 8 bits | 4 (packed) | Done |
83
- | Memory Write Demux | Route write to address | 4 (packed) | Done |
84
- | Memory Cell Logic | Conditional update | 6 (packed) | Done |
85
-
86
- ## Phase 2: Execution Engine
87
-
88
- | Component | Description | Status |
89
- |-----------|-------------|--------|
90
- | Instruction Fetch | PC → Memory → IR | Done |
91
- | Operand Fetch | Decode → Register/Memory Read | Done |
92
- | ALU Dispatch | Opcode → Operation Select | Done |
93
- | Result Writeback | Route to destination | Done |
94
- | Flag Update | Compute Z/N/C/V | Done |
95
- | PC Advance | Increment or Jump | Done |
96
- | Halt Detection | HALT opcode → stop | Done |
97
-
98
- ## Phase 3: ACT Integration
99
-
100
- Threshold runtime available in cpu/threshold_cpu.py (cycle + ACT loop + state I/O).
101
-
102
- | Component | Description | Status |
103
- |-----------|-------------|--------|
104
- | Cycle Block | All Phase 2 as single layer | Done |
105
- | Recurrence Wrapper | Loop until halt signal | Done |
106
- | Max Cycles Guard | Prevent infinite loops | Done |
107
- | State I/O | Pack/unpack state tensor | Done |
108
-
109
- ## Instruction Set
110
-
111
- | Opcode | Mnemonic | Operation | Status |
112
- |--------|----------|-----------|--------|
113
- | 0x0 | ADD | R[d] = R[a] + R[b] | Done |
114
- | 0x1 | SUB | R[d] = R[a] - R[b] | Done |
115
- | 0x2 | AND | R[d] = R[a] & R[b] | Done |
116
- | 0x3 | OR | R[d] = R[a] \| R[b] | Done |
117
- | 0x4 | XOR | R[d] = R[a] ^ R[b] | Done |
118
- | 0x5 | SHL | R[d] = R[a] << 1 | Done |
119
- | 0x6 | SHR | R[d] = R[a] >> 1 | Done |
120
- | 0x7 | MUL | R[d] = R[a] * R[b] | Done |
121
- | 0x8 | DIV | R[d] = R[a] / R[b] | Done |
122
- | 0x9 | CMP | flags = R[a] - R[b] | Done |
123
- | 0xA | LOAD | R[d] = M[addr] | Done |
124
- | 0xB | STORE | M[addr] = R[s] | Done |
125
- | 0xC | JMP | PC = addr | Done |
126
- | 0xD | JZ/JNZ | PC = addr if flag | Done |
127
- | 0xE | CALL | push PC; PC = addr | Done |
128
- | 0xF | HALT | stop execution | Done |
129
-
130
- ## Completed Circuits
131
-
132
- ### Arithmetic (2,756 tensors)
133
- - ADD, SUB, MUL, DIV, NEG
134
- - ADC, SBC (with carry)
135
- - CMP (compare, sets flags)
136
-
137
- ### Bit Operations (62 tensors)
138
- - ASR (arithmetic shift right)
139
- - ROL, ROR (rotate through carry)
140
- - SHL, SHR (from original)
141
-
142
- ### Control (306 tensors)
143
- - NOP, HALT
144
- - PC Increment, PC Load MUX
145
- - Register MUX 4-to-1
146
- - Instruction Decoder 4-to-16
147
-
148
- ### Original Model (~3,100 tensors)
149
- - Boolean gates (AND, OR, XOR, NOT, NAND, NOR)
150
- - Ripple carry adders (2/4/8-bit)
151
- - 8×8 multiplier
152
- - Comparators, threshold gates
153
- - Conditional jumps
154
-
155
- **Current: 6,296 tensors (packed memory)**
156
- **Parameters: 8,267,667**
157
-
158
- ## Applications
159
-
160
- The machine is general-purpose. Possible callers:
161
-
162
- 1. **Direct invocation**: Load state, call forward(), read result
163
- 2. **LLM coprocessor**: Embedded layer for exact computation
164
- 3. **Neuromorphic deployment**: Map to spiking hardware
165
- 4. **Verified computation**: Provably correct execution
166
- 5. **Educational**: Transparent, inspectable CPU
167
-
168
- ## Design Principles
169
-
170
- 1. **Autonomy**: Machine runs without external logic
171
- 2. **Purity**: forward(state) → state', no side effects
172
- 3. **Verification**: Every circuit exhaustively tested
173
- 4. **Transparency**: All weights inspectable, all operations traceable
174
- 5. **Universality**: Turing complete, runs arbitrary programs