HW2_solution - SOLUTION ECE 2504 Introduction to Computer...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
SOLUTION ECE 2504 Introduction to Computer Engineering, Fall 2009 Homework 2 Due date: 7 Sep 09, 11:55pm Show all work. 1. (4 pts) Find the decimal equivalent of the following two’s complement numbers: 1011001; 10000011; 01010101; 111110001 a. The first bit of 1011001 is a 1. it is a negative number. 1011001 is the 2’s complement of 0100111 1011001 = - [0100111] - [1×2 5 + 0×2 4 + 0×2 3 + 1×2 2 + 1×2 1 + 1×2 0 ] 10 = - [32 + 0 + 0 + 4 + 2 + 1] 10 = (- 39) 10 b. 10000011 is the 2’s complement of 01111101 10000011 = - [01111101] - [1×2 6 + 1×2 5 + 1×2 4 + 1×2 3 + 1×2 2 + 0×2 1 + 1×2 0 ] 10 = - [64 + 32 + 16 + 8 + 4 + 0 + 1] 10 = (- 125) 10 c. 01010101 is a positive number 01010101 1×2 6 + 0×2 5 + 1×2 4 + 0×2 3 + 1×2 2 + 0×2 1 + 1×2 0 = 64 + 0 + 16 + 0 + 4 + 0 + 1 = 85 10 d. 111110001 is the 2’s complement of 000001111 111110001 = - [000001111] - [0×2 7 + 0×2 6 + 0×2 5 + 0×2 4 + 1×2 3 + 1×2 2 + 1×2 1 + 1×2 0 ] = - [0 + 0 + 0 + 0 + 8 + 4 + 2 + 1] = (- 15) 10 2. (6 pts) Perform the subtraction of the following unsigned decimal numbers by taking the 10’s complement of the subtrahend: 6340 – 1522; 1874 – 7290; 45 – 75. a.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

HW2_solution - SOLUTION ECE 2504 Introduction to Computer...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online