05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A2.8 Polynomial arithmetic over {0,1}<br />

Application Level Programmers’ Model<br />

The polynomial data type represents a polynomial in x of the form bn–1x n–1 + … + b1x + b0 where bk is<br />

bit [k] of the value.<br />

The coefficients 0 <strong>and</strong> 1 are manipulated using the rules of Boolean arithmetic:<br />

0 + 0 = 1 + 1 = 0<br />

0 + 1 = 1 + 0 = 1<br />

0 * 0 = 0 * 1 = 1 * 0 = 0<br />

1 * 1 = 1.<br />

That is:<br />

adding two polynomials over {0,1} is the same as a bitwise exclusive OR<br />

multiplying two polynomials over {0,1} is the same as integer multiplication except that partial<br />

products are exclusive-ORed instead of being added.<br />

A2.8.1 Pseudocode details of polynomial multiplication<br />

In pseudocode, polynomial addition is described by the EOR operation on bitstrings.<br />

Polynomial multiplication is described by the PolynomialMult() function:<br />

// PolynomialMult()<br />

// ================<br />

bits(M+N) PolynomialMult(bits(M) op1, bits(N) op2)<br />

result = Zeros(M+N);<br />

extended_op2 = Zeros(M) : op2;<br />

for i=0 to M-1<br />

if op1 == ‘1’ then<br />

result = result EOR LSL(extended_op2, i);<br />

return result;<br />

<strong>ARM</strong> DDI 0406B Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. A2-67

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!