Presentation is loading. Please wait.

Presentation is loading. Please wait.

From: From:

Similar presentations


Presentation on theme: "From: From:"— Presentation transcript:

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

2

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

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

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

6 The CPU Memory Registers Register 0Register 1Register 2Register 3Instruction RegisterInstr. Pointer (IP) Arithmetic/Logic Unit Control Unit (State Machine) Memory Access

7 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.

8 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

9 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

10 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

11 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

12 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;

13 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: ….

14 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.

15 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.

16 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)

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

18 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.


Download ppt "From: From:"

Similar presentations


Ads by Google