Computer Architecture: Basic Structures and Operations, Lecture notes of Computer Architecture and Organization

Computer Organization and Architecture Unit 1- 5

Typology: Lecture notes

2021/2022

Available from 07/05/2022

vignesh392
vignesh392 🇮🇳

5 documents

1 / 37

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1 | P a g e
UNIT I
BASIC STRUCTURES OF COMPUTER: Functional Units, Multiprocessors and Multicomputers,
Memory Locations and Addresses, Memory operations, Instructions and Instruction Sequencing,
Addressing modes, Assembly Language, Basic Input/Output operations, Stacks and Queues, Subroutines,
Shift and rotate Instructions, Byte-Sorting program.
2 MARKS
1. What are the functional units?
A computer consists of five functionally independent main parts. They are
1. Input
2. Memory
3. arithmetic and logic
4. output and control units
2. What is meant by input unit?
Computers accept coded information through input units, which read the data.
The most well-known input device is the keyboard. Whenever 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 the processor
3. What is meant by memory unit?
The function of the memory unit is to store programs and data. There are two
classes of storage, called primary and secondary.
Primary storage is a fast memory that operators at electronic speeds. Programs
must be stored in the memory while they are being executed.
Memory in which any location can be reached in a short and a fixed amount of
timeafter specifying its address is called randam access memory(RAM) the time required
to access one word is called memory access time.
4. What are the operations in ALU?
Arithmetic and logic operations Multiplication, division, comparison of
numbers etc.
When operands are brought into the processor they are stored in high speed
storage elements called Registers. Each Register can store one word of data
5. What is meant by output unit?
The output units is the counter part of the input unit. Its function is to sent
processed result to the outside world. Output units Printer(inkjet printer, Laser
printer).Graphics display provide both an input function and input function-I/O Unit.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download Computer Architecture: Basic Structures and Operations and more Lecture notes Computer Architecture and Organization in PDF only on Docsity!

UNIT – I

BASIC STRUCTURES OF COMPUTER: Functional Units, Multiprocessors and Multicomputers, Memory Locations and Addresses, Memory operations, Instructions and Instruction Sequencing, Addressing modes, Assembly Language, Basic Input/Output operations, Stacks and Queues, Subroutines, Shift and rotate Instructions, Byte-Sorting program.

2 MARKS

1. What are the functional units? A computer consists of five functionally independent main parts. They are 1. Input 2. Memory 3. arithmetic and logic 4. output and control units 2. What is meant by input unit? Computers accept coded information through input units, which read the data. The most well-known input device is the keyboard. Whenever 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 the processor 3. What is meant by memory unit? The function of the memory unit is to store programs and data. There are two classes of storage, called primary and secondary. Primary storage is a fast memory that operators at electronic speeds. Programs must be stored in the memory while they are being executed. Memory in which any location can be reached in a short and a fixed amount of timeafter specifying its address is called randam access memory(RAM) the time required to access one word is called memory access time. 4. What are the operations in ALU? Arithmetic and logic operations – Multiplication, division, comparison of numbers etc. When operands are brought into the processor they are stored in high speed storage elements called Registers. Each Register can store one word of data 5. What is meant by output unit? The output units is the counter part of the input unit. Its function is to sent processed result to the outside world. Output units – Printer(inkjet printer, Laser printer).Graphics display provide both an input function and input function-I/O Unit.

6. What are the operations in control unit? The operation of a computer can be summarized as follows, 1. the computer accepts information in the form of programs and data through an input unit and stores it in the memory 2. information stored in the memory is fetched, under program control, into an arithmetic and logic unit, where it is processed. 3. Processed information leaves the computer through an output unit. 4. All activities inside the machines are directed by the control unit. 7. Define byte addressability?  Three basic information – bit, byte and word  A byte Is always 8 bits. But the word length typically ranges from 16 to 64 bits.  Memory location assignments refer to successive byte locations in memory  Memory is byte-accessible.  For 8086, a Word is 16-bits (2 bytes) 8. What is meant by multiprocessor? Large computer system may contain a number of processor units, in which case they are called multiprocessor systems. These systems either execute a number of different application task in parallel, or they execute sub task of a single large in parallel. 9. What is meant by multicomputers? The high performance of these systems comes with much increased complexity and cost in contrast to multiprocessor systems, it is also possible to use an interconnected group of complete computer to achieve high total computional power. When the task they are executing need to communicate data, they do so by exchanging messages over a communication network. This property distinguishes them from shared memory multiprocessors, reading to the name message passing multicomputer.

12. How to align the word? In the case of 32- bit word length, natural word boundaries occur at addresses 0, 4, 8 as shown in the (fig. byte and word addressing). The word locations have aligned addresses. Words are said to be aligned in memory if they begin at a byte address that is a multiple of the number of bytes in a word. There is no fundamental reason why words cannot begin at an arbitrary byte address. In that case words are said to have unaligned addresses. 13. What are the Ways to indicate the length of the string? There are two ways to indicate the length of the string. 1. The special control character with the meaning “end of string” can be used as last character in the string. 2. Processor register can contain a number indicating the length of the string in bytes. 14. What are the me mory operations?  To execute an instruction, the processor control circuits must cause the word containing the instruction to be transferred from the memory to the processor  Two basic operations involving the memory are needed, namely load and store.  load operation  store operation 15. Define subroutine? Subroutine calls are a special type of branch where we return to one instruction below the calling instruction. Provision must be made to save the return address, since it cannot be written into ROM. 16. What are the basic I/O operations?  Program controlled IO  Memory mapped IO 17. Explain stack? A stack is a list of data elements, usually words or bits, with the accessing restrictions that elements can be added or removed at one end of the list only. This end is called the top of the stack and other end is called the bottom. The structure is sometimes referred to as Push down stack. It uses LIFO principle for two operations-Push and Pop.

18. Explain Queue? Another useful datastructure that is similar to stack is called the queue. Data are stored and retrieved from a queue on FIFO basics. New data are added at the back and retieved from the front.. 19. What is the difference between stack and queue imple mentation? There are 2 important differences between how a stack and a queue is implemented. One end of the is fixed while the other end rises and falls as data are pused and poped. A single pointer is needed to point to top of the stack, at on the other hand both ends of the queue move to higher addresses as data are added at the back and removed from the front. So two pointers are needed to keep track of the two ends of the queue. One way to limit the queue to fixed region in a memory is to use a circular buffer. 20. Define Assembly language? Machine Instructions Are Represented By patterns of 0s and 1s. symbolic names are used to represent patterns. When writing programs for specific computer, such words are normally replaced by acronyms called mnemonics such as MOV,ADD,INC, and BR.R is used to refer register 3, and LOC to refer to a location. A complete set of such symbolic names and rules for their use constitute a programming language, generally referred to as an assembly language. 21. What are the basic ope rations pe rformed by any computer system?(Nov 2012) Basic operations of a computer Inputting The process of entering the data and instruction in the computer system.2.

Processing Performing arithmetic operations or logical on data to convert them intouseful information3. Outputting The process of producing the useful information or result for the user suchas a printed report or visual display4. Storing Storing data and instruction to make them readily available for initial or additional processing whenever required.5. Controlling Directing the manner or sequence in which all of the above operation are performed

28. What is meant by subroutine nesting? Subroutine nesting is to have one subroutine call another. In this case, the return address of the second call is also stored in the link register, destroying its previous contents. Hence, it is essential to save the contents of the link register in some other location before calling another subroutines. Otherwise, the return address of the first subroutine will be lost.

FUNCTIONAL UNITS

A computer consists of five functionally independent main parts. They are

  1. Input
  2. Memory
  3. arithmetic and logic
  4. output and
  5. control units

Fig.1.1 Basic functional units of a computer INPUT UNIT Computers accept coded information through input units, which read the data. The most well-known input device is the keyboard. Whenever 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 the processor MEMORY UNIT The function of the memory unit is to store programs and data. There are two classes of storage, called primary and secondary. Primary storage is a fast memory that operators at electronic speeds. Programs must be stored in the memory while they are being executed. The memory contains the large number of semi-conductor storage cells, each capable of storing one bit of information. These cells are rarely read or written as individual cells but instead are processed in groups of fixed size called words. To provide easy access to any word in the memory, a distinct address is associated with each word location. Addresses are numbers that identify successive locations. The number of bits in each word is often refer to as the word length of the computer. Typical word length range from 16 to 64 bits.

Large computer system may contain a number of processor units, in which case they are called multiprocessor systems. These systems either execute a number of different application task in parallel, or they execute sub task of a single large in parallel. All processors usually have access to all of the memory in such systems, and the term shared memory multiprocessor systems is often is used to make this clear.

The high performance of these systems comes with much increased complexity and cost in contrast to multiprocessor systems, it is also possible to use an interconnected group of complete computer to achieve high total computionalpower.when the task they are executing need to communicate data, they do so by exchanging messages over a communication network.

This property distinguishes them from shared memory multiprocessors, reading to the name message passing multicomputer.

MEMORY LOCATIONS AND ADDRESSES Number and character operands, as well as instructions, are stored in the memory of the computer. The memory consists of many millions of storage cells each of which can store a bit of information having the values zero or one. Each group of n bits is refer to as a word of information, and n is called the word length.

Accessing the memory to store or retrieve a single item of information, either a word or a byte, requires distinct names or addresses for each item location. The addresses of successive location in the memory can have values from 0 to 2k-1.

BYTE ADDRESSBILITY

 Three basic information – bit, byte and word  A byte Is always 8 bits. But the word length typically ranges from 16 to 64 bits.  Memory location assignments refer to successive byte locations in memory  Memory is byte-accessible.  For 8086, a Word is 16-bits (2 bytes)

Fig.1.2 Memory words

Fig. 1.3 Example of encoded information in 32- bit word

 Byte locations have addresses 0,1, ….

  1. The special control character with the meaning “end of string” can be used as last character in the string.
  2. Processor register can contain a number indicating the length of the string in bytes.

MEMORY OPERATIONS

To execute an instruction, the processor control circuits must cause the word containing the instruction to be transferred from the memory to the processor. Operands and results must also be moved between the memory and the processor. Two basic operations involving the memory are needed, namely load and store.

The load operation transfers a copy of the contents of a specific memory location to the processor. The memory contents remain unchanged. To start a load operation, the processor sends the address of the desired location to the memory and requests that its contents be read. The memory reads the data stored at that address and sends them to the processor.

The store operation transfers an item of information from the processor to a specific memory location, destroying the former contents of that location. The processor sends the address of the desired location to the memory, together with the data to be written into that location.

INSTRUCTION AND INSRTUCTION SEQUENCING The tasks carried out by a computer program consist of a sequence of small steps, such as adding two numbers, testing for a particular condition, reading a character from the keyboard, or sending a character to be displayed on a display screen.

A computer must have instructions capable of performing four types of operation:

 Data transfers between the memory and the processor registers  Arithmetic and logic operations on data  Program sequencing and control  I/O transfers

REGISTER TRANSFER NOTATION

 Identify a location by a symbolic name standing for its hardware binary address (LOC, R0,…)  Contents of a location are denoted by placing square brackets around the name of the location (R1←[LOC], R3 ←[R1]+[R2])  Register Transfer Notation (RTN)

ASSEMBLY LANGUAGE NOTATION

 Represent machine instructions and programs.  Move LOC, R1 = R1←[LOC]  Add R1, R2, R3 = R3 ←[R1]+[R2]

BASIC INSTRUCTION TYPES

 Three-Address Instructions o ADD R1, R2, R3 R1 ← R2 + R  Two-Address Instructions o ADD R1, R2 R1 ← R1 + R  One-Address Instructions o ADD M AC ← AC + M[AR]  Zero-Address Instructions o ADD TOS ← TOS + (TOS – 1)  RISC Instructions o Lots of registers. Memory is restricted to Load & Store

Example: Evaluate (A+B)  (C+D)

Three-Address Two-Address ADD R1, A, B; R1 ← M[A] + M[B] ADD R2, C, D; R2 ← M[C] + M[D] MUL X, R1, R2; M[X] ← R1  R

MOV R1, A;R1 ← M[A]

ADD R1, B ; R1 ← R1 + M[B]

MOV R2, C ; R2 ← M[C]

ADD R2, D ; R2 ← R2 + M[D]

MUL R1, R2 ; R1 ← R1  R

MOV X, R1 ; M[X] ← R

One-Address Zero-Address LOAD A ; AC ← M[A] ADD B ; AC ← AC + M[B] STORE T ; M[T] ← AC LOAD C ; AC ← M[C] ADD D ; AC ← AC + M[D] MUL T ; AC ← AC  M[T] STORE X ; M[X] ← AC

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

RISC

LOAD R1, A ; R1 ← M[A]

LOAD R2, B ; R2 ← M[B]

LOAD R3, C ; R3 ← M[C]

To begin executing a program the address of its first instruction(i) must be placed into the PC.

The processor control circuits use the information in the PC to fetch and execute instruction, one at the time, in order increasing addresses. This is called straight- line sequencing

Executing a given instruction is a two phase procedure. In the first phase, called instruction fetch, the instruction is fetched from the memory location whose address in the PC. This instruction is placed in the instruction Register(IR) in the processor. The second phase called instruction execute, the instruction in IR is examined to determine which operations is to be performed.

The specified operation is performed by the processor. When the execute phase of an instruction Is completed, the PC contains the address of the next instruction, and the new instruction fetch phase can begin.

BRANCHING

 Consider the task of adding a list of n numbers.  The program outlined in following fig1.6.is a generalization of the program in fig 1.  The address of the memory location contain the n numbers are symbolically given as NUM1,NUM2,… NUM n and separate add instruction is used to add each number to the contents of register R0.  After all the numbers have been added, the result is placed in memory location SUM.

Fig.1.6 A straight line program for adding n numbers

 Instead of using a long list of add instructions, it is possible to place a single ADD instruction in a program loop as shown in Fig. 1.  The loop is a straight line sequence of instruction as many times as needed.  Within the body of the loop, the instruction Decrement R Reduces the contents of R1 by 1 each time through the loop.  We use branch instruction to load a new value into the program counter.  As a result a processor fetches and executes the instruction at this new address called the branch target.  A contional branch instruction causes a branch only if a specified condition is satisfied. Branch >0 LOOP

 How to specify the address of branch target?  Can we give the memory operand address directly in a single Add instruction in the loop?  Use a register to hold the address of NUM1; then increment by 4 on each pass through the loop.

ADDRESSING MODES Programmers used organization called data structure to represent the data used in computation. these include list, linked list, queue, arrays. The different ways in which the location of an operand is specified in an instruction are referred to as Addressing modes

 Implied o AC is implied in “ADD M[AR]” in “One-Address” instr. o TOS is implied in “ADD” in “Zero-Address” instr.  Immediate o The use of a constant in “MOV R1, 5”, i.e. R1 ← 5  Register o Indicate which register holds the operand

 Register Indirect

o Indicate the register that holds the number of the register that holds the operand

 MOV R1, (R2)

 Autoincrement / Autodecrement

o Access & update in 1 instr.

 Direct Address

 Use the given address to access a memory location  Indirect Address Indicate the memory location that holds the address of the memory location that holds the data.  Indexed o EA = Index Register + Relative Addr

 Base Register

o EA = Base Register + Relative Addr

 Relative Address

o EA = PC + Relative Addr

INDEXING AND ARRAYS

 Index mode – the effective address of the operand is generated by adding a constant value to the contents of a register.  Index register  X(Ri): EA = X + [Ri]  The constant X may be given either as an explicit number or as a symbolic name representing a numerical value.  If X is shorter than a word, sign-extension is needed  In general, the Index mode facilitates access to an operand whose location is defined relative to a reference point within the data structure in which the operand appears.  Several variations: (Ri, Rj): EA = [Ri] + [Rj] X(Ri, Rj): EA = X + [Ri] + [Rj]

RELATIVE ADDRESSING

 Relative mode – the effective address is determined by the Index mode using the program counter in place of the general-purpose register.  X(PC) – note that X is a signed number