1 / 85

Data Manipulation

Data Manipulation. 10/4/2014 Che-Rung Lee. What’s inside?. What is a computer?. Monitor, case, keyboard, mouse, speaker, scanner, webcam, printer, …. Inside the case. CPU, motherboard, adaptors, hard disk, memory, CDROM, …. We are going to talk about those. Central Processing Unit (CPU).

ryu
Télécharger la présentation

Data Manipulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Manipulation 10/4/2014 Che-Rung Lee CS135602 Introduction to Information Engineering

  2. What’s inside? What is a computer? • Monitor, case, keyboard, mouse, speaker, scanner, webcam, printer, … CS135602 Introduction to Information Engineering

  3. Inside the case • CPU, motherboard, adaptors, hard disk, memory, CDROM, … We are going to talk about those. CS135602 Introduction to Information Engineering

  4. Central Processing Unit (CPU) • An electronic circuit that can execute computer programs • Intel i7 • AMD K10 • IBM Cell • ARM Acorn • Sun SPARC • To understand CPU, we need to know what computer programs are. CS135602 Introduction to Information Engineering

  5. Outline • Store program concept • Machine language • Program execution • Peripheral devices • Parallel architectures CS135602 Introduction to Information Engineering

  6. Stored Program Concept "The final major step in the development of the general purpose electronic computer was the idea of a stored program..." Brian Randell CS135602 Introduction to Information Engineering

  7. What’re the differences? TV: you can watch different channels. 麵包機: you can make different food. Swiss knife: you can use different tools Computer: you can … CS135602 Introduction to Information Engineering

  8. Magic box You can add more functions to it. How? Program is like data to be input to computers. It can perform multiple functions at a time We will talk about this in the OS lesson.

  9. Stored-program concept • Program: a sequence of instructions • Stored-program concept: a program can be encoded as bit patterns and stored in main memory. From there, the CPU can extract the instructions and execute them. • Advantage: programmable • We can use a single machine to perform different functions. CS135602 Introduction to Information Engineering

  10. Problems • How to convert instructions to operations? • This is like Harry Porter’s spell. • There should be a control unit. • To control which function to perform. • To control which data to be operated. • How can the control unit understand the instructions? • What function units should be included? • CD players, game console, calculators, …? CS135602 Introduction to Information Engineering

  11. Control unit Outline of the magic box Processingunit Storage unit for instructions and data Belt CS135602 Introduction to Information Engineering

  12. Large temporary storage for data and instructions Small but fast temporary storage Processing tools von Neumann architecture general purpose electronic computer Figure 2.1 CPU and main memory connected via a bus CS135602 Introduction to Information Engineering

  13. Machine Language What to do + Specified information CS135602 Introduction to Information Engineering

  14. Compiler lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) You will learn it in CS2410 Assembly Language Program Assembler Machine Language Program Machine Interpretation Control Signal Specification ALUOP[0:3] <= InstReg[9:11] & MASK Computer programs temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; You are learning it in CS1355 High Level Language Program 0000 1001 1100 0110 1010 1111 0101 1000 1010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111 This will be taught in CS4100 We are going to talk about those. CS135602 Introduction to Information Engineering

  15. Example: a = b + c 1 1+2 3 2 CS135602 Introduction to Information Engineering

  16. Represented by instructions CS135602 Introduction to Information Engineering

  17. Instruction format • Store the data in register 5 to memory cell at address A7 Op-code: Specifies which operation to execute Operand: Gives more detailed information about the operation CS135602 Introduction to Information Engineering

  18. Another example • JUMP to instruction at address 58H if the content of register 2 is the same as that of register 0 CS135602 Introduction to Information Engineering

  19. The instruction repertoire • Which instructions should be included? • For example, swapping v[k] and v[k+1] Create a new instruction, called swp, which swaps data in two memory addresses. Using load and store instructions lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) swp 0($2), 4($2) Complex Instruction Set Computing (CISC) Reduced Instruction Set Computing (RISC) CS135602 Introduction to Information Engineering

  20. Instruction types • Data Transfer • Copy data between CPU and main memory • E.g., LOAD, STORE, device I/O, • Control • Direct the execution of the program • E.g., JUMP, BRANCH, JNE (conditional jump), • Arithmetic/Logic • Use existing data values to compute a new value • E.g., AND, OR, XOR, SHIFT, ROTATE, etc. CS135602 Introduction to Information Engineering

  21. Instruction types Data transfer Data transfer Arithmetic/Logic Data transfer Control CS135602 Introduction to Information Engineering

  22. Program Execution CS135602 Introduction to Information Engineering

  23. Program execution cycle CS135602 Introduction to Information Engineering

  24. How to make a program “run”? Figure 2.10 The program from Figure 2.7 stored in main memory CS135602 Introduction to Information Engineering

  25. Instruction fetch Figure 2.11 Performing the fetch step of the machine cycle CS135602 Introduction to Information Engineering

  26. Processor Architecture Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Address bus 4 5 A0 15 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter A5 56 A6 30 Instruction register A7 6E A8 C0 A9 00 Controller

  27. Fetch Instruction 1 Processor Memory Function unit Register Decode 0 6C 1 1 6D 2 2 6E 3 Address bus 4 A0 5 A0 15 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter 156C A5 56 A0 A2 A6 30 Instruction register A7 6E 156C A8 C0 A9 00 Controller

  28. Decode Instruction 1 Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Control signal Address bus 4 5 A0 15 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter A5 56 Decode A2 A6 30 Instruction register A7 6E A8 156C C0 A9 00 Controller

  29. Execute Instruction 1 Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Address bus 4 1 6C 5 A0 15 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter 1 A5 56 Decode A2 A6 30 Instruction register A7 6E A8 C0 156C A9 00 Controller

  30. Fetch Instruction 2 Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Address bus 4 A2 1 5 A0 15 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter 166D A5 56 A2 A4 A6 30 Instruction register A7 6E 166D A8 C0 A9 00 Controller

  31. Decode Instruction 2 Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Address bus 4 1 5 A0 15 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter A5 56 Decode A4 A6 30 Instruction register A7 6E A8 166D C0 A9 00 Controller

  32. Execute Instruction 2 Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Address bus 4 6D 1 5 A0 15 2 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter 2 A5 56 Decode A4 A6 30 Instruction register A7 6E A8 C0 166D A9 00 Controller

  33. Fetch Instruction 3 Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Address bus 4 A4 1 5 A0 15 2 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter 5056 A5 56 A4 A6 A6 30 Instruction register A7 6E 5056 A8 C0 A9 00 Controller

  34. Decode Instruction 3 Processor Memory Function unit Register 0 6C 1 1 6D 2 2 6E 3 Address bus 4 1 5 A0 15 2 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter A5 56 Decode A6 A6 30 Instruction register A7 6E A8 5056 C0 A9 00 Controller

  35. Adder Execute Instruction 3 Processor Memory Function unit Register 3 0 6C 1 1 6D 2 2 6E 3 Address bus 4 1 5 A0 15 2 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter A5 56 Decode A6 A6 30 Instruction register A7 6E A8 C0 5056 A9 00 Controller

  36. Fetch Instruction 4 Processor Memory Function unit Register 0 3 6C 1 1 6D 2 2 6E 3 Address bus 4 A6 1 5 A0 15 2 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter 306E A5 56 A6 A8 A6 30 Instruction register A7 6E 306E A8 C0 A9 00 Controller

  37. Decode Instruction 4 Processor Memory Function unit Register 0 3 6C 1 1 6D 2 2 6E 3 Address bus 4 1 5 A0 15 2 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter A5 56 Decode A8 A6 30 Instruction register A7 6E A8 306E C0 A9 00 Controller

  38. Execute Instruction 4 Processor Memory Function unit Register 0 3 6C 1 1 6D 2 2 3 6E 3 Address bus 4 6E 1 5 A0 15 2 6 A1 6C A2 16 F A3 Data bus 6D A4 50 Program counter 3 A5 56 Decode A8 A6 30 Instruction register A7 6E A8 C0 306E A9 00 Controller

  39. Instruction decode • How to map opcodes to desired circuits on a CPU? • For example: • 00b: add • 01b: or • 10b: jump • 11b: and CS135602 Introduction to Information Engineering

  40. Interpretation of operand • The interpretation of operand depends on the op-code CS135602 Introduction to Information Engineering

  41. Instruction execution • Uses logic circuits • Data transfer: load, store, … • Logic circuit for registers (Ex: flip-flops) • Control: jump, jump-equal, … • Change the value of program counter (PC) • Comparison logic circuit • Arithmetic/Logic: add, and, shift, … • Again, logic circuits (adder, as we have seen.) CS135602 Introduction to Information Engineering

  42. Flip-flops • A logic circuit that can store one bit. • Upper input is used to set its stored value to 1 • Lower input is used to set its stored value to 0 • While both input lines are 0, the most recently stored value is preserved • Initially, both inputs and outputare 0 CS135602 Introduction to Information Engineering

  43. Flip-flops: set value 1 The input signal 1 0 CS135602 Introduction to Information Engineering

  44. Flip-flops: set value 0 Input (1,1) is undefined CS135602 Introduction to Information Engineering

  45. Example of jump • JUMP to instruction at address 58H if the content of register 2 is the same as that of register 0 CS135602 Introduction to Information Engineering

  46. Register 0 Register 2 XOR OR NOT : : Example of jump-equal • B258: JUMP to instruction at address 58H if the content of register 2 is the same as that of register 0 In case you forgot what XOR is 58H=01011000 set Program counter CS135602 Introduction to Information Engineering

  47. Arithmetic/Logic Operations CS135602 Introduction to Information Engineering

  48. Arithmetic/Logic operations • Arithmetic: add, subtract, multiply, divide • Precise action depends on how the values are encoded (two’s complement vs. floating-point) • Shift • circular shift (Rotate), logical shift, arithmetic shift • Logic: AND, OR, XOR, NOT • Masking CS135602 Introduction to Information Engineering

  49. One bit full adder CS135602 Introduction to Information Engineering

  50. 4 bit parallel adder CS135602 Introduction to Information Engineering

More Related