CSC 426: ADVANCED COMPUTER SYSTEM
Computer Organization | Micro-Operation
In computer organization, a micro-operation refers to the smallest tasks performed by the
CPU’s control unit. These micro-operations help to execute complex instructions. They
involve simple tasks like moving data between registers, performing arithmetic calculations, or
executing logic operations. Each micro-operation is completed in a single clock cycle.
What is Micro Operation?
Micro-Operations (also known as micro-ops) are the functional or atomic, operations of a
processor. These are low level instructions used in some designs to implement complex
machine instructions. They generally perform operations on data stored in one or more
registers. They transfer data between registers or between external buses of the CPU, also
performs arithmetic and logical operations on registers. In executing a program, operation of a
computer consists of a sequence of instruction cycles, with one machine instruction per cycle.
Each instruction cycle is made up of a number of smaller units – Fetch, Indirect, Execute
and Interrupt cycles. Each of these cycles involves series of steps, each of which involves the
processor registers. These steps are referred as micro-operations. The prefix micro refers to the
fact that each of the step is very simple.
Micro-operations are small tasks performed inside the CPU. These tasks use data stored in the
CPU’s registers to do basic operations like math or logic tasks. They also help move data
between registers or between memory and registers.
Examples of Micro-Operations
1. Load: Moves data from memory into a register.
2. Store: Saves data from a register back into memory.
3. Add: Adds two values and stores the result in a register.
4. Subtract: Subtracts one value from another and stores the result in a register.
5. AND: Performs a logical AND operation on two values and stores the result in a register.
6. OR: Performs a logical OR operation on two values and stores the result in a register.
7. NOT: Reverses the bits of a value and stores the result in a register.
8. Shift: Moves the bits of a value to the left or right within a register.
9. Rotate: Rotates the bits of a value left or right in a register.
How Micro-Operations Work?
Micro-operations are combined to perform more complex instructions. For example, an
addition instruction might involve several micro-operations:
First, a load operation to move values into registers.
Then, an add operation to perform the calculation.
Finally, a store operation to save the result in memory.
Conclusion
When a computer runs a program, it processes instructions one by one. Each instruction is
executed through an instruction cycle, which consists of smaller steps, like fetching the
instruction, performing the task, and storing the result. Each of these steps involves multiple
micro-operations.
Microarchitecture and Instruction Set Architecture
In this article, we look at what an Instruction Set Architecture (ISA) is and what is the
difference between an ‘ISA’ and Microarchitecture. An ISA is defined as the design of a
computer from the Programmer’s Perspective.
This basically means that an ISA describes the design of a Computer in terms of the basic
operations it must support. The ISA is not concerned with the implementation-specific details of
a computer. It is only concerned with the set or collection of basic operations the computer must
support. For example, the AMD Athlon and the Core 2 Duo processors have entirely different
implementations but they support more or less the same set of basic operations as defined in the
x86 Instruction Set.
Let us try to understand the Objectives of an ISA by taking the example of the MIPS ISA. MIPS
is one of the most widely used ISAs in education due to its simplicity.
1. The ISA defines the types of instructions to be supported by the processor.
Based on the type of operations they perform MIPS Instructions are classified into 3 types:
Arithmetic/Logic Instructions:
These Instructions perform various Arithmetic & Logical operations on one or more
operands.
Data Transfer Instructions:
These instructions are responsible for the transfer of instructions from memory to the
processor registers and vice versa.
Branch and Jump Instructions:
These instructions are responsible for breaking the sequential flow of instructions and
jumping to instructions at various other locations, this is necessary for the
implementation of functions and conditional statements.
2. The ISA defines the maximum length of each type of instruction.
Since the MIPS is a 32 bit ISA, each instruction must be accommodated within 32 bits.
3. The ISA defines the Instruction Format of each type of instruction.
The Instruction Format determines how the entire instruction is encoded within 32 bits
There are 3 types of Instruction Formats in the MIPS ISA:
R-Instruction Format
I-Instruction Format
J-Instruction Format
If we look at the Abstraction Hierarchy:
The Abstraction Hierarchy
We note that the Micro architectural level lies just below the ISA level and hence is concerned
with the implementation of the basic operations to be supported by the Computer as defined by
the ISA. Therefore, we can say that the AMD Athlon and Core 2 Duo processors are based on
the same ISA but have different microarchitectures with different performance and efficiencies.
Now one may ask the need to distinguish between Microarchitecture and ISA?
The answer to this lies in the need to standardize and maintain the compatibility of programs
across different hardware implementations based on the same ISA. Making different machines
compatible with the same set of basic instructions (The ISA) allows the same program to run
smoothly on many different machines thereby making it easier for the programmers to document
and maintain code for many different machines simultaneously and efficiently.
This Flexibility is the reason we first define an ISA and then design different microarchitectures
complying with this ISA for implementing the machine. The design of a lower-level ISA is one
of the major tasks in the study of Computer Architecture.
Instruction Set Architecture Microarchitecture
The Microarchitecture is more concerned
The ISA is responsible for defining the set of with the lower level implementation of
instructions to be supported by the processor. how the instructions are going to be
For example, some of the instructions defined executed and deals with concepts like
by the ARMv7 ISA are given below. Instruction Pipelining, Branch Prediction,
Out of Order Execution.
On the other hand, the Branch
of Computer Organization is concerned
with the implementation of a particular
ISA deals with various hardware
The Branch of Computer Architecture is more implementation techniques, i.e. is the
inclined towards the Analysis and Design of Microarchitecture level. For Example,
Instruction Set Architecture. For Example, Intel ARM licenses other companies like
developed the x86 architecture, ARM Qualcomm, Apple for using ARM ISA,
developed the ARM architecture, & AMD but each of these companies have their
developed the amd64 architecture. The RISC-V own implementations of this ISA thereby
ISA developed by UC Berkeley is an example making them different in performance and
of an Open Source ISA. power efficiency. The Krait cores
developed by Qualcomm have a different
microarchitecture and the Apple A-series
processors have a different
microarchitecture.
The x86 was developed by Intel, but we see that almost every year Intel comes up with a new
generation of i-series processors. The x86 architecture on which most of the Intel Processors are
based essentially remains the same across all these generations but, where they differ is in the
underlying Microarchitecture. They differ in their implementation and hence are claimed to have
improved Performance. These various Microarchitectures developed by Intel are codenamed as
‘Nehalem’, ‘Sandybridge’, ‘Ivybridge’, and so on.
Therefore, in conclusion, we can say that different machines may be based on the same ISA but
have different Microarchitectures.
Types of Program Control Instructions
What is Program Control Instructions?
Program Control Instructions are the machine code instructions which are used to control the
flow of execution of instructions in the processor domain. These are important in instilling on the
processor how to execute a certain task, access different programs and control the decision
making on the basis of some conditions. They are commonly used in assembly language and
generated by high level language which is compiled into machine code form to enable the
processor act in the desired manner.
Types of Program Control Instructions
1. Compare Instruction
Compare instruction is specifically provided, which is similar to a subtract instruction except the
result is not stored anywhere, but flags are set according to the result.
Example:
CMP R1, R2 ;
2. Unconditional Branch Instruction
It causes an unconditional change of execution sequence to a new location.
Example:
JUMP L2
Mov R3, R1 goto L2
3. Conditional Branch Instruction
A conditional branch instruction is used to examine the values stored in the condition code
register to determine whether the specific condition exists and to branch if it does.
Example:
Assembly Code : BE R1, R2, L1
Compiler allocates R1 for x and R2 for y
High Level Code: if (x==y) goto L1;
4. Subroutines
A subroutine is a program fragment that lives in user space, performs a well-defined task. It is
invoked by another user program and returns control to the calling program when finished.
Example:
CALL and RET
5. Halting Instructions
NOP Instruction – NOP is no operation. It cause no change in the processor state other than
an advancement of the program counter. It can be used to synchronize timing.
HALT – It brings the processor to an orderly halt, remaining in an idle state until restarted by
interrupt, trace, reset or external action.
6. Interrupt Instructions
Interrupt is a mechanism by which an I/O or an instruction can suspend the normal execution of
processor and get itself serviced.
RESET – It reset the processor. This may include any or all setting registers to an initial
value or setting program counter to standard starting location.
TRAP – It is non-maskable edge and level triggered interrupt. TRAP has the highest priority
and vectored interrupt.
INTR – It is level triggered and maskable interrupt. It has the lowest priority. It can be
disabled by resetting the processor.
Advantages of Program Control Instructions
Efficient Control Flow: Program Control Instructions provide the processor with the means
to decide the order of instructions. This means that branching can be efficiently made which
is important for complicated mathematics as well as algorithms.
Conditional Execution: With conditional instruction, code can be executed whenever a
specific condition is met thereby improving the usability of programs in dealing with
different situations.
Modular Code: Modular are especially subroutines where separate code can be carried,
simplifying its usage as most calls basically involve performing standard functionalities as
and when required.
Synchronization: Instructions such as NOP and HALT helps in the militia of processes as
well for any inoperable phase of the system thereby protects it from unnecessary algorithm.
Interrupt Handling: Interrupt strategies give real time competencies since they give the
processor the ability to attend to peripheral devices and other kinds of processes promptly.
Efficient Resource Management: These instructions encumber improvement in resource
management over system operations by stopping, resuming or terminating them when high
performance is needed by the CPU.
Disadvantages of Program Control Instructions
Complexity: In cases of program control instructions, mainly regarding assembly language, it
can be complicated to write and understand such instructions as they require thorough
understanding of the way a processor is designed.
Performance Overhead: The use of conditional controls and subroutine calls has its
drawbacks where branching and moving back to previous statuses especially when they
contain nested calls or excessive use can be performance hindrances.
Risk of Errors: Identifying errors such as the program branching where it is not supposed to
or the abuse of interrupts can lead to errors such as program hanging where the program goes
into loops and does not progress any further rendering fixing it virtually impossible.
Dependency on Processor Architecture: These type of instructions are very particular with
the processor architecture to an extent that such type of software cannot be run on a different
hardware platform.
Interrupt Latency: This is on handling interrupts has some downsides particularly latency if
there is a need to handle several interrupts of different priorities.
Overhead with Subroutines: There is little doubt that the use of subroutine physically
changes the way the code is organized and though it saves time concerning the code, too
many transitions between the code and the subroutine/main program usually wastes time
within the detractors of the stack management.
.
CALL and JUMP instructions
In assembly language as well as in low level programming CALL and JUMP are the two major
control transfer instructions. Both instructions enable a program to go to different other parts of
the code but both are different. CALL is mostly used to direct calls to subroutine or a function
and regresses to the main program after function call only. On the other hand, JUMP cause the
control to jump to another part of code and does not return. CALL and JUMP you need to
understand well especially when operating at low levels and the optimizations to the control flow
of a program.
What is CALL Instruction?
The CALL instruction involves in calling up a subroutine or a function used in assembly
language. During CALL, the address of the instruction after the CALL instruction is stored on
the stack since after a subroutine has been executed, the control flows back to the main program.
This feature makes CALL suitable in areas, where a given line of code can be run several times
for instance in function calls.
Advantages of CALL Instruction
Code Reusability: The CALL instruction is used to call subroutines thus making the codes
reusable. This eliminates repetition, and has the added benefits of making the overall
structure of the program easier to develop.
Ease of Maintenance: It is easy to alter the program because the same subroutine is used
many times. Any modifications that are done in the subroutine are implemented wherever its
CALL instruction is employed.
Program Control: CALL allows to come back to the point of the program where execution
was interrupted with less interruptions, more controlled and less random program flow.
Disadvantages of CALL Instruction
Performance Overhead: The CALL instruction also include pushing the address of the next
instruction to the stack which is not serious but may cause some performance degrade in
cases where time is of high essence.
Stack Management: Various problems such as stack overflow or memory problems can occur
because of improper stack management (wrong disposing of a call, for example).
What is JUMP Instruction?
The unconditioned branch instruction is called the JUMP or JMP for short where it is able to
transfer control to a different part of the program. Like CALL, after JUMP executes the jump the
program moves to the target address, the only difference is that there are no RETURN
information needed to return back to the starting point. Basically, JUMP is utilized to do
branching operations within the given code or to omit instructions liking certain code further.
Advantages of JUMP Instruction
Efficiency: This implies that JUMP instructions are usually faster than CALL instructions
since the latter necessitate the saving and managing of return addresses.
Simpler Control Flow: For loops, conditions, and for exiting some parts of the code without
coming back are best suited to be used in JUMP.
Lower Overhead: In this way, unlike in the case of CALL, no return address is pushed on the
stack, and, therefore, JUMP has lesser overhead.
Disadvantages of JUMP Instruction
No Return Mechanism: There are no means to go back to the position where the JUMP
instruction was executed which may prove problematic in some cases especially when one is
debugging.
Risk of Unstructured Code: This is especially because the use of JUMP instructions in a
program’s code can result in generation of what is known as spaghetti code.
Difference between CALL and JUMP instructions
SERIAL
NO. JUMP CALL
Program control is transferred to a Program Control is transferred to a
1. memory location which is in the main memory location which is not a part of
program main program
Immediate Addressing Mode + Register
2. Immediate Addressing Mode
Indirect Addressing Mode
Initialization of SP(Stack Pointer) is Initialization of SP(Stack Pointer) is
3.
not mandatory mandatory
SERIAL
NO. JUMP CALL
Value of Program Counter(PC) is not Value of Program Counter(PC) is
4.
transferred to stack transferred to stack
After JUMP, there is no return
5. After CALL, there is a return instruction
instruction
6. Value of SP does not changes Value of SP is decremented by 2
10 T states are required to execute 18 T states are required to execute this
7.
this instruction instruction
3 Machine cycles are required to 5 Machine cycles are required to execute
8.
execute this instruction this instruction
Interrupts in 8086 microprocessor
An interrupt is a condition that halts the microprocessor temporarily to work on a different task
and then returns to its previous task. An interrupt is an event or signal that requests the CPU’s
attention. This halt allows peripheral devices to access the microprocessor. Whenever an
interrupt occurs, the processor completes the current instruction and starts the implementation
of an Interrupt Service Routine (ISR) or Interrupt Handler. ISR is a program that tells the
processor what to do when the interrupt occurs. After the ISR execution, control returns to the
main routine where it was interrupted. In the 8086 microprocessor following tasks are
performed when the microprocessor encounters an interrupt:
1. The value of the flag register is pushed into the stack. It means that first, the value of SP
(Stack Pointer) is decremented by two then the value of the flag register is pushed to the
memory address of the stack segment.
2. The value of starting memory address of CS (Code Segment) is pushed into the stack.
3. The value of IP (Instruction Pointer) is pushed into the stack.
4. IP is loaded from word location (Interrupt type) * 04.
5. CS is loaded from the following word location.
6. Interrupt, and Trap flags are reset to 0.
The different types of interrupts present in the 8086 microprocessor are given by:
1. Hardware Interrupts – Hardware interrupts are those interrupts that are caused by any
peripheral device by sending a signal through a specified pin to the microprocessor. There
are two hardware interrupts in the 8086 microprocessor. They are:
NMI (Non-Maskable Interrupt): It is a single pin non-maskable hardware interrupt that
cannot be disabled. It is the highest priority interrupt in the 8086 microprocessor. After
its execution, this interrupt generates a TYPE 2 interrupt. IP is loaded from word
location 00008 H, and CS is loaded from the word location 0000A H.
INTR (Interrupt Request): It provides a single interrupt request and is activated by the
I/O port. This interrupt can be masked or delayed. It is a level-triggered interrupt. It can
receive any interrupt type, so the value of IP and CS will change on the interrupt type
received.
2. Software Interrupts – These are instructions inserted within the program to generate
interrupts. There are 256 software interrupts in the 8086 microprocessor. The instructions
are of the format INT type, where the type ranges from 00 to FF. The starting address
ranges from 00000 H to 003FF H. These are 2-byte instructions. IP is loaded from type *
04 H, and CS is loaded from the following address given by (type * 04) + 02 H. Some
important software interrupts are:
TYPE 0 corresponds to division by zero(0).
TYPE 1 is used for single-step execution for debugging the program.
TYPE 2 represents NMI and is used in power failure conditions.
TYPE 3 represents a break-point interrupt.
TYPE 4 is the overflow interrupt.
Computer Organization | Hardwired v/s Micro-programmed Control Unit
Introduction
In computer architecture, the control unit is responsible for directing the flow of data and
instructions within the CPU. There are two main approaches to implementing a control unit:
hardwired and micro-programmed.
A hardwired control unit is a control unit that uses a fixed set of logic gates and circuits to
execute instructions. The control signals for each instruction are hardwired into the control unit,
so the control unit has a dedicated circuit for each possible instruction. Hardwired control units
are simple and fast, but they can be inflexible and difficult to modify.
On the other hand, a micro-programmed control unit is a control unit that uses a microcode to
execute instructions. The microcode is a set of instructions that can be modified or updated,
allowing for greater flexibility and ease of modification. The control signals for each instruction
are generated by a microprogram that is stored in memory, rather than being hardwired into the
control unit.
If we talk about Micro-programmed control units they are generally slower than hardwired
control units because they require an extra step of decoding the microcode to generate control
signals, but they are more flexible and easier to modify. They are commonly used in modern
CPUs because they allow for easier implementation of complex instruction sets and better
support for instruction set extensions.
To execute an instruction, the control unit of the CPU must generate the required control signal
in the proper sequence. There are two approaches used for generating the control signals in
proper sequence as Hardwired Control unit and the Micro-programmed control unit.
Hardwired Control Unit: The control hardware can be viewed as a state machine that changes
from one state to another in every clock cycle, depending on the contents of the instruction
register, the condition codes, and the external inputs. The outputs of the state machine are the
control signals. The sequence of the operation carried out by this machine is determined by the
wiring of the logic elements and hence named “hardwired”.
Fixed logic circuits that correspond directly to the Boolean expressions are used to generate
the control signals.
Hardwired control is faster than micro-programmed control.
A controller that uses this approach can operate at high speed.
RISC architecture is based on the hardwired control unit
Micro-programmed Control Unit –
The control signals associated with operations are stored in special memory units
inaccessible by the programmer as Control Words.
Control signals are generated by a program that is similar to machine language programs.
The micro-programmed control unit is slower in speed because of the time it takes to fetch
microinstructions from the control memory.
Some Important Terms
1. Control Word: A control word is a word whose individual bits represent various control
signals.
2. Micro-routine: A sequence of control words corresponding to the control sequence of a
machine instruction constitutes the micro-routine for that instruction.
3. Micro-instruction: Individual control words in this micro-routine are referred to as
microinstructions.
4. Micro-program: A sequence of micro-instructions is called a micro-program, which is stored
in a ROM or RAM called a Control Memory (CM).
5. Control Store: the micro-routines for all instructions in the instruction set of a computer are
stored in a special memory called the Control Store.
The differences between hardwired and micro-programmed control units:
Micro-programmed Control Unit
Hardwired Control Unit
Fixed set of logic gates Microcode stored in memory
Implementation
and circuits
Less flexible, difficult to More flexible, easier to modify
Flexibility
modify
Supports limited Supports complex instruction sets
Instruction Set
instruction sets
Complex design, more difficult to
Simple design, easy to
Complexity of Design implement
implement
Slower operation due to
Speed Fast operation microcode decoding
Micro-programmed Control Unit
Hardwired Control Unit
Easier to debug and test
Debugging and Testing Difficult to debug and test
Larger size, higher cost
Size and Cost Smaller size, lower cost
Maintenance and Difficult to upgrade and Easier to upgrade and maintain
Upgradability maintain
Types of Micro-programmed Control Unit – Based on the type of Control Word stored in the
Control Memory (CM), it is classified into two types :
1. Horizontal Micro-programmed Control Unit :
The control signals are represented in the decoded binary format that is 1 bit/CS. Example: If 53
Control signals are present in the processor then 53 bits are required. More than 1 control signal
can be enabled at a time.
It supports longer control words.
It is used in parallel processing applications.
It allows a higher degree of parallelism. If degree is n, n CS is enabled at a time.
It requires no additional hardware(decoders). It means it is faster than Vertical
Microprogrammed.
It is more flexible than vertical microprogrammed
2. Vertical Micro-programmed Control Unit :
The control signals are represented in the encoded binary format. For N control signals- Log2(N)
bits are required.
It supports shorter control words.
It supports easy implementation of new control signals therefore it is more flexible.
It allows a low degree of parallelism i.e., the degree of parallelism is either 0 or 1.
Requires additional hardware (decoders) to generate control signals, it implies it is slower
than horizontal microprogrammed.
It is less flexible than horizontal but more flexible than that of a hardwired control unit.
Implementation of Micro Instructions Sequencer
The address is used by a microprogram sequencer to decide which microinstruction has to be
performed next. Microprogram sequencing is the name of the total procedure. The addresses
needed to step through a control store’s microprogram are created by a sequencer, also known as
a microsequencer.
The control unit’s main job is to communicate with the computer’s memory, input/output device,
and ALU on how to respond to or carry out a set of instructions. Processing is not done within
the Control unit itself. It only directs and manages the task. It serves as the computer’s
supervisor, regulating all operations including retrieving instructions from main memory and
putting them to use.
Micro Instructions Sequencer
Micro Instructions Sequencer is a combination of all hardware for selecting the next micro-
instruction address. The micro-instruction in control memory contains a set of bits to initiate
micro-operations in computer registers and other bits to specify the method by which the address
is obtained.
Implementation of Micro Instructions Sequencer
Control Address Register(CAR) : Control address register receives the address from four
different paths. For receiving the addresses from four different paths, Multiplexer is used.
Multiplexer : Multiplexer is a combinational circuit which contains many data inputs and
single data output depending on control or select inputs.
Branching : Branching is achieved by specifying the branch address in one of the fields of the
micro instruction. Conditional branching is obtained by using part of the micro-instruction to
select a specific status bit in order to determine its condition.
Mapping Logic : An external address is transferred into control memory via a mapping logic
circuit.
Incrementer : Incrementer increments the content of the control address register by one, to
select the next micro-instruction in sequence.
Subroutine Register (SBR) : The return address for a subroutine is stored in a special register
called Subroutine Register whose value is then used when the micro-program wishes to
return from the subroutine.
Control Memory : Control memory is a type of memory which contains addressable storage
registers. Data is temporarily stored in control memory. Control memory can be accessed
quicker than main memory.
Design of Micro-programmed Controller Unit
A set of micro-instructions make up microprogramming. Three micro-operation phases are
primarily present in each micro-instruction. F1, F2, F3, respectively. We also have the condition,
branch, and address fields in addition to these three.
A 3X8 decoder decodes the F1, F2, and F3 fields because they are all 3 bits in size. We receive 8
outputs from the F1 micro-operation phase. One of these eight outputs is still unutilized.
Like the F1 procedure, the F2 operation produces a total of 7 outputs.
Only six operations can be carried out in the F3 micro-operation phase (one is left unfinished,
and the other is saved for later use).
Therefore, we can complete 20 micro-operations in total (7+7+6).
Out of 20 operations, the diagram above shows 5 micro-operations.
The ALU is attached to F2 output number 3. It applies the AND operation to the contents of the
data register and accumulator, then transfers the outcome to the accumulator. This is how it is
written: ACAC AND DR
And we give the matching accumulator a clock pulse. The ability to load it onto the accumulator
is enabled.
Output 1 of F1 adds data register and accumulator using an ALU, then sends the outcome to the
accumulator.
The DRTAR operation, or transfer of the contents of the data register to the address register, is
carried out by output 5 of F1. However, the data register’s size is 16 bits, while the the rightmost
significant 12 bits of the data register are moved to the address register since the address register
only has a capacity of 12 bits.
Transferring the contents of the programme counter to the address register is what output 6 of F1
does.
Introduction of Control Unit and its Design
A Central Processing Unit is the most important component of a computer system. A control unit
is a part of the CPU. A control unit controls the operations of all parts of the computer but it does
not carry out any data processing operations.
What is a Control Unit?
The Control Unit is the part of the computer’s central processing unit (CPU), which directs the
operation of the processor. It was included as part of the Von Neumann Architecture by John von
Neumann. It is the responsibility of the control unit to tell the computer’s memory,
arithmetic/logic unit, and input and output devices how to respond to the instructions that have
been sent to the processor. It fetches internal instructions of the programs from the main memory
to the processor instruction register, and based on this register contents, the control unit generates
a control signal that supervises the execution of these instructions. A control unit works by
receiving input information which it converts into control signals, which are then sent to the
central processor. The computer’s processor then tells the attached hardware what operations to
perform. The functions that a control unit performs are dependent on the type of CPU because
the architecture of the CPU varies from manufacturer to manufacturer.
Examples of devices that require a CU are:
Control Processing Units(CPUs)
Graphics Processing Units(GPUs)
Functions of the Control Unit
It coordinates the sequence of data movements into, out of, and between a processor’s many
sub-units.
It interprets instructions.
It controls data flow inside the processor.
It receives external instructions or commands to which it converts to sequence of control
signals.
It controls many execution units(i.e.ALU , data buffers and registers ) contained within a
CPU.
It also handles multiple tasks, such as fetching, decoding, execution handling and storing
results.
Types of Control Unit
There are two types of control units:
Hardwired
Micro programmable control unit.
Hardwired Control Unit
In the Hardwired control unit, the control signals that are important for instruction execution
control are generated by specially designed hardware logical circuits, in which we cannot modify
the signal generation method without physical change of the circuit structure. The operation code
of an instruction contains the basic data for control signal generation. In the instruction decoder,
the operation code is decoded. The instruction decoder constitutes a set of many decoders that
decode different fields of the instruction opcode.
As a result, few output lines going out from the instruction decoder obtains active signal values.
These output lines are connected to the inputs of the matrix that generates control signals for
execution units of the computer. This matrix implements logical combinations of the decoded
signals from the instruction opcode with the outputs from the matrix that generates signals
representing consecutive control unit states and with signals coming from the outside of the
processor, e.g. interrupt signals. The matrices are built in a similar way as a programmable logic
arrays.
Control signals for an instruction execution have to be generated not in a single time point but
during the entire time interval that corresponds to the instruction execution cycle. Following the
structure of this cycle, the suitable sequence of internal states is organized in the control unit. A
number of signals generated by the control signal generator matrix are sent back to inputs of the
next control state generator matrix.
This matrix combines these signals with the timing signals, which are generated by the timing
unit based on the rectangular patterns usually supplied by the quartz generator. When a new
instruction arrives at the control unit, the control units is in the initial state of new instruction
fetching. Instruction decoding allows the control unit enters the first state relating execution of
the new instruction, which lasts as long as the timing signals and other input signals as flags and
state information of the computer remain unaltered.
A change of any of the earlier mentioned signals stimulates the change of the control unit state.
This causes that a new respective input is generated for the control signal generator matrix.
When an external signal appears, (e.g. an interrupt) the control unit takes entry into a next
control state that is the state concerned with the reaction to this external signal (e.g. interrupt
processing).
The values of flags and state variables of the computer are used to select suitable states for the
instruction execution cycle. The last states in the cycle are control states that commence fetching
the next instruction of the program: sending the program counter content to the main memory
address buffer register and next, reading the instruction word to the instruction register of
computer. When the ongoing instruction is the stop instruction that ends program execution, the
control unit enters an operating system state, in which it waits for a next user directive.
Micro Programmable control unit
The fundamental difference between these unit structures and the structure of the hardwired
control unit is the existence of the control store that is used for storing words containing encoded
control signals mandatory for instruction execution. In microprogrammed control units,
subsequent instruction words are fetched into the instruction register in a normal way. However,
the operation code of each instruction is not directly decoded to enable immediate control signal
generation but it comprises the initial address of a microprogram contained in the control store.
With a single-level control store: In this, the instruction opcode from the instruction register
is sent to the control store address register. Based on this address, the first microinstruction of
a microprogram that interprets execution of this instruction is read to the microinstruction
register . This microinstruction contains in its operation part encoded control signals,
normally as few bit fields. In a set microinstruction field decoder, the fields are decoded. The
microinstruction also contains the address of the next microinstruction of the given
instruction microprogram and a control field used to control activities of the microinstruction
address generator
.
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.
With a two-level control store: In this, in a control unit with a two-level control store, besides
the control memory for microinstructions, a nano-instruction memory is included. In such a
control unit, microinstructions do not contain encoded control signals. The operation part of
microinstructions contains the address of the word in the nano-instruction memory, which
contains encoded control signals. The nano-instruction memory contains all combinations of
control signals that appear in microprograms that interpret the complete instruction set of a
given computer, written once in the form of nano-instructions.
In this way, unnecessary storing of the same operation parts of microinstructions is avoided.
In this case, microinstruction word can be much shorter than with the single level control
store. It gives a much smaller size in bits of the microinstruction memory and, as a result, a
much smaller size of the entire control memory. The microinstruction memory contains the
control for selection of consecutive microinstructions, while those control signals are
generated at the basis of nano-instructions. In nano-instructions, control signals are
frequently encoded using 1 bit/ 1 signal method that eliminates decoding.
Advantages of a Well-Designed Control Unit
Efficient instruction execution: A well-designed control unit can execute instructions more
efficiently by optimizing the instruction pipeline and minimizing the number of clock cycles
required for each instruction.
Improved performance: A well-designed control unit can improve the performance of the
CPU by increasing the clock speed, reducing the latency, and improving the throughput.
Support for complex instructions: A well-designed control unit can support complex
instructions that require multiple operations, reducing the number of instructions required to
execute a program.
Improved reliability: A well-designed control unit can improve the reliability of the CPU by
detecting and correcting errors, such as memory errors and pipeline stalls.
Lower power consumption: A well-designed control unit can reduce power consumption by
optimizing the use of resources, such as registers and memory , and reducing the number of
clock cycles required for each instruction.
Better branch prediction: A well-designed control unit can improve branch prediction
accuracy, reducing the number of branch mispredictions and improving performance.
Improved scalability: A well-designed control unit can improve the scalability of the CPU,
allowing it to handle larger and more complex workloads.
Better support for parallelism: A well-designed control unit can better support parallelism,
allowing the CPU to execute multiple instructions simultaneously and improve overall
performance.
Improved security: A well-designed control unit can improve the security of the CPU by
implementing security features such as address space layout randomization and data
execution prevention.
Lower cost: A well-designed control unit can reduce the cost of the CPU by minimizing the
number of components required and improving manufacturing efficiency.
Disadvantages of a Poorly-Designed Control Unit
Reduced performance: A poorly-designed control unit can reduce the performance of the
CPU by introducing pipeline stalls, increasing the latency, and reducing the throughput.
Increased complexity: A poorly-designed control unit can increase the complexity of the
CPU, making it harder to design, test, and maintain.
Higher power consumption: A poorly-designed control unit can increase power consumption
by inefficiently using resources, such as registers and memory, and requiring more clock
cycles for each instruction.
Reduced reliability: A poorly-designed control unit can reduce the reliability of the CPU by
introducing errors, such as memory errors and pipeline stalls.
Limitations on instruction set: A poorly-designed control unit may limit the instruction set of
the CPU, making it harder to execute complex instructions and limiting the functionality of
the CPU.
Inefficient use of resources: A poorly-designed control unit may inefficiently use resources
such as registers and memory, leading to wasted resources and reduced performance.
Limited scalability: A poorly-designed control unit may limit the scalability of the CPU,
making it harder to handle larger and more complex workloads.
Poor support for parallelism: A poorly-designed control unit may limit the ability of the CPU
to support parallelism, reducing the overall performance of the system.
Security vulnerabilities: A poorly-designed control unit may introduce security
vulnerabilities, such as buffer overflows or code injection attacks.
Higher cost: A poorly-designed control unit may increase the cost of the CPU by requiring
additional components or increasing the manufacturing complexity.
Difference between Horizontal and Vertical micro-programmed Control Unit
The Control Unit, in computer architecture, plays a fundamental role in the management of
instruction execution by regulating the use of the processor, memory, and I/O devices. There
exist mainly two methods for designing micro-programmed control units. These comprise the
Horizontal and Vertical Micro programmed Control Units. The two methods are represented,
encoded, and executed differently concerning control signals in attempts to control the micro-
operations guiding the behavior of the CPU.
The control unit (CU) is the engine that runs the entire functions of a computer with the help of
control signals in the proper sequence. In the micro-programmed control unit approach, the
control signals that are associated with the operations are stored in special memory units. It is
convenient to think of sets of control signals that cause specific micro-operations to occur as
being “micro-instructions”. The sequences of micro-instructions could be stored in an internal
“control” memory.
The micro-programmed control unit can be classified into two types based on the type of Control
Word stored in the Control Memory, viz., Horizontal micro-programmed control unit and
Vertical micro-programmed control unit.
What is Horizontal Micro-Programmed Control Unit?
In this design, each control signal in the control word is explicitly specified. It employs a wide
control word in which every bit determines any particular control signal or micro-operation. In
the Horizontal micro-programmed control unit, the control signals are represented in the
decoded binary format, i.e., 1 bit/CS. Here ‘n’ control signals require n bit encoding.
Features of Horizontal Micro-Programmed Control Unit
Control Signals are Explicit: In horizontal control unit, every control signal is specified by a
separate bit in the control word. Which means, there is direct control over all the
microoperations and thus makes for a more flexible system and a faster system.
Wide Control Word: In this type of micro-programming, signals are specified individually;
thus, a wide control word is needed by the horizontal micro-programming. This results in
longer instruction words, but it provides for control over individual operations.
Sequential Execution: More than one control signal can be excited simultaneously, due to
which more parallel operations can be performed in this system and hence it results in higher
efficiency in executing instructions.
Advantages of Horizontal Micro-Programmed Control Unit
It leads to faster implementation of the instructions since the control process is more parallel.
Control signals for every control operation are explicitly specified hence it is easier to control
complex micro-operations.
Drawbacks of Horizontal Micro-Programmed Control Unit
High Memory Requirement: More memory is needed to store the microprograms since the
size of the word is large.
Complex Design: More lines in the control lead to complexity both while designing and
while debugging.
What is Vertical Micro-Programmed Control Unit?
Vertical Micro-programmed Control Unit uses encoded form of control signals. Instead of one
bit per control signal, multiple signals are encoded into a shorter control word. Decoders expand
the encoded signals into real control signals. In a Vertical micro-programmed control unit, the
control signals are represented in the encoded binary format. Here ‘n’ control signals require
log2n bit encoding.
Features of Vertical Micro-Programmed Control Unit
Encoded Control Signals: The control signals are compressed into fewer bits, and decoders
are used to produce actual control signals. This leads to control words that are shorter in
length.
In narrow control word: The length of control word is vertical micro-programming shorter as
compared to horizontal since it uses fewer bits due to the encoding of control signals. Since
only few control signals are activated at any given time, generally, vertical micro-
programming results in operations as being more sequential.
Advantages of Vertical Micro-Programmed Control Unit
Less memory is needed: Shorter control word results in lesser memory to be used for storing
of microprograms.
Easier designing: Lesser number of control signals results in an easier and manageable
system.
Disadvantages of Vertical Micro-Programmed Control Unit
The Speed is Low. Because of the fact that control signals have been encoded and then
decoded, it takes more time than that of the horizontal micro-programming.
Less Flexible: The control signals have been encoded; hence parallelism is limited and the
flexibility of control over several micro-operations simultaneously gets reduced.
Difference Between Horizontal and Vertical Micro-Programmed Control Unit
S.
No Horizontal µ-Programmed CU Vertical µ-Programmed CU
1. It supports longer control word. It supports shorter control word.
It allows a higher degree of parallelism.
It allows a low degree of parallelism i.e., the
If degree is n, then n Control Signals
degree of parallelism is either 0 or 1.
2. are enabled at a time.
Additional hardware in the form of decoders
No additional hardware is required.
3. is required to generate control signals.
It is faster than a Vertical micro- it is slower than a Horizontal micro-
4. programmed control unit. programmed control unit.
It is more flexible than a vertical micro- It is less flexible than horizontal but more
5. programmed control unit. flexible than that of a hardwired control unit.
6. A horizontal micro-programmed control A vertical micro-programmed control unit
unit uses horizontal micro-instruction, uses vertical micro-instruction, where a code
S.
No Horizontal µ-Programmed CU Vertical µ-Programmed CU
is used for each action to be performed and
where every bit in the control field
the decoder translates this code into
attaches to a control line.
individual control signals.
The horizontal micro-programmed
The vertical micro-programmed control unit
control unit makes less use
makes more use of ROM encoding to reduce
of ROM encoding than the vertical
the length of the control word.
7. micro-programmed control unit.
Difference between Hardwired and Micro-programmed Control Unit
Prerequisite – Hardwired v/s Micro-programmed Control Unit To execute an instruction, there
are two types of control units Hardwired Control unit and Micro-programmed control unit.
1. Hardwired control units are generally faster than microprogrammed designs. In hardwired
control, we saw how all the control signals required inside the CPU can be generated using
a state counter and a PLA circuit.
2. A microprogrammed control unit is a relatively simple logic circuit that is capable of (1)
sequencing through microinstructions and (2) generating control signals to execute each
microinstruction.
Hardwired Control Unit Microprogrammed Control Unit
Hardwired control unit generates the control Microprogrammed control unit generates
signals needed for the processor using logic the control signals with the help of micro
circuits instructions stored in control memory
Hardwired control unit is faster when compared
This is slower than the other as micro
to microprogrammed control unit as the
instructions are used for generating
required control signals are generated with the
signals here
help of hardwares
Difficult to modify as the control signals that Easy to modify as the modification need
need to be generated are hard wired to be done only at the instruction level
Hardwired Control Unit Microprogrammed Control Unit
Less costlier than hardwired control as
More costlier as everything has to be realized in
only micro instructions are used for
terms of logic gates
generating control signals
It cannot handle complex instructions as the
It can handle complex instructions
circuit design for it becomes complex
Only limited number of instructions are used Control signals for many instructions
due to the hardware implementation can be generated
Used in computer that makes use of
Used in computer that makes use of Reduced
Complex Instruction Set
Instruction Set Computers(RISC)
Computers(CISC)
Difference Between Mealy Machine and Moore Machine
In theory of computation and automata, there are two machines: Mealy Machine and Moore
Machine which is used to show the model and behavior of circuits and diagrams of a computer.
Both of them have transition functions and the nature of taking output on same input is different
for both. In this article, we will learn about Mealy and Moore Machines with their diagrams and
the differences between them.
What is Mealy Machine?
Mealy Machine is defined as a machine in the theory of computation whose output values are
determined by both its current state and current inputs. In this machine at most one transition is
possible.
It has 6 tuples: (Q, q0, ∑, ▲, δ, λ’)
Q is a finite set of states
q0 is the initial state
∑ is the input alphabet
▲ is the output alphabet
δ is the transition function that maps Q×∑ → Q
‘λ’ is the output function that maps Q×∑→ ▲
The diagram is as follows:
Moore Machine
Moore’s machine is defined as a machine in the theory of computation whose output values are
determined only by its current state. It has also 6 tuples
(Q, q0, ∑, ▲, δ, λ)
1. Q is a finite set of states
2. q0 is the initial state
3. ∑ is the input alphabet
4. ▲ is the output alphabet
5. δ is the transition function that maps Q×∑ → Q
6. λ is the output function that maps Q → ▲
Diagram:
Difference Between Mealy Machine and Moore Machine
The differences between the Mealy machine and Moore machine is as follows:
Moore Machine Mealy Machine
Output depends on the present state as well
Output depends only upon the present state.
as present input.
Moore machine also places its output in the Mealy Machine places its output on the
state. transition.
More states are required. Less number of states are required.
Moore machines requires more hardware Mealy Machines requires less hardware
requirement for circuit implementation. requirement for circuit implementation.
They react slower to inputs(One clock cycle
They react faster to inputs.
later).
Synchronous output and state generation. Asynchronous output generation.
Output is placed on states. Output is placed on transitions.
Easy to design. It is difficult to design.
If input changes, output does not change, as
moore machine is a type of finite state If input changes, output also changes,
machine where the output is determined because in mealy machine output depends on
solely by the current state, not by the current the present state as well as present input.
input.
Has more or the same states as that of the Has fewer or the same states as that of the
Mealy machine. Moore machine.
Multiplication Algorithm
Multiplication of fixed-point binary numbers in signed-magnitude representation is done by
successive shift and add operations. For example, multiplication of numbers 10111(23) and
10011(19).
23 10111
19 x 10011
10111
10111x
00000xx +(adding all)
00000xxx
110110101 Product 437
The process consists of looking at successive Multiplier, least significant bit first. If the
Multiplier is 1, the multiplicand is copied down; otherwise, zero is copied. And like we do in
standard multiplication, the numbers copied down in successive lines are shifted one position to
the left. Finally, all binaries are added, and the total sum is the result. The sign of the
product(result) is determined from the signs of multiplicand and Multiplier. If they are alike, the
final product sign is positive. If they are unlike, the sign of the product is negative.
Recommended Topic - Shift Registers in Digital Electronics and what is middleware
Hardware Implementation for Signed-Magnitude Data
Multiplication is implemented in digital computers by changing the process slightly. First,
instead of providing registers to store bits and binary numbers simultaneously, it is better to give
an adder for the sum of only two binary numbers and then successively accumulate the partial
product. In the second step, instead of shifting the multiplicand to the left, shift the partial
product to the right. In the third step, the corresponding bit of the Multiplier is zero(0); there is
no need to add zeros to the partial product since it will not change the value.
Division Algorithm
Division to two fixed-point binary numbers in signed-magnitude representation is done by the
process of successive compare, shift, and subtract operations. The binary division is simpler than
decimal because the quotient is either 0 or 1. There is no need to calculate how many times the
dividend or partial remainder fires into the divisor. You can follow the following steps for binary
division.
Step 1: Compare the divisor with the dividend; if the divisor is greater, place 0 as the quotient,
then bring down the second bit of the dividend. If the divisor is smaller, multiply it by one, and
the result must be subtracted. Then, subtract the result from the above to get the remainder.
Step 2: Bring down the next number bit from the dividend and perform step1.
Step 3: Repeat the whole process until the remainder becomes 0, or the whole dividend is
divided.
Hardware Implementation for Signed-Magnitude Data
When the division is implemented in a digital system, it is easy to alter the process little. Instead
of shifting the divisor to the right, the partial remainder or dividend is shifted left, thus leaving
the two numbers in the required relative position. After that, subtraction can be achieved by
adding A to the 2's complement of B. The hardware implementation for division is identical to
multiplication and consists of the same components as shown above in the multiplication
hardware implementation.
Divide Overflow
The division operation sometimes results in a quotient with an overflow. It is not a problem
when working with pen and paper, but it is critical to implement the operation with hardware.
This is because the register's length is finite and will not hold a number that exceeds the standard
length.
Design of Control Machines
control machines refer to systems that regulate, monitor, and automate processes using
computational models. These machines are fundamental to various fields, including robotics,
artificial intelligence (AI), cybersecurity, and industrial automation. The design of control
machines involves software algorithms, embedded systems, and real-time decision-making to
ensure that systems operate efficiently, reliably, and autonomously. By integrating control
theory, feedback mechanisms, and machine learning, modern control machines can adapt
dynamically to changing conditions and optimize performance without human intervention.
Control System Design in Computing
A control system is a mechanism that monitors inputs, processes data, and generates outputs to
maintain system stability. Control systems can be implemented in software (e.g., AI-based
decision-making systems) or hardware (e.g., microcontrollers in IoT devices). These systems can
be classified into:
Open-loop control systems, which operate without feedback, executing predefined
commands (e.g., batch processing in an operating system).
Closed-loop control systems, which use feedback to adjust operations dynamically (e.g.,
AI-driven intrusion detection systems).
For instance, in autonomous robotics, a closed-loop control system continuously adjusts motor
speeds and sensor responses based on environmental data, ensuring smooth navigation and
obstacle avoidance.
Feedback Mechanisms in Control Machines
Feedback mechanisms are essential in control machines as they allow self-correction, learning,
and optimization. In computing, feedback is widely used in AI training models, cybersecurity
monitoring, and adaptive system tuning. There are two main types of feedback:
Negative Feedback, which stabilizes a system by counteracting deviations (e.g., an AI
spam filter adjusting its detection threshold based on false positives).
Positive Feedback, which amplifies system behavior, sometimes leading to instability
(e.g., trending content recommendation algorithms reinforcing viral posts).
For example, in machine learning-based fraud detection, a negative feedback loop refines the
model by continuously learning from new fraudulent transaction patterns, reducing false
positives and improving accuracy.
Automation and Control Machines
Automation is a key aspect of control machines, enabling systems to function with minimal
human intervention. In computing, automation is implemented using algorithms, AI, and
machine learning models. Control machines in automation operate under three main principles:
Sequential Control, which follows predefined steps (e.g., CPU scheduling in operating
systems).
Adaptive Control, which modifies operations based on real-time data (e.g., AI-driven
traffic light systems).
Intelligent Control, which leverages AI and neural networks to optimize performance
(e.g., self-learning chatbots in customer service).
An example is cyber-physical systems (CPS), where IoT-enabled devices use AI-powered
control machines to monitor and regulate smart grids, industrial processes, and automated waste
management systems.