Hey guy! ![]()
In my 1-2 years of being inactive, I’ve been taking many programming and computer science classes
My main reason for returning is I wanted to apply my knowledge to GKC!
This first part I will be explaining what and how a CPU works in the simplest terms and we will be designing an instruction set!
CPU stands for Central Processing Unit. What it does is it processing inputs. For example, a calculator. Let’s say you want to do 1+1. The CPU would take the 2 inputs (1 and 1), and do something to it and KABOOM! Now it’s a 2! A CPU can do a lot more than just add numbers!
Computers sadly can’t understand stuff like “add one and one,. They can only understand strings of 0 and 1, for example “10101110001,. This is also known as binary. Sometimes, binary numbers are too long to write out. This is where hexadecimal comes in! Computers can easily convert hexadecimal into binary, and hexadecimal is very short.
Decimal to Binary
Decimal to Hex
Binary to Hex
For now, use these converters I have linked because I don’t feel like teaching how to convert it.
Next up I want to explain the components of a CPU
- Clock: Synchronizes inputs and outputs
- ALU (Arithmetic Logic Unit): Does addition, subtraction, multiplication, and division
- Registers: Short-term memory to hold data that is waiting on being processed
- CU (Control Unit): Tells the CPU what to do
Now, this isn’t really a component of the CPU, but it’s important for it to function: ROM (Read-Only Memory). This type of memory is permanent and cannot be changed. It holds the instruction set (which we will talk about soon), operating system, and more, but for simplicity the ROM will only be used to hold the instruction set.
The final part here is the instruction set. Think of the instruction set as the computer’s own coding language! We will design an instruction set right now!
First of all of course we need the arithmetic functions!
ADD
SUB
MULT
DIVI
Next we need a function to take data from RAM (Random Access Memory) to put it into a register to be processed, and one to do vice versa, which is take data from a register and put it into RAM.
LOAD
STORE
Here’s the formatting I will use:
ADD, SUB, MULTI, or DIVI( reg no., reg no. )
LOAD or STORE( reg no., byte no. in RAM )
Guys please forgive my lack of formatting i’m still re learning markdown and also I PROMISE THE NEXT PART WILL HAVE STUFF IN GKC IM VERY SORRY IF THIS IS OFF TOPIC I DIDNT WANT TO OVERLOAD YALLS BRAINS WITH TOO MUCH
i will try to answer all y’all’s questions