Homework 3 Course Instructor : Ms.

KULJEET

Course Code : CAP 211 Course Tutor : D.O.S : 20/11/09 Section No. : D3803

Date Of Allotment : 5th NOV 2009 Student Roll No. Declaration : D3803A07

I declare that this assignment is my individual work .I have not copied from any other student’s work or from any other source except where due acknowledgement in made explicitly in the text not has any part become written for me by any other person.

JAGPREET SINGH ATHWAL

Evaluater’s comments____________________

Marks Obtained ___________

Out Of ____________

PART-A Q1. How is I bit useful in determining the type of instruction Ans: There are three types of basic computer instruction format: a)memory reference instruction b)register reference instruction c)input output instruction the instruction format is of 16 bits and 1 bit is used for addressing mode I,3 bit is used for the operation code(opcode) and the remaining 12 bits is depend upon the opcode encountered. I=0 for direct address . I=1 for indirect address. 15 14
I Opcode

12 11
address

0

When the value of opcode varies from 000 through 110 then it will be the memory reference instruction and the bit in position 15 is taken as addressing mode I. 15
0 111

14
address

12 11

0

When opcode=111 and I=0 then it is register reference instruction. 15 14 12 11 0

0

111

address

When opcode=111 and I=1 thein it is input output instruction. Q2. Why is micro programmed control better than hardwired? Identify some situations when hardwired is preferred. Ans. It is well known that most computers today are microprogrammed. The reason is basically one of flexibility. Once the control unit of a hard-wired computer is designed and built, it is virtually impossible to alter its architecture and instruction set. In the case of a micro-programmed computer, however, we can change the computer's instruction set simply by altering the microprogram stored in its control memory. In fact, taking our basic computer as an example, we notice that its four-bit op-code permits up to 16 instructions. Therefore, we could add seven more instructions to the instruction set by simply expanding its microprogram. To do this with the hard-wired version of our computer would require a complete redesign of the controller circuit hardware. Another advantage to using micro-programmed control is the fact that the task of designing the computer in the first place is simplified. The process of specifying the architecture and instruction set is now one of software (micro-programming) as opposed to hardware design. Nevertheless, for certain applications hard-wired computers are still used. If speed is a consideration, hard-wiring may be required since it is faster to have the hardware issue the required control signals than to have a "program" do it.

Q3. Show the contents of E, A, Q and SC during the process of division

of two binary numbers, 10100011 by 1011. Ans:Here Divisor B=1011

BC =0100 which is Complement of B BC +1=0101 E A 1010 0100 Q 0011 0110 +0101 1 1 1001 1001 0111 SC 100

Dividend in AQ Shl EAQ Add BC+1, remove Carry E=1 E=1,Set Qn=1 011 Shl EAQ Add BC+1, remove Carry E=1 E=1, Set Qn=1 Shl EAQ Add BC+1, Carry To E E=1

0 1

1

0010

1110 +0101

1 1 0 0 1

0111 0111 1111 +0101 0100 1110 1111 1110 010

E=1, Set Qn=1 Shl EAQ Add BC+1, Carry To E E=0 E=0, Leave Qn=0 Add B, Carry To E E=1 Remainder Neglect E A: Q:

1 0 0 0 0 0 1 1

0100 1001 +0101 1110 1110 +1011 1001 1001

1111 1110

001

1110 1110

1110

100

1001 1110

PART-B

Q4. Show that adding B after A+B+1 restores the original value of A. What should be done with end carry? Ans:A +~B + 1 performs: adding B:

A + 2n – B = 2n + A – B

(2k + A – B) + B = 2n + A remove end-carry 2n to obtain A. Q5. Perform BCD addition and subtraction of 1254 and 456. Ans:-

Bcd addition:-

1245 +456 ─── 789

0001 ─── 0001 ───

0010 0101 ─── 0111

0100 0100 ─── 1010 0110 ─── 0000

0101 0100 1001 0110 ─── 0001

Bcd subtraction:-

here the 10’s complement method is used for bcd subtraction.and if sum is greater than 9 than we add 6(0110)

1245

0001

0010

0100

0101

- 456 ─── 789

1001 ─── 1010 0110 ───── 0000

0101 ─── 0111 ───

0100 ─── 1000

0100 1001

Carry =1 which is discarded. So subtraction is =789 Q6. Why is it necessary to consider the case of divide overflow? Ans: The division operation may result in a quotient with an overflow. this is not a problem when working with pen or pencil but it is critical when the operation is implemented with hardware. therefore it is necessary to consider the case of divide overflow. this is becaue the length of register is finite and will not hold a number that exceeds standard length. when the dividend is twice as long as the divisor, the condition for overflow can be stated as follows: A divide overflow condition can occur if the higher order half bits of the dividend constitute a number greater than or equal to divisor. another problem is division by zero must be avoided.. the divide overflow condition takes care of the condition as well to check whether the dividend is greater than or equal to divisor therefore it is mandatory to consider the case of division overflow