Unit-1 Coa
Unit-1 Coa
Tanya Shrivastava
UNIT – 1
S.
No. Computer Architecture Computer Organization
6. It deals with high-level design issues. It deals with low-level design issues.
S.
No. Computer Architecture Computer Organization
Input Unit:
The input unit consists of input devices that are attached to the computer.
Input refers to any information or data that is sent to a computer for processing.
A computer will only respond when a command is given to the device and these commands can
be given using the input unit or the input devices.
Input devices are: Keyboard (querty keyboard, wired keyboard, wireless keyboard, mechanical
keyboard, numeric keyboard, ergonomic keyboard, Bluetooth keyboard, magic keyboard, backlit
keyboard, gaming keyboard, membrane keyboard, chiclet keyboard, wireless laser keyboard
etc.), Mouse (wired mouse, wireless mouse, Bluetooth mouse, trackball mouse, laser mouse,
magic mouse, USB mouse, gaming mouse, vertical mouse etc.), Scanner, Light Pen, OMR,
MICR, OCR, Bar Code Reader, Joysticks, touch screen, Camera, Mic etc.
Question: Explain any four input devices.
Output Unit:
When we command a computer to perform a task, then computer process that commands and
gives us a result. This result is called output.
The output of a computer is the information that it displays on a screen or prints on paper as a
result.
There is various output devices connected to the computer. The most basic of which is a
monitor. Whatever we write using a keyboard or click using a mouse, is all displayed on the
monitor.
Output devices are: Monitor (also known as VDU, Visual Display Unit), Projector, Speaker
and Printer etc.
Question: Explain any four output devices.
Control Unit:
Control unit is used to control the signals.
The control unit is also known as the nerve center of a computer system.
The control unit controls and monitors communications between the hardware attached to the
computer. It controls the input and output of data, checks that signals have been delivered
successfully, and makes sure that data goes to the correct place at the correct time.
It tells the computer's memory, arithmetic/logic unit and input and output devices how to
respond to a program's instructions.
Memory Unit:
When we enter the data into the computer using an input device, the entered information
immediately gets saved in the memory unit of the Central Processing Unit (CPU).
Also known as storage unit, the Memory Unit transmits the data further to the other parts of the
CPU.
Similarly, when the output of our command is processed by the computer, it is saved in the
memory unit before giving the output to the user.
CPU:
The Central Processing Unit is the core of any computer devices. It is also known as the “Brain of
Computer” and no action can be conducted by a device without the execution and permission of the
Central Processing Unit. It comprises three major components:
Memory Unit
Control Unit
Arithmetic and Logical Unit
All these 3 units are elements of CPU and together help in the efficient working and processing of data.
Data Bus: The data bus is bidirectional. The data bus is used to communicate or send the data from
one part to another.
Address Bus: The address bus is unidirectional. The address bus is used to communicate the address of
the given data and instructions.
Control Bus: The control bus is unidirectional. The control bus is used to control the signals between
different devices.
Therefore, in conclusion, we can say that these functional components communicate through this bus
architecture. The input device takes the input, then the data is processed and the output devices display the
results. Besides, the system bus performs all the communication that the cycle involves.
BUS
A bus is a collection of small wires and a communication system that transfers data between the
internal components of the computer or between the computers.
A bus is a collection of wires used for the communication of different parts of a computer. Further, it uses
electric signals to pass the data and information.
BUS ARCHITECTURE
TYPES OF BUSES
Data Bus: The data bus is bidirectional. The data bus is used to communicate or send the data from
one part to another.
Address Bus: The address bus is unidirectional. The address bus is used to communicate the address of
the given data and instructions.
Control Bus: The control bus is unidirectional. The control bus is used to control the signals between
different devices.
BUS ARBITRATION
It is deciding who get access to the bus for reading or writing for any transaction called Bus
Arbitration.
A multiple devices may need to use the bus at the same time, so the bus has to decide which device
has to be handed the bus first.
The Bus Arbitration is a Master which is going to decide which device will served first, only one
device can be served one at a time. Means in a figure there is a single bus line in which several
devices are connected, so with the help of bus arbitration, the bus will decide which device will be
served first, or the bus decide in which device data will be send first.
A device that initiates data transfers on the bus at any given time is called a Bus Master.
BUS
Bus arbitration is a process by which next device becomes the bus controller by transferring bus
master ship to another bus.
Bus arbitration is needed to resolve conflicts when two or more devices want to become the bus
master at the same time. In short, arbitration is the process of selecting the next bus master from
among multiple candidates.
Bus arbitration scheme usually try to balance two properties:
Bus priority – highest priority device will be served first after the lowest priority device.
Fairness – fairness means whether it is giving services to all the devices or not.
Releases
Whenever the bus is free the Device can make a Bus Request with the Bus Master.
Bus Request is send to the bus master.
Bus master will send the data to the highest priority Device first.
Now in Case of Daisy chain one by one Device can be served, here Device 1 has the highest
priority and Device 3 has the lowest priority.
Now the Highest Priority Device will make the Bus Request first, means Device 1 will make
the bus request to the Bus Master. (Device 1 sense that bus is free, so it will make a request)
So the Bus Master will send the Bus Grant Request to the Device 1, and it will send the Busy
Signal, now the bus is busy so „NO‟ other Devices will send the bus request to the Bus Master.
After the work is over of Device 1 it releases the Bus, now the bus is free.
Whenever the bus is free only then other Devices will make the Bus Request with the Bus
master.
When the bus is free then Device 2 will make the bus request to the bus master. After the work
of Device 2 is over it releases the bus then Device 3 will make the bus request with the bus
master.
So this is a Daisy Chain Process one after other.
Advantages:
Simplicity and Scalability.
The user can add more devices anywhere along the chain, up to a certain maximum
value.
Disadvantages:
The value of priority assigned to a device depends on the position.
Propagation delay arises in this method. Means last devices will receive the data late,
last device is waiting for the data.
Slower, time taken.
If one device fails then the entire system will stop working.
2. Polling Mechanism
Here the Bus Master decides which Device has to be served first. The priority of the Devices is decided
by the bus master. Here 3 lines are present one is for Bus Request, one is for Bus Busy and one is for
Polling.
Releases
Whenever the bus is free Device will make the Bus Request from the Bus Master.
So if bus is not busy the device will make the request.
The master decides by checking each device which is having the highest priority by placing the
Device ID’s on polling line. So each Device will have only one ID. ID‟s will be decided by bus
master.
Suppose:
Device 1 ID is 8
Device 2 ID is 4
Device 3 ID is 6
Now in Case of Polling, the data will send to the highest priority and the priority will be set
according to the ID‟s.
Now the Highest Priority Device will make the Bus Request first, means Device 2 will make the
bus request to the Bus Master, because the ID of Device 2 is 4.
So the Bus Master will send the Bus Grant Request to the Device 2, and it will send the Busy
Signal, now the bus is busy so „NO‟ other Devices will send the bus request to the Bus Master.
After the work is over of Device 2 it releases the Bus, now the bus is free.
Whenever the bus is free only then other Devices will make the Bus Request with the Bus
master.
When the bus is free then Device 3 will make the bus request to the bus master because the ID
of Device 3 is 6. After the work of Device 3 is over it releases the bus, then Device 1 will make
the bus request with the bus master because the ID of Device 1 is 8.
So this is a Polling the data will be send is depending on various ID‟s.
Advantages:
This method does not favor any particular device and processor.
The method is also quite simple.
If one device fails then the entire system will not stop working.
Disadvantages:
Adding more than one bus masters is difficult also increases the number of poll lines of the
circuit.
Polling delay. (Last device has to wait for data)
BGR
BGR
Device 1 Device 2 Device 3
BGR
Releases
R1
BUS R2
MASTER
R3
Bus Busy
Whenever the bus is free Device will make the Bus Request from the Bus Master.
Suppose the bus is free and if Device 3 will make the bus request first, so the bus master will send
the Bus Grant Request to the Device 3 first, and send the busy signal. After the work of Device 3
will be done it releases the bus.
After that another device will request for the bus suppose Device 1, so bus master will send the Bus
Grant signal to the Device 1, and the work of Device 1 is completed so it will release the bus.
In case of Independent Request Mechanism all the devices randomly ask for the Bus request to the
Bus Master. But the limitation is when the bus is busy bus master could not receive the request of
other devices; bus master can only receive the request when the running device will release the bus
or the bus is free.
Advantages:
This method generates a fast response.
Disadvantages:
Hardware cost is high as a large no. of lines or wires is required.
REGISTER
What is Register?
Registers:
Flip flop means a single cell that is capable to store a single bit.
1 cell stores 1 bit.
1 cell = 1 flip-flop
Example: this 8 bit register contains 8 cells or we can say 8 flip-flops.
1 0 1 1 0 1 0 0
Types of Registers are:
The memory content store in the MDR is copied into the Instruction Register (IR).
It is used to store the instructions like LOAD, ADD, SUB, DIV, MUL, STORE, MOV, EXE etc.
Instruction Register (IR) is also known as Current Instruction Register (CIR).
Accumulator (AC)
It contains results.
It is used to perform calculations. For Ex. 3+6=9.
It is processor register used for processing.
In the statement, R2 R1, acts as a replacement operator. This statement defines the transfer of
content of register R1 into register R2.
Register Transfer Language (RTL): Register Transfer Language (RTL) means the symbolic
language is used to transfer the data from one place to another is known as Register Transfer
Language. Now another meaning of RTL means Right To Left, means data is always transfer from
right to left. For example R2 R1, the data of R1 register is transfer to the R2 register from right to
left.
Letters and
Denotes a Register MAR, R1, R2
Numbers
P : R2 <- R1
: Denotes conditional operations
if P=1
The operation performed on the data stored in the registers is referred to as register transfer
operations. There are different types of register transfer operations:
1. Simple Transfer – R2 R1
The content of R1 is copied into R2 without affecting the content of R1. It is a simple type of
transfer operation. R2 R1.
2. Conditional Transfer –
It indicates that if P=1, then the content of R1 is transferred to R2. It is a unidirectional
operation. If P=1 then R2 R1
3. Simultaneous Operations –
If 2 or more micro operations are to occur simultaneously (means at the same time) then they
are separated with comma (,). Like R1 <- R2, R2 <- R1
The IAS computer was named for the Institute for Advanced Study in Princeton, N.J., where it
was developed. Work on the IAS was begun in 1946 and completed in 1952.
The IAS computer was the first to store the program in the same memory as the data.
The logic of the IAS machine was implemented with vacuum tubes.
The memory of the IAS machine was implemented with cathode ray tubes.
The word size is 40 bits.
Memory is word addressed (not byte addressed.)
Numbers were stored as fractions, not as integers.
The IAS machine has 7 registers: Accumulator, Arithmetic Register, Control Counter, Control
Register, Function Table Register, Memory Address Register, Selectron Register.
Arithmetic Register: used to perform arithmetic operations like addition, subtraction, multiplication
and division etc.
Control Register: A control register is a processor register that changes or controls the general
behaviour of a CPU or other digital device.
Function Table Register: describes a function by displaying inputs and outputs in tabular form.
Memory Address Register: MAR is a register in the CPU it contains address of the memory.
Selectron Register: the current data value being read from or written to memory.
CPU:
The Central Processing Unit is the core of any computer devices. It is also known as the “Brain of
Computer” and no action can be conducted by a device without the execution and permission of the
Central Processing Unit. It comprises four major components:
Memory Unit
Control Unit
Arithmetic and Logical Unit
Registers
All these 4 units are elements of CPU and together help in the efficient working and processing of data.
Control Unit:
Control unit is used to control the signals.
The control unit is also known as the nerve center of a computer system.
The control unit controls and monitors communications between the hardware attached to the
computer. It controls the input and output of data, checks that signals have been delivered
successfully, and makes sure that data goes to the correct place at the correct time.
It tells the computer's memory, arithmetic/logic unit and input and output devices how to
respond to a program's instructions.
Memory Unit:
When we enter the data into the computer using an input device, the entered information
immediately gets saved in the memory unit of the Central Processing Unit (CPU).
Also known as storage unit, the Memory Unit transmits the data further to the other parts of the
CPU.
Similarly, when the output of our command is processed by the computer, it is saved in the
memory unit before giving the output to the user.
Arithmetic & Logic Unit:
As the name suggests, all the mathematical calculations or arithmetic and logical operations are
performed in the Arithmetic and Logical Unit of the CPU.
Arithmetic Unit: Like Addition, Subtraction, Multiplication and Division.
Logical unit: Like AND, OR, NOT, NOR, NAND gate, less than, greater than etc.
Bus
A bus is a collection of small wires and a communication system that transfers data between the
internal components of the computer or between the computers.
A bus is a collection of wires used for the communication of different parts of a computer. Further, it uses
electric signals to pass the data and information.
Types of buses
Data Bus: The data bus is bidirectional. The data bus is used to communicate or send the data from
one part to another.
Address Bus: The address bus is unidirectional. The address bus is used to communicate the address of
the given data and instructions.
Control Bus: The control bus is unidirectional. The control bus is used to control the signals between
different devices.
Registers:
1 0 1 1 0 1 0 0
A program counter is a register in the CPU containing the address of the next instruction to be
executed from memory.
It holds the address of the memory/RAM. Address of RAM like – 0,1,2,3 etc.
The memory content store in the MDR is copied into the Instruction Register (IR).
It is used to store the instructions like LOAD, ADD, SUB, DIV, MUL, STORE, MOV, EXE etc.
Instruction Register (IR) is also known as Current Instruction Register (CIR).
Accumulator (AC)
It contains results.
It is used to perform calculations. For Ex. 3+6=9.
It is processor register used for processing.
INPUT/OUTPUT Devices:
I/O devices are the pieces of hardware used by a human (or other system) to communicate with a
computer. For instance, a keyboard or computer mouse is an input device for a computer, while
monitors and printers are output devices.
Memory transfers simply mean to a transfer from a specific location of memory to a register. However a
memory transfer can be either ways. It can work either from Memory to Register or from Register to
Memory. Memory is designated by the letter “M”. The Address register contains address is designated
by AR or MAR (memory address register) and data register contains data is designated by DR.
Memory Read Operation: A memory read operation first searches for a location in the memory and
then transfers the value located at that location to a register. Ex.: with the help of figure and micro
operations.
Memory Write Operation: A memory write operation simply extracts data from a register
and transfers it to a memory location. Ex.: with the help of figure and micro operations.
BUS TRANSFER
A bus transfer is the most effective method to send data by using a common bus system.
Now to transfer the data between registers we don‟t use thousands of wires, instead of
thousands wires we just use single common BUS system.
The two methods that can be used in Bus transfer are as follows −
1. Using multiplexer
2. Using three states bus buffers
1. Using Multiplexer: Multiplexer allow the process of transmitting different type of data such as audio
video at the same time using a single transmission line.
Multiplexer: means multiple inputs but single output. Also known as MUX.
DE multiplexer: means single input but multiple outputs. Also known as DEMUX.
The following block diagram shows a Bus system for four registers each register is of 4 bits. 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).
Here,
A0, B0, C0, D0 connected with MUX 0.
A1, B1, C1, D1 connected with MUX 1.
A2, B2, C2, D2 connected with MUX 2.
A3, B3, C3, D3 connected with MUX 3.
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.
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.
If the selection lines is 00 like S1=0 or S0=0 so all the multiplexers provides 0 output.
As there are 4 registers. So, No. of inputs to each multiplexer is 4 and the total no of bits in each register
is 8. So, the total multiplexer will be 8. As there are four registers, two select lines (two bits) are enough
to represent these four registers.
Question: How do registers communicate with each other through a common bus?
Answer: We connect all registers with a common bus through the multiplexers.
Note: If a common bus has 8 registers of 16 bits then it requires 16 multiplexers. Each multiplexer will
contain eight data input lines and three selection lines (S2, S1, and S0).
Control Input C
One Line
Common Bus
System
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 In 2*4 decoder, 2 is the no. of selection inputs and 4 is the no. of outputs
o Formula of the Decoder is to select no. of input and output lines: N * 2N
For example:
Q. Numerical based on 3 state buffers: Using Tri State buffer & decoder construct bus system to transfer
bus information from 4 register. Each register is of 4 bit wide.
Solution: Let‟s take four register A B C D of size 4 bits. Decoder = 2*22 = 2*4, 2 means 2 selection
inputs S1 S0 and 4 means no. of output lines.
PROCESSOR ORGANIZATION
If a CPU includes some registers, therefore a common bus can link these registers. A general
organization of seven CPU registers is displayed in the figure.
The CPU bus system is managed by the control unit. The control unit explicit the data flow through the
ALU by choosing the function of the ALU and components of the system.
Consider R1 ← R2 + R3, the following are the functions implemented within the CPU −
ALU Operation Selector (OPR) − It can select the arithmetic addition (ADD).
Decoder Destination Selector (SELD) − It can transfers the result into R1.
The 14-bit control word defines a micro-operation. The encoding of register selection fields is specified
in the table. Encoding of Register Selection Field
001 R1 R1 R1
010 R2 R2 R2
011 R3 R3 R3
100 R4 R4 R4
101 R5 R5 R5
110 R6 R6 R6
111 R7 R7 R7
There are several micro-operations are implemented by the ALU. Few of the operations implemented
by the ALU are displayed in the table. Encoding of ALU Operations
01010 OR A and B OR
ALU Micro-Operations
STACK ORGANIZATION
PUSH
POP
SP
Stack's operations are:
SP
Push: Adds an item to the top of the stack
Pop: Removes one item from the stack's top
DR (Data
Register)
D,E,F DR (Data
Register)
SP C,D,E,F
SP
ADDRESSING MODES
Addressing modes shows the location of a required data or instructions. Output of addressing
mode is Effective Address (EA). Effective address is the actual address of the data or instructions.
In opcode we get to know which operation has to perform like addition, subtraction,
multiplication, division, increment, and decrement.
In operand we get to know about the data, in which operation is performed. We will get the
data in the memory, so the location of the data is given by addressing mode.
OPCODE OPERAND
Relative Address = Program counter (Next Instruction) + Address (Program counter stores next
instruction address)
Indexed Address = XR + Address
Auto decrement
In auto-decrement addressing mode,
First, the instruction register RAUTO value is decremented by 1.
Then, the operand value is fetched.
Implied/Implicit addressing mode
This mode doesn‟t require any operand (data); the data is specified by the opcode
itself. Implied addressing mode knows about their data itself. Here we don‟t need to
search the data, Implicit addressing mode already knows about their data.
Q. Show the block diagram of hardware that implements the following register transfer
statement: yT2: R2 R1, R1 R2
Answer:
Ø Here we have used AND gate because in the equation we can see that both the input is in
multiplication (yT2) so we have to use the gate accordingly.
Ø The output from the AND gate is transferred to the register R1 & R2 the data is transferred from R1
to R2 and from R2 to R1.
Explanation:
Q. Represent the following conditional control statement by two register transfer statements with
Control functions. If (P=1) then (R1 R2) else if (Q = 1) then (R1 R3)
Answer:
P: R1 R2
P‟Q: R1 R3
Q. 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?
Answer:
a) 4 (since we have 16 registers, so, 2n, here n = no. of selection inputs lines, 24=16, hence there are 4
selection inputs.)
b) 16X1 (because there are 16 registers, so we get 16 inputs in multiplexer) or (size of multiplexers =
number of registers *1)
c) 32 (as we know, no. of bits of registers = no. of multiplexers, 32 bit register = 32 multiplexers).
Q. The following transfer statements specify a memory. Explain the memory operation in each
case.
a. R2 M[AR]
b. M[AR] R3
c. R5 M[R5]
Answer:
a. This is read operation. It reads memory word specified by the address in the Address Register (AR),
and load it R2.
b. This statement writes the content of register R3 to memory word specified by the address in the
Address Register (AR).
c. This is a read operation where it reads memory word specified by the address in R5, and Override
the content of R5.
Q. Draw the block diagram for the hardware that implements the following statements: x+yz:
AR AR + BR, Where AR and BR are two n-bit registers and x, y and z are control variables.
Include the logic gates for the control functions.
Answer:
Ø Here we have used AND gate because in the equation we can see the input is in multiplication (yz)
but also we use OR gate because in the equation we see both the input is in addition also (x + yz) so we
have to use the gate accordingly.
Y
CLOCK
AR
X
n n
ADDER
BR
Answer:
To change the value in Register A to the desired values, we need to perform logic micro operations
using the B operand.
I. To change the value in Register A to 01101101, we can perform a bitwise XOR operation with the B
operand. The B operand should be the 8-bit binary 10110100. The XOR operation will flip the bits in A
where the corresponding bits in B are set to 1.
II. To change the value in Register A to 11111101, we can perform a bitwise OR operation with the B
operand. The B operand should be the 8-bit binary 00100100. The OR operation will set the bits in A to
1 where the corresponding bits in B are set to 1.
Here is a table showing the B operand and the logic micro operation for each case:
Desired Value B Operand Logic Micro operation
11111101 00100100 OR
Please note that the B operand is determined based on the desired value and the logic micro operation to
be performed.
Operands = A, B, X, Y etc.
Operator = +, -, *, /, (, ) etc.
Infix = Infix means operator is present between two operands known as infix notation.
Postfix = Postfix means operator is present after the operands. Postfix is also known as Reverse Polish
Notation (RPN).
a) (A+B /C * (D + E) – F)
Answer:
- (+*- ABC/DE+*+ Here * is having the highest priority but – is having the lowest
priority, so highest priority cannot tolerate the lowest priority.
Also + and – both have same priorities, so operator with same
priorities will not stay together.
F (- ABC/DE+*+F
) (-) ABC/DE+*+F- If any closed parenthesis occurs so we have to pop that parenthesis
and element.
Q. An instruction is stored at location 300 with its address field at location 301. The address field
has the value 400. A processor register R1 contains the number 200. Evaluate the effective
address if the addressing mode of the instruction is (a) direct; (b) immediate; (c) relative; (d)
register indirect; (e) index with R1 as the index register.
Solution:
Q.