**BIM 3 ^{rd } Semester**

Group “A”

**1.Brief Answer Questions:**

**a .What is instruction?**

**Ans**: Instruction refers to a set of steps or guidelines given to someone in order to complete a task or achieve a specific goal. Instructions are typically communicated using binary code, a sequence of 0s and 1s that describe the action a computer system is expected to perform.

**b. What do you mean by memory and data bus?**

**Ans**:

- Memory Bus: The memory bus is a communication pathway that connects the CPU to the system memory (RAM) and other memory devices. It is used to transfer data and instructions between the CPU and memory for processing.

- Data Bus: The data bus is a set of parallel wires or lines that carry data between the CPU, memory, and other peripheral devices. It is used to transmit binary data in the form of bits (0s and 1s) between different components of the computer system.

c. Define SAP1.

**Ans**: It stands for Simple As Possible1.

The SAP1 microprocessor is designed to perform basic arithmetic and logic operations, as well as data manipulation tasks. It serves as a starting point for beginners to understand the inner workings of a microprocessor and gain hands-on experience in building and programming a simple computing system.

**d. What do you mean by operation code?**

**Ans**: Operation code, also known as opcode, refers to the specific instructions that a computer processor can execute. These codes are typically represented in binary form and are used to perform various operations within a computer system.

**e. Define input and output device.**

Ans:

- Input Device: Input device is any hardware component that allows users to interact with a computer or other electronic device by providing data or commands. Examples : keyboards, mice, touchscreens, microphones etc.

- Output Device: Output device is
**computer hardware that receives data from a computer and then converts that data to another format**. Examples: audio, video, text, printer etc.

Group” B”

Short Answer Questions:

**2. Differentiate between RISC and CISC.**

Ans: The difference between RISC and CISC are as followed:

Based-On | RISC | CISC |
---|---|---|

Differences | It stands for Reduced Instruction Set Computer. | It stands for Complex Instruction Set Computer. |

Definition | It is a microprocessor architecture that uses small instruction set of uniform length. | It refers to hundreds of instructions of different sizes to the users. |

Price | They are inexpensive. | They are relatively expensive. |

Size | It has fixed-length encodings for instructions. | It has variable-length encodings of instructions. |

Uses | It uses LOAD and STORE that are independent instructions in the register-to-register a program’s interaction. | It uses LOAD and STORE that are independent instructions in the register-to-register a program’s interaction. |

Examples | Examples of RISC chips include SPARC, POWER PC. | Examples of CISC include Intel architecture, AMD. |

**3. Explain the shift micro operations with example.**

Ans:

Shift micro-operations are used for serial transfer of data. They are also used in conjunction with arithmetic ,Logic and other data processing operation. Shift micro-operations are **used when the data is stored in registers**. These micro-operations are used for the serial transmission of data. The contents of a register can be shifted to the left or the right. In shift-right operation, the serial input transfers a bit into the leftmost position. The data transferred by the serial input decides the type of shift. There are three types of Shift Micro-operation and they are:

- Logic Shift Micro-operation.

- Circular Shift Micro-operation.

- Arithmetic Shift Micro-operation.

**Logic Shift Micro-operation.**

Logical shift can be defined as the shift of the bits to the right or left serially. This operation is associated with shift of data bits towards left or right and allowing a serial bit stream to occupy vacated bit positions. There are two types of Logic Shift Micro-operation and they are:

- Logic Shift Left (Shl)
- Logic Shift Right (Shr)

a. Logic Shift Left (Shl)

In this shift one position moves each bit to the left one by one. The empty LSB is filled with 0 and the MSB is rejected.Example:

Every time we shift left the bits by 1, it multiples the number two.

b. Logic Shift Right (Shr)

In this shift one position moves one bit to the right one by one . The LSB is rejected and the empty MSB is filled with 0. Example:

Every time we shift right the bits by 1, it divides the number two.

**Circular Shift Micro-operation.**

The circular shift also named as rotate shift circulates the bits among the ends of the register without losing information. We can achieve this by connecting the output terminal to the input terminal of the register. The circular shift in the micro operation circulates the bits in the sequence of the register around the both ends. Circular Shift Micro-operation are classified into two groups and they are:

- Circular Shift Left (Cil).
- Circular Shift Right (Cir).

a. Circular Shift Left (Cil).

Each bit in the register is shifted to the left one by one after shifting the LSB becomes empty, So the value of the MSB is filled in there. Example:

b. Circular Shift Right (Cir).

Each bit in the register is shifted to the right one by one in this micro operation, after shifting, the most significant bit(MSB) place becomes empty, so it is filled with the value at the LSB. Example:

Arithmetic Shift Micro-operation.

Arithmetic Shift Micro-operation is as same as Logic Shift Micro- operation .It shift signed binary number to left or right. For these operations proper care must be taken. For shift left the content of the register is multiplied by 2 whereas For shift right the content of the register is divided by 2. The arithmetic shift must leave the sign bit unchanged. Arithmetic Shift is of two types:

- Arithmetic Left Shift (Ashl)
- Arithmetic Right Shift (Ashr)

Arithmetic Left Shift (Ashl)

Each bit in the register is shifted to the left one by one in this shift micro-operation. The most significant bit MSB is moved outside the register , and the place of the LSB is filled with 0. Example:

Arithmetic Right Shift (Ashr)

Each bit in the register is shifted to the right one by one in this shift micro-operation. The MSB is filled with same number as its others and bits are moved towards right and last bit is discarded of LSB. Example:

**4. Explain the Control unit and ALU of basic computer.**

Ans:

** Control Unit:**

CU stands for Control Unit. It is one of the fundamental parts of the CPU. The main work of the CU is to tell the most efficient method to work. It guides all the related operations to the individual parts of the processor.

Some basic operation performed by it includes taking guidelines, controlling sequential execution, managing information stream in the correct course, directing and observing the time needed amid the preparing and taking care of different functions, etc.

It instructs the memory, logic unit, and both output and input devices of the computer on how to respond to the programâ€™s instructions. CPUs and GPUs are examples of devices that use control units.

**ALU:**

An arithmetic logic unit (ALU) is a key component of a computerâ€™s central processor unit. The ALU performs all arithmetic and logic operations that must be performed on instruction words.

The ALU is split into two parts in some microprocessor architectures: the AU and the LU.

It is a fundamental component of a computer’s central processing unit (CPU) that performs arithmetic and logical operations on data. The ALU is responsible for carrying out tasks such as addition, subtraction, multiplication, division, and comparison operations.

It plays a crucial role in executing instructions and processing data within a computer system.

**5. Explain with example of instruction pipeline.**

Ans:

Pipeline processing can occur not only in the data stream but in the instruction stream as well.

Most of the digital computers with complex instructions require instruction pipeline to carry out operations like fetch, decode and execute instructions.

This type of technique is used to increase the throughput of the computer system. An instruction pipeline reads instruction from the memory while previous instructions are being executed in other segments of the pipeline.

Thus we can execute multiple instructions simultaneously. In the most general case computer needs to process each instruction in following sequence of steps:

- Fetch the instruction from memory (FI)

- Decode the instruction (DA)

- Calculate the effective address

- Fetch the operands from memory (FO)

- Execute the instruction (EX)

- Store the result in the proper place

For Example:

**6. Describe data transfer instruction.**

Ans: Data transfer instructions transfer the data between memory and processor registers, processor registers, and I/O devices, and from one processor register to another. There are eight commonly used data transfer instructions and they are:

**Load**âˆ’ The load instruction is used to transfer data from the memory to a processor register, which is usually an accumulator.**Store**âˆ’ The store instruction transfers data from processor registers to memory.**Move**âˆ’ The move instruction transfers data from processor register to memory or memory to processor register or between processor registers itself.**Exchange**âˆ’ The exchange instruction swaps information either between two registers or between a register and a memory word.**Input**âˆ’ The input instruction transfers data between the processor register and the input terminal.**Output**âˆ’ The output instruction transfers data between the processor register and the output terminal.**Push and Pop**âˆ’ The push and pop instructions transfer data between a processor register and memory stack.

Group” C”

**Comprehensive Questions:**

**7. Multiply (-13) _{10} *(-20)_{10} using booth’s multiplication algorithm and draw flowchart for corresponding examples.**

Ans:

Booth’s algorithm is a multiplication algorithm that allows for the multiplication of two signed binary numbers in two’s complement representation. It reduces the number of additions required compared to traditional multiplication algorithms.

Here’s how you can multiply (-13)10 * (-20)10 using Booth’s multiplication algorithm:

Step 1: Convert the decimal numbers to binary:

- (-13)10 = (-1101)2 (4-bit representation)
- (-20)10 = (-10100)2 (5-bit representation)

Step 2: Pad the shorter number to make them of equal length:

- (-1101)2 (4-bit representation)
- (-10100)2 (5-bit representation)
- We pad (-1101)2 to (-01101)2 to match the length.

Step 3: Perform Booth’s algorithm multiplication:

- Initialize the product as a zero value of the same bit-length as the multiplicand and multiplier (in this case, 5 bits).
- Append an extra 0 at the right end of the product to ensure the algorithm works for negative numbers.
- Repeat the following steps for the number of bits in the multiplier:
- If the last two bits of the multiplier and the last bit of the product are ’10’, subtract the multiplicand from the product.
- If the last two bits of the multiplier and the last bit of the product are ’01’, add the multiplicand to the product.
- Shift the product and the multiplier to the right by 1 bit.

- Repeat step 3 until the multiplier becomes zero.

Let’s perform the multiplication:

```
Multiplier (-01101)
Multiplicand (-10100)
Product 000000 (initialized with 0)
Multiplier (-0 0110) (Extra 0 for sign extension)
-----------------------------------
Multiplier Product Operation
-----------------------------------
- 000000 Initial
1 000000 Shift right (no operation)
1 110100 Add multiplicand
0 011010 Shift right
0 001101 Shift right
1 100110 Subtract multiplicand
0 010011 Shift right
-----------------------------------
Result 010011 (Equals -260 in decimal)
```

So, (-13)10 * (-20)10 = (-260)10.