Intro To Comp Architecture
Intro To Comp Architecture
Intro To Comp Architecture
c) Set-associative Mapping
This type of mapping is an improved version of direct mapping that does
not have the downsides of direct mapping. This is accomplished by
stating that we will create sets of many lines in the cache rather than
having a single line that a block can map to exactly. The lines of a
particular set can then be mapped to any block in memory. Each word in
the cache can have two or more words in the main memory at the same
index address thanks to set-associative mapping.
3. Pipeline hazards
a) Structural hazards
Structural hazards arise due to hardware resource conflict amongst the
instructions in the pipeline. A resource here could be the Memory, a
Register in GPR or ALU. This resource conflict is said to occur when
more than one instruction in the pipe is requiring access to the same
resource in the same clock cycle. This is a situation that the hardware
cannot handle all possible combinations in an overlapped pipelined
execution.
b) Data hazards
Instruction depends on result of prior instruction still in the pipeline.
Data hazards are classified into three categories based on the order of
READ or WRITE operation on the register and these include RAW (read
after write), WAR (write after read) and WAW (write after write).
c) Control hazards
Caused by delay between the fetching of instructions and decisions about
changes in control flow of program or instructions execution (branches and
jumps).
5. Two locality principles observed with respect to user programs and how
they are exploited in computer design : -
a) Temporal locality
Temporal locality is the tendency of programs to use data items over and
again during the course of their execution. This is the founding principle
behind caches and gives a clear guide to an appropriate data-management
heuristic. If a program uses an instruction or data variable, it is probably
a good idea to keep that instruction or data item nearby in case the
program wants it again in the near future. Items accessed recently are
likely to be accessed again soon for example instructions in a loop and
induction variables.
b) Spatial locality
Items near those accessed recently are likely to be accessed soon for
example sequential instruction access and array data. To exploit spatial
locality, a cache uses larger blocks to hold several consecutive words.
The advantage of a block size greater than one is that when a miss occurs
and the word is fetched into the cache, the adjacent words in the block
are also fetched.