Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Transcript

COMPUTER ORGANIZATION AND ARCHITECTURE 1 Course Code : CSE 2151 Credits : 04 COURSE OBJECTIVES This course will enable students to ▪ Summarize the fundamental concepts of the organization and architecture of a computer. ▪ Analyze taxonomy of Execution, Processor, Memo...

COMPUTER ORGANIZATION AND ARCHITECTURE 1 Course Code : CSE 2151 Credits : 04 COURSE OBJECTIVES This course will enable students to ▪ Summarize the fundamental concepts of the organization and architecture of a computer. ▪ Analyze taxonomy of Execution, Processor, Memory and I/O Units. ▪ Explain the pipelining principles, Data dependencies and hazards, SIMD and Multiprocessor concepts. 2 COURSE MODULES 1. Basic structure of computers 2. Instruction set architecture 3. Arithmetic and logic unit 4. Control unit 5. Memory systems 6. Input/output organization 7. Introduction to parallel architecture 3 COURSE OUTCOMES No. of At the end of this course, the student should be able to: Hours Describe the functionalities of the various units of computers and the CO1 10 instruction set architecture. Appreciate the hardware implementation of addition, subtraction, CO2 7 multiplication, and division and perform arithmetic operations. CO3 Design the control unit for simple algorithms. 10 Explain basics of memory system such as cache memories, mapping CO4 functions, replacement algorithms and virtual memory concept and 10 design simple memory systems. Outline the I/O handling techniques and realize the improvement in CO5 11 performance using the concepts of pipelining and parallel processing. Total hours/ Marks 48 4 TEXTBOOKS AND REFERENCE BOOKS Textbooks: 1. Carl Hamacher, ZvonkoVranesic and SafwatZaky, Computer Organization and Embedded Systems, (6e), McGraw Hill Publication, 2012. 2. William Stallings, Computer Organization and Architecture – Designing for Performance, (9e), PHI, 2015. 3. Mohammed Rafiquzzaman and Rajan Chandra, Modern Computer Architecture, Galgotia Publications Pvt. Ltd., 2010. Reference Books: 1. D.A. Patterson and J. L. Hennessy, Computer Organization and Design-The Hardware/Software Interface, (5e), Morgan Kaufmann, 2014. 2. J. P. Hayes, Computer Architecture and Organization, McGraw Hill Publication, 1998. 5 INTRODUCTION ▪ What is Computer Organization and Architecture? 6 WHAT IS COMPUTER ORGANIZATION? Computer Organization ▪ Computer organization refers to the way a computer's hardware components are structured and how they work together to perform tasks. It involves understanding the different parts of a computer system and how they interact to execute instructions and process data. ▪ It explains the function and design of the various units of digital computers that store and process information. ▪ It also deals with the input units of the computer which receive information from external sources and the output units which send computed results to external destinations. Program ▪ The input, storage, processing, and output operations are governed by a list of instructions that constitute a program. Computer hardware and computer architecture ▪ Computer hardware consists of electronic circuits, magnetic and optical storage devices, displays, electromechanical devices, and communication facilities. ▪ Computer architecture encompasses the specification of an instruction set and the functional behavior of the hardware units that implement the instructions. It is important to consider both hardware and software aspects of the design of the various computer components in order to gain a good understanding of computer systems. Department of Computer Science and Engineering 30-07-2024 7 INTRODUCTION ▪ Computer Architecture: refers to those attributes of a system visible to a programmer or those attributes that have a direct impact on the logical execution of a program. ▪ Example: instruction sets, the number of bits used to represent various datatypes, I/O mechanisms and techniques for addressing memory. ▪ Computer Organization: refers to the operational units and their interconnections that realize the architectural specifications. ▪ Example: hardware details transparent to the programmer, such as control signals, interfaces between the computer and the peripherals; and the memory technology used. 8 BASIC STRUCTURE OF COMPUTERS The different types of computers The basic structure of a computer and its operation Machine instructions and their execution Number and character representations Addition and subtraction of binary numbers MODULE 1 TYPES OF COMPUTERS 1. Embedded computers 2. Personal computers 3. Servers and Enterprise systems 4. Supercomputers and Grid computers 10 TYPES OF COMPUTERS ▪ Embedded computers ▪ Integrated into a larger device or system in order to automatically monitor and control a physical process or environment. ▪ Used for a specific purpose. ▪ Applications include industrial and home automation, appliances, telecommunication products, and vehicles 11 TYPES OF COMPUTERS ▪ Personal computers ▪ Primarily for dedicated individual use. ▪ Types of personal computers i. Desktop computers ii. Workstation computers iii. Portable and Notebook computers ▪ Applications include general computation, document preparation, computer-aided design, audiovisual entertainment, interpersonal communication, and Internet browsing 12 TYPES OF COMPUTERS ▪ Servers and Enterprise systems ▪ Large computers shared by many users through personal computer over a public or private network. ▪ May host large databases and provide information processing for a government agency or a commercial organization. 13 TYPES OF COMPUTERS ▪ Supercomputers and Grid computers ▪ Offer the highest performance ▪ Most expensive and physically the largest category of computers. ▪ Supercomputer ▪ High-cost systems. ▪ Performance of a supercomputer is measured in floating-point operations per second (FLOPS) instead of million instructions per second (MIPS) ▪ Applications include high demanding computation systems such as weather forecasting, engineering design and simulation, and scientific work. 14 TYPES OF COMPUTERS ▪ Supercomputers and Grid computers ▪ Grid computers ▪ More cost-effective alternative ▪ A grid of large number of personal computers and disk storage units are created using a physically distributed high-speed network, which is managed as a coordinated computing resource. ▪ The computational workload is distributed across the grid to achieve high performance on large applications ranging from numerical computation to information searching. 15 TYPES OF COMPUTERS ▪ Cloud Computing ▪ Distributed computing and storage server resources for individual, independent, computing need accessed via personal computers. ▪ Communication facility via internet. ▪ Cloud hardware and software service providers operate as a utility and charge on a pay-as-you-use basis. 16 TYPES OF COMPUTERS 1. Embedded computers 2. Personal computers 3. Servers and Enterprise systems 4. Supercomputers and Grid computers ▪ Cloud Computing 17 FUNCTIONAL UNITS ▪ Input Arithmetic Input and Logic ▪ Output Interconnection ▪ Memory Network Output Control ▪ Arithmetic and Logic Unit I/O Processor ▪ Control Unit Memory 18 HOW DOES THE COMPUTER HANDLE INFORMATION? ▪ 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 ▪ A program is ▪ a list of instructions which performs a task. ▪ stored in the memory. ▪ Data are ▪ numbers and characters that are used as operands by the instructions. ▪ stored in the memory. ▪ Instructions and data are encoded in binary format (0 and 1) 19 INPUT UNIT ▪ Keyboard ▪ Whenever a key is pressed, the corresponding letter or digit is automatically translated into its corresponding binary code and transmitted to the processor ▪ Graphic input ▪ touchpad, mouse, joystick, and trackball. ▪ Audio and Video input ▪ The audio input captured by microphones and video input captured by camera are sampled and converted into digital codes for storage and processing. ▪ Digital communication facility: Internet ▪ provides input to a computer from other computers and database servers. 20 OUTPUT UNIT ▪ send processed results to the outside world. ▪ Graphic display ▪ Printers ▪ Audio output: Speakers, headphones 21 MEMORY UNIT ▪ Store programs and data ▪ Two classes of storage ▪ Primary memory or main memory ▪ Secondary Storage 22 MEMORY UNIT Primary Memory ▪ Fast memory ▪ Programs are stored in this memory while being executed ▪ Large number of semiconductor storage cells capable of storing one bit of information ▪ Word refers to the basic unit of data that can be read from or written to memory in a single operation. A word typically represents a fixed-sized group of binary digits (bits) that the computer's architecture can process as a single entity. The size of a word can vary depending on the computer system and its architecture. ▪ Words: groups of cells, fixed size. ▪ Word length of the computer: number of bits in each word -16, 32, or 64 bits. ▪ Address: associated with each word location. Consecutive numbers, starting from 0, that identify successive locations. ▪ Random-access memory (RAM): A memory in which any location can be accessed in a short and fixed amount of time after specifying its address ▪ Memory access time: The time required to access one word. This time is independent of the location of the word being accessed. Typically ranges from a few nanoseconds (ns) to about 100 ns. 23 MEMORY UNIT ▪ Primary Memory ▪ All programs stored in the secondary memory must be loaded from secondary memory to primary memory (RAM) before its execution. ▪ The data is then transferred to the cache, a smaller, faster RAM unit, for fast retrieval of instructions to the CPU Source: https://gfycat.com/contentmeanacornbarnacle 24 MEMORY UNIT ▪ Cache Memory ▪ Used to hold sections of a program that are currently being executed, along with any associated data ▪ is tightly coupled with the processor and is usually contained on the same integrated-circuit chip ▪ facilitates high instruction execution rates 25 MEMORY UNIT ▪ Cache Memory ▪ At the start of program execution, the cache is empty. ▪ As execution proceeds, instructions are fetched into the processor chip, and a copy of each is placed in the cache. ▪ Suppose several instructions are executed repeatedly as happens in a program loop and these instructions are available in the cache, they can be fetched quickly during the period of repeated use. ▪ Similarly, if the same data locations are accessed repeatedly while copies of their contents are available in the cache, they can be fetched quickly. Source: https://gfycat.com/fluidcheapkitty 26 MEMORY UNIT ▪ Secondary Memory ▪ used when large amounts of data and many programs must be stored, particularly for information that is accessed infrequently. ▪ Access times for secondary storage are longer than for primary memory. ▪ magnetic disks, optical disks (DVD and CD), and flash memory devices. ▪ Memory Hierarchy ▪ Secondary > Primary > Cache (storage) ▪ Secondary < Primary < Cache (speed and cost) 27 ARITHMETIC & LOGIC UNIT ▪ Most computer operations are executed in ALU of the processor. ▪ Load the operands into memory – bring them to the processor – perform operation in ALU – store the result back to memory or retain in the processor. ▪ Registers-high-speed storage elements-store one word of data ▪ Fast control of ALU 28 CONTROL UNIT ▪ All computer operations are controlled by the control unit. ▪ The timing signals that govern the I/O transfers are also generated by the control unit. ▪ Control unit is usually distributed throughout the machine instead of standing alone. ▪ The control unit is effectively the nerve center that sends control signals to other units and senses their states. ▪ I/O transfers, consisting of input and output operations, are controlled by program instructions that identify the devices involved and the information to be transferred. ▪ Control circuits are responsible for generating the timing signals that govern the transfers and determine when a given action is to take place. ▪ Data transfers between the processor and the memory are also managed by the control unit through timing signals. 29 OPERATIONS OF A COMPUTER ▪ Accept information in the form of programs and data through an input unit and store it in the memory ▪ Fetch the information stored in the memory, under program control, into an ALU, where it is then processed ▪ Output the processed information through an output unit ▪ All activities inside the machine are controlled through a control unit 30 BASIC OPERATIONAL CONCEPTS ▪ A typical instruction set: ▪ Load R2, LOC ▪ Add R4, R2, R3 ▪ Store R4, LOC ▪ Load R2, LOC ▪ reads the contents of a memory location with address represented as LOC and loads them into processor register R2 Syntax: LOAD destination_register, source_address Execution of this instruction requires several steps. 1. First, the instruction is fetched from the memory into the processor. 2. Next, the operation to be performed is determined by the control unit. 3. The operand at LOC is then fetched from the memory into the processor. 4. Finally, the operand is stored in register R2. After operands have been loaded from memory into processor registers, arithmetic or logic operations can be performed on them. 31 ▪ Add R4, R2, R3 ▪ adds the contents of registers R2 and R3 and stores the result in R4 Add R4, R2, R3 Syntax : ADD destination_register, source_register1, source_register2 ▪ Adds the contents of registers R2 and R3, then places their sum into register R4. ▪ The operands in R2 and R3 are not altered, but the previous value in R4 is overwritten by the sum. ▪ After completing the desired operations, the results are in processor registers. ▪ They can be transferred to the memory using instructions such as, Store R4, LOC - copies the operand in register R4 to memory location LOC Syntax: STORE source_register, destination_address ▪ This instruction copies the operand in register R4 to memory location LOC. ▪ The original contents of location LOC are overwritten, but those of R4 are preserved. 32 CONNECTION BETWEEN THE PROCESSOR AND THE MEMORY For Load and Store instructions, transfers between the memory and the processor are initiated by sending the address of the desired memory location to the memory unit and asserting the appropriate control signals. The data are then transferred to or from the memory. Figure 1.2 shows how the memory, and the processor can be connected. In addition to the ALU and the control circuitry (the control circuit is a part of the control unit, which is a crucial component of a computer's CPU) , the processor contains a number of registers used for several different purposes. 33 REGISTERS ▪ Instruction register (IR) ▪ holds the instruction that is currently being executed. Its output is available to the control circuits, which generate the timing signals that control the various processing elements involved in executing the instruction ▪ Program counter (PC) ▪ points to the next instruction that is to be fetched from the memory ▪ When a computer system starts executing a program, the Program Counter is initialized with the memory address of the first instruction. After each instruction is fetched and executed, the Program Counter is incremented to point to the next instruction in memory. This process continues until the program is completed or a branching instruction is encountered. ▪ General-purpose register ▪ R0 – Rn-1 ▪ Holds operands that have been loaded from the memory for processing 34 GENERAL PURPOSE REGISTERS General-purpose registers R0 through Rn−1, often called processor registers. They serve a variety of functions, including holding operands that have been loaded from the memory for processing. General Purpose Registers are versatile and can be used for a wide range of purposes. They can store data, addresses, function return values, intermediate results, loop counters, and more, depending on the requirements of the program being executed. Data Storage: GPRs are primarily used to store data temporarily during the execution of instructions. They provide a fast and efficient way to access data that is frequently used or manipulated within the CPU. Operand Storage: GPRs hold operands for arithmetic and logical operations performed by the arithmetic logic unit (ALU). They can store data in various formats, such as integers, floating-point numbers, characters, or memory addresses. 35 PROCESSOR-MEMORY INTERFACE ▪ It is a circuit which manages the transfer of data between the main memory and the processor. ▪ If a word is to be read from the memory, the interface sends the address of that word to the memory along with a Read control signal. ▪ The interface waits for the word to be retrieved, then transfers it to the appropriate processor register. ▪ If a word is to be written into memory, the interface transfers both the address and the word to the memory along with a Write control signal. 36 TYPICAL OPERATING STEPS ▪ Programs to be executed must be in main memory ▪ PC is set to point to the first instruction ▪ The contents of PC are transferred to memory along with a Read control signal ▪ The first instruction read out is transferred to IR ▪ The instruction is ready to be decoded and executed ▪ Get operands for ALU ▪ Memory ▪ General-purpose register ▪ Perform operation in ALU ▪ Store the result back ▪ To general-purpose register ▪ To memory ▪ During the execution, PC is incremented to the next Fig. Data flow- Fetch cycle instruction 37 INTERRUPTS ▪ Normal execution of programs may be preempted if some device requires urgent servicing. ▪ The normal execution of the current program must be interrupted – the device raises an interrupt signal. ▪ Interrupt-service routine ▪ Current system information backup and restore (PC, general-purpose registers, control information, specific information) 38 EXERCISE ▪ List the steps needed to execute the machine instruction Load R2, LOC ▪ Solution: ▪ Send the address of the instruction word from register PC to the memory and issue a Read control command. ▪ Wait until the requested word has been retrieved from the memory ▪ load it into register IR, where it is interpreted (decoded) by the control circuitry to determine the operation to be performed. ▪ Increment the contents of register PC to point to the next instruction in memory. ▪ Send the address value LOC from the instruction in register IR to the memory and issue a Read control command. ▪ Wait until the requested word has been retrieved from the memory, then load it into register R2 39 EXERCISE ▪ Repeat for i. Add R4, R2, R3 Solution: ▪ Send the address of the instruction word from register PC to the memory and issue a Read control command. ▪ Wait until the requested word has been retrieved from the memory ▪ load it into register IR, where it is interpreted (decoded) by the control circuitry to determine the operation to be performed. ▪ Increment the contents of register PC to point to the next instruction in memory. ▪ Transfer contents of R1 and R2 to the ALU ▪ Perform addition of two operands in the ALU and transfer answer into R3 40 EXERCISE ▪ Give a short sequence of machine instructions for the task ▪ Add the contents of memory location A to those of location B, and place the answer in location C ▪ Following instructions are the only instructions available to transfer data between the memory and the general-purpose registers. ▪ Load Ri, LOC ▪ Store Ri, LOC ▪ Do not change the contents of either location A or B. ▪ Solution: ▪ Load R3, A ▪ Load R4, B ▪ Add R5, R3, R4 ▪ Store R5, C 41 Repeat for ▪ Store R4, LOC 42 TOPICS COVERED FROM ▪ Textbook 1: ▪ Chapter 1: 1.1, 1.2, 1.3 43 NUMBER REPRESENTATION AND ARITHMETIC OPERATIONS ▪ Number representation ▪ Decimal number system: ▪ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ▪ Each digit has a position value in terms of powers of 10 ▪ 123= 1 * 102 + 2 * 101 + 3 * 100 ▪ Binary number system ▪ 0, 1 ▪ Each digit has a position value in terms of powers of 2 ▪ 101= 1 * 22 + 0 * 21 + 1 * 20 ▪ n-bit vector B = bn−1... b1b0, ▪ where bi = 0 or 1 for 0 ≤ i ≤ n − 1 ▪ unsigned integer value V(B) in the range 0 to 2n − 1, where ▪ V(B) = bn−1 × 2n−1 +· · ·+b1 × 21 + b0 × 20 44 INTEGER ▪ Unsigned integer ▪ If the integers are represented using 4 bit ▪ 0(10) in binary? 0000 ▪ 15(10) in binary? 1111 = 1 * 23 + 1 * 22 + 1 * 21 + 1 * 20 ▪ Signed integer 45 INTEGER ▪ Unsigned integer ▪ If the integers are represented using 4 bit ▪ 0(10) in binary? 0000 ▪ 15(10) in binary? 1111 = 1 * 23 + 1 * 22 + 1 * 21 + 1 * 20 ▪ Signed integer ▪ Sign and magnitude ▪ One’s complement ▪ Two’s complement ▪ In all three systems, ▪ the positive numbers have the same bit representation ▪ the negative numbers have different bit representation ▪ positive numbers - the leftmost bit is 0 ▪ negative numbers- the leftmost bit is 1 46 SIGNED INTEGER: SIGN AND MAGNITUDE ▪ Negative values - most significant bit of the Positive Value b3 b2b1b0 b3 b2b1b0 Negative Value corresponding positive value changed from 0 to 1 1111 -7 +7 0111 ▪ Sign- MSB +6 0110 1110 -6 ▪ Magnitude (or number)- remaining bits +5 0101 1101 -5 ▪ 0 represented as positive and negative +4 0100 1100 -4 +3 0011 1011 -3 +2 0010 1010 -2 +1 0001 1001 -1 +0 0000 1000 -0 47 SIGNED INTEGER: ONE’S COMPLEMENT ▪ Negative values - complementing each bit in Positive Value b3 b2b1b0 b3 b2b1b0 Negative Value the corresponding positive value +7 0111 1000 -7 ▪ Negative to positive- complementing each bit 1001 -6 +6 0110 in the corresponding negative value +6 0110 +5 0101 1010 -5 -6 1001 +4 0100 1011 -4 ▪ For n-bit numbers, this operation is equivalent +3 0011 1100 -3 to subtracting the number from 2n − 1. +2 0010 1101 -2 ▪ Example: +6 to -6 in a 4-bit representation +1 0001 1110 -1 ▪ 2n-1 =15 1111 +6 0110 +0 0000 1111 -0 -6 1001 ▪ 0 represented as positive and negative 48 SIGNED INTEGER: TWO’S COMPLEMENT ▪ Negative values - adding 1 to the 1’s- Positive Value b3 b2b1b0 b3 b2b1b0 Negative Value complement of corresponding positive value +7 0111 1000 -8 ▪ Example: +6 to -6 in a 4-bit representation 1001 -7 +6 0110 ▪ 2n-1 =15 1111 +5 0101 1010 -6 +6 0110 conversion using 1001 1’s complement +4 0100 1011 -5 +1 0001 1100 -4 +3 0011 -6 1010 +2 0010 1101 -3 ▪ For n-bit numbers, this operation is equivalent 1110 -2 to subtracting the number from 2n. +1 0001 1111 -1 ▪ Example: +6 to -6 in a 4-bit representation +0 0000 ▪ 2n 10000 +6 00110 -6 01010 ▪ 0 represented as positive 50 SIGNED INTEGER: TWO’S COMPLEMENT ▪ 4 bits: -8 to +7 -24-1 to +24-1-1 ▪ 5 bits: -16 to +15 -25-1 to +25-1-1 ▪ 6 bits: -32 to +31 -26-1 to +26-1-1 ▪ n bits: -2n−1 to +2n−1 − 1 51 SIGNED INTEGERS ▪ For 4-bit numbers, the value −8 is representable in the 2’s-complement system but not in the other systems. ▪ Sign-and-magnitude system seems the most natural ▪ 1’s-complement system is easily related to this system ▪ 2’s-complement appears unusual. ▪ However, it leads to the most efficient way to carry out addition and subtraction operations. ▪ It is the one most often used system in modern computers. 52 UNSIGNED INTEGERS: OPERATIONS ▪ #include using namespace std; int main() { unsigned short x=65535, y=65537; cout

Tags

computer organization computer architecture hardware information technology
Use Quizgecko on...
Browser
Browser