You are on page 1of 14

1.

Explain Different Instruction formats with an example


To illustrate the influence of the number of addresses on computer programs, we will evaluate the
arithmetic statement
X = (A + B) *` (C + D)
using zero, one, two, or three address instructions

Three-Address Instructions:

Two-Address Instructions:

One-Address Instructions:

Zero-Address Instructions:
RISC Instructions:

2. What are different Addressing modes in Computer system


Types of Addressing Modes:
1. Implied Mode
2. Immediate Mode
3. Register Mode
4. Register Indirect Mode:
5. Autoincrement or Autodecrement Mode
6. Direct Address Mode
7. Indirect Address Mode
8. Relative Address Mode
9. Indexed Addressing Mode
10. Base Register Addressing Mode
There are two modes that need no address field at all. These are the implied
and immediate modes.

1. Implied Mode: In this mode the operands are specified implicitly in the definition of
the instruction.
For example, the instruction ”complement accumulator (CMA)” is an implied-mode
instruction because the operand in the accumulator register is implied in the definition of
the instruction. In fact, all register reference instructions that use an accumulator are
implied-mode instructions. Zero-address instructions in a stack-organized computer are
implied-mode instructions since the operands are implied to be on top of the stack.

2. Immediate Mode: In this mode the operand is specified in the instruction itself. In other
words, an immediate-mode instruction has an operand field rather than an address field.
The operand field contains the actual operand to be used in conjunction with the

operation specified in the instruction.


EX: LDAC #34H
LDAC loads data from memory to accumulator.
Therefore, AC=00110100.

When the address field specifies a processor register,the instruction is said to be in the register mode
3. Register Mode: In this mode the operands are in registers that reside within the CPU.
The particular register is selected from a register field in the instruction.

4. Register Indirect Mode: In this mode the instruction specifies a register in the CPU whose
contents give the address of the operand in memory. In other words, the selected register
contains the address of the operand rather than the operand itself.

EX: LDAC (R1)

If R1cotains the address of an operand in the memory, for example: address of an


operand is 2000 which contains a value 350. Result: 350 is stored in the AC.
5. Autoincrement Mode: This is similar to the register indirect mode except that the register
is incremented or decremented after (or before) its value is used to access memory. The
effective address of the operand is the contents of a register specified in the instruction.
After accessing the operand, the contents of the register are automatically incremented
to the next value.
6. Autodecrement Mode
The effective address of the operand is the contents of a register specified in the instruction.
Before accessing the operand, the contents of this register are automatically decremented
and then the value is accessed.

Sometimes the value given in the address field is the address of the operand, but sometimes
it is just an address from which the address of the operand is calculated.
7. Direct Address Mode: In this mode the effective address is equal to the address part of
the instruction. The operand resides in memory and its address is given directly by the
address field of the instruction. In a branch-type instruction the address field specifies the
actual branch address.

Ex: LDAC 5000


This instruction reads the operand from the Memory location 5000. if the memory location
5000 contains a value 250, then it will be stored in AC.
8. Indirect Address Mode: In this mode the address field of the instruction gives the address
where the effective address is stored in memory. Control fetches the instruction from
memory and uses its address part to access memory again to read the effective address.
EX: ADD (A), R1
 If A is address of EA. For example: address of A is 1000 which contains 3000, 3000 is an
address of an operand (EA).
 This instruction reads an operand from the location address 3000 and adds its contents to R1.

A few addressing modes require that the address field of the instruction be added to the content of
a specific register in the CPU. The effective address in these modes is obtained from the following
computation:

 effective address = address part of instruction + content of CPU register

The CPU register used in the computation may be the program counter, an index register, or a
base register. In either case we have a different addressing mode which is used for a different
application.

9 Relative Address Mode:


In this mode the content of the program counter is added to the address part of the instruction
in order to obtain the effective address.

EX:
PC= address of next instruction , i.e., 1. The address given in the instruction is 5 Then
EA= 5 + 1= 6 which contains a value 12. Finally AC contains 12.

10 Indexed Addressing Mode:


In this mode the content of an index register is added to the address part of the instruction to
obtain the effective address.
Ex: LDAC A(XR)
Assume XR=100, A=500
This instruction reads the operand from the effective
address (600) i.e., EA= XR contents (index register) + 500
= 100 + 500=600
If memory location at 600 contains a value 55 (assume), This 55 will be stored in AC.

11. Base Register Addressing Mode:


In this mode the content of a base register is added to the address part of the
instruction to obtain the effective address.
Ex: LDAC
A(R) Assume
R=1000,
A=50
This instruction reads the operand from the effective address
(1050) i.e., EA= R contents (Base register) + 50

= 1000 + 50=1050

If memory location at 1050 contains a value 255 (assume), this 255 will be
stored in AC.
3. Execute the following instruction using stack operation

(3 * 4) + (5 * 6)
A stack organization is very effective for evaluating arithmetic expressions. The
common mathematical method of writing arithmetic expressions imposes difficulties
when evaluated by a computer.
A * B + C * D  infix notation
The postfix notation, referred to as reverse Polish notation (RPN), places the operator after the
operands. The following examples demonstrate the three representations:
A+B Infix notation
+ AB Prefix or Polish notation
AB + Postfix or reverse Polish notation
The reverse Polish notation is in a form suitable for stack manipulation. The expression
A*B+C*D
is written in reverse Polish notation as AB*CD*+
Consider the arithmetic expression
(3 * 4) + (5 * 6)
In reverse Polish notation, it is expressed as
34 56 * +
4. Explain Key characteristics of Micro Programmed control over
hardwired Control
The key characteristics of Hardwired Control

->High speed of operation


->Expensive
->Relatively complex
->No flexibility of adding new instructions
Examples of CPU with hardwired control unit are Intel 8085, Motorola 6802, Zilog
80, and any RISC CPUs.

Memor Instruction code


y

• .
Sequence Counter Combinational Control
• . signals
Logic
• Circuits

The key characteristics of Microprogrammed control


• Speed of operation is low when compared with hardwired
• Less complex
• Less expensive
• Flexibility to add new instructions
• Examples of CPU with microprogrammed control unit are Intel 8080, Motorola 68000
and any CISC CPUs.
5. What are different status bits. Draw an 8 bit ALU with 4 bit status
registers
It is sometimes convenient to supplement the ALU circuit in the CPU with a status register
where status bit conditions can be stored for further analysis. Status bits are also called
condition-code bits or flag bits

The four status bits are symbolized by C. S, Z, and V. The bits are set or cleared as a result of an
operation performed in the ALU.

1. Bit C (carry) is set to 1 if the end carry C8 is 1. It is cleared to 0 if the carry is 0.


2. Bit S (sign) is set to 1 if the highest-order bit F7 is 1. It is set to 0 if the bit is 0.
3. Bit Z (zero) is set to 1 if the output of the ALU contains all 0's. It is
cleared to 0 otherwise. In other words, Z = 1 if the output is zero and Z
= 0 if the output is not zero.
4. Bit V (overflow) is set to 1 if the exclusive-OR of the last two carries is
equal to 1, and cleared to 0 otherwise. This is the condition for an
overflow when negative numbers are in 2's complement. For the 8-bit
ALU, V = 1 if the output is greater than + 127 or less than – 128.

6. Write about Microinstruction Format in details.


The 20 bits of the microinstruction are divided into four functional parts as follows:

1. The three fields F1, F2, and F3 specify microoperations for the computer. The
microoperations are subdivided into three fields of three bits each. The three bits in each field
are encoded to specify seven distinct microoperations. This gives a total of 21 microoperations.

2. The CD field selects status bit conditions.

3. The BR field specifies the type of branch to be used.

4. The AD field contains a branch address. The address field is seven bits wide, since the control
memory has 128 = 27 words.
A microinstruction can specify two simultaneous microoperations from F2 and F3 and none from
F1. DR
M[AR] with F2 = 100 PC
PC + 1 with F3 = 101
 The nine bits of the microoperation fields will then be 000 100 101.

 The CD (condition) field consists of two bits which are encoded to specify four status bit
conditions as listed in Table

7. Explain the designing of control unit


 The control memory out of each subfield must be decoded to provide the distinct
microoperations.

 The outputs of the decoders are connected to the appropriate inputs in the processor unit.
The below figure shows the three decoders and some of the connections that must be made from their
outputs.

 The three fields of the microinstruction in the output of control memory are decoded with a 3x8
decoder to provide eight outputs.

 Each of the output must be connected to proper circuit to initiate the corresponding
microoperation as specified in previous topic.

 When F1 = 101 (binary 5), the next pulse transition transfers the content of DR (0-10) to AR.

 Similarly, when F1= 110 (binary 6) there is a transfer from PC to AR (symbolized by PCTAR). As
shown in Fig, outputs 5 and 6 of decoder F1 are connected to the load input of AR so that when
either one of these outputs is active, information from the multiplexers is transferred to AR.

 The multiplexers select the information from DR when output 5 is active and from PC when
output 5 is inactive.
 The transfer into AR occurs with a clock transition only when output 5 or output 6 of the
decoder is active.

 For the arithmetic logic shift unit the control signals are instead of coming from the logical
gates, now these inputs will now come from the outputs of AND, ADD and DRTAC respectively.

8. Explain Microprogram Sequencer for a control memory


The basic components of a microprogrammed control unit are the control memory and the circuits that
select the next address.

 The address selection part is called a microprogram sequencer.

 The purpose of a microprogram sequencer is to present an address to the control memory so


that a microinstruction may be read and executed.

 The next-address logic of the sequencer determines the specific address source to be loaded
into the control address register.

 The block diagram of the microprogram sequencer is shown in below figure.

 The control memory is included in the diagram to show the interaction between the sequencer
and the memory attached to it.

 There are two multiplexers in the circuit. o The first multiplexer selects an address from one of
four sources and routes it into control address register CAR. o The second multiplexer tests the
value of a selected status bit and the result of the test is applied to an input logic circuit.

 The output from CAR provides the address for the control memory.

 The content of CAR is incremented and applied to one of the multiplexer inputs and to the
subroutine register SBR.

 The other three inputs to multiplexer come from o The address field of the present
microinstruction o From the out of SBR o From an external source that maps the instruction
 The CD (condition) field of the microinstruction selects one of the status bits in the second
multiplexer.

 If the bit selected is equal to 1, the T variable is equal to 1; otherwise, it is equal to 0.

 The T value together with two bits from the BR (branch) field goes to an input logic circuit.

 The input logic in a particular sequencer will determine the type of operations that are available
in the unit.

You might also like