Docsity

Binary Arithmetic: Multiplication, Two's-complement, Division, and Codes in EECC341, Study notes of Business

Toggle sidebar
bg1
EECC341 - Shaaban
EECC341 - Shaaban
#1 Lec # 3 Winter 2001 12-6-2001
Binary Multiplication
Binary Multiplication
•Multiplication is achieved by adding a list of shifted
multiplicands according to the digits of the multiplier.
•Ex. (unsigned)
11 1 0 1 1 multiplicand (4 bits)
X 13 X 1 1 0 1 multiplier (4 bits)
-------- -------------------
33 1 0 1 1
11 0 0 0 0
______ 1 0 1 1
143 1 0 1 1
---------------------
1 0 0 0 1 1 1 1 Product (8 bits)
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Binary Arithmetic: Multiplication, Two's-complement, Division, and Codes in EECC341 and more Study notes Business in PDF only on Docsity!

EECC341 - ShaabanEECC341 - Shaaban

Binary Multiplication Binary Multiplication

  • Multiplication is achieved by adding a list of shifted

multiplicands according to the digits of the multiplier.

  • Ex. (unsigned)

11 1 0 1 1 multiplicand (4 bits)

X 13 X 1 1 0 1 multiplier (4 bits)


33 1 0 1 1

11 0 0 0 0

______ 1 0 1 1

143 1 0 1 1


1 0 0 0 1 1 1 1 Product (8 bits)

EECC341 - ShaabanEECC341 - Shaaban

Binary Multiplication (continued)

  • Instead of listing all shifted multiplicands and then

adding, we can add each shifted multiplicand to a partial product. The previous un-signed example becomes:

11 1101 multiplicand

x 13 x 1101 multiplier

143 0000 partial product

1011 shifted multiplicand

01011 partial product

0000 shifted multiplicand

001011 partial product

1011 shifted multiplicand

0110111 partial product

1011 shifted multiplicand

10001111 product

EECC341 - ShaabanEECC341 - Shaaban

Binary Division Binary Division

  • Shift and subtract

Example:

19 10011 quotient

11 217 1011 11011001 dividend

11 1011 shifted divisor 107 0101 reduced dividend 99 0000 shifted divisor 8 1010 reduced dividend 0000 shifted divisor 10100 reduced dividend 1011 shifted divisor 10011 reduced dividend 1011 shifted divisor 1000 remainder

EECC341 - ShaabanEECC341 - Shaaban

Binary Codes Binary Codes

• Groups of binary bits are often organized in specific

ways or binary codes to:

  • Represent decimal numbers or alphabetic characters:
    • Binary Coded Decimal (BCD).
    • American Standard Code for Information Interchange (ASCII)
  • Detect errors:
    • Even parity code.
    • Odd parity code.
  • Correct errors:
    • CRC Codes.

– Aid in transmission and storage of digital

information.

EECC341 - ShaabanEECC341 - Shaaban

BCD Addition BCD Addition

  • Addition of BCD digits is similar to adding 4-bit

unsigned binary numbers except a correction must be made if a result exceeds 1001 by adding 6 to the digit.

0101

  • 1001 1110
  • 0110 Correction add 6 0001 0100

5

  • 9 14

Example:

1 4

EECC341 - ShaabanEECC341 - Shaaban

Alphanumeric Binary Codes: ASCII Alphanumeric Binary Codes: ASCII

M S B s L S B s 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1

0 0 0 0 N U L^ D L E^ S P^0 @^ P^ `^ p 0 0 0 1 S O H D C 1! 1 A Q a q 0 0 1 0 S T X^ D C^2 “^2 B^ R^ b^ r 0 0 1 1 E T X D C 3 # 3 C S c s 0 1 0 0 E O T D C 4 $ 4 D T d t 0 1 0 1 E N Q N A K % 5 E U e u 0 1 1 0 A C K S Y N & 6 F V f v 0 1 1 1 B E L E T B ‘ 7 G W g w 1 0 0 0 B S^ C A N^ (^8 H^ X^ h^ x 1 0 0 1 H T^ E M^ )^9 I^ Y^ i^ y 1 0 1 0 L F S U B * : J Z j z 1 0 1 1 V T E S C + ; K [ k { 1 1 0 0 F F F S , < L \ l | 1 1 0 1 C R G S - = M ] m } 1 1 1 0 O R S. > N ^ n ~ 1 1 1 1 S I U S /? O _ o D E L

Seven bit codes are used to represent all upper and lower case letters, numbers, punctuation and control characters