What is the use of a $zero register in MIPS?

The zero register always holds the constant 0. There’s not really anything special about it except for the fact that 0 happens to be a very useful constant. So useful that the MIPS designers dedicated a register to holding its value. (This way you don’t have to waste another register, or any memory, holding the … Read more

What is the difference using NOP and stalls in MIPS

I think you’ve got your terminology confused. A stall is injected into the pipeline by the processor to resolve data hazards (situations where the data required to process an instruction is not yet available. A NOP is just an instruction with no side-effect. Stalls Recall the 5 pipeline stage classic RISC pipeline: IF – Instruction … Read more

MIPS – Fetch address not aligned on word boundary

I’m pretty new to assembly programming and programming in general and I’m doing my best to learn. I’ve been having trouble storing inputs to variables, can you help me please? The problem seems to occur when I load the addresses of n1 and n2, or something like that. I have tried looking at similar problems … Read more

Loading and storing bytes in MIPS

This performs the addition $s3 = 0 + 0, effectively setting the register $s3 to a value of zero. This loads a byte from a location in memory into the register $t0. The memory address is given by 1($s3), which means the address $s3+1. This would be the 0+1=1st byte in memory. Since we have a big-endian architecture, we read bytes the 4-byte … Read more