Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift...

20
Computer Organization Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 1 UNIT-II Micro operation: A micro operation is an elementary operation performed on the information stored in one (or) more registers. (OR) The operations executed on data stored in registers are called “micro operation”. Ex: Shift, count, clear and load. Register transfer language: The symbolic notation used to describe the micro operation transfers among registers is called a “register transfer language”. Register transfer: It implies the availability of hardware logic circuits that can perform a stated micro operation and transfer the result of the operation to the same (or) another register. Register transfer language: It is a system for expressing in symbolic form the micro operation sequences among the register of a digital module. Ex: (register transfer

Transcript of Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift...

Page 1: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 1

UNIT-II

Micro operation: A micro operation is an elementary

operation performed on the information stored in one (or)

more registers.

(OR)

The operations executed on data stored in registers are

called “micro operation”.

Ex: Shift, count, clear and load.

Register transfer language: The symbolic notation used to

describe the micro operation transfers among registers is

called a “register transfer language”.

Register transfer: It implies the availability of hardware

logic circuits that can perform a stated micro operation and

transfer the result of the operation to the same (or) another

register.

Register transfer language: It is a system for expressing in

symbolic form the micro operation sequences among the

register of a digital module.

Ex: (register transfer

Page 2: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 2

The various computer registers are designated by capital

letters.

MAR

PC

IR

RI (processor register)

Register transfer: Information transfer from one register to

another is designated in symbolic form by means of a

replacement operator.

The statement

Content of register R1 into register R2.

The content of the source register R1 does not change after

the transfer.

Page 3: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 3

Every statement written in a register transfer notation implies

a hardware construction for implementing the transfer.

Symbol Description Examples

Letters (and numerals) Denotes a register MAR,R2

Parentheses Denotes a part of a register R2(0-7),R2(L)

Arrow Denotes transfer of information R2 ←R1

Comma , Separates two micro operations R2 ←R1,R1←R2

During one common clock pulse, the contents of two

registers get exchanged provided T=1.

Memory transfer:

Read operation: The transfer of information from a memory

word to the outside environment is called a “read operation”.

Write operation: The transfer of new information to be stored

into a memory is called a “write operation”.

Page 4: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 4

The read operation can be stated as

Read: DR ← M [AR]

M: memory word

AR: address in AR

The write operation can be stated as

Write: M [AR] ←R1

The internal organizations of a digital system is defined by

the sequence of micro operations it performs on data stored

in its registers.

The computer is a capable of executing various micro

operations .

Instruction code:

It is a group of bits that instruct the computer to perform a

specific operation.

Operation code (opcode): It is a group of bits that define

such operations as add, subtract, multiply, shift

&complement.

Page 5: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 5

The basic part of an instruction code is its operation part.

The operation code of an instruction depends on the total

number of operations available in the computer.

If there are 2n distinct operations, the opcode must consist of

at least n bits.

What is the difference between computer operation and a

micro operation?

An operation is part of an instruction stored in computer

memory .It is a binary code that tells the computer to

perform a specific operations.

For Ex: The opcode for ADD operation is 110010(6

bits).when this opcode is decoded in the control unit, the

computer issues control unit, the computer issues control

signals to read an operand from memory and add the

operand to a processor register.

For every operation code, the control issues a sequence of

micro operations needed for the hardware information of the

specified operation.

Page 6: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 6

Stored program organization:

Memory unit capacity 4096 words

210 x 22= 212

1024 x 4=4096

We need 12 bits to specify the memory address.

In memory unit, each location can be used to store a 16 bit

memory word.

Page 7: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 7

Stored program concept:

Data & instructions are available in the same memory.

We have 4 bits to specify the opcode and 12 bits to specify

address of an operand.

The control reads a 16 bit instruction from the program

portion of memory. It uses the 12 bits address part of the

instruction to read a 16 bit operand from the data portion of

memory. It then executes the operation specified by the

operation code.

The operation is performed with the memory operand and

the content of AC.

Computer registers:

Page 8: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 8

Two registers are used for input and output. The input

register (INPR) receives an 8 bit character from an input

device. The output register (OUTR) holds an 8 bit character

for an output device.

Basic computer registers & memory:

Page 9: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 9

Computer instructions:

The basic computer has three instruction code formats.

Each format has 16 bits.

Instruction code formats:

a)Memory-reference instruction:

It uses 12 bits to specify an address of memory and one

bit to specify the addressing mode I. I=0 for direct

address, I=1 for indirect address.

b) Register-reference instruction:

They are recognized by the opcode 111 with a 0 in the

left most bit of the instruction. A register reference

instruction specifies an operation on (or) a test of the AC

register.

Page 10: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 10

c) Input & output instructions:

Transfer data among processor registers & input

(or)output terminals.

d) Push & pop instructions:

Transfer data between processor registers & a memory

stack.

Ex: P: R2 ← R1

‘P’ is a control signal generated in the control section.

Every statement written in a register transfer notation

implies a hardware construction for implementing the

transfer.

Transfer from R1 to R2 when P=1 :

Ex: T: R2←R1, R2←R1

If T=1 , then the exchange takes place.

Page 11: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 11

The micro operations used in digital computers are

classified into 4 categories.

1. Register transfer micro operations

2. Arithmetic micro operations

3. Logic micro operations

4. Shift micro operations

Arithmetic micro operation:

Addition, subtraction, increment, decrement.

R3 ← R1+R2

Page 12: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 12

Arithmetic shift:

It is a micro operation that shifts a signed binary number to the

left (or) right.

“An arithmetic shift-left multiplies a signed binary no. by 2”.

“An arithmetic shift-right divides a signed binary no. by 2”.

Arithmetic shift-right:

The arithmetic shift-right leaves the sign bit unchanged and

shifts the number to the right including the sign bit. Thus Rn-1

remains the same, Rn-2 receives the bit from Rn-1, the bit in R0 is

lost.

Arithmetic shift-left:

It inserts a 0 into R0 and shifts all other bits to the left. The

initial bit of Rn-1 is lost and replaced by the bit Rn-2.

The overflow occurs after an arithmetic shift left

Page 13: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 13

Where Vs is overflow flip-flop. If Vs=0,there is no overflow, but

if Vs=1,there is an overflow and a sign reversal occurs after the

shift.

Logical & bit manipulation instruction:

Shift instructions:

NAME MNEMONIC

logical shift-right SHR

logical shift-left SHL

arithmetic shift-right SHRA

arithmetic shift-left SHLA

Rotate right ROR

Rotate left ROL

Rotate right through carry RORC

Rotate left through carry ROLC

NAME MNEMONIC

clear CLR

complement COM

AND AND

OR OR

Exclusive-OR XOR

clear carry CLRC

set carry SETC

complement carry COMC

Enable Interrupt ET

Disable Interrupt DT

Page 14: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 14

Logic micro operation:

Page 15: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 15

Shift micro operations:

Logic shift: R1←shl R1

R2←shr R2

Circular shift:

It is also known as rotate operation. Circulates the bits of the

register around the two ends W/O loss of information.

Arithmetic shift:

It shifts a signed binary no. to the left (or) right.

Page 16: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 16

Functional table for Arithmetic logic shift unit:

Page 17: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 17

One stage of arithmetic logic shirt unit:

Page 18: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 18

4 bit arithmetic circuit:

Page 19: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 19

Arithmetic circuit function table:

One stage of logic circuit:

Logic micro operations are very useful for manipulating

individual bits (or) a portion of a word stored in a register.

Page 20: Ex: Shift, count, clear and load. - WordPress.com · Logical & bit manipulation instruction: Shift ... arithmetic shift-left SHLA Rotate right ROR Rotate left ROL ... Functional table

Computer Organization

Gokaraju Rangaraju Institute of Engineering & Technology (griet) Page | 20

4 bit combinational circuit shifter: