title: MIPS ADDIU confusion
body: <p>I am doing an assignment on single cycle MIPS processor and I am a little confused on the addiu instruction.</p>
  
  <p><a href="http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html" rel="nofollow">On this website</a>, as my reference the author states that the immediate will be sign extened</p>
  
  <pre><code>Description:
     Adds a register and a sign-extended immediate value and stores the result
     in a register
  Operation:
     $t = $s + imm; advance_pc (4);
  Syntax:
     addiu $t, $s, imm
  Encoding:
     0010 01ss ssst tttt iiii iiii iiii iiii
  </code></pre>
  
  <p>If I have the following instructions</p>
  
  <pre><code>   lui      $3,0x1001
     addiu    $3,$3,0x8010
  </code></pre>
  
  <p>and I create my data path that sign extends addiu I would get</p>
  
  <pre><code>$3 := 0x1001_0000
  $3 := 0x1001_0000 + 0x1111_8010 = 0x1000_8010
  </code></pre>
  
  <p>But it is incorrect according to PCSpim and I should get </p>
  
  <pre><code>$3 := 0x1001_8010  
  </code></pre>
  
  <p>I am confused why I need to sign extend addiu, from what I understand if I do something like <code>addiu $1, $1, -10</code> it should be treated as <code>addiu $1, $1, 10</code> because it is unsigned.</p>
  
  <p>So why does it say I should sign-extend the immediate value?</p>