0% found this document useful (0 votes)
24 views

Unit 3 Micro Operations

Wanna study this course in us
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Unit 3 Micro Operations

Wanna study this course in us
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

@DC

Unit 3: Micro operations (3 Hrs.)


Micro operations:
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.

A micro-operation is an elementary operation performed on the information stored in one or


more registers.
Example: Shift, count, clear and load.
The micro-operations in digital computers are of 4 types:
1. Register transfer micro-operations:
Transfer binary information from one register to another.
2. Arithmetic micro-operations:
Perform arithmetic operations on numeric data stored in registers.
3. Logic micro-operations:

Unit 3: 1
@DC

Perform bit manipulation operation on non-numeric data stored in registers.


4. Shift micro-operations:
They are used to perform shift operations in data store in registers.

Register transfer Micro operations


A Register is a group of flip-flops with each flip-flop capable of storing one bit of information.
An n-bit register has a group of n flip-flops and is capable of storing binary information of n-bits.
Information transferred from one register to another is designated in symbolic form by means
of replacement operator.
R2 ← R1
It denotes the transfer of the data from register R1 into R2.

Arithmetic Micro operations


In general, the Arithmetic Micro-operations deals with the operations performed on numeric data
stored in the registers.

The basic Arithmetic Micro-operations are classified in the following categories:

1. Addition
2. Subtraction
3. Increment
4. Decrement
5. Shift

Some additional Arithmetic Micro-operations are classified as:

6. Add with carry


7. Subtract with borrow
8. Transfer/Load, etc.

The following table shows the symbolic representation of various Arithmetic Micro-operations.

Micro- Symbolic Description


operation Representation
Add R3 ← R1 + R2 The contents of R1 plus R2 are transferred to R3.
Microoperation
Subtract R3 ← R1 - R2 The contents of R1 minus R2 are transferred to R3.
Microoperation
R2 ← R2' Complement the contents of R2 (1's complement)
R2 ← R2' + 1 2's complement the contents of R2 (negate)
R3 ← R1 + R2' + 1 R1 plus the 2's complement of R2 (subtraction)
R1 ← R1 + 1 Increment the contents of R1 by one

Unit 3: 2
@DC

Increment/ R1 ← R1 - 1 Decrement the contents of R1 by one


Decrement
Micro-
operation

 The increment and decrement micro-operations are symbolized by '+ 1' and '- 1'
respectively.
 Arithmetic operations like multiply and divide are not included in the basic set of micro-
operations.

Logic Microoperations
These are binary micro-operations performed on the bits stored in the registers. These
operations consider each bit separately and treat them as binary variables. These are useful for
bit manipulations on binary data and also useful for making logical decisions based on the bit
value.
Logic micro-operations can be used to change bit values, delete a group of bits, insert new bit
values into a register. There are different logic functions that can be defined over two binary
input variables. However, most systems only implement four of these:
AND (^), OR (∨), XOR (⊕), Complement (NOT)
For example, the exclusive-OR microoperation with the contents of two registers R 1 and R2 is symbolized by
the statement P: R1 ← R1 ⊕ R2

 It specifies a logic microoperation to be executed on the individual bits of the registers provided that
the control variable P = 1. As a numerical example, assume that each register has four bits. Let the
content of R1 be 1010 and the content of R2 be 1100.
 The exclusive-OR microoperation stated above symbolizes the following logic computation:

XOR Truth Table

List of Logic Microoperations


There are 16 different logic operations that can be performed with two binary
variables. They can be determined from all possible truth tables obtained with
Unit 3: 3
@DC

two binary variables as shown in Table below. In this table, each of the 16
columns F0 through F15 represents a truth table of one possible Boolean function
for the two variables x and y.

 The functions are determined from the 16 binary combinations that can be
assigned to F. The 16 Boolean functions of two variables x and y are
expressed in algebraic form in the first column of Table below.
 The 16 logic microoperations are derived from these functions by replacing
variable x by the binary content of register A and variable y by the binary
content of register B.
 It is important to realize that the Boolean functions listed in the first
column of Table below represent a relationship between two binary
variables x and y.

Unit 3: 4
@DC

Hardware Implementation of logic microoperation:


 The hardware implementation of logic microoperations requires that logic gates be inserted for
each bit or pair of bits in the registers to perform the required logic function.
 Although there are 16 logic microoperations, most computers use only four-AND, OR, XOR
(exclusive-OR), and complement from which all others can be derived.
 Figure below shows one stage of a circuit that generates the four basic logic microoperations .
 It consists of four gates and a multiplexer. Each of the four logic operations is generated through a
gate that performs the required logic.
 The outputs of the gates are applied to the data inputs of the multiplexer. The two selection inputs
S1 and S0 choose one of the data inputs of the multiplexer and direct its value to the output.
 The diagram shows one typical stage with subscript i. For a logic circuit with n bits, the diagram
must be repeated n times for i = 0, 1, 2, ... , n - 1
 The selection variables are applied to all stages. The function table in Fig. below lists the logic
microoperations obtained for each combination of the selection variables.

Unit 3: 5
@DC

 Logic microoperations are very useful for manipulating individual bits or a portion of a word stored
in a register.
 They can be used to change bit values, delete a group of bits, or insert new bit values into a register.

Shift Microoperations
These are used for serial transfer of data. That means we can shift the contents of the register
to the left or right. In the shift left operation the serial input transfers a bit to the right most
position and in shift right operation the serial input transfers a bit to the left most position.
There are 3 types of shift micro operations.
What differentiates them is the information that goes into the serial input:
1. Logical shift
2. Circular shift
3. Arithmetic shift

1. Logical Shift:
Logical shift is one that transfers 0 through the serial input. The logical shift can be of two types:

Unit 3: 6
@DC

Symbol Microoperation
shl logical shift-left
shr Logical shift-right
For example:
R1 ← shl R1
R1 ← shr R1
* The register symbol must be same on both sides of arrows

2. Circular shift
The circular shift rotates of the register around the two ends without loss of information.
This is accomplished by connecting the two ends of the shift register to each other. "cil" and
"cir" is used for circular shift left and right respectively.

Cil: Circular shift left


Cir: circular shift right
Example:

R2← cir R2

R3← cil R3

3. Arithmetic Shift:
Arithmetic shift is a micro-operation that shifts a signed binary number to the left or right.
Arithmetic shift must leave sign bit unchanged.
The arithmetic shift right is considered divide by 2 and left shift is considered multiply by 2.

Unit 3: 7
@DC

 ashl for an arithmetic shift left


 ashr for an arithmetic shift right
For Example:
R2 ← ashr R2
R3← ashl R3

Arithmetic Logic Shift Unit


Instead of having individual registers performing micro-operations directly, computer systems
employ a number of storage registers connected to a unit called Arithmetic Logic Unit (ALU).
ALU is the main and one of the most important unit inside CPU of computer. All the logical and
mathematical operations of computer are performed here. The contents of specific register is
placed in the input of ALU. ALU performs the given operation and then transfer it to the
destination register.

This unit has 2 operands input ports and one output port and a number of select lines to help in
selecting different operations. The ALU is made of combinational circuit so that the entire
register transfer operation from the sources to the destination is performed in one clock cycle.
The arithmetic, logic, and shift circuits known previously will be combined in one ALU with
common selection inputs.
Unit 3: 8
@DC

 To perform a microoperation, the contents of specified registers are placed in the


inputs of the common ALU.
 The ALU performs an operation and the result of the operation is then transferred to a
destination register.
 The ALU is a combinational circuit so that the entire register transfer operation from
the source registers through the ALU and into the destination register can be performed
during one clock pulse period.
 The shift microoperations are often performed in a separate unit, but sometimes the
shift unit is made part of the ALU.
 The arithmetic, logic, and shift circuits introduced in previous sections can be combined
into one ALU with common selection variables.
 One stage of an arithmetic logic shift unit is shown in Fig. below. The subscript i
designates a typical stage.
 Inputs Ai and Bi are applied to both the arithmetic and logic units.

Unit 3: 9
@DC

 A particular microoperation is selected with inputs S1 and S0. A 4 x 1 multiplexer at the


output chooses between an arithmetic output in Ei and a logic output in Hi.
 The data in the multiplexer are selected with inputs S3 and S2.
 The other two data inputs to the multiplexer receive inputs Ai-1 for the shift-right
operation and Ai+1 for the shift-left operation. Note that the diagram shows just one
typical stage.
 The circuit of Fig. below must be repeated n times for an n-bit ALU. The output carry
Ci+1 of a given arithmetic stage must be connected to the input carry Ci of the next
stage in sequence. The input carry to the first stage is the input carry Cin which provides
a selection variable for the arithmetic operations.
 The circuit whose one stage is specified in Fig. above provides eight arithmetic
operation, four logic operations, and two shift operations.
 Each operation is selected with the five variables S3, S2, S1, S0, and Cin.
 The input carry Cin is used for selecting an arithmetic operation only.
 Table below lists the 14 operations of the ALU.
 The first eight are arithmetic operations and are selected with S3S2 = 00. The next four
are logic operations and are selected with S3S2 = 01. The input carry has no effect
during the logic operations and is marked with don't-care x's.
 The last two operations are shift operations and are selected with S3S2 = 10 and 11.
The other three selection inputs have no effect on the shift.

Unit 3: 10
@DC

- End of Unit 3 -

Unit 3: 11

You might also like