Computer Organization and Architecture Unit 1
Computer Organization and Architecture Unit 1
S.
No. Computer Architecture Computer Organization
In the above figure, it’s clear that it In the above figure, it’s also clear that it
3. deals with high-level design issues. deals with low-level design issues.
Operations
Study different classes of CPU registers,
microoperations, and their examples in detail.
A digital computer system connects digital components such as registers, decoders, arithmetic
components, and control logic. To make a comprehensive digital system, these digital modules
are equipped with some common data and control channels.
Furthermore, the registers and the actions performed on the data stored in them best describe
digital modules. Micro-operations are operations that are done on data contained in registers.
The availability of hardware logic circuits that can perform a specified micro-operation and
transfer the outcome of the operation to the same or another register is referred to as register
transfer. The term “language” was coined by programmers to describe programming languages.
This programming language is a method of expressing a computer process through symbols.
Following are some commonly used register transfer example with an example:
1. Accumulator: This is the most commonly used register for storing data read from memory.
2. General-Purpose Registers: These are used to store data on intermediate outcomes during
the execution of a programme. Assembly programming is required to access it.
3. Special Purpose Registers: Users do not have access to the Special Purpose Registers.
These are computer system registers.
MAR: Memory Address Registers are the registers that store the memory unit’s address
MBR: This register stores instructions and data received from and sent from the memory
PC: Program Counter indicates the next command to be executed
IR: Instruction Register stores the to-be-executed instruction
Register Transfer
The replacement operator designates the information moved from one register to another in
symbolic form.
R2 ← R1
In most cases, we want the transfer to happen only under specific control conditions. The
following if-then sentence demonstrates this: If (P=1), (R2 R1)
Micro-Operations
Micro-operations are operations performed on data stored in registers. A micro-operation is a
simple operation that is carried out on data contained in one or more registers.
Types of Micro-Operations
The following are the different types of micro-operations:
1. Micro-operations that move binary data from one register to another are known as register
transfers.
1. Arithmetic Micro-Operations
· Add Micro-Operation
R1 + R2 = R3
The foregoing line tells the computer to add the data or contents of register R1 to the data or
contents of register R2, then transfer the sum to register R3.
· Subtract Micro-Operation
R1 + R2′ + 1 R3
Instead of using the minus operator, we use the complement of 1 and add one to the register
being subtracted.
· Increment/Decrement Micro-Operation
R1 → R1 + 1
R1 → R1 – 1
2. Logic Micro-Operations
These are binary micro-operations carried out on the register bits. These procedures treat each
bit as a binary variable and consider it separately.
Consider the X-OR micro-operation with the contents of R1 and R2 registers.
P: R1 ← R1 X-OR R2
3. Shift micro-operations
These are the important different types of micro-operations. That means we can move the
register’s contents to the left or right. The serial input shifts a bit to the rightmost position in the
shift left operation, and a bit to the leftmost position in the shift right action.
a) Logical Shift
The serial input is used to send 0 to the device. The symbols “shl” and “shr” are used to
represent logical shifts left and right, respectively.
R1 ← shl R1
R1 ← shr R1
b) Circular Shift
This moves the bits of the register around the two ends without losing any data or contents. The
shift register’s serial output is connected to its serial input in this configuration. The terms “cir”
and “cil” stand for left and right circular shifts, respectively.
d) Shift in Arithmetic
A signed binary number is shifted to the left or right using this method. Arithmetic shift left
multiplies and divides a signed binary number by two. Because the signed number remains the
same when multiplied or divided by two, the sign bit is left unaltered by the arithmetic shift micro-
operation.
Conclusion
RTL is a symbolic notation for describing the micro-operations transfer between registers. It’s a
type of intermediate representation (IR) that’s extremely similar to assembly language, such as
the kind used in compilers. The term “Register Transfer” refers to the ability to perform micro-
operations and then transfer the results to the same or another register.
In symbolic notation, it is used to describe the micro-operations transfer among
registers. It is a kind of intermediate representation (IR) that is very close to
assembly language, such as that which is used in a compiler.The term “Register
Transfer” can perform micro-operations and transfer the result of operation to the
same or other register.
Micro-operations :
The operation executed on the data store in registers are called micro-operations.
They are detailed low-level instructions used in some designs to implement
complex machine instructions.
Register Transfer :
The information transformed from one register to another register is represented in
symbolic form by replacement operator is called Register Transfer.
Replacement Operator :
In the statement, R2 <- R1, <- acts as a replacement operator. This statement
defines the transfer of content of register R1 into register R2.
There are various methods of RTL –
3. The numbering of bits in a register can be marked on the top of the box as
shown in (c).
R1(8-bit)
() Denotes a part of register
R1(0-7)
P : R2 <-
: Denotes conditional operations R1
if P=1
Register Transfer
The term Register Transfer refers to the availability of hardware logic circuits that can
perform a given micro-operation and transfer the result of the operation to the same
or another register.
Most of the standard notations used for specifying operations on various registers are
stated below.
1. P: R2 ← R1
The following image shows the block diagram that depicts the transfer of data from
R1 to R2.
Here, the letter 'n' indicates the number of bits for the register. The 'n' outputs of the
register R1 are connected to the 'n' inputs of register R2.
A load input is activated by the control variable 'P' which is transferred to the register
R2.
A bus structure, on the other hand, is more efficient for transferring information
between registers in a multi-register configuration system.
A bus consists of a set of common lines, one for each bit of register, through which
binary information is transferred one at a time. Control signals determine which
register is selected by the bus during a particular register transfer.
The following block diagram shows a Bus system for four registers. It is constructed
with the help of four 4 * 1 Multiplexers each having four data inputs (0 through 3) and
two selection inputs (S1 and S2).
We have used labels to make it more convenient for you to understand the input-
output configuration of a Bus system for four registers. For instance, output 1 of
register A is connected to input 0 of MUX1.
The two selection lines S1 and S2 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.
When both of the select lines are at low logic, i.e. S1S0 = 00, the 0 data inputs of all
four multiplexers are selected and applied to the outputs that forms the bus. This, in
turn, causes the bus lines to receive the content of register A since the outputs of this
register are connected to the 0 data inputs of the multiplexers.
Similarly, when S1S0 = 01, register B is selected, and the bus lines will receive the
content provided by register B.
The following function table shows the register that is selected by the bus for each of
the four possible binary values of the Selection lines.
Note: The number of multiplexers needed to construct the bus is equal to the
number of bits in each register. The size of each multiplexer must be 'k * 1' since it
multiplexes 'k' data lines. For instance, 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.
A bus system can also be constructed using three-state gates instead of multiplexers.
The three state gates can be considered as a digital circuit that has three gates, two
of which are signals equivalent to logic 1 and 0 as in a conventional gate. However,
the third gate exhibits a high-impedance state.
The most commonly used three state gates in case of the bus system is a buffer gate.
o The outputs generated by the four buffers are connected to form a single bus line.
o Only one buffer can be in active state at a given point of time.
o The control inputs to the buffers determine which of the four normal inputs will
communicate with the bus line.
o A 2 * 4 decoder ensures that no more than one control input is active at any given
point of time.
Memory Transfer
Most of the standard notations used for specifying operations on memory transfer are
stated below.
o The transfer of information from a memory unit to the user end is called
a Read operation.
o The transfer of new information to be stored in the memory is called a Write operation.
o A memory word is designated by the letter M.
o We must specify the address of memory word while writing the memory transfer
operations.
o The address register is designated by AR and the data register by DR.
o Thus, a read operation can be stated as:
1. Read: DR ← M [AR]
o The Read statement causes a transfer of information into the data register (DR) from
the memory word (M) selected by the address register (AR).
o And the corresponding write operation can be stated as:
1. Write: M [AR] ← R1
o The Write statement causes a transfer of information from register R1 into the memory
word (M) selected by address register (AR).
We can perform arithmetic operations on the numeric data which is stored inside
the registers.
Example :
R3 <- R1 + R2
The value in register R1 is added to the value in the register R2 and then the sum is
transferred into register R3. Similarly, other arithmetic micro-operations are
performed on the registers.
Addition –
In addition micro-operation, the value in register R1 is added to the value in the
register R2 and then the sum is transferred into register R3.
What are Logic Micro-Operations?
Logic Microoperations are a set of binary operations that are performed on registers
that contain strings of bits. These operations treat each bit of the register separately
and consider them as binary variables. As a result, there are 16 different logic
operations that could be performed. These are-
Before discussing these logic micro-operations, let’s discuss their truth tables.
The below diagram shows the truth table for all the 16 logic micro-operations
mentioned above. Here, x and y are the variables or registers in which the data is
stored and F0, F1, ….., F15 are the outputs that occur after performing these logic
micro-operations.
Subtraction –
In subtraction micro-operation, the contents of register R2 are subtracted from
contents of the register R1, and then the result is transferred into R3.
There is another way of doing the subtraction. In this, 2’s complement of R2 is
added to R1, which is equivalent to R1 – R2, and then the result is transferred into
register R3.
Increment –
In Increment micro-operation, the value inside the R1 register is increased by
1.
Decrement –
In Decrement micro-operation, the value inside the R1 register is decreased by
1.
1’s Complement –
In this micro-operation, the complement of the value inside the register R1 is
taken.
2’s Complement –
In this micro-operation, the complement of the value inside the register R2 is
taken and then 1 is added to the value and then the final result is transferred into
the register R2. This process is also called Negation. It is equivalent to -R2.
Shift micro-operations are those micro-operations that are used for the serial
transfer of information. These are also used in conjunction with arithmetic micro-
operation, logic micro-operation, and other data-processing operations. There are
three types of shift micro-operations: 1.
1. Logical Shift:
It transfers the 0 zero through the serial input. We use the symbols ‘<<‘ for the
logical left shift and ‘>>‘ for the logical right shift.
Logical Left Shift:
In this shift, one position moves each bit to the left one by one. The Empty least
significant bit (LSB) is filled with zero (i.e, the serial input), and the most
significant bit (MSB) is rejected.
The left shift operator is denoted by the double left arrow key (<<). The general
syntax for the left shift is shift-expression << k.
Logical Left Shift
Note: Every time we shift a number towards the left by 1 bit it multiplies that
number by 2.
Logical Right Shift
In this shift, each bit moves to the right one by one and the least significant
bit(LSB) is rejected and the empty MSB is filled with zero.
The right shift operator is denoted by the double right arrow key (>>). The general
syntax for the right shift is “shift-expression >> k”.
Note: Every time we shift a number towards the right by 1 bit it divides that
number by 2.
2. Arithmetic Shift:
The arithmetic shift micro-operation moves the signed binary number either to the
left or to the right position.
Following are the two ways to perform the arithmetic shift.
1. Arithmetic Left Shift
2. Arithmetic Right Shift
Arithmetic Left Shift:
In this shift, each bit is moved to the left one by one. The empty least significant bit
(LSB) is filled with zero and the most significant bit (MSB) is rejected. Same as the
Left Logical Shift.
3. Circular Shift:
The circular shift circulates the bits in the sequence of the register around both
ends without any loss of information.
Following are the two ways to perform the circular shift.
1. Circular Shift Left
2. Circular Shift Right
Circular Left Shift:
In this micro shift operation each bit in the register is shifted to the left one by one.
After shifting, the LSB becomes empty, so the value of the MSB is filled in there.
Arithmetic Logic Shift Unit (ALSU) is a member of the Arithmetic Logic Unit
(ALU) in a computer system. It is a digital circuit that performs logical, arithmetic,
and shift operations. Rather than having individual registers calculating the micro
operations directly, the computer deploys a number of storage registers which is
connected to a common operational unit known as an arithmetic logic unit or
ALU.
Now, to implement the micro operation, the contents of specified registers are
allocated in the inputs of the common Arithmetic Logic Unit. The Arithmetic
Logic Unit performs an operation that leads as a result and gets transferred to a
destination register. Arithmetic Logic Unit may be a combinatory circuit in order
that the complete register transfer operation from the supply registers through the
ALU and into the destination register is performed throughout one clock pulse
amount. Sometimes, the shift micro operations are performed in a separate unit, but
sometimes it is made as a part of full ALU.
We can combine and make one ALU with common selection variables by adding
arithmetic, logic, and shift circuits. We can see the, One stage of an arithmetic
logic shift unit in the diagram above. Some particular micro operations are selected
through the inputs S1 and S0.
4 x 1 multiplexer at the output chooses between associate arithmetic output
between Ei and a logic output in Hi. The data in the multiplexer are selected
through inputs S3 and S2 and the other two data inputs to the multiplexer obtain
the inputs Ai – 1 for the shr operation and Ai + 1 for the shl operation.
Note: The output carry Ci + 1 of a specified arithmetic stage must be attached to
the input carry Ci of the next stage in the sequence.
The circuit whose one stage is given in the below diagram provides 8 arithmetic
operations, 4 logic operations, and 2 shift operations, and Each operation is
selected by the 5 variables S3, S2, S1, S0, and Cin.
The below table shows the 14 operations perform by the Arithmetic Logic Unit:
1. The first 8 are arithmetic operations which are selected by S3 S2 = 00
2. The next 4 are logic operations which are selected by S3 S2 = 01
3. The last two are shift operations which are selected by S3 S2 = 10 & 11
What are Instruction Codes and Operands in Computer Architecture?
Instruction codes are bits that instruct the computer to execute a specific operation.
An instruction comprises groups called fields. These fields include:
An instruction comprises groups called fields. These fields include:
The Operation code (Opcode) field determines the process that needs to be performed.
The Address field contains the operand's location, i.e., register or memory location.
The Mode field specifies how the operand locates.
Instruction Format
Operand(s): The operand(s) represents the data that the operation must be performed
on. This data can take various forms, depending on the processor's architecture. It
might be a register containing a value, a memory address pointing to a location in
memory where the data is stored, or a constant value embedded within the instruction
itself.
Addressing mode: The addressing mode represents how the operand(s) can be
interpreted. It might indicate that the operand is a direct address in memory, an indirect
address (i.e. a memory address stored in a register), or an immediate value (i.e. a
constant embedded within the instruction).
4. Data transfer instructions: These instructions move data between memory and
registers or between registers. For example, the "mov" instruction in the x86 assembly
language moves data from one location to another.
8. Comparison instructions: These instructions compare two operands and set a flag
based on the result. For example, the "cmp" instruction in x86 assembly language
compares two operands and sets a flag indicating whether they are equal, greater than,
or less than.
Computer Registers
Registers are a type of computer memory used to quickly accept, store, and transfer
data and instructions that are being used immediately by the CPU. The registers used
by the CPU are often termed as Processor registers.
A processor register may hold an instruction, a storage address, or any data (such as
bit sequence or individual characters).
The computer needs processor registers for manipulating data and a register for
holding a memory address. The register holding the memory location is used to
calculate the address of the next instruction after the execution of the current
instruction is completed.
Following is the list of some of the most common registers used in a basic
computer:
Accumulator AC 16 Processor
register
The following image shows the register and memory configuration for a basic
computer.
o The Memory unit has a capacity of 4096 words, and each word contains 16 bits.
o The Data Register (DR) contains 16 bits which hold the operand read from the memory
location.
o The Memory Address Register (MAR) contains 12 bits which hold the address for the
memory location.
o The Program Counter (PC) also contains 12 bits which hold the address of the next
instruction to be read from memory after the current instruction is executed.
o The Accumulator (AC) register is a general purpose processing register.
o The instruction read from memory is placed in the Instruction register (IR).
o The Temporary Register (TR) is used for holding the temporary data during the
processing.
o The Input Registers (IR) holds the input characters given by the user.
o The Output Registers (OR) holds the output after processing the input data.
Computer Instructions
Computer instructions are a set of machine language instructions that a particular
processor understands and executes. A computer performs tasks on the basis of the
instruction provided.
o The Operation code (Opcode) field which specifies the operation to be performed.
o The Address field which contains the location of the operand, i.e., register or memory
location.
o The Mode field which specifies how the operand will be located.
The Register-reference instructions are represented by the Opcode 111 with a 0 in the
leftmost bit (bit 15) of the instruction.
Note: The Operation code (Opcode) of an instruction refers to a group of bits that
define arithmetic and logic operations such as add, subtract, multiply, shift, and
compliment.
Input-Output instruction
Just like the Register-reference instruction, an Input-Output instruction does not need
a reference to memory and is recognized by the operation code 111 with a 1 in the
leftmost bit of the instruction. The remaining 12 bits are used to specify the type of
the input-output operation or test performed.
Note
o The three operation code bits in positions 12 through 14 should be equal to 111.
Otherwise, the instruction is a memory-reference type, and the bit in position 15 is
taken as the addressing mode I.
o When the three operation code bits are equal to 111, control unit inspects the bit in
position 15. If the bit is 0, the instruction is a register-reference type. Otherwise, the
instruction is an input-output type having bit 1 at position 15.
A huge amount of binary information is stored in the memory unit, but all
computations are done in processor registers. Therefore, one must possess the
capability of moving information between these two units.
Program control instructions such as branch instructions are used change the
sequence in which the program is executed.
Input and Output instructions act as an interface between the computer and the user.
Programs and data must be transferred into memory, and the results of computations
must be transferred back to the user.
Input-Output Configuration
In computer architecture, input-output devices act as an interface between the
machine and the user.
Instructions and data stored in the memory must come from some input device. The
results are displayed to the user through some output device.
The following block diagram shows the input-output configuration for a basic
computer.
Note: FGI and FGO are corresponding input and output flags which are considered
as control flip-flops.
1. Two decoders: a 3 x 8 operation decoder and 4 x 16 timing decoder
2. A 16-bit common bus
3. Control Logic Gates
4. The Logic and Adder circuits connected to the input of AC.
AND
7. The AND instruction implements the AND logic operation on the bit
collection from the register and the memory word that is determined by
the effective address. The result of this operation is moved back to the
register.
ADD
8. The ADD instruction adds the content of the memory word that is
denoted by the effective address to the value of the register.
9. LDA
The LDA instruction shares the memory word denoted by the effective
address to the register.
STA
STA saves the content of the register into the memory word that is
defined by the effective address. The output is next used to the common
bus and the data input is linked to the bus. It needed only one micro-
operation.
BUN
BSA
BSA stands for Branch and Save return Address. These instructions can
branch a part of the program (known as subroutine or procedure). When
this instruction is performed, BSA will store the address of the next
instruction from the PC into a memory location that is determined by the
effective address.
ISZ
The method that is used to transfer information between internal storage and
external I/O devices is known as I/O interface. The CPU is interfaced using special
communication links by the peripherals connected to any computer system. These
communication links are used to resolve the differences between CPU and
peripheral. There exists special hardware components between CPU and
peripherals to supervise and synchronize all the input and output transfers that are
called interface units.
Mode of Transfer:
The binary information that is received from an external device is usually stored in
the memory unit. The information that is transferred from the CPU to the external
device is originated from the memory unit. CPU merely processes the information
but the source and target is always the memory unit. Data transfer between CPU
and the I/O devices may be done in different modes. Data transfer to and from the
peripherals may be done in any of the three possible ways
1. Programmed I/O.
2. Interrupt- initiated I/O.
Now let’s discuss each mode one by one.
1. Programmed I/O: It is due to the result of the I/O instructions that are written
in the computer program. Each data item transfer is initiated by an instruction
in the program. Usually the transfer is from a CPU register and memory. In this
case it requires constant monitoring by the CPU of the peripheral devices.
Example of Programmed I/O: In this case, the I/O device does not have direct
access to the memory unit. A transfer from I/O device to memory requires the
execution of several instructions by the CPU, including an input instruction to
transfer the data from device to the CPU and store instruction to transfer the
data from CPU to memory. In programmed I/O, the CPU stays in the program
loop until the I/O unit indicates that it is ready for data transfer. This is a time
consuming process since it needlessly keeps the CPU busy. This situation can
be avoided by using an interrupt facility. This is discussed below.
2. Interrupt- initiated I/O: Since in the above case we saw the CPU is kept busy
unnecessarily. This situation can very well be avoided by using an interrupt
driven method for data transfer. By using interrupt facility and special
commands to inform the interface to issue an interrupt request signal whenever
data is available from any device. In the meantime the CPU can proceed for any
other program execution. The interface meanwhile keeps monitoring the device.
Whenever it is determined that the device is ready for data transfer it initiates
an interrupt request signal to the computer. Upon detection of an external
interrupt signal the CPU stops momentarily the task that it was already
performing, branches to the service program to process the I/O transfer, and
then return to the task it was originally performing.
The I/O transfer rate is limited by the speed with which the processor can
test and service a device.
The processor is tied up in managing an I/O transfer; a number of
instructions must be executed for each I/O transfer.
Terms:
o Hardware Interrupts: Interrupts present in the hardware pins.
o Software Interrupts: These are the instructions used in the program
whenever the required functionality is needed.
o Vectored interrupts: These interrupts are associated with the static
vector address.
o Non-vectored interrupts: These interrupts are associated with the
dynamic vector address.
o Maskable Interrupts: These interrupts can be enabled or disabled
explicitly.
o Non-maskable interrupts: These are always in the enabled state.
we cannot disable them.
o External interrupts: Generated by external devices such as I/O.
o Internal interrupts: These devices are generated by the internal
components of the processor such as power failure, error
instruction, temperature sensor, etc.
o Synchronous interrupts: These interrupts are controlled by the
fixed time interval. All the interval interrupts are called as
synchronous interrupts.
o Asynchronous interrupts: These are initiated based on the
feedback of previous instructions. All the external interrupts are
called as asynchronous interrupts.