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

Unit-1 Notes

Coa

Uploaded by

Rocky
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Unit-1 Notes

Coa

Uploaded by

Rocky
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Unit-1

Register Transfer Language


Reena saini
Assistant Professor, BKBIET-Pilani
Computer Science Dept.
Register Transfer Language
• Digital units are interconnected to form a logical digital system capable
of performing specific information processing task.
• Micro-operation: The operation executed on data stored in registers are
called micro-operation.
• The result od operation may replace the previous information of a
register or may transferred to another register. Eg. Shift, count, load etc.
• The movement of data stored in registers and processing performed on
data is called Register Transfer Operation
Register Transfer Language
• The symbolic notation used to describe the micro-operation transfers
among registers is called a register transfer language.
• The term "register transfer" 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.
• The word "language" is borrowed from programmers, who apply this
term to programming languages.
• A register transfer language is a system for expressing in symbolic form
the micro-operation sequences among the registers of a digital module.
Register Transfer Language

The micro-operation in digital computer are divided into 4 categories:


1. Data Transfer Micro-operation
1.1- Register transfer micro-operation(Register to Register)
1.2- Memory transfer micro-operation(Register to memory & vice-versa)
2. Arithmetic micro-operation (on data stored in register)
3. Logic micro-operation(Logical bit manipulation on data)
4. Shift micro-operation(Shift operation on data)
Register Transfer Notation

• Computer registers are designated by capital letters (sometimes


followed by numerals) to denote the function of the register.
• For example, the register that holds an address for the memory unit is
usually called a memory address register and is designated by the name
MAR.
• Other designations for registers are:
- PC (for program counter),
- IR (for instruction register, and
- R 1 (for processor register).
Representation of register in block diagram
• Information transfer from one register to another is designated in symbolic form by
means of a replacement operator. The statement:

denotes a transfer of the content of register R1 into register R2. It designates a replacement
of the content of R2 by the content of R l . By definition, the content of the source register R1
does not change after the transfer.

Normally, we want the transfer to occur only under a predetermined control condition. This
can be shown by means of an if-then statement.

where P is a control signal generated in the control section..


• A control function is a Boolean variable that is equal to 1 or 0. The control function is
included in the statement as follows:

• The control condition is terminated with a colon. It symbolizes the requirement that the
transfer operation be executed by the hardware only if P = 1 .

• Every statement written in a register transfer notation implies a hardware construction for
implementing the transfer.
Basic Symbols for Register Transfers:
Bus and Memory Transfers
• Bus is a path(a group of wires), over which information is transferred from
any of several source to destination.
• A more efficient scheme for transferring information between registers in a
multiple-register configuration is a common bus system.

• Control signals determine which register is selected by the bus during each
particular register transfer.
• One way of constructing a common bus system is with multiplexers.
• The construction of a bus system for four registers:
- Each register has four bits, numbered 0 through 3.
- The bus consists of four, 4 x 1 multiplexers each having four data inputs, 0
through 3, and
- two selection inputs, S1 and S0•
• The two selection lines S1 and S0 are connected to the selection inputs of all four
multiplexers. The selection lines choose the four bits of one register and transfer them
into the four-line common bus.
• Function table for bus:

• Note: The size of each multiplexer must be k x 1 since it multiplexes k data lines.
• For example, a common bus for eight registers of 16 bits each requires 16
multiplexers, one for each line in the bus.
• Each multiplexer must have eight data input lines and three selection lines to multiplex
one significant bit in the eight registers.
Example
• A digital computer has a common bus system for 16 registers of 32
bits each. The bus is constructed with multiplexers.
a. How many selection inputs are there in each multiplexer?
b. What size of multiplexers are needed?
c. How many multiplexers are there in the bus?

(a) 4 selection lines to select one of 16 registers.


(b) 16 × 1 multiplexers.
(c) 32 multiplexers, one for each bit of the registers.
Three-State Bus Buffers

• A bus system can be constructed with three-state gates instead of multiplexers.


• A three-state gate is a digital circuit that exhibits three states. Two of the states are
signals equivalent to logic 1 and 0 as in a conventional gate.
• The third state is a high-impedance state. The high-impedance state behaves like an
open circuit, which means that the output is disconnected and does not have a logic
significance.
• Graphic symbols for three state buffer:
Bus line with three state-buffers .
Memory Transfer: refers to either transfer of data from a word in memory to some register or
a transfer of data from register to some word in memory.
Word: the memory store binary information in group of bits called words.
Read: The transfer of information from a memory word to the outside environment is called a
read operation.
Write: The transfer of new information to be stored into the memory is called a write operation.

• Consider a memory unit that receives the address from a register, called the address
register, symbolized by AR . The data are transferred to another register, called the data
register, symbolized by DR . The read operation can be stated as follows:

This causes a transfer of information into DR from the memory word M selected by the address in AR.

For write operation: Write: M[AR] ← DR


Arithmetic Micro-operations
• Basic Arithmetic micro-operations are:
Binary Adder
• To implement the add micro-operation with hardware, we need the registers that hold
the data and the digital component that performs the arithmetic addition.
• The digital circuit that forms the arithmetic sum of two bits and a previous carry is
called a full-adder.
• The digital circuit that generates the arithmetic sum of two binary numbers of any
length is called a binary adder.
• The binary adder is constructed with full-adder circuits connected in cascade, with the
output carry from one full-adder connected to the input carry of the next full-adder.
• For example: 4-bit binary adder:
Binary Adder-Subtractor

• The addition and subtraction operations can be combined into one common circuit by
including an exclusive-OR gate with each full-adder.
• A 4-bit adder-subtractor circuit:
• The mode input M controls the operation. When M = 0 the circuit is an adder and when M
= 1 the circuit becomes a subtractor.
• Each exclusive-OR gate receives input M and one of the inputs of B. When M = 0, we have
B 0 = B. The full-adders receive the value of B, the input carry is 0, and the circuit
performs A plus B .
• When M = 1, we have B 1 = B' and C0 = 1. The B inputs are all complemented and a 1
is added through the input carry. The circuit performs the operation A plus the 2's
complement of B.
• For unsigned numbers, this gives A - B if A >= B or the 2's complement of (B - A) if
A < B.
Binary lncrementer

The increment micro-operation adds one to a number in a register. For example, if a 4-bit
register has a binary value 0110, it will go to 0111 after it is incremented
..

Eg. 4-bit binary incrementer:


Arithmetic Circuit

• The arithmetic micro-operations can be implemented in one composite arithmetic circuit.


• The basic component of an arithmetic circuit is the parallel adder. By controlling the
data inputs to the adder, it is possible to obtain different types of arithmetic operations.
• Eg. 4-bit arithmetic circuit:
The output of the binary adder is calculated from the following arithmetic sum:

• where A is the 4-bit binary number at the X inputs and Y is the 4-bit binary number at the
Y inputs of the binary adder. Cin is the input carry, which can be equal to 0 or 1.
• Note that the symbol + in the equation above denotes an arithmetic plus.
• By controlling the value of Y with the two selection inputs S1and S0 and making Cin equal
to 0 or 1, it is possible to generate the eight arithmetic micro-operations
• It has four full-adder circuits that constitute the 4-bit adder and four multiplexers for
choosing different operations.
• There are two 4-bit inputs A and B and a 4-bit output D.
• The four inputs from A go directly to the X inputs of the binary adder.
• Each of the four inputs from B are connected to the data inputs of the multiplexers.
The multiplexers data inputs also receive the complement of B.
• The other two data inputs are connected to logic-0 and logic-1 . Logic-0 i s a fixed
voltage value (0 volts for TTL integrated circuits) and the logic-1 signal can be
generated through an inverter whose input is 0.
• The four multiplexers are controlled by two selection inputs, S1 and S 0.
• The input carry Cin goes to the carry input of the FA in the least significant
position. The other carries are connected from one stage to the next.
Arithmetic Circuit Function Table
Logic Micro-operations

• Logic micro-operations specify binary operations for strings of bits stored in registers.
• These operations consider each bit of the register separately and treat them as binary
variables.
• For example, the exclusive-OR micro-operation with the contents of two registers R 1
and R2 is symbolized by the statement:

It specifies a logic micro-operation to be executed on the individual bits of the registers


provided that the control variable P = 1.
• Special symbols will be adopted for the logic micro-operations OR, AND, and complement,
to distinguish them from the corresponding symbols used to express Boolean functions.
• The symbol ˅ will be used to denote an OR micro-operation and the symbol Ʌ to
denote an AND micro-operation.
• The complement micro-operation is the same as the 1's complement and uses a bar on
top of the symbol that denotes the register name.
• By using different symbols, it will be possible to differentiate between a logic micro-
operation and a control (or Boolean) function.
• Another reason for adopting two sets of symbols is to be able to distinguish the symbol + ,
when used to symbolize an arithmetic plus, from a logic OR operation.
• Although the + symbol has two meanings, it will be possible to distinguish between them
by noting where the symbol occurs.
• When the symbol + occurs in a micro-operation, it will denote an arithmetic plus.
• When it occurs in a control (or Boolean) function, it will denote an OR operation.
• We will never use it to symbolize an OR micro-operation. For example, in the statement:
• the + between P and Q is an OR operation between two binary variables of a control
function.
• The + between R2 and R3 specifies an add micro-operation. The OR micro-operation is
designated by the symbol V between registers R5 and R6.

List of Logic Micro-operations

There are 16 different logic operations that can be performed with two binary variables.
Hardware Implementation

• The hardware implementation of logic micro-operations 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 micro-operations, most computers use only four-AND, OR,
XOR (exclusive-OR), and complement from which all others can be derived.

Eg. One stage of logic circuit

• 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.
Some Applications

• Logic micro-operations 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.
• The following examples show how the bits of one register (designated by A)
are manipulated by logic micro-operations as a function of the bits of
another register (designated by B).
• In a typical application, register A is a processor register and the bits of
register B constitute a logic operand extracted from memory and placed in
register B .
1. selective-set

The selective-set operation sets to 1 the bits in register


A where there are corresponding 1's in register B . It
does not affect bit positions that have 0's in B. The
following numerical example clarifies this operation:

From the truth table we note that the bits of A after the operation are obtained from the logic-
OR operation of bits in B and previous values of A . Therefore, the OR micro-operation can
be used to selectively set bits of a register.
2.selective-complement

• The selective-complement operation complements bits


in A where there are corresponding 1's in B . It does
not affect bit positions that have 0's in B . For
example:
• The exclusive-OR micro-operation can be used to
selectively complement bits of a register.

3. selective-clear
• The selective-clear operation clears to 0 the bits in A
only where there are corresponding 1's in B. For
example:
• One can deduce that the Boolean operation
performed on the individual bits is AB ' . The
corresponding logic micro-operation is:
4. mask operation
• The mask operation is similar to the selective-clear
operation except that the bits of A are cleared only
where there are corresponding 0' s in B.
• The mask operation is an AND micro operation as
seen from the following numerical example:

5. clear operation
• The clear operation compares the words in A and B
and produces an all 0' s result if the two numbers are
equal.
• This operation is achieved by an exclusive-OR micro-
operation as shown by the following example:
6. insert operation
• The insert operation inserts a new value into a group of
bits. This is done by first masking the bits and then OR-ing
them with the required value.
• For example, suppose that an A register contains eight bits,
0110 1010. To replace the four leftmost bits by the value
1001 we first mask the four unwanted bits:

and then insert the new value :

The mask operation is an AND micro-operation and the insert operation is an OR


microoperation.
Shift Micro-operations
• Shift micro-operations are used for serial transfer of data. They are also used
in conjunction with arithmetic, logic, and other data-processing operations.
• The contents of a register can be shifted to the left or the right. At the same
time that the bits are shifted, the first flip-flop receives its binary information
from the serial input.
• During a shift-left operation the serial input transfers a bit into the rightmost
position.
• During a shift-right operation the serial input transfers a bit into the leftmost
position.
• The information transferred through the serial input determines the type of
shift. There are three types of shifts:
- logical shift,
- circular shift, and
- arithmetic shift.
logical shift

• A logical shift is one that transfers 0 through the serial input.


• We will adopt the symbols shl and shr for logical shift-left and shift-right rnicro-operations.
For example:

• are two micro-operations that specify a 1-bit shift to the left of the content of register R 1
and a 1-bit shift to the right of the content of register R2.
• The register symbol must be the same on both sides of the arrow.
• The bit transferred to the end position through the serial input is assumed to be 0 during a
logical shift.
Logical Shift Left

Right Logical Shift

1 0 1 1 0 0 1
Serial i/p = 0
0 1 0 1 1 0 0
circular shift
• The circular shift (also known as a rotate operation) circulates the bits of the register
around the two ends without loss of information.
• This is accomplished by connecting the serial output of the shift register to its serial input.
• We will use the symbols cil and cir for the circular shift left and right, respectively
.

Left Circular Shift


Right Circular Shift
arithmetic shift

• An arithmetic shift is a micro-operation that shifts a signed binary number to the left or
right.
• An arithmetic shift-left multiplies a signed binary number by 2. An arithmetic shift-right
divides the number by 2.
• 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.
• The leftmost bit in a register holds the sign bit, and the remaining bits hold the number.
• The sign bit is 0 for positive and 1 for negative. Negative numbers are in 2's complement
form.

typical register o f n bits


• Bit R n-1 in the leftmost position holds the sign bit. R n-2 is the most significant bit of the
number and R0 is the least significant bit.
• The arithmetic shift-right leaves the sign bit unchanged and shifts the number
(including the sign bit) to the right. Thus R n-1 remains the same, R n-2 receives the bit
from R n-1 and so on for the other bits in the register. The bit in R0 is lost.

• The arithmetic shift-left inserts a 0 into R0 and shifts all other bits to the left. The
initial bit of R n-1 is lost and replaced by the bit from R n-2 •
• A sign reversal occurs if the bit in R n-1 changes in value after the shift.
• This happens if the multiplication by 2 causes an overflow. An overflow occurs after an
arithmetic shift left if initially, before the shift, R n-1 is not equal to R n- 2•
• An overflow flip-flop Vs can be used to detect an arithmetic shift-left overflow.

If Vs = 0, there is no overflow, but if Vs = I, there is an overflow and a sign reversal after the
shift. Vs must be transferred into the overflow flip-flop with the same clock pulse that shifts the
register.
Left Arithmetic Shift

1 0 1 1 0 0 1
Serial I/p=0
0 1 1 0 0 1 0

Right Arithmetic Shift

Sign bit

1 0 1 1 0 0 1
1 1 0 1 1 0 0
Hardware Implementation

• In a processor unit with many registers it is more efficient to implement the shift operation
with a combinational circuit.
• In this way the content of a register that has to be shifted is first placed onto a common
bus whose output is connected to the combinational shifter, and the shifted number is then
loaded back into the register.
• This requires only one clock pulse for loading the shifted value into the register.

A combinational circuit shifter can be constructed with multiplexers.

Eg. A 4-bit combinational circuit shifter:


• The 4-bit shifter has four data inputs, A0 through A3 and four data outputs,
H0 through H3•
• There are two serial inputs, one for shift left (IL) and the other for shift right
(IR).
• When the selection input S = 0, the input data are shifted right (down in the
diagram).
• When S = 1, the input data are shifted left (up in the diagram).
• The function table shows which input goes to each output after the shift. A
shifter with n data inputs and outputs requires n multiplexers.
• The two serial inputs can be controlled by another multiplexer to provide the
three possible types of shifts.
Arithmetic Logic Shift Unit

• Instead of having individual registers performing the micro-operations


directly, computer systems employ a number of storage registers
connected to a common operational unit called an arithmetic logic unit,
abbreviated ALU.
• The arithmetic, logic and shift circuits can be combined into one ALU with
common selection variables. This unit called arithmetic logic shift unit.
• Eg. One stage arithmetic logic shift unit:
Function Table for Arithmetic Logic Shift Unit
• The subscript i designates a typical stage. Inputs Ai and Bi are applied to
both the arithmetic and logic units. A particular micro-operation is selected
with inputs S1 and S2•
• A 4 x 1 multiplexer at the output chooses between an arithmetic output in Di
and a logic output in Ei.
• 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 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.
• This circuit preform 14 micro-operations (8 arithmetic, 4 logic and 2 shift).

You might also like