Lecture 3 - Processor and memory Flashcards
What is processor architecture?
What components the processor consists of, and how they are connected
What are the two types of processor architectures?
The two types seperates how memory is organized.
Von Neumann: Shared instruction- and data memory (general purpose).
Harvard: Seperate memories for instruction and data (mostly used in embedded systems)
Why is Harvard architectures best for embedded systems?
To optimize memory use.
You know the text segment at run time. Won’t be new instructions, and can therefor seperate data and text.
What are the main processor functions?
Fetch: Get instruction from memory (send PC to memory and read from memory at this address)
Decode: What operation need to be performed, and what are the operands. Locates the operands
Executes: Read operands and execute instructions. Save results
What is a single cycle processor design?
All functions (fetch, decode, execute) are all performed in one cycle.
Cycle needs to be long enough to cover all the functions.
What is a downside with using single cycle designs?
Only one piece of hardware is being used at the time. During fetch, decode and execution is idle. During decode, fetch and execution is idle
What is pipelined processor design?
Breaks instruction execution in different phases.
Execute one phase in one cycle. Because of this, less work is done per cycle - can increasy frequency
Can overlap execution of phases, as these are executed on different pieces of hardware.
What stages updates the PC in a pipeline design?
Fetch must update the PC, so that the next instruction is ready to be fetched next cycle.
For branch instructions, execute stages sets the PC - don’t know earlier because of branch conditions needs to be resolved.
What is the formula for execution time?
Instruction count * CPI * cycle time
What are the types of dependencies?
Data- and control dependencies
Compare execution time of single- and pipeline processors
Instruction count is the same
CPI is the same (Because of overlap, though one instruction takes n cycles, the overlap causes one instruction to finish every cycle)
Pipeline has 1/n cycle time of single cycle
Pipeline can provide n-times the performance (the ideal case)
Why is 1/n only the ideal performance increase of pipeline, and not the actual one
To be able to achieve 1/n cycle time in pipelined processors, the work for each phase must be evenly distributed. This is difficult to do.
Even if the cycle time is 1/n, the CPI being 1 is difficult because of dependencies causing hazards
What are data dependencies?
An instruction reads the result of a previous instruction before the result is ready to be used
What is a control dependency?
Instruction execution depends on the outcome of branch instructions
What is one way to avoid hazards?
Pause pipeline - increases execution time
What are true (data) dependencies?
Data written by one instruction is being used by another
What are named dependencies / false dependencies
No data movement between instructions, but instructions are using the same registers.
What are anti dependencies
A type of named dependency
One instruction reads a register. A later instruction writes to this register. These instructions can’t be reorderes as the first would read a different value if it were to execute after the second.