[SPRING 2015] ASSIGNMENT
PROGRAM
|
BSc IT
|
SEMESTER
|
SECOND
|
SUBJECT CODE & NAME
|
BT0068, Computer Organization &
Architecture
|
Q. NO. 1.
Explain various units of a digital computer with the help of a diagram.
Ans. A computer can
process data, pictures, sound and graphics. They can solve highly complicated
problems quickly and accurately. A computer as shown in Fig. performs basically
five major computer operations or functions irrespective of their size and
make. These are
1) It accepts data or instructions by way of input,
2) It stores data,
3) It can process data as required by the user,
4) It gives results in the form of output, and
5) It controls all operations inside a computer.
We discuss below each of these Computer operations:
Block diagram of a Computer
1. Input: This is the process of entering data
and programs in to the computer system. You should know that computer is an
electronic machine like any other machine which takes as inputs raw data and performs
some processing giving out processed data. Therefore, the input unit takes data
from us to the computer in an organized manner for processing.
2. Storage: The process of saving data and
instructions permanently is known as storage. Data has to be fed into the
system before the actual processing starts. It is because the processing speed
of Central Processing Unit (CPU)
is so fast that the data has to be provided to CPU with the same speed.
Therefore the data is first stored in the storage unit for faster access and
processing. This storage unit or the primary storage of the computer system is
designed to do the above functionality. It provides space for storing data and
instructions.
The storage unit performs the following major functions:
• All data and instructions are stored here before and after
processing.
• Intermediate results of processing are also stored here.
3. Processing: The task of performing operations
like arithmetic and logical operations is called processing. The Central
Processing Unit (CPU) takes data and instructions from the storage unit and
makes all sorts of calculations based on the instructions given and the type of
data provided. It is then sent back to the storage unit.
4. Output: This is the process of producing
results from the data for getting useful information. Similarly the output produced
by the computer after processing must also be kept somewhere inside the
computer before being given to you in human readable form. Again the output is
also stored inside the computer for further processing.
5. Control: The manner how instructions are
executed and the above operations are performed. Controlling of all operations
like input, processing and output are performed by control unit. It takes care
of step by step processing of all operations inside the computer.
FUNCTIONAL UNITS
In order to carry out the operations mentioned in the
previous section the computer allocates the task between its various functional
units. The computer system is divided into three separate units for its
operation. They are
1) Arithmetic logical unit
2) Control unit.
3) Central processing unit.
Arithmetic Logical Unit (ALU) Logical Unit
Logical Unit: After you enter data through the input
device it is stored in the primary storage unit. The actual processing
of the data and instruction are performed by Arithmetic Logical Unit. The major
operations performed by the ALU are addition, subtraction, multiplication,
division, logic and comparison. Data is transferred to ALU from storage unit
when required. After processing the output is returned back to storage unit for
further processing or getting stored.
Control Unit (CU)
The next component of computer is the Control Unit, which
acts like the supervisor seeing that things are done in proper fashion. Control
Unit is responsible for co coordinating various operations using time
signal. The control unit determines the sequence in which computer programs and
instructions are executed. Things like processing of programs stored in the main memory,
interpretation of the instructions and issuing of signals for other units of
the computer to execute them. It also acts as a switch board operator when
several users access the computer simultaneously. Thereby it coordinates the
activities of computer’s peripheral equipment as they perform the input and
output.
Central Processing Unit (CPU)
The ALU and the CU of a computer system are jointly known as
the central processing unit. You may call CPU as the brain of any computer
system. It is just like brain that takes all major decisions, makes all sorts
of calculations and directs different parts of the computer functions by
activating and controlling the operations.
Q. NO. 2. Describe bus in computer system and explain
its structure.
Ans. Bus Structure
A bus is a
collection of wires that connect several devices within a computer system. When
a word of data is transferred between units, all its bits are transferred in
parallel. A computer must have some lines for addressing and control purposes.
Three main groupings of lines:
1. Data Bus: This
is for the transmission of data.
2. Address Bus:
This specifies the location of data in MM.
Control Bus: This
indicates the direction of data transfer and coordinates the timing of events
during the transfer.
Single Bus Structure
All units are connected to a
single bus, so it provides the sole means of interconnection. Single bus
structure has advantages of simplicity and low cost.
Single bus structure has
disadvantages of limited speed since usually only two units can participate in
a data transfer at any one time. This means that an arbitration system is
required and that units will be forced to wait.
Only two units can actively
use the bus at any given time. Bus control lines are used to arbitrate multiple
requests for the use of the bus.
Buffer Registers are
used to hold information during transfers.
Two Bus Structure
In the first configuration,
the processor is placed between the I/O unit and the memory unit. The processor
is responsible for any data transfer between the I/O unit and the memory unit.
The processor acts as a “messenger.” In this structure, the processor
performance and capability is not being maximized. Most of the time, the
processor is doing data transfer between these units instead of performing more
complex applications. Also, the processor is idle most of the time waiting for
these slow devices.
In the second configuration,
I/O transfers are made directly to or from the memory. A special purpose
processor called peripheral processor or I/O channel is needed as part of the
I/O equipment to control and facilitate such transfers. This special processor
is the direct memory access (DMA) controller. It allows main memory to perform
data transfer between I/O units.
Q. NO. 3. Explain the simple instruction format with
diagram and examples.
Ans. The most common fields found in
instruction format are:-
(1) An
operation code field that specified the operation to be performed
(2) An address field that designates a memory address or a processor registers.
(3) A mode field that specifies the way the operand or the effective address is determined.
(2) An address field that designates a memory address or a processor registers.
(3) A mode field that specifies the way the operand or the effective address is determined.
(1) Single
Accumulator organization ADD X AC ® AC + M [×]
(2) General Register Organization ADD R1, R2, R3 R ® R2 + R3
(3) Stack Organization PUSH X
(2) General Register Organization ADD R1, R2, R3 R ® R2 + R3
(3) Stack Organization PUSH X
Three address Instruction
Computer with three addresses
instruction format can use each address field to specify either processor
register are memory operand.
ADD R1, A,
B A1 ® M [A] + M [B]
ADD R2, C, D R2 ® M [C] + M [B] X = (A + B) * (C + A)
MUL X, R1, R2 M [X] R1 * R2
ADD R2, C, D R2 ® M [C] + M [B] X = (A + B) * (C + A)
MUL X, R1, R2 M [X] R1 * R2
The advantage of the three
address formats is that it results in short program when evaluating arithmetic
expression. The disadvantage is that the binary-coded instructions require too
many bits to specify three addresses.
Two Address Instruction
Most common in commercial
computers. Each address field can specify either a processes register on a
memory word.
MOV
R1, A R1 ® M [A]
ADD R1, B R1 ® R1 + M [B]
MOV R2, C R2 ® M [C] X = (A + B) * ( C + D)
ADD R2, D R2 ® R2 + M [D]
MUL R1, R2 R1 ® R1 * R2
MOV X1 R1 M [X] ® R1
ADD R1, B R1 ® R1 + M [B]
MOV R2, C R2 ® M [C] X = (A + B) * ( C + D)
ADD R2, D R2 ® R2 + M [D]
MUL R1, R2 R1 ® R1 * R2
MOV X1 R1 M [X] ® R1
One Address instruction
It used an implied accumulator
(AC) register for all data manipulation. For multiplication/division, there is
a need for a second register.
LOAD
A
AC ® M [A]
ADD B AC ® AC + M [B]
STORE T M [T] ® AC X = (A +B) × (C + A)
ADD B AC ® AC + M [B]
STORE T M [T] ® AC X = (A +B) × (C + A)
All operations are done
between the AC register and a memory operand. It’s the address of a temporary
memory location required for storing the intermediate result.
LOAD
C
AC ® M (C)
ADD D AC ® AC + M (D)
ML T AC ® AC + M (T)
STORE X M [×]® AC
ADD D AC ® AC + M (D)
ML T AC ® AC + M (T)
STORE X M [×]® AC
Zero – Address
Instruction
A stack organized computer
does not use an address field for the instruction ADD and MUL. The PUSH &
POP instruction, however, need an address field to specify the operand that
communicates with the stack (TOS ® top of the stack)
PUSH
A TOS ® A
PUSH B TOS ® B
ADD TOS ® (A + B)
PUSH C TOS ® C
PUSH D TOS ® D
ADD TOS ® (C + D)
MUL TOS ® (C + D) * (A + B)
POP X M [X] TOS
PUSH B TOS ® B
ADD TOS ® (A + B)
PUSH C TOS ® C
PUSH D TOS ® D
ADD TOS ® (C + D)
MUL TOS ® (C + D) * (A + B)
POP X M [X] TOS
Q.
NO. 4. Explain memory interleaving with the help of diagram.
Ans. Interleaving is
an advanced technique used by high-end motherboards/chipsets to improve memory
performance. Memory interleaving increases bandwidth by allowing simultaneous
access to more than one chunk of memory. This improves performance because the
processor can transfer more information to/from memory in the same amount of
time, and helps alleviate the processor-memory bottleneck that is a major
limiting factor in overall performance.
Interleaving works by dividing the system memory into multiple
blocks. The most common numbers are two or four, called two-way or four-way interleaving,
respectively. Each block of memory is accessed using different sets of control
lines, which are merged together on the memory bus. When a read or write is
begun to one block, a read or write to other blocks can be overlapped with the
first one. The more blocks, the more that overlapping can be done. As an
analogy, consider eating a plate of food with a fork. Two-way interleaving
would mean dividing the food onto two plates and eating with both hands, using
two forks. (Four-way interleaving would require two more hands. :^)) Remember
that here the processor is doing the "eating" and it is much faster
than the forks (memory) "feeding" it (unlike a person, whose hands
are generally faster.)
In order to get the best performance from this type of memory
system, consecutive memory addresses are spread over the different blocks of
memory. In other words, if you have 4 blocks of interleaved memory, the system
doesn't fill the first block, and then the second and so on. It uses all 4
blocks, spreading the memory around so that the interleaving can be exploited.
Interleaving is an advanced technique that is not generally
supported by most PC motherboards, most likely due to cost. It is most helpful
on high-end systems, especially servers that have to process a great deal of
information quickly. The Intel
Orion chipset is one that does support memory interleaving.
.
Q.
NO.5 Explain interrupt and interrupts driven I/O.
Ans.
Interrupt: In systems programming,
an interrupt is a signal to the processor emitted
by hardware or software indicating an event that needs immediate attention. An
interrupt alerts the processor to a high-priority condition requiring the
interruption of the current code the processor is executing. The processor
responds by suspending its current activities, saving its state,
and executing a function called an interrupt handler (or an
interrupt service routine, ISR) to deal with the event. This interruption is
temporary, and, after the interrupt handler finishes, the processor resumes
normal activities. There are two types of interrupts: hardware interrupts and
software interrupts.
Hardware interrupts are used by devices to communicate that
they require attention from the operating system. Internally, hardware
interrupts are implemented using electronic alerting signals that are sent to
the processor from an external device, which is either a part of the computer
itself, such as a disk controller, or an external peripheral. For example, pressing a key on
the keyboard or moving the mouse triggers hardware interrupts that
cause the processor to read the keystroke or mouse position. Unlike the
software type (described below), hardware interrupts are asynchronous and
can occur in the middle of instruction execution, requiring additional care in
programming. The act of initiating a hardware interrupt is referred to as
an interrupt request (IRQ).
A software interrupt is caused either by an exceptional
condition in the processor itself, or a special instruction in
the instruction set which
causes an interrupt when it is executed. The former is often called a trap or exception and is
used for errors or events occurring during program execution that are
exceptional enough that they cannot be handled within the program itself. For
example, if the processor's arithmetic logic unit is
commanded to divide a number by zero, this impossible demand will cause a divide-by-zero
exception, perhaps causing the computer to abandon the calculation or
display an error message. Software interrupt instructions function similarly
to subroutine calls and are
used for a variety of purposes, such as to request services from
low-level system software such
as device drivers. For example,
computers often use software interrupt instructions to communicate with
the disk controller to
request data be read or written to the disk.
Each interrupt has its own interrupt handler. The number of hardware
interrupts is limited by the number of interrupt request (IRQ) lines to the
processor, but there may be hundreds of different software interrupts.
Interrupts are a commonly used technique for computer multitasking,
especially in real-time computing.
Such a system is said to be interrupt-driven.
Interrupt-Driven
I/O
Whenever a data transfer to or from the managed hardware might be
delayed for any reason, the driver writer should implement buffering. Data
buffers help to detach data transmission and reception from the write and read system
calls, and overall system performance benefits.
A good buffering mechanism leads to interrupt-driven I/O,
in which an input buffer is filled at interrupt time and is emptied by
processes that read the device; an output buffer is filled by processes that
write to the device and is emptied at interrupt time. An example of
interrupt-driven output is the implementation of /dev/short print.
For interrupt-driven data transfer to happen successfully, the
hardware should be able to generate interrupts with the following semantics:
v For
input, the device interrupts the processor when new data has arrived and is
ready to be retrieved by the system processor. The actual actions to perform
depend on whether the device uses I/O ports, memory mapping, or DMA.
v For
output, the device delivers an interrupt either when it is ready to accept new
data or to acknowledge a successful data transfer. Memory-mapped and
DMA-capable devices usually generate interrupts to tell the system they are
done with the buffer.
Q.NO.6
Explain DMA controller with the help of diagram.
Ans. Direct memory
access (DMA) is a feature of computerized systems that allows certain
hardware subsystems to access main system memory independently of
the central processing unit (CPU).
Without DMA, when the CPU is using programmed input/output, it is typically fully occupied for the entire duration of
the read or write operation, and is thus unavailable to perform other work.
With DMA, the CPU first initiates the transfer, then it does other operations
while the transfer is in progress, and it finally receives an interrupt from the DMA
controller when the operation is done. This feature is useful at any time that
the CPU cannot keep up with the rate of data transfer, or when the CPU needs to
perform useful work while waiting for a relatively slow I/O data transfer. Many
hardware systems use DMA, including disk drive controllers, graphics cards, network cards and sound cards. DMA is also used
for intra-chip data transfer in multi-core processors. Computers that have DMA channels can transfer data to and
from devices with much less CPU overhead than computers without DMA channels.
Similarly, a processing element inside a multi-core processor can transfer data
to and from its local memory without occupying its processor time, allowing
computation and data transfer to proceed in parallel.
DMA can also be used for "memory to
memory" copying or moving of data within memory. DMA can offload expensive
memory operations, such as large copies or scatter-gather operations,
from the CPU to a dedicated DMA engine. An implementation example is the I/O Acceleration
Technology.
DMA
Controller block diagram
No comments:
Post a Comment