Parts of computer: CPU, memory, I/O CPU: Control and data path Memory: Stores instruction and data Input/output: Interact with the outside of computers
address
data
address r/w
data
ALU
CPU
Load-store architecture
5
CPU to I/O
Port mapped I/O used when address space is limited, special instructions are needed for I/O Memory mapped I/O I/O looks like memory locations, easier to use and common in Reduced Instruction Set Computing (RISC)
7
Machine-level Execution
Machine instruction:
A bundle of binary bits with certain formats Only asks for simple operations Assembly: textual notations of machine program
Machine-Level Execution
memory
I/O address
Fetch inst
10
Processor Performance
CPU Time = # Cycles Cycle Time = # Instructions CPI Cycle Time
Programming methods
Machine Code bits Low level language assembly High level language C, C++, Java Application level language Visual Basic, Access
Nibble
4 bits 16 possible values 1 Hex character = 1 nibble
17
19
Variables in C
Can have long variable names
X in FORTRAN vs. Area, Graph2, InFile, etc.
No punctuation marks besides underscore Must start with a letter Case sensitive MyVariable myvariable Programming practice can you remember what a variable was used for 1 year from now? Use long variable names
H vs. height Fi vs. inputFile
20
Variables in C
For looping variables, use common looping names like i, j, k Spending a little more time now = savings later when debugging Use a naming convention to help quickly identify variables Some conventions
Variable names begin with a lower case letter, multiple words are separated by _ or capital letter
my_variable, myVariable, peripheralBaseAddress
21