0% found this document useful (0 votes)
49 views

QUESTION BANK UNIT 2 - Computer Organization and Architecture

Course: B. Tech. Branch: Electronics & Allied Semester: IV Subject Code & Name: Computer Organization and Architecture BTETPE405C/ BTEXPE405(C)
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

QUESTION BANK UNIT 2 - Computer Organization and Architecture

Course: B. Tech. Branch: Electronics & Allied Semester: IV Subject Code & Name: Computer Organization and Architecture BTETPE405C/ BTEXPE405(C)
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Semester: IV

Subject Name: Computer Organization and Architecture

Unit 2

1a. Draw the flowchart and explain about Booth's algorithm.

Answer:

Booth's Algorithm: An algorithm for multiplying binary numbers in two's complement


notation.

Flowchart:

sql
Copy code
+-------------+
| Start |
+-------------+
|
v
+-------------+
| Initialize |
| M, Q, Q-1 |
+-------------+
|
v
+-------------+
| Check Q0, Q-1|
+-------------+
|
/------------\
| 10 | 00 |
/ v v \
| +M | do nothing |
v | |
+--------+ +-----------+ +--------+
| Add | | Subtract|
| M | | M |
+--------+ +--------+
|
v
+-------------+
| Arithmetic |
| Shift Right |
+-------------+
|
v
+-------------+
| Count = 0? |
+-------------+
|
/ \
No Yes
| v
/----------\
v
+-------------+
| Store Result|
+-------------+
|
v
+-------------+
| End |
+-------------+

Explanation:

1. Initialize: M = multiplicand, Q = multiplier, Q-1 = 0, and count = number of bits.


2. Check Q0, Q-1:
o If Q0 Q-1 = 10, subtract M from the product.
o If Q0 Q-1 = 01, add M to the product.
o If Q0 Q-1 = 00 or 11, do nothing.
3. Arithmetic Shift Right: Shift the product and adjust Q-1.
4. Count: Decrement the count. If count is not zero, repeat the process.

1b. Multiply 100111 with 11011 using Booth's algorithm.

Answer: Multiplicand (M): 100111 (binary for 39 in decimal)


Multiplier (Q): 11011 (binary for -5 in decimal, using two's complement)

Let's use 6-bit representation for both numbers:

• 100111 (M)
• 111011 (Q in 2's complement for -5)

Steps:

1. Initial values:
o A=0
o Q = 111011
o Q-1 = 0
o Count = 6
2. Step by step:
o Iteration 1:
▪ Q0 Q-1 = 11 (do nothing)
▪ Arithmetic shift right: A = 000000, Q = 011101, Q-1 = 1
o Iteration 2:
▪ Q0 Q-1 = 01 (Add M to A)
▪ A = 000000 + 100111 = 100111
▪ Arithmetic shift right: A = 010011, Q = 101110, Q-1 = 1
o Iteration 3:
▪ Q0 Q-1 = 10 (Subtract M from A)
▪ A = 010011 - 100111 = 101100
▪ Arithmetic shift right: A = 110110, Q = 110111, Q-1 = 0
o Iteration 4:
▪ Q0 Q-1 = 11 (do nothing)
▪ Arithmetic shift right: A = 111011, Q = 011011, Q-1 = 1
o Iteration 5:
▪ Q0 Q-1 = 01 (Add M to A)
▪ A = 111011 + 100111 = 110010
▪ Arithmetic shift right: A = 111001, Q = 101101, Q-1 = 1
o Iteration 6:
▪ Q0 Q-1 = 10 (Subtract M from A)
▪ A = 111001 - 100111 = 010100
▪ Arithmetic shift right: A = 001010, Q = 110110, Q-1 = 1
3. Final result (A and Q): 001010110110

The product of 100111 (39) and 11011 (-5) is 110110010 which is -195 in decimal.

2. Explain logical shift and rotate instructions with examples.

Answer:

1. Logical Shift:
o Logical Shift Left (LSL): Shifts all bits in a binary number to the left, the
leftmost bit is discarded, and a 0 is inserted at the rightmost bit.
▪ Example: 1010 << 1 results in 0100.
o Logical Shift Right (LSR): Shifts all bits in a binary number to the right, the
rightmost bit is discarded, and a 0 is inserted at the leftmost bit.
▪ Example: 1010 >> 1 results in 0101.
2. Rotate Instructions:
o Rotate Left (ROL): All bits are rotated to the left; the leftmost bit is placed at
the rightmost position.
▪ Example: 1010 rol 1 results in 0101.
o Rotate Right (ROR): All bits are rotated to the right; the rightmost bit is
placed at the leftmost position.
▪ Example: 1010 ror 1 results in 0101.

3. Explain different types of instructions with examples. Compare their relative merits
and demerits.

Answer:

1. Data Transfer Instructions:


o Move, load, store.
o Example: MOV AX, BX
o Merits: Efficient data handling.
o Demerits: Limited to data movement.
2. Arithmetic Instructions:
o Addition, subtraction, multiplication, division.
oExample: ADD AX, BX
oMerits: Performs mathematical operations.
oDemerits: Can be slow for complex operations.
3. Logical Instructions:
o AND, OR, NOT, XOR.
o Example: AND AX, BX
o Merits: Useful for bitwise operations.
o Demerits: Not suitable for arithmetic operations.
4. Control Transfer Instructions:
o Jump, call, return.
o Example: JMP label
o Merits: Controls the flow of the program.
o Demerits: Can make debugging difficult.
5. Input/Output Instructions:
o IN, OUT.
o Example: IN AX, DX
o Merits: Handles I/O operations.
o Demerits: Device dependent.

4. Explain different rotate instructions.

Answer:

1. Rotate Left (ROL):


o Rotates bits to the left.
o Example: 1010 rol 1 results in 0101.
2. Rotate Right (ROR):
o Rotates bits to the right.
o Example: 1010 ror 1 results in 0101.
3. Rotate through Carry Left (RCL):
o Rotates bits to the left through the carry flag.
o Example: 1010 with CF = 1, rcl 1 results in 0101 with CF = 1.
4. Rotate through Carry Right (RCR):
o Rotates bits to the right through the carry flag.
o Example: 1010 with CF = 1, rcr 1 results in 0101 with CF = 1.

5. Explain the memory reference instructions with examples.

Answer:

Memory reference instructions involve accessing memory to retrieve or store data. Examples
include:

1. LOAD:
o Example: LOAD R1, 100 (Loads the content of memory location 100 into
register R1).
2. STORE:
o Example: STORE R1, 100 (Stores the content of register R1 into memory
location 100).
3. ADD:
o Example: ADD R1, 100 (Adds the content of memory location 100 to register
R1).
4. SUBTRACT:
o Example: SUB R1, 100 (Subtracts the content of memory location 100 from
register R1).
5. MULTIPLY:
o Example: MUL R1, 100 (Multiplies the content of register R1 with the content
of memory location 100).

6. Explain with an example how to multiply two unsigned binary numbers.

Answer:

To multiply 110 (6) and 101 (5):

1. Write both numbers aligned right.


2. Multiply each bit of the second number by the first number, shifting left each time.

sql
Copy code
110
x 101
--------
110 (110 * 1)
000 (110 * 0, shifted left)
+ 110 (110 * 1, shifted left twice)
--------
100110 (Result in binary)

Result: 100110 which is 30 in decimal.

7. Explain the different types of instruction formats with examples.

Answer:

1. Zero Address Instruction:


o Stack-based, no operands.
o Example: PUSH, POP
2. One Address Instruction:
o Single operand, usually implied accumulator.
o Example: LOAD A
3. Two Address Instruction:
o Two operands, source and destination.
oExample: MOV A, B
4. Three Address Instruction:
o Three operands.
o Example: ADD A, B, C (A = B + C)
5. Variable Address Instruction:
o Instructions can have different numbers of addresses.
o Example: ADD A, MOV B, C

8. Explain instruction cycle with necessary steps and explain different instructions with
examples.

Answer:

Instruction Cycle steps:

1. Fetch: Retrieve instruction from memory.


o Example: MOV AX, BX
2. Decode: Interpret the instruction.
3. Execute: Perform the operation.
4. Store: Write back the result.

Different Instructions:

1. Data Transfer:
o MOV AX, BX
2. Arithmetic:
o ADD AX, BX
3. Logical:
o AND AX, BX
4. Control:
o JMP LABEL
5. I/O:
o IN AX, DX

9. Explain the following instructions:

• (i) MOV
• (ii) ADD
• (iii) SUB
• (iv) AND
• (v) JMP

Answer:

1. MOV:
o Transfers data from one location to another.
o Example: MOV AX, BX
2. ADD:
o Adds two values.
o Example: ADD AX, BX
3. SUB:
o Subtracts one value from another.
o Example: SUB AX, BX
4. AND:
o Performs a bitwise AND operation.
o Example: AND AX, BX
5. JMP:
o Unconditionally jumps to a specified address.
o Example: JMP LABEL

BY Laxmikant S Doijode
For further assistance or inquiries, please contact us through the ELECTRONICS ENGINEER
following :

• WhatsApp
• Instagram
• twitter

You might also like