Testing, Arithmetic



Testing -- SPARC

Signed Unsigned
bl blu
ble bleu
be be
bne bne
bge bgeu
bg bgu
Signed and Unsigned branches test different condition codes



Testing -- Intel

Signed Unsigned
JL JB
JLE JBE
JE JE
JNE JNE
JGE JAE
JG JA
Signed and Unsigned branches test different condition codes (see page 3-241 of Intel manual). "B" stands for "below", "A" for "above".



Other condition-code testing

SPARC Intel
bneg JS
bpos JNS
bz (be) JZ (JE)
bnz (bne) JNZ (JNE)
bvs JO
bvc JNO
bcs (blu) JC (JB)
bcc (bgeu) JNC (JAE)



Binary Multiplication



Unsigned Binary Multiplication

          0000 0000 0111 0101 +
          0000 0000 1110 1010 +
          0000 0111 0101 0000 +
          0011 1010 1000 0000
          =====================
          0100 0011 0010 1111



Complement Multiplication



Complement Multiplication
using enough digits



Signed Binary Multiplication
sufficient digits

          0000 0000 0111 0101 +
          0000 0000 1110 1010 +
          0000 0111 0101 0000 +
          0011 1010 1000 0000 +

0111 0101 0000 0000 + 1110 1010 0000 0000 + 1101 0100 0000 0000 + 1010 1000 0000 0000 +

0101 0000 0000 0000 + 1010 0000 0000 0000 + 0100 0000 0000 0000 + 1000 0000 0000 0000 ===================== 100 1100 1110 0010 1111



Signed Binary Multiplication



Multiplication -- insight



SPARC Multiplication



Intel Multiplication



Exercise