1 / 48

Subject Name: Computer Organization Subject Code: 10CS46 Prepared By: Vanshika Rastogi

so. Subject Name: Computer Organization Subject Code: 10CS46 Prepared By: Vanshika Rastogi Department: ISE. UNIT -1 Basic Structure of Computers, Machine Instructions and Programs. Computer Types. What is a computer?????

migueli
Download Presentation

Subject Name: Computer Organization Subject Code: 10CS46 Prepared By: Vanshika Rastogi

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. so Subject Name: Computer Organization Subject Code: 10CS46 Prepared By: Vanshika Rastogi Department: ISE

  2. UNIT -1 Basic Structure of Computers, Machine Instructions and Programs

  3. Computer Types • What is a computer????? • Computer is an electronic device that is designed to work with Information. The term computer is derivedfrom the Latin term ‘computer’, this means to calculate or programmable machine. • In other words, a contemporary computer is a fast electronic calculating machine that accepts digitized input information, processes it according to a list of internally stored instructions, and produces the resulting output information. • Computer can not do anything without a Program.  • The list of instructions is called a program. • The internal storage is called the memory.

  4. Different types of computers are available that differ in terms of size, cost, computational power and intended usage. • Personal computers, most commonly used in schools, home. It is a common form of • Desktop computers that has processing and storage units, VDU, audio units and keyboard. • Workstations have high resolution graphics I/O capability, have more power than personal computers. • Enterprise system or Mainframes are used for business data processing in medium to large corporations that require more storage capacity. • Supercomputers are used for large scale numerical calculations required in applications, such as weather-forecasting.

  5. Functional Units • Computer consists of five functionally independent units: input, memory, arithmetic and logic, output, control units. • Input unit accepts coded information from the user, through the electromechanical devices such as, keyboard. • This information received is either stored in the computer memory for later usage or is used immediately by the arithmetic and logic unit. • The processing steps are determined by a program that is stored in the memory. • Finally, at the end, the result is sent to the outside world through the output unit. • All this is coordinated by the control unit.

  6. Information is categorized as either instruction or data. • Instructions are explicit commands that, • Govern the transfer of information within a computer as well as between the computer and its i/o devices. • Specify the arithmetic and logic operations to be performed. • The program is also stored in the memory. • The processor fetches the instruction that makes the program from the memory, one after the other and perform the desired operations. • Data are numbers and encoded characters that are used as operands by the instructions. • Input Unit • Coded information is accepted through input units, that reads the data. • The most common example is keyboard. • Whenever a key is pressed on the keyboard, the letter is digitized and translated into corresponding binary code and transmitted over a cable to the memory or the processor.

  7. Memory Unit • The basic function is to store the programs and data. • It is divided into two parts: • Primary Storage: fast memory that operates electronic speeds. Programs should be stored in the memory before they are executed. Memory contains large number of semiconductor storage cells, each of which can store one bit of information.These cells are not processed individually, rather processed in a group of fixed size called word. • For easy access to any word, a unique address is assigned to each word location. Any word can then be accessed by just specifying the address and through the control command, the storage or retrieval process can be started. • Word length, is the number of bits in each word, it ranges from 16 bits to 64 bits. The capacity of the memory is one of the factors used for characterizing the size of a computer. • RAM (Random Access Memory), is the memory in which any location can be achieved in a short and fixed amount of time. This time is referred to as memory access time.

  8. Secondary Storage: is used when large amount of data and many programs have to be stored. It is non-volatile and persistent in nature and is not directly accessed by a computer/processor. It allows a user to store data that may be instantly and easily retrieved, transported and used by applications and services. • Secondary memory is slower than primary memory but can store and retain data, even if the computer is not connected to electrical power. It also has substantial storage capacities, ranging from some MBs to several TBs of storage space within single memory. • Arithmetic and Logic Unit • Most of the computer instructions are executed in the ALU of the processor. • For example, two numbers are there in the memory that has to be added or multiplied,they are brought into the processor but the actual operation is done by the ALU. When operands are brought into the processor they are stored in the high speed storage elements i.e. register. Each register is capable of storing one word of data. • The control unit and the arithmetic and logic units are faster than other devices that are connected to the computer.

  9. Output Unit • Its function is to send the processed result to the outside world. • Control Unit • The memory, arithmetic and logic, and input and output units store and process information and perform various operations. • The operations of all these units are coordinated by the Control Unit.

  10. Basic Operational Concepts • To perform a given task, an appropriate program is stored in the memory. • Individual instructions are brought into the processor from the memory for executing the specified operation. • Data that has to be used as operand is also stored in the memory. • For example, consider the instruction; • Add LOCA, R0 • This instruction says that add the operands at location A to the operands in register R0 and store the result back to R0. • Here, the content of Loc A remains unchanged but the content in R0 is overwritten. • This single instruction is carried out in several steps; • Firstly, the instruction is fetched from the memory into the processor. • Secondly, the operand from LOCA is fetched and added to the operands of R0. • Finally, the result is stored at R0.

  11. This can be summarized as; • Load LOCA, R1 • Add R1, R0 • The processor contains a number of registers that are used for different purposes. • The Instruction Register holds the instruction that is currently being executed. Its output is available to the control circuits that generate the timing signals which is used to control the various processing elements involved in executing the instruction. • The Program Counter keeps track of the execution of the program. It contains the memory address of the next instruction that has to be fetched from the memory and executed. Its content gets updated during the execution of an instruction. • There are two registers that are basically used for communication with the memory. • Memory Address Register holds the address of the locations that has to be accessed. • Memory Data Register holds the data that has to be written in or read out from the addressed location.

  12. Programs reside in the memory through input devices • PC is set to point to the first instruction • The contents of PC are transferred to MAR • A Read signal is sent to the memory • The first instruction is read out and loaded into MDR • The contents of MDR are transferred to IR • Decode and execute the instruction • If the instruction involves any operation to be performed by the ALU, it is required to obtain the operands. • If the operands are in the memory, they can be fetched by sending its address to the MAR and initiate a Read cycle. • When the operands have been read from the MDR, they can be transferred to the ALU for the operation

  13. Bus Structures • In order to achieve good speed of operations, all the units of computer are organized so that all units together can handle one full word of data at a given time. • When a word is transferred between units, all its bits are transferred parallel i.e. all bits are transferred on multiple wires, with one bit per wire. • A group of lines that serves as a connecting path for several devices is called a BUS. • In addition to lines carrying data, lines should be there to carry address and control signal also. • Simplest way to connect various functional units is to use single bus. • All units are connected to this Bus, since the bus can be used only for one transfer at a time, only two units can use it at a given time. • Main attractions for the single bus are its low cost and flexibility to attach peripheral devices. • A system that has more number of buses achieves more concurrency in operations as two or more transfers can be carried out at the same time. • As a result, performance improves and cost also increases.

  14. Different devices connected to bus have different speeds. • With each device, a buffer register is included to hold information during the transfer.

  15. Performance • We evaluate the performance of any system, by how quickly the system executes the problem. • Speed depends on the design of hardware and machine language instructions. • Since, programs are written in high-level language, so, compiler also plays an important role for the speed of the system. • Processor time depends on the hardware involved in the execution of an ordinary machine instruction. • For best results, design compiler, machine instructions and hardware in a coordinated way. • At the start of execution, all programs and required data is in the memory. • As the execution proceeds, they are fetched one by one over the bus into the processor and a copy is stored in the cache. • When the execution calls for any data in the memory, it is fetched and a copy of it is placed in the cache. • If the same instruction is called for the next time, the data is fetched from the cache rather than calling it from the processor. • The processor and a relatively small cache can be fabricated on a single integrated circuit chip.

  16. Processor Clock • Processor circuits are controlled by a timing signal called clock. • Clock defines regular intervals, called, clock cycles. • For execution, the instruction is divided into basic steps, so that each step is done in one clock cycle. • The length P of one clock cycle is an important parameter that affects the performance. • Its inverse is the clock rate; • R=1/P, measured in cycles per second(Hz) • Basic Performance Equation • T -> processor time required to execute a program • N ->no. of machine language instructions to be completed to assume the execution of the complete program. • S ->average number of steps to execute one machine instruction. • R ->clock rate, cycles per second Program execution time is; T=NXS R

  17. Pipelining and Superscalar Operation • Performance can be improved by overlapping the execution of successive instructions, through the use of a technique called, pipelining. • Consider the instruction; • Add R1, R2, R3 • It adds the contents of registers R1 and R2 and places the result into R3. • Contents of R1 and R2are transferred to the input of ALU, where addition is performed and the result is then transferred to R3. • Meantime, when the addition is carried out, the processor can read the next instruction. • If the next instruction also needs any operation, then its contents are also transferred to • the ALU while the result of the previous is getting transferred to the register. • For higher concurrency, multiple instruction pipelines are implemented in the processor. • Multiple functional units are used, creating parallel paths through which different instructions can be executed in parallel. • With such arrangement, it becomes possible to start the execution of several instructions in every clock cycle. • This mode of operation is called, superscalar execution.

  18. Clock Rate • Two ways to improve the clock rate, R; • Improve the IC technology, makes logic circuits faster, which reduces the time needed to complete a basic step. This results in reducing the clock period, P and increasing the clock rate, R. • Reduce the amount of processing done in one basic step. • Instruction Set: CISC and RISC • Simple instructions require a small number of basic steps to execute. • For a processor that has only simple instructions, a large number of instructions may be required to perform the given task. • This results large value for N and a small value for S. • These are called Reduced Instruction Set Computers (RISC). • If individual instruction performs complex operation, fewer instructions will be needed. • This will result in small value for N and large value for S. • These are called Complex Instruction Set Computers (CISC).

  19. . • Complier • A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processoruses. • Optimizing compilers reduces the NXS, total number of cycles needed to execute a program. • Performance Measurement • Computer’s performance can be measured using benchmark programs.

  20. Multiprocessors and Multicomputer • Large computer systems may contain a number of processor units, they are called multiprocessors. • These systems either execute multiple tasks parallel or subtasks of a given task in parallel. • Different systems can be interconnected, but they have access to their own memory. • When these systems need to communicate for some undergoing task, they communicate by passing messages over the communication network, thus called, message-passing multicomputer.

  21. Historical Perspective • The first generation(1945-55) • Program and data were stored in the same memory. • Assembly language was used to prepare programs and was translated into machine language for execution. • Vacuum tube technology was used. • The second generation(1955-65) • Transistors replaced vacuum tubes. • The third generation(1965-75) • IC’s were introduced (several transistors on a single chip) • The fourth generation(1975-present) • Complete processor on a single chip-VLSI.

  22. Numbers, Arithmetic Operations and Characters • Computers are built using logic circuits that operate on information represented by two valued electrical signals. • The two values are: 0 and 1, the amount of information represented by these signals is considered as bit of information, where a bit is a binary digit. • Number Representation • consider an n-bit vector • B=bn-1…….b1b0 • Where, bi=0 or 1for 0≤i≤n-1. This vector can represent unsigned integer values V in the range 0 to 2n-1, where • V (B) = bn-1X2n-1+………+b1X21+b0X20 • three systems to represent numbers • Sign and magnitude: negative (-ve) values are represented by changing the most significant bit in the B vector of the corresponding positive value.

  23. . • 1’s compliment: negative values are obtained by complementing each bit of the corresponding positive number.

  24. 2’s complement: subtracting that number from 2n, i.e. adding 1 to 1’s complement.

  25. Addition of positive numbers • Consider adding two 1-bit numbers. 0 1 0 1 + 0 + 0 + 1 + 1 0 1 1 10 Carry-out

  26. . • Addition and Subtraction of Signed Numbers • The 2’s complement system is the most efficient way for performing addition and subtraction. • To understand 2’s-complement arithmetic, consider addition modulo N. • Consider the case N=16, the operation (7+4) mod 16 will give 11. • To perform this graphically, locate 7 on the circle, and move 4 units in the clockwise direction, to arrive at the answer 11. • This representation works for the computation of any (a+b) mod 16 for any two positive numbers, a and b. FIG.1.6: Circle representation of integers mod N

  27. Fig 1.7: Mod16 system for 2’s-complement numbers • The rules governing the addition and subtraction of n-bit signed numbers using the 2’s-complement representation system: • To add two numbers add their n-bit representations, ignoring the carry-out signal from the most significant bit position. • To subtract two numbers X and Y, that is to perform X-Y, form the 2’s-complement of Y and then add it to X.

  28. Examples,

  29. Overflow in Integer Arithmetic • In 2’s complement number representation system, n bits can represent values in the range -2n-1 to +2n-1-1. • When the result of an arithmetic operation is outside the represent able range, an arithmetic overflow occurs. • Overflow can only occur when we try to add two numbers that have same sign. • The carry-out signal from the sign-bit position is not sufficient indicator of overflow when adding signed numbers. • Memory Locations and Addresses • Memory consists of million of storage cells, where each cell is capable of storing 1 bit of information. • Memory is organized in a way, so that a group of n bits can be stored and retrieved in a single, basic operation. • Each such group is referred to as a word and n is called the word length. • Today’s computers have word length ranging from 16 to 64 bits. • If the word length of a computer is 32 bits, then a single word can store 32-bit 2’s complement number.

  30. To access the memory to store or to retrieve a single item of information, either a word or byte requires either a name or an address for each item location. • Byte Addressability • A byte is equivalent to 8 bits and the word length varies from 16 to 64 bits. • It is not possible to assign address to individual bit; addresses are assigned to successive bytes in the memory.

  31. The term byte-addressable memory is used for assigning successive addresses to successive byte locations in the memory. • Byte locations have addresses 0, 1, 2, ….. • Thus, if the word length of the machine is 32 bits, successive words will be located at addresses 0, 4, 8, …., with each word of 4 bytes.

  32. Big-Endean and Little-Endean Assignments • There are two ways for assigning byte addresses can be assigned across words. • Big-endianis used for the most significant bytes of the word. • Little-endian is used when the lower byte addresses are used for the less significant bytes of the word.

  33. Word alignment • Words are said to align in memory, if they begin at a byte address that is a multiple of the number of bytes in the word. • If the word length is 16, aigned words begin at byte address0, 2, 4, ….and if it is 64, address will be 0, 8, 16, …. • Accessing Numbers, Characters and Character Strings • Numbers usually occupy one word. • They can be accessed by specifying the word address. • Beginning of a string is identified by giving the address of the byte containing its first character.

  34. GPS • TheGlobal Positioning System(GPS) is a space-basedsatellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. • The system provides critical capabilities to military, civil and commercial users around the world. It is maintained by the United States government and is freely accessible to anyone with aGPS receiver.

  35. Memory Operations • Program instructions and data operands get stored in the memory. • To execute any instruction, program control circuit must bring the word containing the instruction from the memory to the processor. • Two basic memory operations: • Load (fetch): transfers a copy of the content of the memory location to the processor. The memory contents remain unchanged. To start, processor sends the address of the desired location to the memory and requests to read that content. The memory reads that data and send it to the processor. • Store (write): transfers the information from the processor to the memory location. The former content of that location will be overwritten Processor sends the address of the desired location to the memory along with the data to be written on that location.

  36. Instruction and Instruction Sequencing • a computer must have instructions that supports 4 basic operations: • Data transfers between the memory and the processor registers. • Arithmetic and logic operations. • Program sequencing and control. • I/O transfers. • Register Transfer Notation • Information transfers from one location to the other. • Possible locations for such transfers are memory locations, processor registers, or registers in the I/O subsystem. • Example, memory locations can be named as; LOC, PLACE, VAR. • Processor registers may be named as; R0, R1. • I/O registers names may be; DATAIN, OUTSTATUS.

  37. Contents of location are denoted by putting square brackets around the name of the location. • R1 [LOC] • This means that the contents from the memory location LOC are transferred to the processor register R1. R3 [R1]+[R2] • This means that the contents of R1 and R2 are added and the result is transferred to the processor register R3.

  38. Assembly Language Notation • Another type of notation is needed to represent machine instructions and programs. • For this purpose, assembly-language format can be used. • Example, the instruction shown above, where content from LOC were transferred to R1 can be specified with the statement • Move LOC, R1 • similar way, adding the contents of R1 and R2 and storing them to R3, can be specified as, • Add R1, R2, R3 • Basic Instruction Types • The statement C=A+B, in a high-level language is a command to the computer to add two values in A and B and store the result into third variable C. • when the program is compiled, the three variables get stored at three distinct locations in memory. • The variable names then correspond to the memory location.

  39. The above expression requires the C [A]+[B] to take place. • Let’s assume that this instruction has to be computed within one machine instruction. • The three-address instruction can be represented as; • Add A, B, C • Here, operands A and B are called source operands and operand C is called the destination. • General format for this is: • Operation Source, Destination • An alternative way is to use only one or two operands. This is two-address mode. • Add A, B • This performs the operation [B] [A]+[B] • This can be achieved by even doing • Move B, C • Add A, C • Always source is described first, later destination. • Sometimes even two-address instructions will not fit into one word for usual word lengths and address sizes.

  40. Another option is to have machine instructions that specify only one operand. • When there is a need of the second operator, it is understood to be in a unique location. • A processor register called, accumulator, is used for this purpose. • Add A • This means that adds the contents of memory location A to the contents of accumulator register and place the result back to accumulator register. • Load A • It copies the content from memory location A to the accumulator register. • Store A • It copies the contents of accumulator register to the memory location A. • Let Ri be a general purpose register, the instructions • Load A, Ri • Store Ri, A • Add A, Ri • Is the generalization of the Load, Store and Add instructions for the single-accumulator case, in which register Ri performs the functions for the accumulator. • Instruction Move source, destination places a copy of the contents of source to the destination.

  41. Instruction Execution and Straight-Line Sequencing

  42. the figure above shows the execution for the task C [A] + [B] • Assume that the computer allows only one memory operand per instruction and has a number of processor registers. Also that the word length is 32 bits and memory is byte addressable. • The three instructions are at successive locations starting with i, i+4, i+8. • Now, lets see how this gets executed; • the processor contains a register called program counter(PC), that holds the address of the instruction to be executed next. • To start the execution, address of the first instruction that is at I should be there in PC. • Then the processor control circuits use the information in the PC to fetch and execute instruction at one time, in the increasing order, this is caleed straight-line sequencing. • During the execution of each instruction, the PC is incremented by 4 to point to the next instruction. • Executing a instruction is a two-phase process. • The first phase, called, instruction fetch, and the instruction is fetched from the memory, whose address is there in PC. This instruction is then placed in the instruction register (IR) in the processor. • The second phase, called, instruction execute, the instruction in IR is examined to find what operation has to be performed. • The specified operation is then performed by the processor.

  43. EXERCISE QUESTIONS • Explain the different functional units of a computer with a neat block diagram. • Write the basic performance equation. Explain the role of each of the parameters in the equation on the performance of the computer. • Explain the function of a processor register with a block diagram. • Show how the instruction C=A+B can be implemented in a single accumulator computer by (i) three-address instruction (ii) two-address instruction (iii) one-address instruction. • What is a bus? Explain single-bus and multiple bus structure used to interconnect functional units in a computer. • List the different systems used to represent a signed number and give one example for each. Specify which representation is preferred and why? • Perform the following operations on the 5-bit signed numbers using 2’s complement representation system. Also indicate whether overflow has occurred. • (-10) + (-13) • (-10) – (+4) • (-3) + (-8) • (-10) – (+7)

  44. Explain Big-Endian and Little-Endian methods of byte addressing, with proper examples. • List and explain the technological features and device improvement made during different generations of computers. • Write a program which evaluates the expression A*B+C*D in a single accumulator processor. Assume that the processor has load, store, multiply, and add instructions and all the values fit in the accumulator. • What is straight-line sequencing? Explain with an example.

More Related