COMPUTER ARCHITECTURES Himansu Shekhar Pradhan 1 WHAT IS COMPUTER ARCHITECTURE? Computer architecture refers to those parameters of a computer system that are visible to a programmer Or those parameters that have a direct impact on the logical execution of a program. Example: Instruction set, the number of bits used to represent different data types, I/O mechanisms and techniques for addressing memory. Technology Hardware Organization Parallelism Computer Architecture Execution & Evaluation PL Interface Interface Design OS 2 HISTORY OF COMPUTER EVOLUTION Before VLSI technology (1945-1978) ENIAC IAS IBM PDP-8 After VLSI technology (1979-till date) Microprocessors!!!! 3 EVOLUTION OF COMPUTER FIRST GENERATION (1945-1954) Program and data reside in the same memory (stored program concepts – John von Neumann) ALP was made used to write programs Vacuum tubes were used to implement the functions (ALU & CU design) Magnetic core and magnetic tape storage devices are used 4 EVOLUTION OF COMPUTER SECOND GENERATION (1955-1964) Transistor were used to design ALU & CU HLL was used (FORTRAN) To convert HLL to MLL compilers were used Separate I/O processors were developed to operate in parallel with CPU, thus improving the performance Invention of the transistor which was found so that it required considerably less power to operate 5 EVOLUTION OF COMPUTER THIRD GENERATION (1965-1974) IC technology improved Improved IC technology helped in designing low cost, high speed processor and memory modules Multiprogramming, pipelining concepts were incorporated DOS allowed efficient and coordinate operation of computer system with multiple users Cache and virtual memory concepts were developed More than one circuit on a single silicon chip became available 6 EVOLUTION OF COMPUTER FOURTH GENERATION (1975-1984) CPU – Termed as microprocessor INTEL, MOTOROLA, TEXAS, NATIONAL semiconductors started developing microprocessor Workstations, microprocessor (PC) & Notebook computers were developed Interconnection of different computer for better communication LAN,MAN,WAN Computational speed increased by 1000 times Specialized processors like Digital Signal Processor were also developed 7 EVOLUTION OF COMPUTER BEYOND FOURH GENERATION (1985 TO TILL DATE) E‐Commerce, E‐ banking, home office ARM, AMD, INTEL, MOTOROLA High speed processor ‐ GHz speed Because of submicron IC technology lot of added features in small size 8 TYPES OF COMPUTERS Computers are classified based on the following parameters Speed of operation Cost Computational power Type of application 9 TYPE OF COMPUTERS DESKTOP NOTEBOOK WORK STATIONS ENTERPRISE SYSTEM (MAINFRAME) SERVER SYSTEM SUPER COMPUTERS HANDHELD 10 DESKTOP COMPUTER Processing &storage units, visual display & audio units, keyboards Storage media‐Hard disks, CD‐ROMs Personal computers which is used in homes and offices Advantage: Cost effective, easy to operate, suitable for general purpose educational or business application 11 NOTEBOOK COMPUTER Compact form of personal computer (laptop) Advantage is portability (Types of application) 12 WORKSTATIONS More computational power than PC Costlier Used to solve complex problems which arises in engineering application (graphics, CAD/CAM etc) 13 ENTERPRISE SYSTEM (MAINFRAME) More computational power Larger storage capacity Used for business data processing in large organization Sometimes it can be used as servers or super computers 14 SERVER SYSTEM Supports large volumes of data which frequently need to be accessed or to be modified (Types of application) Supports request response operation 15 SUPER COMPUTERS Faster than mainframes Helps in calculating large scale numerical and algorithm calculation in short span of time Used for aircraft design and testing, military application and weather forecasting etc. 16 HANDHELD Also called a PDA (Personal Digital Assistant) A computer that fits into a pocket, runs on batteries, and is used while holding the unit in your hand Typically used as an appointment book, address book, calculator, and notepad (Types of application) Can be synchronized with a personal microcomputer as a backup 17 BASIC TERMINOLOGY Input – Whatever is put into a computer system. Data – Refers to the symbols that represent facts, objects, or ideas. Information – The results of the computer storing data as bits and bytes, the words, numbers, sounds, and graphics. Output – Consists of the processing results produced by a computer. Processing – Manipulation of the data in many ways. Memory – Area of the computer that temporarily holds data waiting to be processed, stored, or output. Storage – Area of the computer that holds data on a permanent basis when it is not immediately needed for processing. 18 BASIC TERMINOLOGY CONT. Assembly language program (ALP) – Programs are written using mnemonics Mnemonic – Instruction will be in the form of English Assembler – is a software which converts ALP to MLL (Machine Level Language) HLL (High Level Language) – Programs are written using English like statements Compiler- Convert HLL to MLL, does this job by reading source program at once 19 BASIC TERMINOLOGY CONT. Interpreter – Converts HLL to MLL, does this job statement by statement System software – Program routines which aid the user in the execution of programs eg: Assemblers, Compilers Operating system – Collection of routines responsible for controlling and coordinating all the activities in a computer system 20 COMPUTING SYSTEMS Computers have two kinds of components: Hardware, consisting of its physical devices (CPU, memory, bus, storage devices etc.) Software, consisting of the programs it has (Operating system, applications, utilities etc.) 21 FUNCTION IMPORTANT SLIDE ! The most important functions of computers are: Data PROCESSING Data STORAGE Data=Information Data MOVEMENT CONTROL Co-ordinate how the operations have been done NOTHING ELSE!!!!! 22 BASIC COMPUTER MODEL The model of a computer can be described by four basic units in high level abstraction. These basic units are: Central Processor Unit Input Unit I/O Output Unit Devices Memory Unit CPU O/P Devices Memory 23 CENTRAL PROCESSOR UNIT (CPU) Central processor unit consists of two basic blocks : The program control unit has a set of registers and control circuit to generate control signals The execution unit or data processing unit contains a set of registers for storing data and an Arithmetic and Logic Unit (ALU) for execution of arithmetic and logical operations In addition, CPU may have some additional registers for temporary storage of data 24 INPUT UNIT Data from outside can be supplied to the computer with the help of input unit Program or data is read into main storage or secondary storage from input device under the control of CPU input instruction Example of input devices: Keyboard, Mouse, Hard disk, Floppy disk, CD-ROM drive etc. 25 OUTPUT UNIT Computer results can be provided to the user or it can be stored in storage device permanently for future use with the help of output unit Output data from main storage go to output device under the control of CPU output instructions Example of output devices: Printer, Monitor, Hard Disk, Floppy Disk etc. 26 MEMORY UNIT Memory unit is used to store the data and program CPU can work with the information stored in memory unit This memory unit is termed as primary memory or main memory module These are basically semi conductor memories 27 MEMORY UNIT CONT. There are two types of semiconductor memories Volatile Memory: RAM (Random Access Memory) Non-Volatile Memory: ROM (Read only Memory) PROM (Programmable ROM) EPROM (Erasable PROM) EEPROM (Electrically Erasable PROM) 28 MEMORY UNIT CONT. Secondary Memory: Secondary memories are non-volatile memory it is used for permanent storage of data and program Example of secondary memories: Hard Disk, Floppy Disk, Magnetic Tape ------ These are magnetic devices CD-ROM ------ is optical device Thumb drive (or pen drive) ------ is semiconductor memory 29 MEMORY MEMORY HIERARCHY The memory unit is an essential component in any digital computer since it is needed for storing programs and data. Not all accumulated information is needed by the CPU at the same time Therefore, it is more economical to use low-cost storage devices to serve as a backup for storing the information that is not currently used by CPU MEMORY HIERARCHY Memory Hierarchy is a pyramid structure that is commonly used to illustrate the significant differences among memory types The memory unit that directly communicate with CPU is called the main memory Devices that provide backup storage are called auxiliary memory The memory hierarchy system consists of all storage devices employed in a computer system Slow but high-capacity----Auxiliary memory A relatively faster----Main memory A faster and smaller----Cache memory MEMORY HIERARCHY MAIN MEMORY Main memory in a general purpose computer is referred as RAM integrated circuits chips However, a portion of the memory may be constructed with ROM chips RAM– Random Access memory RAMs are available in two possible operating modes i.e. Static and Dynamic ROM– Read Only memory RAM A RAM chip has one or more control inputs that select the chip when needed Read/write memory The memory system used to store data at various locations and retrieve it later from these locations It has bidirectional data pins (data can flow into or out of the chip via these pins), unlike to ROM that it has output only It loses its data once the power is removed therefore, it is a volatile memory RANDOM ACCESS MEMORY TYPES Static RAM (SRAM) Each cell stores bit with a six-transistor circuit Retains value indefinitely, as long as it is kept powered Relatively insensitive to disturbances such as electrical noise. Faster and more expensive than DRAM. Dynamic RAM (DRAM) Each cell stores one bit with a capacitor and transistor. Value must be refreshed every 10-100 ms Sensitive to disturbances. Slower and cheaper than SRAM. PO IN DYNAMIC RAM (DRAM) PO IN DYNAMIC RAM (DRAM) DRAM Made with cells that store data as charge on capacitors Presence or absence of charge in a capacitor is interpreted as a binary 1 or 0 Requires periodic charge refreshing to maintain data storage The term dynamic refers to tendency of the stored charge to leak away, even with power continuously applied 38 PO IN STATIC RAM (SRAM) PO IN STATIC RAM (SRAM) SRAM SRAMs are simply integrated circuits that are memory arrays with (usually) a single access port that can provide either a read or a write SRAMs have a fixed access time to any datum, though the read and write access times may differ SRAMs don’t need to refresh and so the access time is very close to the cycle time SRAM needs only minimal power to retain the charge in standby mode 40 SRAM VERSUS DRAM Both volatile Power must be continuously supplied to the memory to preserve the bit values Dynamic cell Simpler to build and smaller More dense (smaller cells = more cells per unit area) Less expensive Requires the supporting refresh circuitry Tend to be favoured for large memory requirements Used for main memory Static Faster Used for cache memory (both on and off chip) ROM ROM is used for storing programs that are PERMANENTLY resident in the computer The tables of constant do not change it’s value once the production of the computer is completed The ROM portion of main memory is needed for storing an initial program called bootstrap loader Which is used to start the computer software operating when power is turned off ROM TYPES Masked ROM – programmed with its data when the chip is fabricated PROM – Programmable Read Only Memory: it can be programmed once as per user requirements EPROM – Erasable Programmable Read Only Memory: the contents of the memory can be erased and store new data into the memory. In this case, we have to erase whole information. EEPROM – Electrically Erasable Programmable Read Only Memory: in this type of memory the contents of a particular location can be changed without affecting the contents of other location. PHYSICAL MEMORY TYPES Memory Type Random-access memory (RAM) Read-only memory (ROM) Programmable ROM (PROM) Category Read-write memory Read-only memory Erasable PROM (EPROM) Electrically Erasable PROM (EEPROM) Flash memory Erasure Electrically, byte-level Write Mechanism Electrically Volatile Masks Not possible UV light, chiplevel Read-mostly memory Volatility Electrically, byte-level Electrically, block-level Nonvolatile Electrically PROGRAMMABLE ROM (PROM) Less expensive alternative Nonvolatile and may be written into only once Writing process may be performed by supplier or customer at a time later than the original chip fabrication Special equipment is required for the writing process Provides flexibility and convenience Attractive for high volume production runs READ-MOSTLY MEMORY EPROM EEPROM Erasable programmable read-only memory Electrically erasable programmable readonly memory Erasure process can be performed repeatedly More expensive than PROM but it has the advantage of the multiple update capability Can be written into at any time without erasing prior contents Combines the advantage of non-volatility with the flexibility of being updatable in place More expensive than EPROM Flash Memory Intermediate between EPROM and EEPROM in both cost and functionality Uses an electrical erasing technology, does not provide bytelevel erasure Microchip is organized so that a section of memory cells are erased in a single action or “flash” WHY CACHE MEMORY? Analysis of large number of programs has shown that a number of instructions are executed repeatedly This may be in the form of simple loops, nested loops, or a few procedures that repeatedly call each other Many instructions in each of a few localized areas of the program are repeatedly executed, while the other area of the program is accessed relatively less This phenomenon is referred to as locality of reference 47 WHY CACHE MEMORY? CPU is a faster device and memory is a relatively slower device Memory access is the main bottleneck for the performance efficiency To make this arrangement effective, the cache must be considerably faster than the main memory Typically it is 5 to 10 time faster than the main memory This approach is more economical than the use of fast memory device to implement the entire main memory This is also a feasible due to the locality of reference 48 CACHE MEMORY ❑Cache memory is a small, high-speed RAM buffer located between the CPU and main memory. ❑Cache memory holds a copy of the instructions (instruction cache) or data (operand or data cache) currently being used by the CPU. ❑The main purpose of a cache is to accelerate your computer while keeping the price of the computer low. PLACEMENT OF CACHE IN COMPUTER OPERATION OF CACHE MEMORY The memory control circuitry is designed to take advantage of the property of locality of reference Some assumptions are made while designing the memory control circuitry: 1. The CPU does not need to know explicitly about the existence of the cache. 2. The CPU simply makes Read and Write request. The nature of these two operations is same whether cache is present or not 3. The address generated by the CPU always refers to location of main memory. 4. The memory access control circuitry determines whether or not the requested word currently exists in the cache. 51 OPERATION OF CACHE MEMORY When a Read request is received from the CPU, the contents of a block of memory words containing the location specified are transferred into the cache When any of the locations in this block is referenced by the program, its contents are read directly from the cache The cache memory can store a number of such blocks at any given time 52 OPERATION OF CACHE MEMORY When a write request is received from the CPU, there is a way that the system can proceed In this process, the cache location and the main memory location are updated simultaneously The correspondence between the Main Memory Blocks and those in the cache is specified by means of a mapping function 53 TYPES OF CACHE MAPPING Direct mapping: A particular block of main memory can be brought to a particular block of cache memory. So, it is not flexible. Associative mapping: In this mapping function, any block of Main memory can potentially reside in any cache block position. This is much more flexible mapping method. Block-set-associative mapping: In this method, blocks of cache are grouped into sets, and the mapping allows a block of main memory to reside in any block of a specific set. From the flexibility point of view, it is in between to the other two methods. DIRECT MAPPING The direct mapping technique is simple and inexpensive to implement. When the CPU wants to access data from memory, it places a address. The index field of CPU address is used to access address. The tag field of CPU address is compared with the associated tag in the word read from the cache. If the tag-bits of CPU address is matched with the tag-bits of cache, then there is a hit and the required data word is read from cache. If there is no match, then there is a miss and the required data word is stored in main memory. It is then transferred from main memory to cache memory with the new tag. DIRECT MAPPING Example: Consider a cache of 4096 (4K) words with a block size of 32 words. Therefore, the cache is organized as 128 blocks. For 4K words, required address lines are 12 bits. To select one of the blocks out of 128 blocks, we need 7 bits of address lines and to select one word out of 32 words, we need 5 bits of address lines. So the total 12 bits of address is divided for two groups, lower 5 bits are used to select a word within a block, and higher 7 bits of address are used to select any block of cache memory. 56 DIRECT MAPPING Example: Let us consider a main memory system consisting 64K words. The size of address bus=16 bits Since the block size of cache is 32 words, so the main memory is also organized as block size of 32 words Therefore, the total number of blocks in main memory is 2048 (2K x 32 words = 64K words) To identify any one block of 2K blocks, we need 11 address lines Out of 16 address lines of main memory, lower 5 bits are used to select a word within a block and higher 11 bits are used to select a block out of 2048 blocks 57 DIRECT MAPPING DIRECT MAPPING