Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keyvank/pygates
Simulating a CPU made of logic gates
https://github.com/keyvank/pygates
Last synced: 4 days ago
JSON representation
Simulating a CPU made of logic gates
- Host: GitHub
- URL: https://github.com/keyvank/pygates
- Owner: keyvank
- License: mit
- Created: 2023-09-04T21:53:52.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-17T12:38:28.000Z (8 months ago)
- Last Synced: 2024-10-29T19:29:49.285Z (18 days ago)
- Language: Python
- Size: 68.4 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyGates
Trying to understand how computers work at the transistor level in a Python simulation.
A Von-Neumann Brainfuck CPU:
```
FWD
P = P + 1
PC = PC + 1
MEM[P] = MEM[P]BWD
P = P - 1
PC = PC + 1
MEM[P] = MEM[P]INC
P = P
PC = PC + 1
MEM[P] = MEM[P] + 1DEC
P = P
PC = PC + 1
MEM[P] = MEM[P] - 1JZ
P = P
PC = X
MEM[P] = MEM[P]
``````
P =
p+1 if 0b000
p-1 if 0b001
else pPC =
X if 0b100 &&
else PC + 1MEM[P] =
MEM[P] + 1 if 0b010
MEM[P] - 1 if 0b011
else MEM[P]
```