Introduction Flashcards
CPU (Central Processing Unit)
the “overworked clerk” performs simple tasks
(ADD/SUB/MUL/DIV/LOGIC).
The task to perform is also known as an “instruction.”
Memory
the clerk’s “desk drawers,” a.k.a. the clerk’s “memory.” Each drawer has a number, also known as an address.
Program memory
contains instructions for the clerk and tells it what to do.
Data memory
contains data for the clerk to work on.
Program Counter (PC)
tells the clerk which program memory drawer to open
up and execute.
basic parts of a CPU
○ ALU (has no own memory, can only do arithmetic and logic operations)
○ PC
○ Memory for data
○ Memory for instruction
Basic Operation of a CPU
○ Program Counter tells clerk which drawer to open up
■ Referred to as instruction “fetching”
○ Clerk examines instruction and performs operation
■ Referred to as instruction “decoding” and “execution”
○ Stores result of instruction in data memory drawer
■ Optional part of the execution of an instruction
○ Updates the program counter (PC)
■ PC = PC + 1 ; so we advance to next instruction upon repeat
■ optionally: PC = some other value ; if we wish to ‘jump’ around to
another part of our program.
○ Repeats this process until instructions are complete
■ Instructions constitute a “program”
Algorithm
Step-by-step procedure that is guaranteed to terminate
Procedure:
-Definiteness: each step is precisely stated
-Effective computability: each step can be carried out by computer
- finiteness: procedure terminates