Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computers’ Basic Organization

Similar presentations


Presentation on theme: "Computers’ Basic Organization"— Presentation transcript:

1 Computers’ Basic Organization
Von Neumann model MIPS programming model Registers Memory ALU Control Unit I/O Textbook: Appendix A .

2 C program to explain the Von Neumann model
#include <stdio.h> unsigned char array[1024]; unsigned char a,b,c; // temporary variables int i1,i2,j; // array indexes for operands and result char operation; // which operation to do int main() { printf( "Enter the operation sign +, -, /, * \n" ); scanf( "%c", &operation ); printf( "Enter the first operand's index in array \n" ); scanf( "%d", &i1 ); printf( "Enter the second operand's index in array \n" ); scanf( "%d", &i2 ); printf( "Enter the result's index in array \n" ); scanf( "%d", &j ); a = array[i1]; b = array[i2]; switch (operation) case '+': c = a+b; break; case '-': c = a-b; case '/': c = a/b; case '*': c = a*b; } array[j] = c; return 0; We have an array of bytes – this is similar to computer random access memory (RAM). It holds bytes’ values. It could be addressed – in our case for 1024 byte memory the addresses are from 0 to 1023. We can write into the array and read from it like with the memory. Variables – are similar to registers: They hold temporary values of operands after reading of the memory and hold the result before writing to memory. Operations are done with the variables (like with the registers). Input output results are kept in variables. Switch block decodes the operation like Control Unit and launches appropriate operation. The operation statements - similar to Arithmetic Logic Unit. ALU performs operations on the operands (registers) and writes the result back to variable (register). This simple C program by its behavior will help us to understand computer general organization. We should find here 5 main components of Von Neumann architecture: Memory Registers Control Unit ALU Input / Output Printf(), Scanf() – similar to Input / Output blocks. The input output is done through the registers (variables).

3 Von Neumann model Memory: keeps the program code and data.
The other units periodically refer to memory to fetch (load) the data or program or to write (store) some information. Control Unit (CU): fetches instructions from memory decodes them to produce signals which control the other parts of the computer. transfers data between memory and ALU activates peripherals to perform input or output. Arithmetic and Logic Unit (ALU): performs operations such as addition, subtraction, multiplication of integers bit-wise AND, OR, NOT and other Boolean operations. Registers ( Accumulator): The data exchange between ALU, Memory and Input/Output is done through the Registers Registers are the memory which have the fastest access for CPU instructions. Input and Output devices are used when there is need to exchange information with the outside world. The Control Unit and ALU are included in single device called Central Processing Unit (CPU).

4 What is CPU and datapath ?
Processor (CPU): the active part of the computer that does all the work (data manipulation and decision-making) Datapath: portion of the processor that contains hardware necessary to perform operations required by the processor (the brawn) Control: portion of the processor (also in hardware) that tells the datapath what needs to be done (the brain)

5 Harvard architecture physically separate storage and signal pathways for instructions and data. Allows high performance. Complex to implement 2 memories are needed Von Neumann bottleneck often limits the performance of the system But is simple to implement as only one memory is needed for both instructions and data

6 MIPS Programming Model
A programming model is an abstract view of a processor that is appropriate for programming but omits details that are not needed for that task. It is the view of the machine a programmer uses when programming. Based on this model we can suppose the existence of several groups of MIPS instructions: Inter Register transfer instructions. Memory - register transfer instructions. Input / output instructions. Arithmetic or Logical instructions with registers.

7 Another MIPS programming model from the textbook
MIPS contains: Integer arithmetic processor Floating point arithmetic processor Whole system’s Control Processor In this model from the textbook we can see several additional groups of MIPS instructions : Integer Multiplication Division instructions. Floating point arithmetic instructions. System Control instructions We have to learn all components of the model separately and all instructions and groups in details.

8 Assembly variables: Registers
Assembly Operands are registers A register is a part of the processor that can hold a bit pattern operations can only be performed on these registers. Assembly – registers, Languages - local variables Local variables in C and Java can be unlimited and can have different length Registers in Assembly limited, same length. The Hardware should be simple. It’s impossible to create unlimited amount of unknown types of bit containers in the hardware. Benefit: Since registers are directly in hardware, they are very fast Registers are the memory which have the fastest access for CPU instructions. Drawback: Since registers are in hardware, there are a predetermined number of them Solution: MIPS code must be very carefully put together to efficiently use registers

9 General Purpose Registers
A group of registers that are visible in MIPS assembly language are called general purpose registers. There are 32 general purpose registers. Why 32 ? More registers - less operations with memory . Each general purpose register holds a 32 bit pattern. Groups of 32 bits called a word in MIPS

10 Registers – Names and Numbers
Each register can be referred to by number or name Registers are numbered from 0 to 31 Number references: $0, $1, $2, … $30, $31 By convention, each register also has a name to make it easier to code The names make your code more readable For example: $16 - $23  $s0 - $s7 (saved registers – more close to local variables in C) $8 - $15  $t0 - $t7 (temporary registers – more close to global variables in C) One of the general purpose registers, Register $0, is hard-wired to always contain the value 0x (all zero bits).

11 Registers have no type. In C (and most High Level Languages) variables declared first and given a type Example: int fahr, celsius; char a, b, c, d, e; Each variable can ONLY represent a value of the type it was declared as (cannot mix and match int and char variables). In Assembly Language, the registers have no type; operation or a program determines how register contents are treated

12 Register use convention


Download ppt "Computers’ Basic Organization"

Similar presentations


Ads by Google