Professional Documents
Culture Documents
MODULE 1
Computer Types
A computer is a fast electronic calculating machine that that accepts digitized input
information processes it according to a list of internally stored instructions and produces the
resulting output information. The list of instructions is called a computer program and the
internal storage is called computer memory.
Many computers differ widely in size, cost, computational power and intended use.
1. Desktop computers have processing and storage units, visual display and audio output
units and keyboard that can be located on a home or office desk.
2. Personal Notebook computers a compact version of personal computers with all
components packaged into single unit the size of a thin briefcase.
3. Workstations with high resolution graphics input/output capability with the same
dimension as desktop computers have more computational power.
4. A range of large and powerful computer systems exist that are called enterprise systems
and servers at low end of the range and servers at high end.
Functional Units
Arithmetic
Input and
logic
Memory
Output Control
I/O Processor
I/O
Computer Organization & Architecture
The input unit accepts coded information from human operators, from electromechanical
devices such as keyboards or from other computers over digital communication line. The information
received is either stored in the computer memory for later reference or immediately used by the
arithmetic and logic circuitry to perform the desired operations. The processing steps are determined
by the program stored in the memory. Finally the results are shown on the output unit. All of these
actions are co-ordinated by the control unit. We refer to the arithmetic and logic circuits in
conjunction to the control circuits as the processor and input and output units are referred to as input-
output (I/O) unit.
A list of instructions that perform a task is called program. The computer is completely
controlled by a stored program except for a possible external interruption by an operator or by I/O
devices connected to the machine. Data is used to mean any digital information. Each number,
character or instruction is encoded as a string of binary digits known as bits each having one of two
possible values 0 or 1.
Input Unit
Computers accept the coded information through input units which read the data. The
well known input device is Keyboard. When a key is pressed, the corresponding letter or digit
is automatically translated into its corresponding binary code and transmitted over a cable to
either the memory or processor.
Memory Unit
The memory unit is used to store program and data. There are two classes of storage
known as primary and secondary.
Primary memory is a fast storage that operates at electronic speeds. Programs are
stored in the memory while they are executed. The memory contains large number of
semiconductor storage cells each capable of storing one bit but instead are processed as
groups of fixed size called words. The memory is organized so that a word can be stored or
retrieved in one basic operation. A distinct address is associated to each word in the memory.
Addresses are numbers that identify successive locations.
Programs must reside in the memory during execution. Instructions and data can be
read out or written into the memory under the control of the processor. Memory in which any
location can be reached in short and fixed amount of time after specifying its address is called
random-access memory (RAM). The small, fast RAM units are called caches.
The additional cheaper secondary storage is used when large amount of data and
many programs have to be stored particularly for information that is accessed infrequently.
Output Unit
The output unit is a counterpart of input unit. Its function is used the processed results
to the outside world. The most familiar example of such a device is a printer.
Control Unit
The control unit is a well defined physically separate unit that interacts with other
parts of the machine. The control unit sends the control signals to other units and senses their
states. Timing signals are generated by the control circuits that determine when a given action
is to take place. Data transfer between memory and processor is also controlled unit through
timing signals. A large set of control lines (wires) carries the signals used for timing and
synchronization of events in all units.
Add LOCA, R0
This instruction adds the operand at memory location LOCA to the operand in a
register in the processor, R0, and places the sum in the register R0. The original contents of
location LOCA are preserved whereas those of R0 are overwritten. First the instruction is
fetched from the memory into the processor. Next the operand at LOCA is fetched and added
to the contents of R0. Finally the resulting sum is stored in register R0.
Transfers between memory and processor are started by sending the address of the
memory location to be accessed to the memory unit and issuing the appropriate control
signals. The data is transferred to or from the memory. The memory and processor
connection is shown in Fig 1.2.
Memory
MAR MDR
Control
PC R0
R1
IR .
. ALU
Rn-1
The Instruction register (IR) holds the instruction that is currently being executed. Its
output is available to control circuits which generate the timing signals that control various
processing elements involved in executing the instruction.
The Program Counter (PC) holds the address of the next instruction to be fetched and
executed. During the execution of an instruction, the contents of the PC are updated to
correspond to the address of the next instruction to be executed. MAR and MDR facilitate
communication with the memory.
MAR (Memory Address Register) hold the address of the location to be accessed and
MDR (Memory Data Register) contains data written into or read out of the addressed
location.
If some devices require urgent servicing then they raise the interrupt signal
interrupting the normal execution of the current program. The processor provides the
requested service by executing the appropriate interrupt service routine.
Bus Structures
The individual parts of a computer need to be connected in an organized way to
increase the speed of operation. When a word of data is transferred between units, all its bits
are transferred in parallel that is bits are transferred simultaneously over many wires or lines,
one bit per line. A group of lines that serves as a connecting path for several devices is called
a bus. The simplest way to inter connect functional units is to use a single bus as shown in
Fig 1.3.
The main virtue of single-bus structure is its low cost and its flexibility for attaching
peripheral devices. Systems that contain multiple buses achieve more concurrency in
operation by allowing two or more transfers to be carried out at the same time. This leads to
better performance but at increased cost.
A common approach is to include buffer registers with the devices to hold the
information during transfers.
Dept of ECE, CMRIT 5
Computer Organization & Architecture
Software
System software is a collection of programs that are executed as needed to perform
functions such as:
A compiler is a system software program translates the high level language program in to
a suitable machine language program containing instructions such as Add and Load
instructions.
Consider a system with one processor, one disk and one printer. When the application
program has been compiled from a high language form to machine language form and stored
on the disk. The first step is to transfer this file into the memory. When the transfer is
complete, execution of the program is started. Assume part of the program’s task involves
reading a data file from the disk in to the memory, performing some computations on the data
and printing the results. When the execution of the program reaches the point where the data
file is needed, the program requests the operating system to transfer the data file from the
disk to the memory. The OS performs this task and passes the execution control back to the
application program, which then proceeds to perform the required computation. When the
computation is completed and the results are ready to be printed, the application program
again sends the request to the operating system. An OS routine is then executed to cause the
printer to print the results.
Printer
Disk
OS
routines
Program
Time
The execution control passes back and forth between application program and OS
routines. This sharing of processor execution time is illustrated by a time line diagram as
shown in Fig 1.5. During the time period to , an OS routine initiates the application
loading program from the disk to the memory, waits until the transfer is completed, and
then passes execution control to the application program. A similar pattern of activity
occurs during period to and period to , when the operating system transfers the
data file from the disk and print the results. At , the operating system may load and
execute another application program. Notice that the disk and processor are idle during
most of the time period to . The operating system manages the concurrent execution
of several application programs to make best possible use of computer resources. This
pattern of concurrent execution is called multiprogramming or multitasking.
Performance
The total time required to execute the program is known as elapse time. This is a
measure of performance of entire computer system. The periods during which processor is
active is used to measure the performance of processor. The sum of these periods is
referred to as processor time. The processor time depends on the hardware involved in the
execution of individual machine instructions. This hardware comprises the processor and
the memory which are connected by a bus as shown in Fig 1.6.
Cache
Main Memory Processor
Memory
Bus
At the start of execution, all program instructions and the required data are stored in
the main memory. As execution proceeds, instructions are fetched one by one over the
bus into the processor, and a copy is placed in the cache. When the execution of an
instruction calls for data located in the main memory, the data are fetched and a copy is
placed in the cache. Later if the same instruction or data item is needed a second time, it is
read directly from the cache.
Processor Clock
Processor circuits are controlled by a timing signal called clock. The clock defines
regular time intervals called clock cycles. To execute a machine instruction, the processor
divides the action to be performed into a sequence of basic steps, such that each can be
completed in one clock cycle. The length of one clock cycle is an important parameter
that affects the processor performance. Its inverse is the clock rate, which is
measured in cycles per second.
To achieve high performance, the value of must be reduced which can be done by
reducing and , and increasing . The value of is reduced if the source program is
compiled in fewer machine instructions. The value of is reduced if instructions have a
smaller number of basic steps to perform or if the execution of instructions are
overlapped. Using a higher-frequency clock increases the value of which means the
time required to complete a basic execution step is reduced.
Number Representation
Consider an n-bit vector
We need to represent both positive and negative numbers. Three systems are used for
representing such numbers:
Sign-and-magnitude
1’s-complement
2’s-complement
B Values represented
Sign and
magnitude 1’s complement 2’s complement
This graphical techniques works for the computation of mod for any
positive integers and , that is , to perform addition , locate and move units in the
clockwise direction to arrive at mod . Let us apply the mod addition technique
to add to . The 2’s complement representation of these numbers is and . To
add these numbers locate on the circle in Fig 1.9 and then move steps in the
clockwise direction to arrive at , which yields the correct answer of .
We now state the rules governing the addition and subtraction of -bit signed
numbers using 2’s-complement representation systems.
1. To add two numbers, add their -bit representations, ignoring the carry-out signal
from the most significant bit (MSB) position.
2. To subtract two numbers and that is to perform , form the 2’s complement
of and add it to as in rule 1.
The results will be algebraically correct in the 2’s complement representation if the
answer is in the range through .
For a negative number, the left most bit which is a sign bit is a , and a longer number
with the same value is obtained by replicating the sign bit to the left as many times as desired.
This operation of representing the signed number in 2’s complement form using a large
number of bits by repeating the sign bit as many times as needed to the left is known as sign
extension.
n bits
first word
second word
i-th word
last word
Accessing the memory to store or retrieve a single item of information, either a byte
or word, requires distinct names or addresses for each item location. The addresses
constitute the address space of the computer, and the memory can have up to addressable
locations. For example, a bit address generates an address space of
locations.
A byte is always bits but the word length typically ranges from to bits. The
successive addresses refer to successive byte locations in the memory. The term byte-
addressable memory is used for this assignment. Byte locations of addresses Thus, if
word length of the machine is 32 bits, successive words are located at addresses
with each word consisting of four bytes.
The word locations have aligned addresses where the word begins at a byte address
that is a multiple of number of bytes in a word. If the word length is bytes , aligned
words begins at byte addresses
Individual characters can be accessed by their byte address. The beginning of a string
is indicated by giving the address of the byte containing its first character. Successive byte
locations contain successive characters of the string. A special character “end of string” can
be used as last character in the string, or a separate memory word location or processor
register can contain a number indicating the length of the string in bytes.
Memory Operations
Both program instructions and data operands are stored in the memory. To execute an
instruction, the processor control circuits must cause the word (or words) containing the
instructions to be transferred from the memory to the processor. Operands and results must
also be moved between memory and processor. Thus the two basic operations involving
memory are needed, namely, Load (or Read or Fetch) and Store (or Write).
The Load operation transfers a copy of the contents of a specified memory location to
the processor. The memory content remains unchanged. The Store operation transfers an item
of information from the processor to a specific memory location destroying the contents of
that location.
The possible locations that may be involved in transfer of information from one
location of computer to another are memory locations, processor registers or registers in the
I/O subsystem. The names for the addresses of memory locations may be LOC, PLACE, A,
VAR2; processor register names may be R0, R5; and I/O register names may be DATAIN,
OUTSTATUS. The expression
Adds two numbers contained in the processor registers and and placing their
sum in without changing the contents of and .
There are machine instructions that specify only one memory operand. When a
second operand is needed, it is understood implicitly to be in unique location. A processor
register called the accumulator is used for this purpose.
Dept of ECE, CMRIT 15
Computer Organization & Architecture
and
The Load instruction copies the content of memory location into the accumulator,
and the Store instruction copies the contents of accumulator into memory location . When
data is moved to or from a processor register, the Move instruction can be used rather than
Load or Store instructions because of the order of source and destination operands determines
which operation is intended. Thus
is the same as
and
is same as
The Program Counter (PC) contains the address of the instruction to be executed next.
To begin executing a program, the address of its fist instruction must be placed in to PC.
Then the processor control circuits use the information in the PC to fetch and execute the
instructions, one at a time, in the order of increasing addresses. This is called straight-line
sequencing.
Address Contents
Branching
Consider a task of adding a list of numbers. The address of the memory locations
containing the numbers are given as and a separate
instruction is used to add each number to the contents of the register . After all numbers
have been added, the result is placed in the memory location .
Execution of the loop is repeated as long as the result of the decrement operation is
greater than zero.
LOOP
SUM
NUM1
NUM2
NUMn
Conditional Codes
The processor keeps track of information about the results of various operations for
use by subsequent conditional branch instructions. This is accomplished by recording the
required information in individual bits, often called conditional code flags. These flags are
usually grouped together in a special processor register called the conditional code register or
status register. Individual condition code flags are set to or cleared to , depending on the
outcome of the operation performed.
Four commonly used flags are
N (negative) Set to 1 if the result is negative; otherwise, cleared to .
Z (Zero) Set to 1 if the result is ; otherwise, cleared to .
V (Overflow) Set to 1 if arithmetic overflow occurs; otherwise, cleared to .
C (Carry) Set to if carry-out results from the operation; otherwise, cleared to
.
PROBLEMS
Assume that the instruction is stored in memory location INSTR and this address is
initially in register PC.
Sol: The steps needed to execute this machine instruction are listed below:
Transfer the contents of PC to register MAR
Issue a Read command to memory, and then wait until it has transferred the
requested word into register MDR.
Transfer the instruction from MDR into IR and decode it.
Transfer the address LOCA from IR to MAR.
Issue a Read command and wait until MDR is loaded.
Transfer contents of MDR to the ALU.
Transfer contents of R0 to the ALU.
Perform addition of the two operands in the ALU and transfer result into
R0.
Transfer contents of PC to ALU.
Add 1 to operand in ALU and transfer incremented address to PC.
2. Give a short sequence of machine instruction for the task “Add the contents of
memory location A to those of location B and place the answer in location C”. Use
only Load and Store instructions to transfer the data between memory and general
purpose registers. Do not destroy the contents of either location A or B.
Sol: Load A, R0
Load B, R1
Add R0, R1
Store R1, C
3. Let each of the six OS routine execution intervals are 1 unit of time, with each disk
operation requiring 3 units, printing requiring 3 units and each program execution
interval requiring 2 units of time. Compute the ratio of best overlapped time to non
overlapped time for a long sequence of programs. Ignore the start up and ending
transients.
Program
1 3 1 2 1 3 1 2 1 3 1
Program
1 3 1
1 3 1 2 1 3 1 2 1 3 1
Program
1 3 1
4. The program can be run on RISC or CISC computers. The effective value of S in the
expression of T for the RISC machine is 1.2, but is only 1.5 for the CISC machine.
What is the largest allowable value for N, the number of instructions executed o the
CISC machine, expressed as percentage of the N value for the RISC machine, if the
time required on the CISC is to be no longer than that on the RISC machine?
Repeat the same problem if the clock rate R for the RISC machine is 15% higher
than that of CISC machine.
Then
If the clock rate R for the RISC machine is 15% higher than that of CISC machine. Then
we have
Then
Sol: Load A
Multiply B
Store RESULT
Load C
Multiply D
Add RESULT
Store RESULT
ASSIGNMENT QUESTIONS