Extra Practice Worksheet for Week 1

advertisement

1. Convert the following:

Extra Problems Worksheet (Answers at End)

Base 2/8/16 Decimal

10111101

2

111001111

2

377

8

756

8

D8

16

3EC

16

Decimal Binary Octal Hexidecimal

199

10

335

10

2. Do the following binary operations (unsigned numbers):

1 0 1 0

+ 0 1 1 0

1 0 1 0

- 0 1 1 0

1 0 1 1 0 0 1 1

AND 0 1 1 1 0 1 0 1

1 0 1 1 0 0 1 1

XOR 0 1 1 1 0 1 0 1

Hex value after rotating A4 left 3 bits?

Hex value after arithmetic shifting

3. Fill in the following ASCII text chart:

B2 right 2 bits?

Text Binary ASCII Octal ASCII Hex ASCII

M+5

4. Convert the following decimal numbers to signed 8-bit numbers:

Decimal Numbers: -68

130 117 122 58 4F 52

-91

Sign/magnitude

1's complement

2's complement

5. What range of values can be represented using a: a) 6-bit unsigned number to __________________ b) 6-bit sign/magnitude number to _________________ c) 6-bit 2's complement number to __________________

6. Perform the indicated operations on these 2's complement signed 6-bit values. Check your answers by converting to decimal. Circle unrepresentable values.

0 0 1 0 1 0

+0 0 1 1 0 1

0 1 1 1 1 0

-0 0 1 0 1 1

1 1 0 0 1 0

+1 0 0 1 0 0

1 1 1 1 1 0

-1 0 1 1 0 0

1 0 1 1 0 1

+0 1 0 1 1 1

1 1 1 0 0 1

-0 1 0 0 1 1

7. Convert the following numbers:

Decimal Number Floating Point Representation

44.1875

10

-319.5625

10

10

0 10000111 11101011000000000000000

10

1 01111101 11000000000000000000000

8. Add floating point numbers 4.625 and 5.5625.

9. Multiply floating point numbers 32.5 and 2.25

10. Use Booth's Algorithm to multiply 12 x –12 using 5-bit signed integers.

1.

ANSWERS

10111101

2

111001111

2

377

8

756

8

D8

16

3EC

16

189

10

463

10

255

10

494

10

216

10

1004

10

Decimal Binary Octal Hexidecimal

199

10

11000111 307

335

10

101001111 517

2. 1 0 1 0

+ 0 1 1 0

1 0 0 0 0

1 0 1 1 0 0 1 1

AND 0 1 1 1 0 1 0 1

0 0 1 1 0 0 0 1

Hex value after rotating A4 left 3 bits?

A4 = 10100100

Rotate

 00100101

Convert back to hex = 25

1 0 1 0

- 0 1 1 0

0 1 0 0

1 0 1 1 0 0 1 1

XOR 0 1 1 1 0 1 0 1

1 1 0 0 0 1 1 0

Hex value after arithmetic shifting B2 right 2 bits?

B2 = 10110010

ASH

 11101100

Convert back to hex = EC

3.

C7

14F

Text

M+5

XOR

4.

Decimal Numbers:

Sign/magnitude

Binary ASCII Octal ASCII Hex ASCII

1001101 0101011 0110101 115 53 65 4D 2B 35

1011000 1001111 1010010 130 117 122 58 4F 52

-68

11000100

-91

11011011

1's complement

10111011

2's complement

10111100

5. Range for 6-bit unsigned: 0 to 63

Range for 6-bit sign/magnitude: -31 to 31

Range for 6-bit 2's complement: -32 to 31

6.

0 0 1 0 1 0 (+10)

+0 0 1 1 0 1 (+13)

0 1 0 1 1 1 (+23)

0 1 1 1 1 0 (+30)

-0 0 1 0 1 1 (+11)

0 1 0 0 1 1 (+19)

1 1 0 0 1 0 (-14)

+1 0 0 1 0 0 (-28)

(-42)

(-42) unrepresentable

1 1 1 1 1 0 ( -2)

-1 0 1 1 0 0 (-20)

0 1 0 0 1 0 (+18)

7.

44.1875

10

10100100

10100101

1 0 1 1 0 1 (-19)

+0 1 0 1 1 1 (+23)

0 0 0 1 0 0 ( +4)

1 1 1 0 0 1 ( -7)

-0 1 0 0 1 1 (+19)

1 0 0 1 1 0 (-26)

101100.0011 ==> 0 10000100 01100001100000000000000

-319.5625

10

-100111111.1001 ==> 1 10000111 00111111100100000000000

491

10

0 10000111 11101011000000000000000 ==> 1.11101011 x 2

8

-0.4375

10

1 01111101 11000000000000000000000 ==> -1.11 x 2

-2

8.

Add:

4.625 + 15.5625 = 20.1875

Convert to binary:

4.625 = 100.101

15.5625 = 1111.1001

Normalize:

1.00101 x 2 2

1.1111001 x 2 3

Align decimal points:

0.100101 x 2 3

1.1111001 x 2 3

Add:

0.1001010

1.1111001

--------------

10.1000011 x 2 3

De-normalize:

10100.0011

Convert back to decimal:

20.1875

9. Multiply 32.5 x 6.25 = 203.125

Convert to binary:

32.5 = 100000.1

6.25 = 110.01

Normalize:

1.000001 x 2 5

1.1001 x 2 2

Add exponents:

5 + 2 = 7

Multiply significands:

1.000001 x 1.1001 = 1.1001011001

Combine Results:

1.1001011001 x 2 7

Remove exponent:

11001011.001

Convert to decimal

203.125

10. Booth's Algorthim: 12 x -12

Multiplier = 12 (decimal) = 01100 (5-bit binary)

Multiplicand = -12 (decimal) = 10100 (5-bit binary 2’s complement)

Initial Product = Multiplier w/five leading zeros (for 5-bit operands)

00000 01100

(1a) Always use 0 as your initial previous LSB (pLSB). That means

the LSB & previous LSB above are 00, so there is no arithmetic

operation (no-op).

ASR

00000 00110 0

(1b)

(2a)

(2b)

(3a)

LSB and pLSB above are again 00 - no-op

ASR

00000 00011 0

LSB and previous LSB above are 10 - so subtract the multiplicand from left half:

00000 - 10100 = 01100 (with phantom borrow)

Product is now: 01100 00011

(3b) ASR

00110 00001 1

(4a)

(4b)

(5a)

LSB and previous LSB above are 11 - no-op

ASR

00011 00000 1

LSB and pLSB above are 01 - add the multiplicand to left half

00011 + 10100 = 10111

Product is now: 10111 00000

(5b) ASR

11011 10000

We have completed 5 passes, so answer is 1101110000.

1101110000 is a negative 2’s complement number, equivalent to -144, which is the correct product of 12 x -12.

Download