Pipelining Flashcards
How many and what kinds of registers are present in the MIPS architecture?
There are 32 registers from r0 to r31.
Each of these registers are 32 bits and they are all equivalent except for r0 which is always 0 and r31 which is used for jal.
What are the special registers from r0 to r31 in MIPS architecture?
The special registers are r0 and r31
r0: Used to store 0
r31: Used for jal (Jump and Link) instruction to store the return address of call
There are also 2 special registers $hi and $lo to store the results of multiplicatin and division.
What are the aliases for the registers in MIPS (r29, r30, r31)?
r29: $29: Stack pointer:
r30: $30: frame pointer
r31: $31: return address
What type of architecture does the MIPS use for accessing memory and stuff?
MIPS uses load store architecture, which means that memory is only used to :
- Load data onto registers.
- Store data from registers
Some operands can be immediate values instead of registers
What are the 3 types of instruction formats in MIPS?
The three types of instruction formats are R type, I type and J Type instructions.
- R-Type: Acts on registers
- I-type: Immediate
- J-Type: Jump instructions
How do you compile a file to mips assembly ( call.c )
clang -S call.c -o call.s -target mips
What is the fetch-execute cycle in MIPS
There are 5 stages in the FE cycle in MIPS:
- IF: Instruction fetch - fetch the instructions from the memory, increment the program counter.
- ID: Decode the instruction, analyse the opcode and gather the operands.
- EX: Execute the instruction, do computations and calculate jumps.
- MEM: Access memory if needed
- WB: Write back to memory.
What is a pipeline stall?
Delays because the execution of one instruction depends on the result of the previous instruction.
What are the causes of pipeline stalls?
Structural Hazard: 2 tasks can’t be executed simultaneously because they both require the use of the same hardware.
Data Hazard: The output of one instruction is the input of the other instruction
Control Hazard: When conditional branching changes the instruction to be executed next.
Solutions for structural hazard and what’s the drawback?
Duplicating the execution units and the drawback is that this is expensive.
Solutions for data hazards.
if one instruction is writing to certain registers, then stall the instructions which require those registers.
What is data forwarding or bypassing?
Data forwarding or bypassing is when the ID detects a data hazard and then forwards the result to the next instruction at the same time it is being written to the destination register through the ALU outputs and the inputs.
What is the nop in assembly?