title: Why Does the DSP Subtract 1 From my Equation?
body: <p>I tried implementing in a DSP48E1:</p>
  
  <p><code>(A * B) - C</code></p>
  
  <p>From reading the manual:</p>
  
  <p><a href="http://www.xilinx.com/support/documentation/user_guides/ug479_7Series_DSP48E1.pdf" rel="nofollow">http://www.xilinx.com/support/documentation/user_guides/ug479_7Series_DSP48E1.pdf</a></p>
  
  <p>I figured I must have:</p>
  
  <p><code>OPMODE =&gt; "0110101"</code></p>
  
  <p>So that the outputs of the X, Y,  and Z multiplexers are:</p>
  
  <ul>
  <li>X and Y are the partial products of <code>M = A * B</code>, so that, <code>X + Y = M = A * B</code></li>
  <li><code>Z = C</code></li>
  </ul>
  
  <p>Then I set:</p>
  
  <p><code>ALUMODE =&gt; "0001"</code></p>
  
  <p>So that it should produce:</p>
  
  <p><code>-Z + (X + Y + CIN) - 1 = not(Z) + X + Y + CIN</code></p>
  
  <p>There is a note on page 35 which says "In 2s complement <code>-Z = not(Z) + 1</code>"</p>
  
  <p>Therefore the result I consistently get is:</p>
  
  <p><code>-C + A * B -1</code></p>
  
  <p>Is there an easy way to correct this result? Or should I just register an addition of + 1 before the input?</p>