Assignment No 3 Course Code: CAP254 SYSTEM

13
Assignment No 3 Course Code: CAP254 SYSTEM ARCHITECTURE Submitted to: Ms Narinder kaur Submitted by: Tarun Baveja MCA(hons) Roll No. A3803 B28 Reg. No.

description

free assignment

Transcript of Assignment No 3 Course Code: CAP254 SYSTEM

Page 1: Assignment No 3 Course Code: CAP254 SYSTEM

Assignment No 3Course Code: CAP254

SYSTEM ARCHITECTURE

Submitted to:Ms Narinder kaur

Submitted by:

Tarun Baveja

MCA(hons)

Roll No. A3803 B28Reg. No.

Page 2: Assignment No 3 Course Code: CAP254 SYSTEM

10807675

PART A

Q1. How is I bit useful in determining the type of instruction.Sol I bit plays important role to determine type of instruction.We have three types of instruction.

1. Memory reference instruction.2. Register reference instruction.3. Input-Output instruction

15 14 12 11 0 I Oppcode Address

Instruction format When I=0 then it will be direct memory reference

instruction. When I=1 , it will be indirect memory reference

instruction.

I bit always responsible for distinguishing between Register reference and Input-Output instruction.

Oppcode bits are responsible for distinguishing between memory reference among register and input-output reference instructions.

Page 3: Assignment No 3 Course Code: CAP254 SYSTEM

Examples.

memory reference instruction 0 100 Address of

instruction

If oppcode is 000 to 110 then instruction is memory reference instruction.

Register reference instruction 0 111 Address of

instruction

If I=0 and oppcode =111 then instruction is register reference instruction.

Input output instrution 100 Address of

instruction

If I=1 and oppcode =111 then instruction is input-output instruction.

Q2. Why is micro programmed control better than hardwired? Identify some situations when hardwired is preferred.Sol Micro programmed control is better than hardwired here are some reasons why it is better than hardwired.

1. If we want any modification or change then we can do easily by updating the micro programmed in control memory. But in case of hard wired we have to construct

Page 4: Assignment No 3 Course Code: CAP254 SYSTEM

all the circuit again which is very difficult.For example: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.

2. 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.

3. Simplifies design of control unit.4. Micro programmed control is Cheaper than hardwired

control. 5. It is less error-prone6. It is easy to modify than hard wired.

Diagram of programmed control

Page 5: Assignment No 3 Course Code: CAP254 SYSTEM

Some situations when hard wired is preferred1. In case of speed: 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.

2. In case of implementing RISK: Hardwired control unit is typically use for implementing control unit in pure RISC while micro programmed is not usually used for implementing RISC.

Page 6: Assignment No 3 Course Code: CAP254 SYSTEM

Diagram of hardwired control

Q3 Perform the same multiplication using Booth Algorithm.

Sol In booth algorithm a procedure for multiplying binary integers in signed 2’s complement representation. It works

Page 7: Assignment No 3 Course Code: CAP254 SYSTEM

on the fact that strings of 0’s in the multiplier require no addition but just shifting, and a string of 1’s in the multiplier from bit weight 2k to weight 2m can be treated as 2k+1 -2m.

In Booth algorithm requires examination of the multiplier bits and shifting of the partial product. Prior to the shifting the multiplicand may be added to the partial product, subtracted from the partial product, or left unchanged according to the below given rules.

1. The multiplicand is subtracted from the partial product upon encountering the first least significant 1 in a string of 1’s in the multiplier.

2. The multiplicand is added to the partial product upon encountering the first 0 in a string of 0’s in the multiplier.

3. The partial product eoes not change when the multiplier bit is identical to the previous multiplier bit.

Numeric example for Binary Multiplier

Page 8: Assignment No 3 Course Code: CAP254 SYSTEM

Hardware implementation for booth algorithm

The hardware implementation of Booth algorithm requires the register configuration. We have registers A ,B and Q . #n designates the least significant bit of the multiplier in register QR. An extra flip-flop Qn+1 is appended to QR to facilitate a double bit inspection of the multiplier.

AC register

Sequence counter (sc)

Complement and parallel adder

QR register

Page 9: Assignment No 3 Course Code: CAP254 SYSTEM

Qn Qn+1

AC register

Hardware for Booth algorithm.

PART-B

Q4 Show the contents of E, A, Q and SC during the process of division of two binary numbers, 10100011 by 1011.Sol The below explained procedure shows the

Page 10: Assignment No 3 Course Code: CAP254 SYSTEM

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

10100011/1011= 1110 + 1001/1011 163/11 = 14 + 9/11

B = 1011 B + 1 = 0101 DVF = 0

E A Q SCDividend in AQ - - - - 0 1010 0011 100shl EAQ - - - - - 1 0100 0110add B + 1,suppress carry 0101E = 1, set Qto 1 - - - - 1 1001 0111 011Nshl EAQ - - - - - - 1 0010 1110add B + 1,suppress carry 0101E = 1, set Q to 1 - - - - 1 0111 1111 010shl EAQ - - - - - - 0 1111 1110add B + 1, carry to E - - 0101

E = 1, set Qn to 1 1 0100 1111 001shl EAQ - - - - - - 0 1001 1110add B + 1, carry to E - - - 0101E = 0, leave Qn = 0--- 0 1110 1110add B - - - - - - - 1011restore remainder - - 1 1001 1110 000 remainder quotient

Q5. Show that adding B after A+B+1 restores the original value of A. What should be done with end carry?Sol A +-B + 1 performs: A + 2n – B = 2n + A – B Adding B: (2k + A – B) + B = 2n + A

We should remove end-carry 2n to obtain A.

Page 11: Assignment No 3 Course Code: CAP254 SYSTEM

Q6. Perform BCD addition and subtraction of 1254 and 456.

Ans. BCD addition :-

BCD ADDITIONCarry bit

1 1 11

1254 0001 0010

0101 0100

+456 0000 0100

0101 0110

1710 0001 0111

1011(>9)

1010(>9)

0110 0110 0001 0000

Sum 1 7

1 0

BCD SUBTRACTION1254 0001 0010 0101 0100 -456 0000 0100 0101 0110 798 1101 1111 1110(>9

) 0110 0110 0110

0000 0111 1001 1000 Sum 0 7 9 8

Page 12: Assignment No 3 Course Code: CAP254 SYSTEM