QUESTION BANK UNIT 2 - Computer Organization and Architecture
QUESTION BANK UNIT 2 - Computer Organization and Architecture
Unit 2
Answer:
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:
• 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.
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:
Answer:
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).
Answer:
sql
Copy code
110
x 101
--------
110 (110 * 1)
000 (110 * 0, shifted left)
+ 110 (110 * 1, shifted left twice)
--------
100110 (Result in binary)
Answer:
8. Explain instruction cycle with necessary steps and explain different instructions with
examples.
Answer:
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
• (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