COMPUTER ORGNIZATION AND ASSEMBLY LANGUAGE EBOOK

Please download to get full document.

View again

of 397
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report
Category:

Software

Published:

Views: 6 | Pages: 397

Extension: PDF | Download: 0

Share
Related documents
Description
YOU CAN TAKE ADVANTAGE
Transcript
  • 1. 5 The Basic Computer UNIT 1 THE BASIC COMPUTER Structure Page Nos. 1.0 Introduction 5 1.1 Objectives 5 1.2 The von Neumann Architecture 5 1.3 Instruction Execution: An Example 9 1.4 Instruction Cycle 12 1.4.1 Interrupts 1.4.2 Interrupts and Instruction Cycle 1.5 Computers: Then and Now 18 1.5.1 The Beginning 1.5.2 First Generation Computers 1.5.3 Second Generation Computers 1.5.4 Third Generation Computers 1.5.5 Later Generations 1.6 Summary 29 1.7 Solutions/Answers 29 1.0 INTRODUCTION The use of Information Technology (IT) is well recognised. IT has become a must for the survival of all business houses with the growing information technology trends. Computer is the main component of an Information Technology network. Today, computer technology has permeated every sphere of existence of modern man. From railway reservations to medical diagnosis, from TV programmes to satellite launching, from matchmaking to criminal catching ─ everywhere we witness the elegance, sophistication and efficiency possible only with the help of computers. In this unit, you will be introduced to one of the important computer system structures: the von Neumann Architecture. In addition, you will be introduced to the concepts of a simple model of Instruction execution. This model will be enhanced in the later blocks of this course. More details on these terms can be obtained from further reading. We have also discussed about the main developments during the various periods of computer history. Finally, we will discuss about the basic components of microprocessors and their uses. 1.1 OBJECTIVES After going through this unit you will be able to: • define the logical structure of the computer; • define the instruction cycle; • define the concept or Interrupt; • discuss the basic features of computers; and • define the various components of a modern computer and their usage. 1.2 THE VON NEUMANN ARCHITECTURE The von Neumann architecture was the first major proposed structure for a general- purpose computer. However, before describing the main components of von Neumann
  • 2. 6 Introduction to Digital Circuits architecture, let us first define the term ‘computer’ as this will help us in discussing about von Neumann architecture in logical detail. Computer is defined in the Oxford dictionary as “An automatic electronic apparatus for making calculations or controlling operations that are expressible in numerical or logical terms”. The definition clearly categorises computer as an electronic apparatus although the first computers were mechanical and electro-mechanical apparatuses. The definition also points towards the two major areas of computer applications viz., data processing’s and computer assisted controls/operations. Another important aspect of the definition is the fact that the computer can perform only those operations/ calculations, which can be expressed in Logical or Numerical terms. Some of the basic questions that arise from above definition are: How are the data processing and control operations performed by an electronic device like the computer? Well, electronic components are used for creating basic logic circuits that are used to perform calculations. These components are further discussed in the later units. However, for the present discussion, it would be sufficient to say that there must be a certain unit that will perform the task of data processing and control. What is the basic function performed by a computer? The basic function performed by a computer is the execution of the program. A program is a sequence of instructions, which operates on data, to perform certain tasks such as finding a prime number. The computer controls the execution of the program. What is data in computers? In modern digital computers data is represented in binary form by using two symbols 0 and 1. These are called binary digits or bits. But the data which we deal with consists of numeric data and characters such as decimal digits 0 to 9, alphabets A to Z, arithmetic operators (e.g. +,-, etc.), relations operators (e.g. =, > , etc.), and many other special characters (e.g.;,@,{,], etc.). Therefore, there has to be a mechanism for data representation. Old computers use eight bits to represent a character. This allows up to 28 = 256 different items to be represented uniquely. This collection of eight bits is called a byte. Thus, one byte is used to represent one character internally. Most computers use two bytes or four bytes to represent numbers (positive and negative) internally. The data also includes the operational data such as integer, decimal number etc. We will discuss more about data representation in the next unit. Thus, the prime task of a computer is to perform instruction execution. The key questions, which can be asked in this respect, are: (a) how are the instructions supplied to the computer? and (b) how are the instructions interpreted and executed? Let us answer the second question first. All computers have a Unit that performs the arithmetic and logical functions. This Unit is referred to as the Arithmetic Logic Unit (ALU). But how will the computer determine what operation is to be performed by ALU or in other words who will interpret the operation that is to be performed by ALU? This interpretation is done by the Control Unit of the computer. The control unit accepts the binary form of instruction and interprets the instruction to generate control signals. These control signals then direct the ALU to perform a specified arithmetic or logic function on the data. Therefore, by changing the control signal the desired function can be performed on data. Or conversely, the operations that need to be performed on the data can be obtained by providing a set of control signals. Thus, for a new operation one only needs to change the set of control signals. The unit that interprets a code (a machine instruction) to generate respective control signals is termed as Control Unit (CU). A program now consists of a sequence of codes. Each code is, in effect, an instruction, for the computer. The hardware
  • 3. 7 The Basic Computer interprets each of these instructions and generates respective control signals such that the desired operation is performed on the data. The Arithmetic Logic Unit (ALU) and the Control Unit (CU) together are termed as the Central Processing Unit (CPU). The CPU is the most important component of a computer’s hardware. All these arithmetic and logical Operations are performed in the CPU in special storage areas called registers. The size of the register is one of the important considerations in determining the processing capabilities of the CPU. Register size refers to the amount of information that can be held in a register at a time for processing. The larger the register size, the faster may be the speed of processing. But, how can the instructions and data be put into the computers? The instructions and data to a computer are supplied by external environment; it implies that input devices are needed in the computer. The main responsibility of input devices will be to put the data in the form of signals that can be recognised by the system. Similarly, we need another component, which will report the results in proper format. This component is called output device. These components together are referred to as input/output (I/O) devices. In addition, to transfer the information, the computer system internally needs the system interconnections. At present we will not discuss about Input/Output devices and system interconnections in details, except the information that most common input/output devices are keyboard, monitor and printer, and the most common interconnection structure is the Bus structure. These concepts are detailed in the later blocks. Input devices can bring instructions or data only sequentially, however, a program may not be executed sequentially as jump, looping, decision-making instructions are normally encountered in programming. In addition, more than one data element may be required at a time. Therefore, a temporary storage area is needed in a computer to store temporarily the instructions and the data. This component is referred to as memory. The memory unit stores all the information in a group of memory cells such as a group of 8 binary digits (that is a byte) or 16 bits or 32 bits etc. These groups of memory cells or bits are called memory locations. Each memory location has a unique address and can be addressed independently. The contents of the desired memory locations are provided to the CPU by referring to the address of the memory location. The amount of information that can be held in the main memory is known as memory capacity. The capacity of the main memory is measured in Mega Bytes (MB) or Giga Bytes (GB). One-kilo byte stands for 210 bytes, which are 1024 bytes (or approximately 1000 bytes). A Mega byte stands for 220 bytes, which is approximately a little over one million bytes, a giga byte is 230 bytes. Let us now define the key features of von Neumann Architecture: • The most basic function performed by a computer is the execution of a program, which involves: the execution of an instruction, which supplies the information about an operation, and the data on which the operation is to be performed. The control unit (CU) interprets each of these instructions and generates respective control signals. • The Arithmetic Logic Unit (ALU) performs the arithmetic and logical Operations in special storage areas called registers as per the instructions of control unit. The size of the register is one of the important considerations in determining the processing capabilities of the CPU. Register size refers to the
  • 4. 8 Introduction to Digital Circuits amount of information that can be held in a register at a time for processing. The larger the register size, the faster may be the speed of processing. • An Input/ Output system involving I/O devices allows data input and reporting of the results in proper form and format. For transfer of information a computer system internally needs the system interconnections. One such interconnection structure is BUS interconnection. • Main Memory is needed in a computer to store instructions and the data at the time of Program execution. Memory to CPU is an important data transfer path. The amount of information, which can be transferred between CPU and memory, depends on the size of BUS connecting the two. • It was pointed out by von-Neumann that the same memory can be used for Storing data and instructions. In such a case the data can be treated as data on which processing can be performed, while instructions can be treated as data, which can be used for the generation of control signals. • The von Neumann machine uses stored program concept, i.e., the program and data are stored in the same memory unit for execution. The computers prior to this idea used to store programs and data on separate memories. Entering and modifying these programs was very difficult as they were entered manually by setting switches, plugging, and unplugging. • Execution of instructions in von Neumann machine is carried out in a sequential fashion (unless explicitly altered by the program itself) from one instruction to the next. Figure 1 shows the basic structure of a conventional von Neumann machine Figure 1: Structure of a Computer A von Neumann machine has only a single path between the main memory and control unit (CU). This feature/constraint is referred to as von Neumann bottleneck. Several other architectures have been suggested for modern computers. You can know about non von Neumann architectures in further readings. Check Your Progress 1 1) State True or False a) A byte is equal to 8 bits and can represent a character internally. b) von Neumann architecture specifies different memory for data and instructions. The memory, which stores data, is called data memory and the memory, which stores instructions, is called instruction memory. c) In von Neumann architecture each bit of memory can be accessed independently. d) A program is a sequence of instructions designed for achieving a task/goal. T/F
  • 5. 9 The Basic Computer e) One MB is equal to 1024KB. f) von Neumann machine has one path between memory and control unit. This is the bottleneck of von Neumann machines. 2) What is von Neumann Architecture? ………………………………………………………………………………………… ………………………………………………………………………………………… ………………………………………………………………………………………… 3) Why is memory needed in a computer? ………………………………………………… ……………………………………… …………………………………………………………………………………………. …………………………………………………………………………………………. 1.3 INSTRUCTION EXECUTION: AN EXAMPLE After discussing about the basic structure of the computer, let us now try to answer the basic question: “How does the Computer execute a Program?” Let us explain this with the help of an example from higher level language domain. Problem: Write a program to add two numbers. A sample C program (Assuming two fixed values of numbers as a = 5 and b = 2) 1. #include <stdio.h> 2. main () 3. { 4. int a =5, b=2, c; 5. c= a+b; 6. printf (“n The added value is: % d”, c); 7. } The program at line 4 declares variables that will be equivalent to 3 memory locations namely a, b and c. At line 5 these variables are added and at line 6 the value of c is printed. But, how will these instructions be executed by CPU? First you need to compile this program to convert it to machine language. But how will the machine instructions look like? Let us assume a hypothetical instruction set of a machines of a size of 16 binary digits (bits) instructions and data. Each instruction of the machine consists of two components: (a) Operation code that specifies the operation that is to be performed by the instruction, and (b) Address of the operand in memory on which the given operation is to be performed. Let us further assume that the size of operation code is assumed to be of six bits; therefore, rest 10 bits are for the address of the operand. Also the memory word size is assumed to be of 16 bits. Figure 2 shows the instruction and data formats for this machine. However, to simplify our discussion, let us present the operation code using Pnemonics like LOAD, ADD, STORE and decimal values of operand addresses and signed decimal values for data.
  • 6. 10 Introduction to Digital Circuits Figure 2: Instruction and data format of an assumed machine The instruction execution is performed in the CPU registers. But before we define the process of instruction execution let us first give details on Registers, the temporary storage location in CPU for program execution. Let us define the minimum set of registers required for von Neumann machines: Accumulator Register (AC): This register is used to store data temporarily for computation by ALU. AC is considered to contain one of the operands. The result of computation by ALU is also stored back to AC. It implies that the operand value is over-written by the result. Memory Address Register (MAR): It specifies the address of memory location from which data or instruction is to be accessed (read operation) or to which the data is to be stored (write operation). Refer to figure 3. Memory Buffer Register (MBR): It is a register, which contains the data to be written in the memory (write operation) or it receives the data from the memory (read operation). Program Counter (PC): It keeps track of the instruction that is to be executed next, that is, after the execution of an on-going instruction. Instruction Register (IR): Here the instructions are loaded prior to execution. Comments on figure 3 are as follows: • All representation are in decimals. (In actual machines the representations are in Binary). • The Number of Memory Locations = 16 • Size of each memory location = 16 bits = 2 Bytes (Compare with contemporary machines word size of 16,32, 64 bits) • Thus, size of this sample memory = 16 words (Compare it with actual memory) size, which is 128 MB, 256 MB, 512 MB, or more). • In the diagram MAR is pointing to location 10. • The last operation performed was “read memory location 10” which is 65 in this. Thus, the contents of MBR is also 65. Figure 3: CPU registers and their functions
  • 7. 11 The Basic Computer The role of PC and IR will be explained later. Now let us define several operation codes required for this machine, so that we can translate the High level language instructions to assembly/machine instructions. Operation Code Definition/Operation (please note that the address part in the Instruction format specifies the Location of the Operand on whom operation is to be performed LOAD as “Load the accumulator with the content of memory” STORE as “Store the current value of Accumulator in the memory” ADD as “Add the value from memory to the Accumulator” A sample machine instructions for the assumed system for line 5 that is c = a + b in the program would be: LOAD A ; Load the contents of memory location A to Accumulator register ADD B ; Add the contents of B to contents of Accumulator and store result in Accumulator. STORE C ; Store the content into location C Please note that a simple one line statement in ‘C’ program has been translated to three machine instructions as above. Please also note that these translated instructions are machine dependent. Now, how will these instructions execute? Let us assume that the above machine instructions are stored in three consecutive memory locations 1, 2 and 3 and the PC contains a value (1), which in turn is address of first of these instructions. (Please refer to figure 4 (a)). Figure 4: Memory and Registers Content on execution or the three given Consecutive Instructions (All notations in Decimals) Then the execution of the instructions will be as follows: Fetch First Instruction into CPU: Step 1: Find or calculate the address of the first instruction in memory: In this machine example, the next instruction address is contained in PC register. It contains 1, which is the address of first instruction to be executed. (figure 4 a). Step 2: Bring the binary instruction to IR register. This step requires: • Passing the content of PC to Memory Address Registers so that the instruction pointed to by PC is fetched. That is location 1’s content is fetched. • CPU issues “Memory read” operation, thus, brings contents of location pointed by MAR (1 in this case) to the MBR register. • Content of MBR is transferred to IR. In addition PC is incremented to point to next instruction in sequence (2 in this case).
  • 8. 12 Introduction to Digital Circuits Execute the Instruction Step 3: The IR has the instruction LOAD A, which is decoded as “Load the content of address A in the accumulator register”. Step 4: The address of operand that is 13, that is A, is transferred to MAR register. Step 5: The content of memory location (specified by MAR that is location 13) is transferred to MBR. Step 6: The content of MBR is transferred to Accumulator Register. Thus, the accumulator register is loaded with the content of location A, which is 5. Now the instruction 1 execution is complete, and the next instruction that is 2 (indicated by PC) is fetched and PC is incremented to 3. This instruction is ADD B, which instruct CPU to add the contents of memory location B to the accumulator. On execution of this instruction the accumulator will contain the sum of its earlier value that is A and the value
  • We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks