Top Banner
From: http://www.obsolyte.com/sgi_indigo2/
18
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: From: . From: .

From: http://www.obsolyte.com/sgi_indigo2/

Page 2: From: . From: .

From: http://www.obsolyte.com/sgi_indigo2/

Page 3: From: . From: .

From: http://www.silicon-impact.de/gallery/albums/SGI-Indy-Components/Indy_CPU_bottom_view.jpg

Page 4: From: . From: .

From http://www.vaughns-1-pagers.com/computer/pc-block-diagram.htm

Page 5: From: . From: .

From: http://www.research.ibm.com/journal/rd/483/slege8.jpg

Page 6: From: . From: .

The CPUMemory Registers

Register 0

Register 1

Register 2

Register 3

Instruction Register

Instr. Pointer (IP)

Arithmetic/LogicUnit

Control Unit(State Machine)

Memory Access

Page 7: From: . From: .

Fetch/Execute Cycle

• At each tick of the clock– Read the Instruction pointer– Go to that address in RAM (Memory)– Fetch the contents of that location to the instruction register– Execute the instruction stored in the instruction register

• This instruction may require using the A/LU to operate on information in registers

• This instruction may involve information from registers, RAM, disk, CD, …

• This instruction may change the address in the instruction pointer. It it doesn’t, the instruction pointer is increased by 1 when the execution is done.

Page 8: From: . From: .

Simple Code

• Copy the value in Memory Location XXX to Register 0

• Move the value in Memory Location YYY to Register 1

• Add the Values in Registers 0 and 1 and store the result in Register 2

• Copy the Value in Register 2 to Memory Location ZZZ

Page 9: From: . From: .

Simple Code

• Copy the value in Memory Location XXX to Register 0 mv XXX R0

• Copy the value in Memory Location YYY to Register 1 mv YYY R1

• Add the Values in Registers 0 and 1 (result is put in the accumulator) add R0 R1

• Copy the Value in the accumulator to Register 2 cop acc R2

• Copy the Value in Register 2 to Memory Location ZZZ sto R2 ZZZ

Page 10: From: . From: .

Simple Code (the actual code)

mv XXX R0

mv YYY R1

add R0 R1

cop acc R2

sto R2 ZZZ

0001 00000001 10000000

0001 00000010 10000001

0010 10000000 10000001

0011 11000000 10000010

0100 10000010 00000011

Mneumonic (assembler) Machine level

Page 11: From: . From: .

Coding in Algebraic Fashion

• A, B, and C are integers; want to add A to B and store the result as C.

• C = A + B

Page 12: From: . From: .

Enhancements

• A programming language that can only do arithmetic operations is limited– Need to be able to process text as well as

numbers– Need to be able to structure data– Need to be able to make decisions

• IF (a certain condition) do something ELSE do something else;

Page 13: From: . From: .

A very simple program

int fact, i, n ;

fact = 1;

i = 1;

loop: i = i+1;

if (i > n) go to end:

fact = fact * i;

go to loop;

end: ….

Page 14: From: . From: .

Next steps

• A compiler is a program that translates a program into machine language.

• A compiled program is then loaded into machine memory and executed.

Page 15: From: . From: .

Next steps (Code)

• A compiler is a program that translates a program into machine language. The compiler enforces code. A compiler will only compile programs that have a structure valid in the defined language.

• A compiled program is then loaded into machine memory and executed. The machine architecture defines a code in which the machine language of the program must be written.

• The machine architecture also determines a code (via the hardware) that tells which machine languages instructions are done most efficiently.

Page 16: From: . From: .

Historical context

• Machine language – the 1950’s• First compilers –Fortran (1957), Algol (1958,

1960) Another example of code• Higher level languages – Pascal, C (early 70’s)• The present Further examples of code

– Toolkits and Programming Environments (Visual Studio .NET from Microsoft)

– Secure languages (Java from Sun Microsystems)

Page 17: From: . From: .

Toolkits

• To build a large program, programming has to begin at a higher level– String processing– User interface toolkits– Debugging tools– Shared libraries

Page 18: From: . From: .

Toolkits as code

• To build a large program, programming has to begin at a higher level– String processing

• Font libraries define how things are displayed

– User interface toolkits• The Microsoft/Apple Interface defines interaction

– File/Edit/… menus – (Cut,Copy,Paste, Undo)

– Debugging tools– Shared libraries

• If I write a library that can do most of the things you need to make one aspect of your program work, you will be inclined to use it rather than writing it yourself.

• Open source issues arise here.