Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet.

Similar presentations


Presentation on theme: "1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet."— Presentation transcript:

1 1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet

2 2 Computer Organization Two Major Sub-Parts: CPU with registers Memory where instructions and data are stored CPU with registers instruction pointer (IP) register, often called the program counter (PC) instruction register (IR) condition flag (CF) computation register (AX), often called the accumulator general purpose registers

3 The P88 Machine: 1 computational register (AX) 12 Instructions (plus END) COPY AX, mem copy from mem, AX = mem COPY mem, AX copy to mem, mem = AX ADD AX, mem add, AX = AX + mem SUB AX, mem subtract, AX = AX - mem MUL AX, mem multiply, AX = AX * mem DIV AX, mem divide, AX = AX / mem CMP AX, mem compare, if AX < mem then CF = B else CF = NB JMP label jump, goto instr marked with label JNB label jump if not below, goto instr w/ label, if CF==NB otherwise goto next instr JB label jump if below, goto instr w/ label, if CF==B otherwise goto next instr IN AX input, integer input to AX OUT AX output, integer output from AX END halt, stop execution

4 4 Fetch-Execute Cycle Repeat Forever: Fetch the next instruction use address in IP to get instruction Increment the IP (program counter) Decode the instruction Execute the instruction

5 5 Program Execution instruction pointer (IP) 11 instruction register (IR) accumulator register (AX) : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

6 6 Program Execution instruction pointer (IP) 11 instruction register (IR) copy AX, X accumulator register (AX) : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

7 7 Program Execution instruction pointer (IP) 12 instruction register (IR) copy AX, X accumulator register (AX) : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

8 8 Program Execution instruction pointer (IP) 12 instruction register (IR) copy AX, X accumulator register (AX) 4 : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

9 9 Program Execution instruction pointer (IP) 12 instruction register (IR) add AX, Y accumulator register (AX) 4 : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

10 10 Program Execution instruction pointer (IP) 13 instruction register (IR) add AX, Y accumulator register (AX) 4 : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

11 11 Program Execution instruction pointer (IP) 13 instruction register (IR) add AX, Y accumulator register (AX) 7 : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

12 12 Program Execution instruction pointer (IP) 13 instruction register (IR) copy Z, AX accumulator register (AX) 7 : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

13 13 Program Execution instruction pointer (IP) 14 instruction register (IR) copy Z, AX accumulator register (AX) 7 : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 200 (Z) : CPU: Memory:

14 14 Program Execution instruction pointer (IP) 14 instruction register (IR) copy Z, AX accumulator register (AX) 7 : 11copy AX, X 12add AX, Y 13copy Z, AX : : 1E4 (X) 1F3 (Y) 207 (Z) : CPU: Memory:

15 15 Example Read two numbers, multiply them, and then print the result. in AX copy Y, AX inAX multAX, Y outAX

16 16 Example Reads how many numbers(>0), then numbers, sums and outputs. ONE1 //1 conveniently stored in memory in AX copy CT, AX //stores a ct in memory subAX,CT copyZERO, AX //stores a 0 in memory copySUM, AX //initialize sum to 0 LOOPinAX //get a number addAX,SUM //add to sum copySUM,AX //store new sum copyAX, CT //gets ct from memory subAX,ONE //decrement ct copy CT, AX //stores new ct in memory cmpAX,ONE //if AX < 1 then CF =B, else CF=NB jnbLOOP //do again copyAX,SUM //get SUM back in the accumulator outAX //output SUM end //halt

17 Format: Python Code translation Assembly Language Code translation Machine Language Code Execution by Electric Circuitry Example: Z = X + Y translation copy AX, X add AX, Y copy Z, AX translation 00101101 01001010 00100001 Execution of codes 00101101, 01001010, 00100001 Language Translation: Higher Level Languages (like Python) are translated to Lower Level Languages (like assembly language or machine language.)

18 18 How is this done? Production rules are recognized in the source language (syntax recognition) Compute meaning "semantics" for each entity recognized This computed meaning eventually generates object code. Production rules would recognize the string: Z = X + Y Lots of bookkeeping--are they all legal variables, get addresses for the variables, etc. Then "output" equivalent code: copy AX, X add AX, Y copy Z, AX

19 19 History of the Internet The next two slides summarize the information available in the slide show found at: http://www.wellesley.edu/cs100/Internethttp://www.wellesley.edu/cs100/Internet 1. The internet started as ARPAnet (Advanced Research Projects Agency). 2. Other networks started forming: bitnet, CSnet, NSFnet, etc. 3. These networks became interconnected to form the internet. 4. Several organizations oversee the internet: Internet Society Internet Corporation for Assigned Names and Numbers (ICANN) Network Information Services

20 20 TCP/IP The Internet is a Packet Switched Network--messages are sent as packets. Messages are sent across the web using the TCP/IP protocols Transmission Control Protocol (TCP) breaks up the messages and puts on header information regarding the order of packets and for error checking. Internet Protocol (IP) addresses the packets and sends them across the internet. The packets don’t all necessarily follow the same route or arrive in the correct order. IP unpacks the packets at their destination. TCP puts the packets in their proper order at the end.


Download ppt "1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet."

Similar presentations


Ads by Google