Download presentation
Presentation is loading. Please wait.
Published byHoratio Page Modified over 9 years ago
1
Data Manipulation CSC 2001
2
Overview Computer Architecture Machine Language Computer Architecture Machine Language
3
Disclaimer There is A LOT more detail to computer architecture & machine language than what I’ll go over today. That detail is of great interest, but beyond the scope of this class. Basically, this is a simplified, high-level view. We can explore more outside of class if you are interested. There is A LOT more detail to computer architecture & machine language than what I’ll go over today. That detail is of great interest, but beyond the scope of this class. Basically, this is a simplified, high-level view. We can explore more outside of class if you are interested.
4
General approach Build up a basic understanding of architecture and begin to look at how it gets used to manipulate data.
5
Computer Architecture Input device Output device Auxiliary storage device Central Processing Unit Control Unit Arithmetic/logic unit Memory unit
6
Computer Architecture Central Processing Unit Control Unit Arithmetic/logic unit Memory unit Bus
7
Central Processing Unit (CPU) Central Processing Unit Control Unit Arithmetic/logic unit Pentium (Intel) PowerPC (Motorola & IBM) SPARC
8
CPU
9
~55 million transistors
10
Control Unit Central Processing Unit Control Unit Arithmetic/logic unit Memory unit Bus
11
Control Unit Circuits for coordinating the machine’s activities
12
Arithmetic/Logic Unit Central Processing Unit Control Unit Arithmetic/logic unit Memory unit Bus
13
Arithmetic/Logic Unit Arithmetic/logic unit Circuits for performing data manipulation.
14
Memory Main memory Registers Cache memory Main memory Registers Cache memory
15
Registers The CPU circuitry has to have a place to hold data that it is working with. Very fast access Use: Control unit transfers data from memory to registers. Informs the ALU where the data is. Activates the ALU Tells it which register to store the result in The CPU circuitry has to have a place to hold data that it is working with. Very fast access Use: Control unit transfers data from memory to registers. Informs the ALU where the data is. Activates the ALU Tells it which register to store the result in
16
Example: Adding two numbers Load a register with one value from main memory (control unit/main memory/bus) Load another register with a value from main memory (control unit/main memory/bus) Tell the ALU to add two specific registers and where to store the result (control unit/ALU) Do the addition and store the result (ALU) Copy the result to main memory (control unit/main memory/bus) Load a register with one value from main memory (control unit/main memory/bus) Load another register with a value from main memory (control unit/main memory/bus) Tell the ALU to add two specific registers and where to store the result (control unit/ALU) Do the addition and store the result (ALU) Copy the result to main memory (control unit/main memory/bus)
17
Cache memory Purpose: Store pertinent part of main memory on CPU itself for faster access. Level 1 (L1/primary): typically small, but on CPU Level 2 (L2/secondary/backside): small compared to main memory, larger than L1 cache, not on CPU Purpose: Store pertinent part of main memory on CPU itself for faster access. Level 1 (L1/primary): typically small, but on CPU Level 2 (L2/secondary/backside): small compared to main memory, larger than L1 cache, not on CPU
18
Bus Central Processing Unit Control Unit Arithmetic/logic unit Memory unit Bus
19
Central Processing Unit Memory unit Bus Physically transfers data between CPU and main memory
20
Early programming Hardwiring (rewiring) the control unit.
21
Breakthrough Program can be encoded and stored like data. Generalize control unit to read and execute instructions. A computer’s set of instructions and the encoding system comprise a machine language. Program can be encoded and stored like data. Generalize control unit to read and execute instructions. A computer’s set of instructions and the encoding system comprise a machine language.
22
Machine Language Instruction set: CPU dependent Usually relatively small Two philosophies: Reduced Instruction Set Computer (RISC) minimal set of instructions; efficient and fast example? Complex Instruction Set Computer (CISC) larger set; easy to program (at the machine level); one CISC instruction = several RISC instructions example? Instruction set: CPU dependent Usually relatively small Two philosophies: Reduced Instruction Set Computer (RISC) minimal set of instructions; efficient and fast example? Complex Instruction Set Computer (CISC) larger set; easy to program (at the machine level); one CISC instruction = several RISC instructions example?
23
Instruction categories Data transfer Arithmetic/logic Control Data transfer Arithmetic/logic Control
24
Data transfer Movement of data LOAD or STORE Movement of data LOAD or STORE
25
Arithmetic/logic AND, OR, XOR, SHIFT, ROTATE
26
Control directs the execution of program JUMP to another part of the program directs the execution of program JUMP to another part of the program
27
Example Appendix C Review machine architecture Review syntax of language Review semantics of language Example Figure 2.2/Figure 2.7 Appendix C Review machine architecture Review syntax of language Review semantics of language Example Figure 2.2/Figure 2.7
28
Another example Store the ASCII letter A in memory location 56. Store the ASCII letter B in memory location 112. Swap the bit patterns in memory locations 56 and 112 Halt Store the ASCII letter A in memory location 56. Store the ASCII letter B in memory location 112. Swap the bit patterns in memory locations 56 and 112 Halt
29
First steps ASCII A? 01000001 (Hex: 0100 0001 = 41) ASCII B? 01000010 (Hex: 0100 0010 = 42) Hex 56? 38 (3*16 + 8 = 48 + 8 = 56) Hex 112? 70 (7*16 + 0 = 112) ASCII A? 01000001 (Hex: 0100 0001 = 41) ASCII B? 01000010 (Hex: 0100 0010 = 42) Hex 56? 38 (3*16 + 8 = 48 + 8 = 56) Hex 112? 70 (7*16 + 0 = 112)
30
Program Store the ASCII letter A in memory location 56. 2141 3138 Store the ASCII letter B in memory location 112. 2142 3170 Store the ASCII letter A in memory location 56. 2141 3138 Store the ASCII letter B in memory location 112. 2142 3170
31
Program (continued) Swap the bit patterns in memory locations 56 and 112 1138 1270 3170 3238 Halt C000 Swap the bit patterns in memory locations 56 and 112 1138 1270 3170 3238 Halt C000
32
Final program 2141 3138 2142 3170 1138 1270 3170 3238 C000 2141 3138 2142 3170 1138 1270 3170 3238 C000 Simple program completely storable as data.
33
Practice problems If you find this difficult, do some of the practice problems on page 82 (answers start on page 518). Do enough to either convince yourself you understand or find the places you are having problems!! If you find this difficult, do some of the practice problems on page 82 (answers start on page 518). Do enough to either convince yourself you understand or find the places you are having problems!!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.