Coa Unit - 2 Important Questions
Coa Unit - 2 Important Questions
Engineering College
An Autonomous Institution
(NBA ACCREDITED B.TECH COURSES: EEE, ECE, MECH & CSE, ACCORDED NAAC ‘A’GRADE)
Ghatkesar, Hyderabad- 501 301
Routine
Microinstructions are stored in control memory in groups, with each group specifying a
routine.
Each computer instruction has its own microprogram routine to generate microoperations that
execute the instruction.
The hardware that controls the address sequencing of the control memory must be capable of
sequencing the microinstructions within a routine and be able to branch from one routine to
another.
− An initial address is loaded into the CAR when power is turned on in the computer.
− This address is the address of the first microinstruction that activates the instruction fetch routine.
− At the end of the fetch routine, the instruction is in the Instruction Register of the computer.
− The control memory next must go through the routine that determines the effective address of the
operand.
3. A mapping process from the bits of the instruction to an address for control memory.
Mapping of Instruction
Each computer instruction has its own microprogram routine stored in a given location of the control
memory.
The transformation from the instruction code bits to an address in control memory where the routine
is located is referred to as a mapping process.
The input logic circuit in Fig. has three inputs, I0, I1, and T, and three outputs, S0, S1, and L .
Variables S0 and S1, select one of the source addresses for CAR . Variable L enables the load input
in SBR .
The binary values of the two selection variables determine the path in the multiplexer.
It is the function of the control unit within the CPU to interpret each instruction code and provide the
necessary control functions needed to process the instruction.
Computers may have instructions of several different lengths containing varying number of
addresses.
The number of address fields in the instruction format of a computer depends on the internal
organization of its registers.
− The instruction format in this type of computer uses one address field.
− The instruction format in this type of computer needs three address fields or two address
fields (register / memory) .
− PUSH and POP instructions, need an address field to specify the operand.
To illustrate the influence of the number of addresses on computer programs, we will evaluate the
arithmetic statement
X = (A + B) ∗ (C + D)
i. Three-Address Instructions
Short program
5. MUL R1, R2 ; R1 ← R1 R2
6. MOV X, R1 ; M[X] ← R1
1. LOAD A ; AC ← M[A]
2. ADD B ; AC ← AC + M[B]
3. STORE T ; M[T] ← AC
4. LOAD C ; AC ← M[C]
5. ADD D ; AC ← AC + M[D]
6. MUL T ; AC ← AC M[T]
7. STORE X ; M[X] ← AC
All operations are done between the implied AC register and memory operand, result is stored in AC.
1. PUSH A ; TOS ← A
2. PUSH B ; TOS ← B
3. ADD ; TOS ← (A + B)
4. PUSH C ; TOS ← C
5. PUSH D ; TOS ← D
6. ADD ; TOS ← (C + D)
1. Implied Mode
− Operands are specified implicitly in definition of the instruction
− Effective Address(EA) = Implied
Examples
• AC is implied in “ADD M[AR]” in “One-Address” instruction.
• TOS is implied in “ADD” in “Zero-Address” instruction.
2. Immediate Mode
The operand is specified in the instruction itself.
Operand field contains the actual operand not the address
Useful for initializing registers to a constant value
Effective Address(EA) = Operand
3. Register Mode
the operands are in registers that reside within the CPU.
EA = Register
Register is selected from a register field in the instruction.
− k-bit register field can specify any one of 2k registers.
− Example : LD R1 AC R1
A useful feature that is included in the CPU of most computers is a stack or last-in, first-out (LIFO)
list.
A stack is a storage device that stores information in such a manner that the item stored last is the
first item retrieved.
Stack Pointer
The stack in digital computers is essentially a memory unit with an address register that can count
only (after an initial value is loaded into it).
The register that holds the address for the stack is called a stack pointer (SP) because its value
always points at the top item in the stack.
Stack Operations
The two operations of a stack are the insertion and deletion of items.
Insertion and Deletion of Items
− PUSH : Push-Down = Insertion : pushing a new item on top.
− POP : Pop-Up = Deletion : removing one item
Register Stack
A stack can organized as a collection of a finite number of registers.
Below Figure shows the organization of a 64-word register stack.
The stack pointer register SP contains a binary number whose value is equal to the address of the
word that is currently on top of the stack.
Four items are placed in the stack: A, B, C and D, in that order. Item D is on top of the stack so that
the content of SP is now 4.
To remove the top item, the stack is popped by reading the memory word at address 4 and
decrementing the content of SP .
To insert a new item, the stack is pushed by incrementing SP and writing a word in the next-higher
location in the stack.
Push Operation
Initially, SP is cleared to 0, EMTY is set to 1, and FULL is cleared to 0, so that SP points to
the word at address 0 and the stack is marked empty and not full.
Pop Operation
A new item is deleted from the stack if the stack is not empty (if EMTY = 0).
The pop operation consists of the following sequence of microoperations:
Memory Stack
A stack can be placed in a portion of a large memory as a collection of a finite number of memory
words.
Below figure shows a portion of computer memory partitioned into three segments: program, data,
and stack.
Push Operation
A new item is inserted with the push operation as follows:
SP ← SP - 1
M[SP] ← DR
Pop Operation
A new item is deleted with a pop operation as follows:
DR ← M[SP]
SP ← SP + 1
Stack Limits
Check for stack overflow(full) /underflow(empty)
− Checked by using two registers
• Upper Limit and Lower Limit Register
− After PUSH Operation
• SP compared with the upper limit register
− After POP Operation
• SP compared with the lower limit register
Applications of Stack
2. This hierarchy dictates that first perform all arithmetic inside inner parentheses, then inside outer
parentheses, and do multiplication and division operations before addition and subtraction operations.
(3*4)+(5*6) 34*56*+
PUSH 3
PUSH 4
MULT
PUSH 5
PUSH 6
MULT
ADD
The control unit is responsible for initiating the sequence of control signals and timing signals to
generate microoperations that comprise instructions.
1. Hardwired Control :
When the control signals are generated by hardware, the control unit is hardwired control unit.
The control logic is implemented with gates, Flip-Flops, decoders, and other digital circuits.
Fast operation.
Wiring change (if the design has to be modified) is difficult.
Example CPUs: Intel 8085, Motorola 6802, Zilog 80, and any RISC (Reduced Instruction Set
Computer) CPUs.
2. Microprogrammed Control :
The control information is stored in a control memory, and the control memory is programmed to
initiate the required sequence of microoperations for an instruction.
Any required change can be done by updating the microprogram in control memory.
Slow operation
Example CPUs: Intel 8080, Motorola 68000, Zilog 80, and any CISC(Complex Instruction Set
Computer) CPUs.
(c) microprogram
A sequence of microinstructions constitutes a microprogram.
(d) microcode
• A symbolic microprogram can be translated into its binary equivalent by a microprogram
assembler is called microcode