COMPURT ORGANAZTION CHAPTER 5 Computer Organization We can divide the parts that make up a computer into 3 subsystems : 1. Central processing unit (CPU). 2. Main Memory. 3. Input / output subsystem. Computer System Component Computer System Central processing Unit (CPU) Memory Input\output systems 5.1 CENTRAL PROCESSING UNIT (CPU) Central processing unit (cpu) Central processing Unit (CPU) Arithmetic Logic Unit (ALU) Logic Operations NOT, AND, OR, XOR Shift Operations Logical shift operations, arithmetic shift operations Arithmetic Operations Data Registers R1,R2….Rn Registers Control Unit Instruction Registers Program Counter Registers Fast stand –alone storage locations that holds data temporarily. Data registers holds the input and the result of operations Computers use dozens of registers inside the CPU to speed up their operations Complex operations done using hardware instead of software Data registers are named R1,R2,….Rn Instruction The registers CPU Responsible for fetching instructions one by one from memory, storing them in the instruction registers, decoding them and executing them Program Counter Keep track of the instructions currently being executed The counter is incremented to point to the address of the next instruction in the memory, after the execution of the instruction The Control Unit Controls the operations of each subsystem Controlling subsystem is achieved through signals sent from it to other Computer System Component Computer System Central processing Unit (CPU) Memory Input\output systems 5.2 MAIN MEMORY Main Memory Main memory Consists of collection of storage locations, each with a unique identifier called an address Main Memory Data is transferred to and from memory in groups of bits called words. A word can be a group of 8 bits, 16 bits, 32 bits or 64 bits (and growing). If the word is 8 bits, it is referred to as a byte 16-bit word is referred to as a 2-byte word 32-bit word is referred to as a 4-byte word Address space each word is identified by an address. The total number of uniquely identifiable locations in memory is called the address space. For example, a memory with 64 kilobytes and a word size of 1 byte has an address space that ranges from 0 to 65,535. Address space Note: this is an approximation of number of bytes in the power of 10, but the actual number of bytes is in power of 2 to facilitate addressing. Address space Because computers store numbers as bit patterns, memory address also represented as a bit pattern. 216= 65535 • Computer with 64 kilobytes (216) of memory and a word size of 1 byte To define an address • We need a bit pattern of 16 bits • First memory address: Address 0: 0000000000000000 • Last memory address: Address 65535:1111111111111111 N words of memory needs log2 bits for addressing Memory addresses are defined using unsigned binary integers. Address space - Example 5.1 A computer has 32 MB (megabytes) of memory. How many bits are needed to address any single byte in memory? Answer: The memory address space is , or 225 (25 × 220). This means that we need log2 225, or 25 bits, to address each byte. Address space - Example 5.2 A computer has 128 MB of memory. Each word in this computer is eight bytes. How many bits are needed to address any single word in memory? Answer: The memory address space is , which means 227. However, each word is eight (23) bytes, which means that we have 224 words. This means that we need log2 224, or 24 bits, to address each word. Memory types Memory types RAM SRAM Static RAM ROM DRAM Dynamic RAM PROM Program mable read-only memory EPROM Erasable program mable read-only memory EEPROM Electricall y erasable program mable read-only memory RAM Most up of main memory Data item can access randomly Can be read from and written to Volatile Two categories: SRAM Use traditional flip –flop gates to hold data It holds their state (0,1)(means data stored as long as the power is on and no need to refresh memory location Fast and expensive DRAM Use capacitors, that store energy for data storage Need to be refreshed periodically Slow and inexpensive ROM Written by the manufacturer CPU can read from but not write Nonvolatile Ex: boot program PROM (programmable read only memory) Blank when the computer is shipped The user with special equipment can store programs on it Can not be overwritten EPROM (Erasable programmable read only memory) Can be programmed by the user and can be erased with special device using ultraviolet Require physical removal and reinstallation EEPROM Can (Electronically EPROM) be programmed and erased using elec Memory hierarchy Computer users need a lot of memory, especially memory that is very fast and inexpensive. This demand is not always possible to satisfy—very fast memory is usually not cheap. A compromise needs to be made. The solution is hierarchical levels of memory. Cache memory Cache memory is faster than main memory, but slower than the CPU and its registers. Cache memory, which is normally small in size, is placed between the CPU and main memory. Cache memory It contains a copy of a portion of main memory. When CPU needs to access a word in main memory, it follows this procedure: 1 2 3 • The CPU checks the cache. • If the word is there, it copies the word: if not, the CPU accesses the main memory and copies a block of memory starting with the desired word. This block replaces the previous content of cache memory. • The CPU access the cache and copies the word. 5.2 INPUT / OUTPUT SUBSYSTEMS Input / Output subsystems This subsystem allows a computer to communicate with the outside world and to store programs and data even when the power is off. Input/output devices can be divided into two broad categories: Non-storage devices: they cannot store information. Storage devices: they can store large amounts of information to be retrieved at a later time. They are cheaper than main memory, and their contents are nonvolatile (not erased when the power is turned off). Input / Output subsystems Input / Output subsystems Non-storage devices Keyboa rd and monitor Printer Storage devices Optical Magnetic Magnetic disk Magnetic tapes CD ROM CD-R CD- RW DVD Magnetic Storage devices Magnetic disk: Magnetic Storage devices Magnetic tape