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.
What is output dependencies?
Type of named/false dependencies.
Output dependencies uses the same output registers.
For example when two instruction write to the same data. If other instructions depends on the stored value of this data from one of the instructions, re-ordering the write instructions will cause wrongful execution.
The instructions themselves are not effected by each other, but other instructions are
What is branch penalty
When pipeline needs to be flushed because of wrong execution path.
Loss of cycles
What can be done to avoid control hazards?
While a branch instruction is passing through the pipeline, start execution of instructions that are completely independent.
Disadvantages:
Difficult in general to find these instructions.
This is more difficult for deeper pipelines.
Exposes pipeline design to programmer/compiler -> architecture dependent code
Can also use a branch predictor
What is a branch predictor?
Hardware that predicts the direction taken by the branch, before the next fetch is executed.
What can be done to boost performance
Out-of-order execution
Superscalar processors (fetch, decode and execute multiple instructions per cycle)
Multithreaded processors (execute multiple instructions streams in parallell)
Caching, prefetch
What are the different memory technologies that are available?
speed and cost for 1GB
SRAM: (1-10 ns), expensive ($1000)
DRAM: (100 ns), $10
Flash SSD: (100 micro meter), $1
Magnetic disk: (10 ms), $0.1