Unit 4 Control Unit and Central Processing Unit
Unit 4 Control Unit and Central Processing Unit
Control unit generates timing and control signals for the operations of the computer. The
control unit communicates with ALU and main memory. It also controls the transmission
between processor, memory and the various peripherals. It also instructs the ALU which
operation has to be performed on data.
Control unit can be designed by two methods:
1. Hardwired Control
2. Micro-programmed Control
Hardwired Control
The Hardwired Control organization involves the control logic to be implemented with gates,
flip-flops, decoders, and other digital circuits. The inputs to control unit are the instruction
register, flags, timing signals etc. This organization can be very complicated if we have to
make the control unit large.
If the design has to be modified or changed, all the combinational circuits have to be
modified which is a very difficult task.
Micro-programmed Control
o The Control memory address register specifies the address of the micro-instruction.
o The Control memory is assumed to be a ROM, within which all control information is
permanently stored.
o The control register holds the microinstruction fetched from the memory.
o The micro-instruction contains a control word that specifies one or more micro-
operations for the data processor.
o While the micro-operations are being executed, the next address is computed in the
next address generator circuit and then transferred into the control address register to
read the next microinstruction.
o The next address generator is often referred to as a micro-program sequencer, as it
determines the address sequence that is read from control memory.
• The four basic arithmetic operations are addition, subtraction, multiplication and
division.
• From these four basic operations, it is possible to formulate other arithmetic
functions and solve problems by means of numerical analysis methods.
• An arithmetic instruction may specify binary or decimal data, and in each case the
data may be in fixed-point or floating point form.
• Negative numbers may be in signed magnitude or signed compliment
representation.
• Fixed point numbers may represent integers or fractions.
Timing Signal
Microoperations - One, Two, Three Symbols, separated by commas (indicates that the
micro operation being performed). Symbols and Binary code for Microinstruction Fields
are shown in table: 1.1
BR - The BR (branch) field consists of two bits. It is used, in conjunction with the
address field AD, to choose the address of the next microinstruction shown below:
AD - A Symbolic Address, NEXT (address), RET, MAP (both of these last two converted
to zeros by the assembler) (indicates the address of the next microinstruction)
The pseudo instruction ORG is used to define the first instruction (or origin) of a micro
program, e.g., ORG 0 begins at 0000000.
The nine bits of the micro-operation fields will then be 000 100 101.
Symbolic Micro-program
Microprocessor and Computer Architecture | BIT 2nd Sem Unit 4: 7
@DC
Binary Micro-Program
The symbolic micro-program is a convenient way for writing micro-programs in a way
that people can read and understand, but this is not the way that the micro-program is
stored in memory. The symbolic micro-program must be translated to binary either by
means of an assembler program or by the user if the microprogram is simple enough.
For example simple binary microinstructions are shown in below table:
The equivalent binary form of the microprograms is shown in the above table. The
addresses for control memory are given in both decimal and binary. The binary
Microprocessor and Computer Architecture | BIT 2nd Sem Unit 4: 8
@DC
content of each microinstruction is derived from the symbols and their equivalent
binary values from table 1.1 which is given above.
Notes:
1. Address 3 has no equivalent in the symbolic microprogram since the ADD
routine has only three microinstructions at addresses 0, 1, and 2. The next
routine starts at address 4.
2. Even though address 3 is not used, some binary value must be specified for each
word in control memory. We could have specified all 0's in the word since this
location will never be used. However; if some unforeseen error occurs, or if a
noise signal sets CAR to the value of 3, it will be wise to jump to address 64,
which is the beginning of the fetch routine.
Register Organization
Registers are the smaller and the fastest accessible memory units in the central
processing unit (CPU). According to memory hierarchy, the registers in the processor,
function a level above the main memory and cache memory. The registers used by the
central unit are also called as processor registers.
A register can hold the instruction, address location, or operands. Sometimes, the
instruction has register as a part of itself.
Types of Register
Conditional Code
Memory Buffer Register
Stack is a storage structure that stores information in such a way that the last item
stored is the first item retrieved. It is based on the principle of LIFO (Last-in-first-out).
The stack in digital computers is a group of memory locations with a register that holds
the address of top of element. This register that holds the address of top of element of
the stack is called Stack Pointer.
The two operations of a stack are: * The two operations of a stack are the
1. Push: Inserts an item on top of stack. insertion and deletion of items.
2. Pop: Deletes an item from top of stack. However, nothing is pushed or popped
in a computer stack. These operations
Implementation of Stack are simulated by incrementing or
In digital computers, stack can be implemented in two decrementing
ways: the stack pointer
1. Register Stack register.
2. Memory Stack
Register Stack
A stack can be organized as a collection of finite number of registers that are used to
store temporary information during the execution of a program.
A stack can be placed in a portion of a large memory or it can be organized as a
collection of a finite number of memory words or registers. 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. Three items are placed in the stack: A, B, and C, in that
order. Item C is on top of the stack so that the content of SP is now 3.
The first item stored in the stack is at address L The last item is stored at address 0.
If SP reaches 0, the stack is full of items, so FULL is set to L This condition is reached if the top
item prior to the last push was in location 63 and, after incrementing SP, the last item is
stored in location 0.
Once an item is stored in location 0, there are no more empty registers in the stack. If an item
is written in the stack, obviously the stack cannot be empty, so EMTY is cleared to 0.
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 implemented in a random access memory (RAM) attached to a CPU.
The implementation of a stack in the CPU is done by assigning a portion of memory to
a stack operation and using a processor register as a stack pointer. The starting
memory location of the stack is specified by the processor register as stack pointer.
The stack pointer SP points at the top of the stack. The three registers are connected to a
common address bus, and either one can provide an address for memory.
PC is used during the fetch phase to read an instruction. AR is used during the execute phase
to read an operand.
SP is used to push or pop items into or the stack. As shown in Fig, the initial value of SP is
4001 and the stack grows with decreasing addresses.
Thus the first item stored in the stack is at address 4000, the second item is stored at address
3999, and the last address that can be used for the stack Is 3000.
No provisions are available for stack limit checks.
We assume that the items in the stack communicate with a data register DR. A new item is
inserted with the push operation as follows:
SP ← SP - 1
M[SP] ← DR
The stack pointer is decremented so that it points at the address of the next word. A memory
write operation inserts the word from DR into the top of the stack. A new item is deleted with
a pop operation as follows:
DR ← M[SP]
SP ← SP + 1
The top item is read from the stack into DR. The stack pointer is then incremented to point at
the next item in the stack.
Most computers do not provide hardware to check for stack overflow (full stack) or
underflow (empty stack).
The stack limits can be checked by using two processor registers: one to hold the upper limit
(3000 in this case), and the other to hold the lower limit (4001 in this case).
After a push operation SP is compared with the upper-limit register and after a pop
operation, SP is compared with the lower-limit register.
The two microoperations needed for either the push or pop are
o an access to memory through SP, and
o Updating SP.
Which of the two microoperations is done first and whether SP is updated by
incrementing or decrementing depends on the organization of the stack.
The advantage of a memory stack is that the CPU can refer to it without having to specify an
address, since the address is always available and automatically updated in the stack pointer.
1. Data transfer
- Data transfer instruction cause transfer of data from one location to another
without changing the binary information.
- The most common transfers are between memory and processor registers,
between processor registers and input or output, and between the processor
registers themselves.
Microprocessor and Computer Architecture | BIT 2nd Sem Unit 4: 14
@DC
- Typical data transfer instructions are:
2. Data manipulation
- Data manipulation instructions are those that perform arithmetic, logic ,shift
operation
- Operation on data provides the computational capabilities for computers
- Data manipulation instructions are divided into three basic types
1. Arithmetic Instructions
2. Logical and bit manipulation instructions
3. Shift instructions
2.1 Arithmetic Instructions
Problems:
1. Define the different ways to design the control unit of basic computer.
2. Differentiate between Hardwired Control and micro-programmed control.
3. What is register? Explain the types of registers.
4. Write the difference between CISC and RISC architecture.
5. What is stack? Explain the methods of implementation of the stack in digital
computers.
6. Define:
i. symbolic micro- program
ii. symbolic microinstructions
iii. Binary micro-program
iv. RISC
v. CISC
- End of Unit 4 -