CS251 - Computer Organization
What is a computer?
A machine that can solve problems by following a set of instructions.
What are some of the main parts of a computer?
CPU, Memory, Disks, Monitor ...
Let's consider a simple computer...
K&S Model 1 - Datapath Simulator
The Parts:
Registers: Hold data values
Knobs: Select addresses and operations
ALU: Performs arithmetic and locical functions
Switches: Make or break connections
Programming the K&S Model 1:
Add register 0 to register 1 and put the result in register 3.
Set the knobs and switches:
Click on "Run Cycle"
What is missing from this model?
Lots of things but very obviously... Memory (RAM)!
RAM == Random Access Memory
Adding Memory to the K & S Computer:
K&S Model 1 - Datapath Simulator w/ Main Memory
New Parts:
Memory Addresses
Main Memory Bus
New Switches
Reading and Writing Memory:
Reading memory:
Select the memory cell to read
Open switch from ALU
Close switch from Main Memory Bus
Close switch to registers
Select Register to write
Click on Run Cycle
Writing memory:
Homework Exercise: Not quite as straight forward as reading memory...
So what is missing from this model?
Some obvious hardware - but lets think about functionality...
Can this computer be programmed?
Only one instruction at a time...
That's not much of a program!
Adding Programmability to the K&S model 1:
What types of instructions do computers understand?
Java?
C++?
When you get right down to it they only understand 1's and 0's!
Ultimately, this class is all about how do computers do what they do while only really understanding 1's and 0's.
So how can we write a program for the K&S model 1?
Use patterns of 1's and 0's to express all of the knob and switch positions and also the selected memory cell...
One possible scheme is:
Now would I write the instruction: MM[2] = R0 - R2
How would I compute R0 = MM[1] + R2?
This takes two steps:
Move MM[1] into a register (R1)
Add R1 to R2 and put the result into R0
Micro-Programming:
K&S Model 1 - Datapath Simulator w/ Micro-programming
Write a micro-program to compute R0 = MM[1] + R2
Step 1: R1 = MM[1]
Step 2: R0 = R1 + R2
This is essentially how the first computers were programmed!
Load Main Memory by setting switches.
Load the program by setting switches
.
Hit the run button.
Read results from memory by looking at lights.
Syllabus etc...
Class webpage
Syllabus is on-line - read it!