hw1_soln_w2011

# hw1_soln_w2011 - Homework#1Solutions ECE 15a Winter 2011 1...

This preview shows pages 1–4. Sign up to view the full content.

Homework #1Solutions ECE 15a Winter 2011 1. Do the following conversion problems: (5p) (a) Convert decimal 35.4377 to binary Soln: 35/2 = 17 + 1 17/2 = 8 + 1 8/2 = 4 + 0 4/2 = 2 + 0 2/2 = 1 + 0 1/2 = 0 + 1 (35) 10 = (100011) 2 .4377 x 2 = 0 + .8754 .8754 x 2 = 1 + .7508 .7508 x 2 = 1 + .5016 .5016 x 2 = 1 + .0032 .0032 x 2 = 0 + .0064 .0064 x 2 = 0 + .0128 .0128 x 2 = 0 + .0256 .0256 x 2 = 0 + .0512 (.4377) 10 = (.01110000) 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
(35.4377) 10 = (100011.01110000) 2 (5p) (b) Calculate the binary equivalent of 1/3 out to 8 places. Then convert from binary to decimal. How close is the result to 1/3? 1/3 = 0.333 0.333 x 2 = 0 + 0.666 .666 x 2 = 1 + .332 .332 x 2 = 0 + .664 .664 x 2 = 1 + .328 .328 x 2 = 0 + .656 .656 x 2 = 1 + .312 .312 x 2 = 0 + .614 .614 x 2 = 1 + .228 Binary equivalent of (1/3) 10 = (0.01010101) 2 Binary to decimal: (0.01010101) 2 = (1/4 + 1/16 + 1/64 + 1/256) 10 = 85/256 = (0.33203125) 10 2. A computer has a word length of 8 bits, including sign. Obtain 1’s and 2’s complement of the following binary numbers. This problem may be interpreted in several ways: (1) The given numbers are in sign and magnitude representation, and (2) they are in 1’s or (3) in 2’s complement representation. (1) The given binary numbers are in sign and magnitude representation: 8 bit word (including sign) Base integer 1s Complement 2s Complement 1 1101010= -1101010 0 1101010 10010101 10010110 0 1111110= +1111110 0 1111110 01111110 01111110 0 0000001= +0000001 0 0000001 00000001 00000001 1 0000000= -0000000 0 0000000 11111111 00000000 0 0000000= +0000000 0 0000000 00000000 00000000 - Base integer is obtained by replacing the sign bit by 0
- 1s complement is obtained by replacing the 0s to 1s and 1s to 0s in base integer if the sign bit of the 8 bit word is 1 - 2s complement is obtained by adding 1 to 1s complement if the sign bit of the 8 bit word is 1 (2) The given binary numbers are in 1’s complement representation: 8 bit word A (including sign) 1s complement Taking 1s complement of A allows us to 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 10

hw1_soln_w2011 - Homework#1Solutions ECE 15a Winter 2011 1...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online