You are on page 1of 13

No Yes

Mock paper solution – 1

Section – C

Que.1 what do you mean by instruction cycle? Discuss the different


stages of executing an instruction.

Ans. Instruction cycle- a program residing in the memory unit of the


computer consist of a sequence of instructions. The program is
executed in the computer by going through a cycle for each instruction.
Each instruction is sub divided into a sequence of sub cycles or phases.
In the basic computer each instruction cycle consists of the following
phases.

1) Fetch on the instruction from memory


2) Decode the instruction
3) Reading the effective address of memory if the instruction has an
indirect address.
4) Execute the instruction.

START

LOAD ADDRESS TO PC
No Yes

LOAD PC CONTENTS
+ TO MAR

UPDATE PC TO
NEXT ADDRESS

LOAD DATA
REQUIRED TO MDR

MAR CONTENT TO
CIR

DECODE CIR
CONTENTS

JUMP

Set pc to value from


jump instruction

Execute
instruction
No Interrupt Yes

Service interrupt

1. An Instruction is fetched from the memory address stored in the


program counter (PC) and is stored in the instruction register (IR). The
PC is incremented.
2. The decoder interprets the instruction. If it is a jump, the PC is reset and
the cycle ends. Otherwise, any required data is fetched from the main
memory and is placed in data registers.
3. The CPU executes the instruction by reading values from registers,
performing arithmetic or logical functions on them, and writing the
result into a register.
4. The result is stored in main memory or is sent to an output device.
5. Interrupts are handled.

Fetching the instruction from memory

Initially, CPU stores the address of the first instruction of the program in the
program counter (PC ) register. Since only address register (AR) is connected to
the address inputs of memory; so the contents of PC are transferred to the AR
and then a read request is sent to the memory. Thus the CPU fetches the next
instruction from the memory into the next instruction Register (IR). At the same
time PC is also incremented by one, so that it can now hold the address of the
next instruction of the program.

Decoding the instruction

After fetching the instruction, the operation code part of the instruction stored in
IR is decoded, i.e, the indirect bit is transferred to flip-flop and the address part is
transferred to AR.

Execute the instruction

The data forming the instruction and stored in IR, is decode by control unit, now
the decoded instruction is passed to relevant functional units of the CPU as a
sequence of control signals; so that required actions can be performed, such as
No Yes

reading values from registers, passing them to ALU, etc. finally the result
generated after the execution of the instruction, is stored in memory or sent to an
output device as required.

Upon the completion of phase 4, the control goes back to phase 1 to execute the
next instruction. This process continues until a HALT instruction is encountered.

Que2. Draw the block diagram of RAM chip and explain it.

Ans. RAM- it is a type of main memory. It has bidirectional data bus that allows
the transfer of data from memory to CPU during a read operation or from CPU to
memory during write operation.

Semi conductor RAM is used in all type of computers. It is also called read/write
memory.

Semiconductor RAM is used as either READ cycle or writes cycle that depends on
the type of required operation that are independent of each other. The read cycle
is normally shorter time period as compared to write cycle.

RAM use non-destructive read-out to read the data from memory. It is also
volatile in nature that requires power to maintain current data.

RAM chip
CS1
8-bit bidirectional data bus
CS2 RAM

128 *8

RD

Rw

7 bit address lines

Block Diagram Representing 128 *8 RAM

(Random access memory)


No Yes

In this block representation, the given RAM chip consists of two chip select lines, a
read line; write line, address lines and a bidirectional 8-bit data bus. Here, two
chip select(CS) lines are used in order to ensure that only the required chip is
selected from a given array chips when required by the microprocessor, also it
helps in address decoding in the similar conditions.

As usual, the RD and WR lines refer to read and write lines for Reading/writing
data to/from this memory (RAM). Here the configuration 128*8 signifies that the
current memory elements are capable of storing about 128 words with each word
consisting of 8-bits. Hence, in order to access the data stored operation of RAM
circuit can be analyzed by considering the following function table.

CS1 CS2 RD WR Type of function State(Data bus)


0 0 NUL NULL I HI
L
0 1 NUL NULL I HI
L
1 0 0 0 I HI
1 0 0 1 WR Write data (into RAM)
1 0 1 NULL RD Extract the data(from
RAM)
1 1 NUL NULL I HI
L

Notations used

I = inhibit

WR = Write

RD = Read

HI = High impedance

Que3. How are the floating point numbers stored in computer? Explain
normalization in relation to floating point.
No Yes

Ans. A floating point numbers consist of two parts mantissa m and an exponent e,
(m * r^e). the decimal number 125.45 is represented by m = 12545 and e = 3 in a
register and interpreted as

.12545 * 10^3

A floating point numbers is normalized if the MSB of the mantissa is non-zero.


Computer with shorter word lengths use two or more words to represent a
floating point numbers. Floating point operations are more complex then fixed
point numbers.

Que4. What are the limitations of Assembly language?

Ans. There are many disadvantages of assembly language:

1) It takes a lot of time and effort to write the code for the same.
2) It is very complex and difficult to understand.
3) The syntax is difficult to remember.
4) It has a lack of probability of program between different computer
architecture.
5) It needs more size or memory of the computer to run the long programs
written in assembly language.
6) Long programs written in such languages cannot be executed on small sized
computers.
7) To write programs in assembly language, the internal structure of the
microprocessor must be known.

Que5. What do you mean by effective address?

Ans. An address generated or used by a program to reference memory. A


memory-management until translates an effective address (EA) to a virtual
address(VA), which it then translates to a real address(RA) that accesses
real(physical) memory. The maximum size of the effective-address space is 2^64
bytes. It is also called offset. An offset is determined by adding any combination of
three address elements: displacement, base and index.
No Yes

Displacement – it is an 8 bit or 16 bit immediate value given in the instruction.

Base – contents of base register, BX or BP.

Index – content of index register SI or DI.

Que6. What is control memory? What is the role of control address register?

Ans. It is the storage in the microprogrammed control unit to store the


microprogram.

Microprogram consists of instructions in the strings of 0’s and 1’s & these are
called microinstructions.

Microprogramming is a method of control unit design in which the control signal


selection and sequencing information is stored in ROM and RAM called a control
memory.

Microinstructions are fetched from control memory in similar way as an


instruction is fetched from main memory.

Each microinstruction also explicitly or implicitly specifies, the next


microinstruction to be used, thereby providing the necessary information for
sequencing. Control memory

Microoperations CD BR Address
Microinstructions

Control address register: A control register is a processor register which changes


or controls the general behavior of CPU or other digital device. Common tasks
performed by control register include interrupt control, switching the addressing
mode, paging control, coprocessor control.

Que7. Explain booth algorithm.

Ans. Booth algorithm provides steps to perform multiplication using binary


numbers. Using this algorithm there will be no need to convert the final result
into its 2’s complement form, even if the sign of the multiplier and the
multiplicand are not same.
No Yes

The algorithm works for positive or negative multipliers in 2’s complement


representation. The hardware implementation of booth algorithm requires the
register configuration show in figure.

Here BR, AC, and QR are registers. On 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. The flow chart of booth algorithm is show:

PROCEDURE:

1) Let M is the multiplicand


2) Let Q is the multiplier
3) Consider a 1-bit register Q-1 and initialize it to 0
4) Consider a register A and initialize it to 0

CONDITIONS:

1) If Q0 Q-1 is same i.e. 00 or 11 then, perform arithmetic right shift by 1 bit.


2) If Q0 Q-1 = 10 then perform A A-M
And then perform arithmetic right shift.
3) If Q0 Q-1 = 01 then perform A A+M and then perform arithmetic right
shift.

Flow chart of booth algorithm,

START

Count = 0

M – Multiplicand

Q - Multiplier
No Yes

Qn Qn+1
10 01

A=A-M A=A+M

Arithmetic Shift
right

Count = count - 1

NO Count = 0 YES
END

Que8. What are general purpose register? Explain their functionality.

Ans. General purpose register are used by the programmer to store temporary
data. They are symmetric and interchangeable. Registers such as, B, C, D, E, H, L in
8085, the registers R1, R2…. Etc which are used to store data/address during
execution are general purpose registers.

Each register can hold 8 bit data.

Some specific functions of general purpose register are follow as:


No Yes

AX- this is the accumulator. It is of 16 bits and divided into two 8-bit registers AH
and AL to also perform 8-bit instructions. It is generally used for arithmetical and
logical instructions but in 8086 microprocessor it is not mandatory to have
accumulator as the destination operand.

Example: ADD AX, AX (AX = AX + AX)

BX- this is the base register. It is of 16 bit and is divided into two 8-bit registers CH
and CL to also perform 8-bit instructions. It is used in looping and rotation.

Example: MOV CX, 0005

LOOP

DX- this is the data register. It is of 16 bits and divided into two 8-bit registers DH
and DL to also perform 8-bit instructions. It is used in multiplication an
input/output port addressing.

Example: BX (DX, AX = AX * BX)

SP- this is the stack pointer. It is of 16 bits. It points to the topmost item of the
stack. If the stack is empty the stack pointer will be (FFFE)H.

Si- this is the source index register. It is of 16 bits. It is used in pointer addressing
of data as a source in some string related operations.

DI- this is the destination index register. It is of 16 bits. It is used in the pointer
addressing of data and as a destination in some string related operations.

Que9. What is macro? Explain the use of macros in I/O instructions of an


assembly language program.

Ans.
No Yes
No Yes
No Yes

You might also like