Transcript Document

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
3138: A3
2142: A5
3170: A7
1138: A9
1270: AB
3170: AD
3238: AF
C000:
21
31
21
31
11
12
31
32
A2
A4
A6
A8
AA
AC
AE
B0
41
38
42
70
39
70
70
38
B1
C0
B2
1.
2.
3.
4.
5.
6.
7.
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
Logic instructions: OR
OR
10011010
11001001
11011011
OR
00001111
10101010
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
OR
10011010
00000001
10011011
OR
10011010
10000000
10011010
Masking with XOR
Complementing a bit map (or part of a bit
map)
XOR
10011010
11111111
01100101
XOR
10011010
11110000
01101010
Rotating/shifting
10011010
01001101
circular shift
10011010
two’s complement
representation
10110100
10110100
logical shifts
doubling
11011010
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.)