title: Nop and Pipeline Hazards in this Assembly MIPS
body: <p>After Compiling C to Assembly MIPS by Cross Compiler , i had:</p>
  
  <pre><code>main:
  .frame $fp,32,$31 # vars= 16, regs= 1/0, args= 0, gp= 8
  
  addiu $sp,$sp,-32
  sw $fp,24($sp)
  move $fp,$sp
  li $2,5 # 0x5
  sw $2,8($fp)
  lw $2,8($fp)
  nop
  sw $2,16($fp)
  li $2,5 # 0x5
  lw $3,16($fp)
  nop
  beq $3,$2,$L4
  nop
  
  li $2,10 # 0xa
  lw $3,16($fp)
  nop
  beq $3,$2,$L5
  nop
  
  li $2,1 # 0x1
  lw $3,16($fp)
  nop
  beq $3,$2,$L3
  nop
  
  b $L7
  nop
  
  $L3:
  lw $2,8($fp)
  nop
  addiu $2,$2,3
  sw $2,8($fp)
  b $L7
  nop
  
  $L4:
  lw $2,8($fp)
  nop
  sll $2,$2,3
  sw $2,8($fp)
  b $L7
  nop
  
  $L5:
  lw $2,8($fp)
  nop
  srl $2,$2,2
  sw $2,8($fp)
  $L7:
  move $sp,$fp
  lw $fp,24($sp)
  addiu $sp,$sp,32
  j $31
  nop
  
  .end main
  </code></pre>
  
  <p>I don't understand why there are many <code>nop</code> code lines, what is the meaning of <code>nop</code> in this code ? does it help anything in <code>Pipeline Hazards</code>? What if i remove all the nops ? </p>