Co Notes
Co Notes
CO - Notes
Coa@aneetta
Part B
1. Explain stored program organisation.
2. Differentiate RISC and CISC
3. Explain Bus organisation.
4. Explain about data transfer instructions with suitable examples.
5. Explain how magnetic tapes work.
6. Discuss the replacement algorithms foe cache memory.
7. Explain address mapping using pages.
8. Explain multiprocessing systems.
9. Explain different types of array processors. What are the advantages provided by array processors?
10. Explain different instruction code formats.
11. Explain hoe reverse polish notation is suitable for stack manipulation.
Coa@aneetta
12. Write the help of a diagram explain set associative mapping.
13. Explain microprogrammed control unit.
14. Explain vector processing.
15. Explain the memory hierarchy in a computer system.
16. Write a note on virtual memory.
17. Write different instruction classification.
Part C
1) Discuss general register organisation with the help of a neat diagram.
2) Explain memory hierarchy.
3) a) Explain CPU internal architecture.
b) Write a short note on parallel systems.
4) Explain instruction pipeline with example and neat diagram.
5) Describe the instruction cycle in detail.
6) Explain the stack organisation in CPU.
7) What is pipelining? Explain arithmetic, instruction and RISC pipeline.
8) Explain various addressing modes with the help of examples.
9) Explain the Flynn’s Classification.
Module 1
Instruction codes: Basic computer organization and design
An instruction code is a group of bits that instruct the computer to perform a specific operation. It is usually
divided into two parts. The operation code and operands. The operation code of an instruction is a group of bits that
define the operations such as add, subtract, multiply, shift, and complement. The operands are the data on which the
operation is to be performed.
Opcode Operands
Computer Registers:
Computer instructions are normally stored in consecutive memory locations and are executed sequentially one
at a time. The control unit reads an instruction from a specific address in memory and executes it. It then continues by
reading the next instruction in sequence and executes it, and so on. This type of instruction sequencing needs a counter
to calculate the address of the next instruction after execution of the current instruction is completed. It is also
necessary to provide a register in the control unit for storing the instruction code after it is read from memory. The
computer needs processor registers for manipulating data and a register for holding a memory address. Different
registers used in a computer are:
Coa@aneetta
2. Register - reference instruction
3. Input-Output instruction
In Memory-reference instruction, 12 bits of memory is used to specify an address and one bit to specify the
addressing mode 'I'.
The Register-reference instructions are represented by the Opcode 111 with a 0 in the leftmost bit (bit
15) of the instruction.
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.
• Addresses- distinct name for location in memory where data is stored or retrieved
• Have 2k addressable locations .
• Use numbers from 0 to 2k – 1
• Byte is 8 bits
• Word length of memory ranges from 16 to 64 bits
The name big-endian is used when lower byte addresses are used for the most significant bytes (the leftmost bytes)
of the word.
The name little-endian is used for the opposite ordering, where the lower byte addresses are used for the less
significant bytes (the rightmost bytes) of the word.
Coa@aneetta
Instruction cycle:
A program residing in the memory unit of a computer consists of a sequence of instructions. These
instructions are executed by the processor by going through a cycle for each instruction.
In a basic computer, each instruction cycle consists of the following phases:
1. Fetch instruction from memory.
2. Decode the instruction.
3. Read the effective address from memory.
4. Execute the instruction.
Coa@aneetta
Fetch Stage: The next instruction is fetched from the memory address that is currently stored in the program
counter and stored into the instruction register. At the end of the fetch operation, the PC points to the next instruction
that will be read at the next cycle.
Decode Stage: During this stage, the encoded instruction presented in the instruction register is
interpreted by the decoder.
Read the effective address: In the case of a memory instruction (direct or indirect), the execution phase will be
during the next clock pulse. If the instruction has an indirect address, the effective address is read from main memory,
and any required data is fetched from main memory to be processed and then placed into data registers. If the
instruction is direct, nothing is done during this clock pulse. If this is an I/O instruction or a register instruction, the
operation is performed during the clock pulse.
Execute Stage: The control unit of the CPU passes the decoded information as a sequence of control signals to the
relevant function units of the CPU to perform the actions required by the instruction, such as reading values from
registers, passing them to the ALU to perform mathematical or logic functions on them, and writing the result back to
a register.
Timing and control:
All sequential circuits in the Basic Computer CPU are driven by a master clock, with the exception of the
INPR register. At each clock pulse, the control unit sends control signals to control inputs of the bus, the registers, and
the ALU.
Control unit design and implementation can be done by two general methods:
In simple words, the hardwired control unit generates the control signals to execute the instructions in a
proper sequence and at the correct time. The hardwired control unit is created with the hardware; it is a
circuitry approach. It is designed for the RISC style instruction set. A hardwired circuit organization is shown
in the figure below. Let us discuss all the components one by one, in order to understand the “generation of
control signals” from this circuitry organization.
5) Control Memory:
The set of microinstruction is stored in control Memory (CM) also called as control store.
6) Control Address Register (CAR):
It contains the address of next microinstruction to be read. This is similar to the program counter(PC) which
stores the address of the next instruction.
7) Control Buffer Register(CBR):When microinstruction is read from the control memory, it is transferred to a control Buffer
Register (CBR), which is similar to the instruction Register (IR) that stores the opcode of the instruction read from the memory.
8) Sequencing:
Coa@aneetta
It loads the control Address register with the address of the next instruction to be read and issues a read
command to control memory.
Microprogrammed Control Unit Organization:
The microroutines for all instruction in the instruction set of a computer are stored in a special memory called
the control memory (CM). The control unit can generate the the control signals for any instructions by sequentially
reading the control words of the corresponding micro-routine from the control store. To read the control words
sequentially from the control memory, a microprogram counter (µPC) is used. Every time a new instruction is loaded
into the IR the output of the block labelled ‘starting Address Generator’. is loaded into the µPC. The µPC then
automatically incremented by one, by the clock. So that successive microinstructions are fetched from the control
memory.
Difference between Hardwired and Microprogrammed control unit(important)
Coa@aneetta
What is RISC?
A reduced instruction set computer is a computer that only uses simple commands that can be divided into
several instructions that achieve low-level operation within a single CLK cycle, as its name proposes “Reduced
Instruction Set”. The RISC is a Reduced Instruction Set Computer microprocessor and its architecture includes a set of
instructions that are highly customized. The main function of this is to reduce the time of instruction execution by
limiting as well as optimizing the number of commands. So each command cycle uses a single clock cycle where
every clock cycle includes three parameters namely fetch, decode & execute.
What is CISC?
A complex instruction set computer is a computer where single instructions can perform numerous low-level
operations like a load from memory, an arithmetic operation, and a memory store or are accomplished by multi-step
processes or addressing modes in single instructions, as its name proposes “Complex Instruction Set ”.So, this
processor moves to decrease the number of instructions on every program & ignore the number of cycles for each
instruction. It highlights to assemble complex instructions openly within the hardware as the hardware is always as
compared with software.
Binary SEL-D or
SELA SELB
code SEL-REG
Coa@aneetta
000 Input Input ---
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
Operation selection
Operation symbol
code
0000 Transfer A TSFA
0001 Increment A INC A
0010 A+B ADD
0011 A-B SUB
0100 Decrement A DEC
0101 A AND B AND
0110 A OR B OR
0111 A XOR B XOR
1000 Complement A COMA
1001 Shift right A SHR
1010 Shift left A SHL
Coa@aneetta
The push operation is implemented with the following sequence of micro operations Initially
SP=0, EMPTY=1 and FULL=0
If the stack is not full(if FULL=0), a new item is inserted with a push operation SP
SP + 1 increment SP
M[SP] DR write item on top of the stack
If (SP=0) then (FULL 1) check if stack is full
EMPTY 0 mark the stack is not empty
Pop operation
DR M[SP] Read item from top SP
SP-1 Decrement SP
If (SP=0) then (EMPTY 1)check if stack is empty
FULL 0 Mark the stack is not full
Memory Stack
A stack can be implemented in a random access memory (RAM) attached to a CPU. The implementation of a
stack in the CPU is done by assigning a portion of memory to a stack operation and using a processor register as a
stack pointer. The starting memory location of the stack is specified by the processor register as stack pointer.
Stack Applications
Reverse Polish Notation
Opcode Operand
Implied Mode
In this mode the operands are specified implicitly in the definition of the instruction.
For example, the instruction "complement accumulator" is an implied-mode instruction because the operand
in the accumulator register is implied in the definition of the instruction.
In fact, all register reference instructions that use an accumulator are implied-mode instructions. Zero-address
instructions in a stack-organized computer are implied-mode instructions since the operands are implied to be
on top of the stack.
Immediate Mode
In this mode the operand is specified in the instruction itself. In other words, an immediate-mode instruction
has an operand field rather than an address field.
Coa@aneetta
The operand field contains the actual operand to be used in conjunction with the operation specified in the
instruction. Immediate-mode instructions are useful for initializing registers to a constant value.
Register Mode
In this mode the operands are in registers that reside within the CPU. The particular register is selected from a
register field in the instruction.
The operand resides in memory and its address is given directly by the address field of the instruction. In a
branch-type instruction the address field specifies the actual branch address.
Coa@aneetta
counter, the result produces an effective address whose position in memory is relative to the address of the
next instruction.
Instruction classification
An instruction can be classified as
Three Address
Two address
One Address
Zero Address
Three Address
This type of instructions contains the address of three operands. eg:-
Add A,B,C
Two Address
This type of instructions contains the address of two operands. eg:-
Add A,B
One Address
This type of instruction contains the address of one memory operand. eg:-
Load A, Store A
Zero Address
Coa@aneetta
This type of instruction does not use an address field. A stack based computer do not use address field in instruction.
Program control
Types of Program Control Instructions
Program Control Instructions are the machine code that are used by machine or in assembly language by user to
command the processor act accordingly. These instructions are of various types.
Types of Program Control Instructions:
There are different types of Program Control Instructions:
1. Compare Instruction:
Compare instruction is specifically provided, which is similar t a subtract instruction except the result is not
stored anywhere, but flags are set according to the result.
Example:
CMP R1, R2 ;
2. Unconditional Branch Instruction:
It causes an unconditional change of execution sequence to a new location.
Example:
JUMP L2
Mov R3, R1 goto L2
3. Conditional Branch Instruction:
A conditional branch instruction is used to examine the values stored in the condition code register to determine
whether the specific condition exists and to branch if it does.
Example:
4. Subroutines:
A subroutine is a program fragment that lives in user space, performs a well-defined task. It is invoked by
another user program and returns control to the calling program when finished.
Example:
CALL and RET
5. Halting Instructions:
NOP Instruction – NOP is no operation. It cause no change in the processor state other than an
advancement of the program counter. It can be used to synchronize timing.
HALT – It brings the processor to an orderly halt, remaining in an idle state until restarted by interrupt, trace,
reset or external action.
6. Interrupt Instructions:
Interrupt is a mechanism by which an I/O or an instruction can suspend the normal execution of
processor and get itself serviced.
RESET – It reset the processor. This may include any or all setting registers to an initial value or setting
program counter to standard starting location.
TRAP – It is non-maskable edge and level triggered interrupt. TRAP has the highest priority and vectored
interrupt.
INTR – It is level triggered and maskable interrupt. It has the lowest priority. It can be disabled by resetting
the processor.
Module 3
Memory Organization
Memory Hierarchy
The following memory hierarchy diagram is a hierarchical pyramid for computer memory. The designing of the
memory hierarchy is divided into two types such as primary (Internal) memory and secondary (External) memory.
Coa@aneetta
Memory Hierarchy Design
The memory hierarchy in computers mainly includes the following.
Registers
Usually, the register is a static RAM or SRAM in the processor of the computer which is used for holding the
data word which is typically 64 or 128 bits. The program counter register is the most important as well as found in all
the processors.
Cache Memory
Cache memory can also be found in the processor, however rarely it may be another IC (integrated circuit)
which is separated into levels. The cache holds the chunk of data which are frequently used from main memory.
Main Memory
` The main memory in the computer is nothing but, the memory unit in the CPU that communicates directly. It
is the main storage unit of the computer. This memory is fast as well as large memory used for storing the data
throughout the operations of the computer. This memory is made up of RAM as well as ROM.
Magnetic Disks
The magnetic disks in the computer are circular plates fabricated of plastic otherwise metal by magnetized
material. Frequently, two faces of the disk are utilized as well as many disks may be stacked on one spindle by read or
write heads obtainable on every plane. All the disks in computer turn jointly at high speed. The tracks in the computer
are nothing but bits which are stored within the magnetized plane in spots next to concentric circles. These are usually
separated into sections which are named as sectors.
Magnetic Tape
This tape is a normal magnetic recording which is designed with a slender magnetizable covering on an
extended, plastic film of the thin strip. This is mainly used to back up huge data. Whenever the computer requires to
access a strip, first it will mount to access the data. Once the data is allowed, then it will be unmounted. The access
time of memory will be slower within magnetic strip as well as it will take a few minutes for accessing a strip.
Main Memory
SRSM DRAM
5. SRAMs are low density devices. DRAMs are high density devices.
6. These are used in cache memories. These are used in main memories.
Classification of ROM
The very first ROMs were hard-wired devices that contained a pre-programmed set of data or instructions.
These kind of ROMs are known as masked ROMs, which are inexpensive.
Coa@aneetta
EPROM can be erased by exposing it to ultra-violet light for a duration of up to 40 minutes. Usually, an
EPROM eraser achieves this function. During programming, an electrical charge is trapped in an insulated gate
region. The charge is retained for more than 10 years because the charge has no leakage path. For erasing this charge,
ultra-violet light is passed through a quartz crystal window (lid). This exposure to ultra-violet light dissipates the
charge. During normal use, the quartz lid is sealed with a sticker.
EEPROM (Electrically Erasable and Programmable Read Only Memory)
EEPROM is programmed and erased electrically. It can be erased and reprogrammed about ten thousand
times. Both erasing and programming take about 4 to 10 ms (millisecond). In EEPROM, any location can be
selectively erased and programmed. EEPROMs can be erased one byte at a time, rather than erasing the entire chip.
Hence, the process of reprogramming is flexible but slow.
The advantages of ROM are as follows −
Non-volatile in nature
Cannot be accidentally changed
Cheaper than RAMs
Easy to test
More reliable than RAMs
Static and do not require refreshing
Contents are always known and can be verified
Auxiliary memory
Auxiliary memory holds programs and data for future use, and, because it is non volatile (like ROM), it is
used to store inactive programs and to archive data. Early forms of auxiliary storage included punched paper tape,
punched cards, and magnetic drums. Since the 1980s, the most common forms of auxiliary storage have been magnetic
disks, magnetic tapes, and optical discs.
Coa@aneetta
Optical discs
Another form of largely read-only memory is the optical compact disc, developed from
videodisc technology during the early 1980s. Data are recorded as tiny pits in a single spiral track on plastic discs that
range from 3 to 12 inches (7.6 to 30 cm) in diameter, though a diameter of 4.8 inches (12 cm) is most common. The
pits are produced by a laser or by a stamping machine and are read by a low- power laser and a photocell that generates
an electrical signal from the varying light reflected from the pattern of pits. Optical discs are removable and have a far
greater memory capacity than diskettes; the largest ones can store many gigabytes of information.
A common optical disc is the CD-ROM (compact disc read-only memory). It holds about 700 megabytes of
data, recorded with an error-correcting code that can correct bursts of errors caused by dust or imperfections. CD-
ROMs are used to distribute software, encyclopaedias, and multimedia text with audio and images. CD-R (CD-
recordable), or WORM (write-once read-many), is a variation of CD-ROM on which a user may record information
but not subsequently change it. CD-RW (CD-rewritable) disks can be re-recorded. DVDs (digital video, or versatile,
discs), developed for recording movies, store data more densely than does CD-ROM, with more powerful error
correction. Though the same size as CDs, DVDs typically hold 5 to 17 gigabytes—several hours of video or several
million text pages.
Cache Memory
• A small, fast memory inserted between main memory & processor
• Holds the currently active segments of a program and their data
• Effectiveness of cache mechanism is based on a property- locality of reference
Locality of reference
• Many instructions in localized areas of the program are executed repeatedly during some time period
and remainder program is accessed relatively infrequently
• 2 ways
– Temporal
• A recently executed instruction is likely to be executed again very soon
– Spatial
• Instructions in close proximity to a recently executed instruction are also likely to be
executed soon
Mapping Functions
Associative Mapping
Direct Mapping
Set Associative Mapping
Associative Mapping
The associative memory stores both address and data. The address value of 15 bits is 5 digit octal numbers
and data is of 12 bits word in 4 digit octal number. A CPU address of 15 bits is placed
in argument register and the associative memory is searched for matching address.
Direct Mapping
The CPU address of 15 bits is divided into 2 fields. In this the 9 least significant bits constitute
the index field and the remaining 6 bits constitute the tag field. The number of bits in index field is equal to the
number of address bits required to access cache memory.
Coa@aneetta
Set Associative Mapping
The disadvantage of direct mapping is that two words with same index address can't reside in cache memory
at the same time. This problem can be overcome by set associative mapping. In this we can store two or more words
of memory under the same index address. Each data word is stored together with its tag and this forms a set.
Virtual Memory
• Techniques that automatically move program and data blocks into the physical main memory when they are
required for execution – virtual memory techniques
• Binary addresses that the processor issues for either instructions or data are called virtual or logical
addresses
• A special hardware unit called Memory Management Unit (MMU) translates virtual addresses into physical
addresses
PROCESSOR
Virtu
Da
Phys
MM
CACHE
Phys
Da
MAIN MEMORY
DMA
DISK STORAGE
Address Translation
• Assume all programs & data are composed of fixed length units called pages
• Pages consists of a block of words that occupy contiguous locations in main memory
Coa@aneetta
• Pages commonly range from 2K to 16K bytes in length
Process
Each virtual address is interpreted as a virtual page number, followed by an offset that specifies the location of
a particular byte within a page
Information about main memory location of each page is kept in a page table
An area in the main memory that can hold one page is called a page frame
The starting address of the page table is kept in a page table base register
Physical
Page Offs
Module 4
Parallel Computer Structures:
Introduction to parallel processing
Technique to provide simultaneous data processing tasks
Coa@aneetta
Flynn’s Classification
Flynn’s classification is based on the multiplicity o0f instructions and data streams. the term stream is used to
denote a sequence of items.
Flynn's classification divides computers into four major groups that are:
1. Single instruction stream, single data stream (SISD)
2. Single instruction stream, multiple data stream (SIMD)
3. Multiple instruction stream, single data stream (MISD)
4. Multiple instruction stream, multiple data stream (MIMD)
SISD
SISD stands for 'Single Instruction and Single Data Stream'. It represents the organization of a single
computer containing a control unit, a processor unit, and a memory unit.Instructions are executed sequentially, and
the system may or may not have internal parallel processing capabilities. Most conventional computers have SISD
architecture like the traditional Von-Neumann computers.
SIMD
SIMD stands for 'Single Instruction and Multiple Data Stream'. It represents an organization that includes
many processing units under the supervision of a common control unit. All processors receive the same instruction
from the control unit but operate on different items of data. The shared memory unit must contain multiple modules so
that it can communicate with all the processors simultaneously.
Coa@aneetta
MISD
MISD stands for 'Multiple Instruction and Single Data stream'. MISD structure is only of theoretical
interest since no practical system has been constructed using this organization. In MISD, multiple processing units
operate on one single-data stream. Each processing unit operates on the data independently via separate instruction
stream.
MIMD:
MIMD stands for 'Multiple Instruction and Multiple Data Stream'. In this organization, all processors in a
parallel computer can execute different instructions and operate on various data at the same time. In MIMD, each
processor has a separate program and an instruction stream is generated from each program.
Module 5
Arithmetic Pipelines are mostly used in high-speed computers. They are used to implement floating-point
operations, multiplication of fixed-point numbers, and similar computations encountered in scientific problems.To
understand the concepts of arithmetic pipeline in a more convenient way, let us consider an example of a pipeline unit
for floating-point addition and subtraction.The inputs to the floating- point adder pipeline are two normalized floating-
point binary numbers defined as:
Coa@aneetta
a 3
X = A * 2 = 0.9504 * 10 Y
= B * 2b = 0.8200 * 102
Where A and B are two fractions that represent the mantissa and a and b are the exponents.
The combined operation of floating-point addition and subtraction is divided into four segments. Each
segment contains the corresponding sub operation to be performed in the given pipeline. The sub operations that are
shown in the four segments are:
The following block diagram represents the sub operations performed in each segment of the pipeline.
Instruction Pipeline
Pipeline processing can occur not only in the data stream but in the instruction stream as well. Most of the
digital computers with complex instructions require instruction pipeline to carry out operations like fetch, decode and
execute instructions.
In general, the computer needs to process each instruction with the following sequence of steps.
A four-segment instruction pipeline combines two or more different segments and makes it as a single
one. For instance, the decoding of the instruction can be combined with the calculation of the effective address into
one segment.
Coa@aneetta
The following block diagram shows a typical example of a four-segment instruction pipeline. The
instruction cycle is completed in four segments.
Vector Processing:
Applications
Vector Processing
Eliminates the overhead associated with time for fetch and execution of instructions in the program loop
Allows operations to be specified with a single vector instruction of the form
C(1:100)=A(1:100)+B(1:100)
The vector instruction includes the initial address of the operands, length of vectors and operation to be
performed
Array Processors(Important)
Array processors are also known as multiprocessors or vector processors. They perform computations on
large arrays of data. Thus, they are used to improve the performance of the computer.
Types of Array Processors
There are basically two types of array processors:
• Attached Array Processors
• SIMD Array Processors
Coa@aneetta
Attached Array Processors
An attached array processor is a processor which is attached to a general purpose computer and its purpose is
to enhance and improve the performance of that computer in numerical computational tasks. It achieves high
performance by means of parallel processing with multiple functional units.
SIMD is the organization of a single computer containing multiple processors operating in parallel.
The processing units are made to operate under the control of a common control unit, thus providing a single
instruction stream and multiple data streams.
A general block diagram of an array processor is shown below. It contains a set of identical processing
elements (PE's), each of which is having a local memory M. Each processor element includes an ALU and registers.
The master control unit controls all the operations of the processor elements. It also decodes the instructions and
determines how the instruction is to be executed.
The main memory is used for storing the program. The control unit is responsible for fetching the
instructions. Vector instructions are send to all PE's simultaneously and results are returned to the memory. The best
known SIMD array processor is the ILLIAC IV computer developed by the Burroughs corps. SIMD processors are
highly specialized computers. They are only suitable for numerical problems that can be expressed in vector or matrix
form and they are not suitable for other types of computations.