Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.78 KB

README.md

File metadata and controls

45 lines (33 loc) · 1.78 KB

CPU-Data-Processing-Replica

Note

This program is only a rough approximation of a simple real CPU. Its purpose is to create an basic understanding of how the system works and how it computes.

Instruction data // CPU-Programming

How to program the CPU.

Example: ["0001", "0000", "01010101", None, "0011"]

This block of code represents a single instruction for the CPU to execute. It's structure is build like this:

[instruction_address, instruction_type, memory_address, data, instruction_continuer]

The purpose of the instruction address is to establish a sequence of instructions that must be executed in a specific order. Also required is the instruction continuer, which informs the CPU about the next instruction to be processed (it appends to an already existing instruction address). To enable the CPU to determine the type of computation required, the instruction type is essential, as it defines the primary instruction from the instruction set.

Instruction set

Base instructions

  • 0000 = load > imports data from RAM
  • 0001 = add > adds number to data
  • 0010 = store > stores data in RAM
  • 0011 = compare > compares two datasets
  • 0100 = output > outputs data in terminal

Note

Updates are upcoming. Not all base functionalities are given.

DATA-STORAGE

RAM

RAM structure

Example: ["00101101", "10011010"] --> [memory_address, data]

REGISTER

Register types

  • accumulator > imported data
  • memory_address > saved memory address
  • result_register > calculation values
  • state_register > (True/False) values

SETTINGS

(Default) show_process = True > shows the process-steps in terminal

(Default) clock_speed = 1 > instruction step speed

USAGE

Program your own CPU instructions in instruction_data.