5EC3-01: Computer Architecture: UNIT-3
5EC3-01: Computer Architecture: UNIT-3
# Number of Addresses
One-address instructions:
Two-address instructions:
Three-address instructions:
# Expression Evaluation
Mathematical formulas are usually expressed in infix notation. In this form, a binary operator appears between
the operands (e.g., A + B ). Generally, multiplication takes precedence over addition, so that a + b x c is
equivalent a + (b x c).
An alternative technique is known as reverse Polish, or postfix, notation. In this notation, the operator
follows its two operands. For example,
Note that, no parentheses are required when using reverse Polish. The advantage of postfix notation is that an
expression in this form is easily evaluated using a stack.
An expression in postfix notation is scanned from left to right. For each element of the expression, the
following rules are applied:
1. If the element is a variable or constant, push it onto the stack.
2. If the element is an operator, pop the top two items of the stack, perform the operation, and push the
result.
After the entire expression has been scanned, the result is on the top of the stack.
Memory address register (MAR): Is connected to the address lines of the system bus. It specifies the
address in memory for a read or write operation.
Memory buffer register (MBR): Is connected to the data lines of the system bus. It contains the value
to be stored in memory or the last value read from memory.
Program counter (PC): Holds the address of the next instruction to be fetched.
Instruction register (IR): Holds the last instruction fetched.
To summarize, the execution of a program consists of the sequential execution of instructions. Each
instruction is executed during an instruction cycle made up of shorter sub-cycles (e.g., fetch, indirect, execute,
interrupt).The execution of each sub-cycle involves one or more shorter operations, that is, micro-operations
shown in figure below.
The concept of micro-operations serves as a guide to the design of the control unit.
Fetch Cycle:
The fetch cycle occurs at the beginning of each instruction cycle and causes an instruction to be
fetched from memory.
The sequence of events for the fetch cycle from the point of view of its effect on the processor registers.
An example shown in Figure, at the beginning of the fetch cycle, the address of the next instruction to be
executed is in the program counter (PC); in this case, the address is 1100100.
Each micro-operation involves the movement of data into or out of a register. So long as these movements do
not interfere with one another, several of them can take place during one step, saving time.
Symbolically, it can be writing this sequence of events as follows:
Indirect Cycle:
Once an instruction is fetched, the next step is to fetch source operands. Let us assume a one-address
instruction format, with direct and indirect addressing allowed.
If the instruction specifies an indirect address, then an indirect cycle must precede the execute cycle.
The address field of the instruction is transferred to the MAR. This is then used to fetch the address of the
operand. Finally, the address field of the IR is updated from the MBR, so that it now contains a direct rather than
Unit-3: Page | 4 Dr S K Singh
an indirect address. The IR is now in the same state as if indirect addressing had not been used, and it is ready
for the execute cycle.
Interrupt Cycle:
At the completion of the execute cycle, a test is made to determine whether any enabled interrupts have
occurred. If so, the interrupt cycle occurs. The nature of this cycle varies greatly from one machine to another.
In the first step, the contents of the PC are transferred to the MBR, so that they can be saved for return from the
interrupt.
Then the MAR is loaded with the address at which the contents of the PC are to be saved, and the PC is
loaded with the address of the start of the interrupt-processing routine. These two actions may each be a single
micro-operation. However, it may take one or more additional micro-operations to obtain the Save _Address and
the Routine_Address before they can be transferred to the MAR and PC, respectively.
In any case, once this is done, the final step is to store the MBR, which contains the old value of the PC,
into memory. The processor is now ready to begin the next instruction cycle.
Execute Cycle:
The fetch, indirect, and interrupt cycles are simple and predictable. Each involves a small, fixed sequence of
micro-operations and, in each case, the same micro-operations are repeated each time around.
This is not true of the execute cycle. Because of the variety opcodes, there are a number of different
sequences of micro-operations that can occur.
First, consider an add instruction:
ADD R1, X
Which adds the contents of the location X to register R1. The following sequence of micro-operations might
occur:
Figure shows a general model of the control unit, showing all of its inputs and outputs.
The last mentioned field decides the addressing mode (addressing operation) to be applied to the address
embedded in the ongoing microinstruction. In microinstructions along with conditional addressing mode, this
address is refined by using the processor condition flags that represent the status of computations in the current
program. The last microinstruction in the instruction of the given microprogram is the microinstruction that
fetches the next instruction from the main memory to the instruction register.
Hardwired control unit generates the control signals Micrprogrammed control unit generates the control
needed for the processor using logic circuits signals with the help of micro instructions stored in
control memory
Hardwired control unit is faster when compared to This is slower than the other as micro instructions are
microprogrammed control unit as the required control used for generating signals here
Difficult to modify as the control signals that need to be Easy to modify as the modification need to be done
More costlier as everything has to be realized in terms Less costlier than hardwired control as only micro
It cannot handle complex instructions as the circuit It can handle complex instructions
Only limited number of instructions are used due to the Control signals for many instructions can be
Used in computer that makes use of Reduced Used in computer that makes use of Complex