270 likes | 435 Views
Data Manipulation. CSC 2001 TTU. Now what?. Program can be represented (and stored) like data. So, now what happens? The program needs to retrieved from memory and executed. Program execution. Need to “add” some special purpose registers to the CPU to help with this. Program counter
E N D
Data Manipulation CSC 2001 TTU
Now what? • Program can be represented (and stored) like data. So, now what happens? • The program needs to retrieved from memory and executed.
Program execution • Need to “add” some special purpose registers to the CPU to help with this. • Program counter • Keeps up with location in program (address of next instruction). • Instruction register • Holds the instruction being executed.
Program execution • Control unit’s basic algorithm • the machine cycle • fetch • decode • execute • repeat
Program execution • Fetch • Retrieve the next instruction from memory and increment the program counter. • Decode • Decode the bit pattern in the instruction register. • Execute • Perform the action required by the decoded instruction.
Example • Let’s say each memory cell is a byte. • Our memory addresses are 1 byte. • Program counter: 1 byte • Our instructions each take 2 bytes. • Instruction register: 2 bytes • Must increment program counter by 2 each time.
Example (continued) 2141: A1 21 A2 41 3138: A3 31 A4 38 2142: A5 21 A6 42 3170: A7 31 A8 70 1138: A9 11 AA 39 1270: AB 12 AC 70 3170: AD 31 AE 70 3238: AF 32 B0 38 C000: B1 C0 B2 00 Program counter: A1 Instruction register: 2141 Program counter: A3 Decode 2141 Execute 2141 Instruction register: 3138 Program counter: A5 Decode 3138 Execute 3138 . . .
Instruction set • We’ve seen addition, jump, load, store. • We haven’t looked at logical operations • AND, OR, XOR
Logic instructions: AND 10011010 AND 11001001 10001000 00001111 AND 10101010 00001010
Logic instructions: OR 10011010 OR 11001001 11011011 00001111 OR 10101010 10101111
Logic instructions: XOR 10011010 XOR 11001001 01010011 00001111 XOR 10101010 10100101
Bit maps and masking • Using a bit string to represent the presence (or absence) of something. • Meaning of bit string specific to use. • Examples: • attendance • keeping up with what users have seen within a computer application
Masking with AND • Checking for the presence of a 1. 10011010 AND 10000000 10000000 10011010 AND 00000001 00000000
Masking with OR • Setting a bit without disturbing other bits 10011010 OR 00000001 10011011 10011010 OR 10000000 10011010
Masking with XOR • Complementing a bit map (or part of a bit map) 10011010 XOR 11111111 01100101 10011010 XOR 11110000 01101010
Rotating/shifting 10011010 01001101 10011010 10110100 10110100 11011010 circular shift two’s complement representation doubling logical shifts halving
Communicating with other devices • Controllers • mediates communication between computer and device • translates messages back and forth • has to speak both “languages” • plugs in system bus and can be found at a particular “port” on the bus
Communicating with other devices • Computer typically doesn’t blindly flood a device with data. • Device might not be able to keep up. • Coordination occurs through a two-way communication (handshake) that lets the computer know about the device’s status
Communication rates • Rate of bit transfer • bps (bits per second) • Kbps • Mbps • Gbps
Communication types • parallel • multiple bits sent simultaneously down several lines • faster, but more complicated • serial • one bit at a time sent along same wire
Exam 1 review • Try not to surprise on tests • However, these notes are not necessarily comprehensive • Aim for understanding over memorizing • But the two are not mutually exclusive
Exam 1 review • Chapters 0 - 2 • 0.1 - 0.4 • 1.1 - 1.7 • 2.1 - 2.5 • Lectures
Chapter 0 • What is an algorithm? • What is the process of abstraction? • Charles Babbage • Ada Byron, Countess of Lovelace • Grace Hopper • Will not ask much on history. • Will not ask dates.
Data storage • Boolean operators • Gates • Evaluate inputs • Translate between Boolean logic and circuit • Convert between bases 10, 2, and 16 • Basic memory organization • Understand seek time, latency time, access time, transfer time
Data storage • Representing text • Don’t memorize ASCII table • Basic difference between ASCII and UNICODE • Bitmap images • Representing sound
Data storage • Numbers • Integers • Two’s complement • Conversion • Adding • Overflow problem • Floating point • Given rules regarding translation, perform translation
Data manipulation • Basic architecture • Basic machine language • RISC vs. CISC • Understand and be able to work with sample machine language (Appendix will be provided here if needed.)