Sie sind auf Seite 1von 12

Amity School of Engineering & Technology

Amity School of Engineering & Technology


B. Tech. (CSE), V Semester
Computer Architecture Jitendra Rajpurohit

Amity School of Engineering & Technology

Shift Microoperations

Amity School of Engineering & Technology

Introduction
Shift microoperations are used for serial transfer of data. There are three types of shifts: logical, circular, and arithmetic. o A logical shift is one that transfers 0 through the serial input. e.g., R1 shl R1, R2 shr R2 o The register symbol must be the same on both sides of the arrow. The circular shift (rotate operation) circulates the bits of the register around the two ends without loss of information. e.g., cil, cir The symbolic notation for the shift microoperations is shown in Table

Amity School of Engineering & Technology

Shift Microoperations
Symbolic designation R shl R R shr R R cil R R cir R R ashl R R ashrR Description Shift-left register R Shift-right register R Circular shift-left register R Circular shift-right register R Arithmetic shift-left R Arithmetic shift-right R

Amity School of Engineering & Technology

Arithmetic Shift
An arithmetic shift is a microoperation that shifts a signed binary number to the left or right. Arithmetic shifts must leave the sign bit unchanged because the sign of the number remains the same when it is multiplied or divided by 2. Figure shows a typical register of n bits.
o o o

Arithmetic shift right Arithmetic shift left, an overflow flip-flop Vs is used Vs = (Rn-1) XOR (Rn-2

If Vs=0, there is no overflow If Vs=1, there is an overflow and a sign reversal after the shift.

Amity School of Engineering & Technology

Arithmetic shift right and left

Arithmetic shift right:

Rn-1

Rn-2

R1

R0

Arithmetic shift left:

Rn-1

Rn-2

R1

R0

Amity School of Engineering & Technology

Hardware Implementation
A possible choice for a shift unit would be a bidirectional shift register with parallel load.
o

Two clock pulses are needed to initiate the shift.

It is more efficient to implement the shift operation with a combinational circuit.


o

This requires only one clock pulse for loading the shifted value into the register.

A combinational circuit shift can be constructed with multiplexers as shown in the figure next. The function table shows which input goes to each output after the shift.

Amity School of Engineering & Technology

4-bit combinational circuit shift


Select 1 for shift left (up)
Serial Input (IR) S 0 1 0 for shift right (down)

MUX

H0 Function table

A0 A1 A2

S 0 1 S 0 1 S 0 1

MUX

H1

Select S 0 H0 IR H1 A0

Output

H2 A1

H3 A2

A3

MUX

H2

A1

A2

A3

IL

MUX

H3

Serial Input (IL)

Amity School of Engineering & Technology

Arithmetic Logic Shift Unit

Amity School of Engineering & Technology

Introduction
Computer systems employ a number of storage registers connected to a common operational unit called an arithmetic logic unit, abbreviated ALU. 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. One stage of an arithmetic logic shift unit is shown in the figure. Table lists the 14 operations of the ALU.

Amity School of Engineering & Technology

One stage of arithmetic logic shift unit


S3 S2
S1 S0
One stage of Arithmetic circuit

Ci

Di
Select

Ci+1

0 1 2 3

Fi

BI Ai Ai-1 Ai+1

One stage of logic circuit

Ei shr

shl

Amity School of Engineering & Technology

Function table for arithmetic logic shift unit

Das könnte Ihnen auch gefallen