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

Chapter Three RTL

Uploaded by

shewakass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Chapter Three RTL

Uploaded by

shewakass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Chapter Three:

Register Transfer and Microoperations


Contents to be covered
• Register Transfer Language
• Register Transfer
• Bus and Memory Transfers
• Arithmetic Microoperations
• Logic Microoperations
• Shift Microoperations
3-1 Register Transfer Language (RTL)
• Simple digital Systems are an interconnection of
hardware modules that do a certain task on the
information.
• The modules are constructed from such digital
components as registers, decoders, arithmetic
elements and control logic
• Modules are interconnected with common data and
control paths to form a digital computer system
3-1 Register Transfer Language cont.
• Microoperations: operations executed on data stored in one
or more registers.
• The result of the operation may be:
– replace the previous binary information of a register or
– transferred to another register
Shift Right Operation
101101110011 010110111001

– Computer system micro-operations are of four types:


– Register transfer micro-operations
– Arithmetic micro-operations
– Logic micro-operations
– Shift micro-operations
3-1 Register Transfer Language cont.
• The internal hardware organization of a digital computer is
defined by specifying:
• The set of registers it contains and their function
• The sequence of microoperations performed on the
binary information stored in the registers
• The control that initiates the sequence of
microoperations

• Register Transfer Language (RTL) : a symbolic


notation to describe the microoperation transfers
among registers
3-2 Register Transfer (our first microoperation)
• Computer registers are designated by capital letters
(sometimes followed by numerals) to denote the
function of the register
• R1: processor register
• MAR: Memory Address Register (holds an address for
a memory unit)
• PC: Program Counter
• IR: Instruction Register
• SR: Status Register
3-2 Register Transfer cont.
• The individual flip-flops in an n-bit register are
numbered in sequence from 0 to n-1 (from the right
position toward the left position)

R1 7 6 5 4 3 2 1 0

Register R1 Showing individual bits

A block diagram of a register


3-2 Register Transfer cont.
Other ways of drawing the block diagram of a register:

15 0
PC

Numbering of bits

15 87 0
Upper byte PC(H) PC(L) Lower byte

Partitioned into two parts


3-2 Register Transfer cont.
• Information transfer from one register to another is described by
a replacement operator: R2 ← R1
• This statement denotes a transfer of the content of register R1
into register R2
• The transfer happens in one clock cycle
• The content of the R1 (source) does not change
• The content of the R2 (destination) will be lost and replaced
by the new data transferred from R1
• We are assuming that the circuits are available from the outputs
of the source register to the inputs of the destination register, and
that the destination register has a parallel load capability
3-2 Register Transfer cont.
• Conditional transfer occurs only under a control
condition
If(p=1) then (R2 ← R1)
• Representation of a (conditional) transfer
P: R2 ← R1
• A binary condition (P equals to 0 or 1)
determines when the transfer occurs
• The content of R1 is transferred into R2 only if P
is 1
3-2 Register Transfer cont.
Basic Symbols for Register Transfers
Symbol Description Examples
Letters & Denotes a register MAR, R2
numerals
Parenthesis ( ) Denotes a part of a R2(0-7), R2(L)
register
Arrow ← Denotes transfer of R2 ← R1
information
Comma , Separates two R2 ← R1, R1 ← R2
microoperations
3-3 Bus and Memory Transfers
• Paths must be provided to transfer information from
one register to another
• A Common Bus System is a scheme for transferring
information between registers in a multiple-register
configuration
• A bus: set of common lines, one for each bit of a
register, through which binary information is
transferred one at a time
• Control signals determine which register is selected by
the bus during each particular register transfer
3-3 Bus and Memory Transfers
3-3 Bus and Memory Transfers
• The selection lines choose the four bits of one
register and transfer them in to the four line
common bus.
3-3 Bus and Memory Transfers
• The transfer of information from a bus into one
of many destination registers is done:
– By connecting the bus lines to the inputs of all
destination registers and then:
– activating the load control of the particular destination
register selected
• We write: R2 ← C to symbolize that the content
of register C is loaded into the register R2 using
the common system bus
• It is equivalent to: BUS ←C, (select C)
R2 ←BUS (Load R2)
3-3 Bus and Memory Transfers:
• A memory unit is a collection of storage cells together with
associated circuits needed to transfer information in and out
of storage.
• The memory stores binary information in groups of bits
called words
• Data being read or wrote is called a memory word (called
M)
• It is necessary to specify the address of M when writing
/reading memory
• This is done by enclosing the address in square brackets
following the letter M
• Example: M[0016] : the memory contents at address 0016
3-3 Bus and Memory Transfers:
• The transfer of information from a memory word to
the outside environment is called a read operation.
• Memory read : Transfer from memory
• The transfer of new information to be stored into the
memory is called a write operation.
• Memory write : Transfer to memory
• Assume that the address of a memory unit is stored in
a register called the Address Register AR
• Lets represent a Data Register with DR, then:
• Read: DR ← M[AR]
• Write: M[AR] ← DR
3-3 Bus and Memory Transfers:

AR
x0C 19
x12 x0E 34
R1 x10 45
100 x12 66
x14 0
x16 13
R1←M[AR] x18 22

RAM

R1 R1
100 66
3-4 Arithmetic Microoperations
• The microoperations most often encountered in digital
computers are classified into four categories:
– Register transfer microoperations
– Arithmetic microoperations (on numeric data stored in
the registers)
– Logic microoperations (bit manipulations on non-
numeric data)
– Shift microoperations
3-4 Arithmetic Microoperations cont.
• The basic arithmetic microoperations are: addition,
subtraction, increment, decrement, and shift
• The following table shows the arithmetic microoperation
3-4 Arithmetic Microoperations Binary
Adder

B3 A3 B2 A2 B1 A1 B0 A0

C3 C2 C1
FA FA FA FA C0

C4 S3 S2 S1 S0

4-bit binary adder


(connection of FAs)
3-4 Arithmetic Microoperations Binary
Adder-Subtractor
B3 A3 B2 A2 B1 A1 B0 A0

C3 C2 C1 C0
FA FA FA FA

C4 S3 S2 S1 S0

4-bit adder-subtractor
3-4 Arithmetic Microoperations Binary
Adder-Subtractor
• The mode input M controls the operation
• When M=0, the circuit is an adder and
B 0=B and the input carry is 0, then A+B
• When M=1, the circuit becomes subtractor
B 1=B’ and the input carry is 1, then A plus
2’complement of B
The subtraction A-B can be carried out by the following steps
• Take the 1 ’ complement of B
• Get the 2 ’ complement by adding 1
• Add the result to A
3-4 Arithmetic Microoperations Binary
Incrementer
A3 A2 A1 A0 1

x y x y x y x y

HA HA HA HA

C S C S C S C S

C4 S3 S2 S1 S0

4-bit Binary Incrementer


3-4 Arithmetic Microoperations Binary
Incrementer
• Binary Incrementer can also be
implemented using a counter
• A binary decrementer can be implemented
by adding 1111 to the desired register
each time!
 3-5 Logic Microoperations
 Manipulating the bits stored in a register (bit by bit)
 The four basic logic microoperations
3-5 Logic Microoperations
The four basic microoperations
OR Microoperation
• Symbol: , +

• Gate:

• Example: 1001102  10101102 = 11101102


OR OR

P+Q: R1←R2+R3, R4←R5 R6


ADD
3-5 Logic Microoperations
The four basic microoperations cont.
AND Microoperation
• Symbol: 

• Gate:

• Example: 1001102  10101102 = 00001102


3-5 Logic Microoperations
The four basic microoperations cont.
Complement (NOT) Microoperation
• Symbol:

• Gate:

• Example: 10101102 = 01010012


3-5 Logic Microoperations
The four basic microoperations cont.
XOR (Exclusive-OR) Microoperation
• Symbol: 

• Gate:

• Example: 1001102  10101102 =


11100002
3-5 Logic Microoperations
Other Logic Microoperations
Selective-set Operation
• Used to force selected bits of a register
into logic-1 by using the OR operation

• Example: 01002  10002 = 11002


Loaded into a register from
In a processor register
memory to perform the
selective-set operation
3-5 Logic Microoperations
Other Logic Microoperations cont.
Selective-complement (toggling) Operation
• Used to force selected bits of a register to be
complemented by using the XOR operation

• Example: 00012  10002 = 10012

Loaded into a register from


In a processor register
memory to perform the
selective-complement operation
3-5 Logic Microoperations
Hardware Implementation
• 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
• Most computers use only four (AND, OR, XOR, and
NOT) from which all others can be derived.
3-5 Logic Microoperations
Hardware Implementation cont.
S1
4×1
S0
MUX S1 S0 Output Operation
Ai
0 0 E=AB XOR
Bi
0
0 1 E=AB OR

1 0 E=AB AND
1 Ei
1 1 E=A Complement

3 This is for one bit i


3-5 Logic Microoperations
• List of logic microoperations
3-6 Shift Microoperations
• Used for serial transfer of data
• Also used in conjunction with arithmetic, logic, and
other data-processing operations
• The contents of the register can be shifted to the left or
to the right
• As being shifted, the first flip-flop receives its binary
information from the serial input
• There are three types of shifts:
• Logical shift,
• Circular shift (rotate operation)
• Arithmetic shift
3-6 Shift Microoperations
• The following table shows shift microoperations
3-6 Shift Microoperations cont.

Serial Input r2 Serial Output


rn-1 r3 r1 r0

Determines Shift Right


the “shift”
type

Serial Output Serial Input


rn-1 r3 r2 r1 r0

Shift Left

**Note that the bit ri is the bit at position (i) of the register
3-6 Shift Microoperations:
Logical Shifts
• A logical Shift transfers 0 through the serial
input (Zero inserted)
• Logical Shift Right: R1←shr R1
The same
• Logical Shift Left: R2←shl R2
The same

? rn-1 r3 r2 r1 r0 0
Logical Shift Left
• Example: use a logical shift left on the bit pattern 10011000.
• Solution: The leftmost bit is lost and a 0 is inserted as the rightmost bit.
3-6 Shift Microoperations:
Circular Shifts (Rotate Operation)
• Circulates the bits of the register around the
two ends without loss of information
• Circular Shift Right: R1←cir R1
The same
• Circular Shift Left: R2←cil R2 The same
rn-1 r3 r2 r1 r0
Circular Shift Left
• Use a Circular Left Shift Operation on the bit pattern 10011000.
• Solution: The leftmost bit is circulated and becomes the rightmost bit.
3-6 Shift Microoperations
Arithmetic Shifts
• Shifts a signed binary number to the left or right
• An arithmetic shift-left multiplies a signed binary
number by 2: ashl (00100): 01000
• An arithmetic shift-right divides the number by 2
ashr (00100) : 00010
• The sign bit is 0 for positive and 1 for negative.

Sign
Bit
3-6 Shift Microoperations
Arithmetic Shifts cont.
• An overflow may occur in arithmetic shift-left, and
occurs when the sign bit is changed (sign reversal)
• An overflow flip-flop Vs can be used to detect an
arithmetic shift-left overflow

Vs = Rn-1  Rn-2

Rn-1 1  overflow
Vs=
Rn-2 0  no overflow
3-6 Shift Microoperations
Arithmetic Shifts
 Arithmetic shift right:
 Rn-1 remains unchanged;
 Rn-2 receives Rn-1, Rn-3 receives Rn-2, so on.
 For a negative number, 1 is shifted from the sign bit to
the right.
 A negative number is represented by the 2’s
complement form. The sign bit remained unchanged.
3-6 Shift Microoperations
Arithmetic Shifts
 Arithmetic Shift Right :
 Example 1
0100 (4)  0010 (2)
 Example 2
1010 (-6)  1101 (-3)
3-6 Shift Microoperations
Arithmetic Shifts
Arithmetic Shift Left :
• The operation is same with Logic shift-left
• transfers 0 through the serial input (Zero inserted)
• The only difference is you need to check overflow
problem
Carry out
Sign bit
R2←ashl R2

LSB

Rn-1 Rn-2 0 insert

Vs=1 : There is an overflow and sign reversal


Vs=0 : There is no overflow
3-6 Shift Microoperations
Arithmetic Shifts
 Arithmetic Shift Left :
 Example 1
0010 (2)  0100 (4)
 Example 2
1110 (-2)  1100 (-4)
 Arithmetic Shift Left :
 Example 3
0100 (4)  1000 (overflow)
 Example 4
1010 (-6)  0100 (overflow)
3-6 Shift Microoperations cont.

• Example: Assume R1=11001110, then:


– Arithmetic shift right once : R1 = 11100111
– Arithmetic shift right twice : R1 = 11110011
– Arithmetic shift left once : R1 = 10011100
– Arithmetic shift left twice : R1 = 00111000
– Logical shift right once : R1 = 01100111
– Logical shift left once : R1 = 10011100
– Circular shift right once : R1 = 01100111
– Circular shift left once : R1 = 10011101

You might also like