Computer architecture aslamzai Course Objectives To learn Computer
Computer architecture aslamzai
Course Objectives • • To learn Computer types Functional units Basic operational concepts Number representation and arithmetic operations Character representation Performance Historical perspective • • How computers work, basic principles How to analyze their performance How computer are designed and built Issues effecting modern processors (processors)
Course Motivation • This course will be useful if you need to • • • Design/build a new computer Design/build a new version of a computer Improve software performance Purchase a computer Provide a solution with an embedded computer
What is computer architecture • Building architecture: structural design (civil engg) • Computer architecture: circuit design (elec engg)
Software abstraction
Hardware abstraction
slots
Computer Types • Since their introduction in the 1940 s, digital computers have evolved into different types • Sze, cost, computational power, and intended use. • Modern computers can be divided into below categories • • Embedded Computers Personal Computers Servers and Enterprise Systems Supercomputers and Grid Computers • Emerging trend in access to computing facilities – cloud computing.
Functional Units • Five functional parts • Input, memory, ALU, output, and CU. • Interconnection network • Exchange information and coordinate their actions.
Functional Units • Information handled by computer • Instruction or data. • Instructions, are explicit commands • Transmission of information • Specify the AL operations. • Program, is a list of instructions which performs a task. • Data are numbers and characters used as operand by the instructions.
Functional Units • Instructions must be encoded in a suitable format. • Most recent H/W employs digital circuits that have only two states. • Everything is encoded as string of binary digits called bits. • Having one of two values, 0 or 1.
Functional Units Input Unit • Computers accept coded information though input units. • Keyboard, touchpad, mouse, and trackball. • Digital communication facilities, such as internet, can also provide input to a computer.
Functional Units Memory Unit • Primary memory, also called main memory, is a fast memory that operates at electronic speeds. • Programs are stored while being executed. • Consist of large number of semiconductor storage cells, each capable of storing one bit of information. • Handled in groups of fixed size called words. • Number of bits in each word is referred to as word length, typically 16, 32, or 64 bits. • For access, each word in memory has a distinct address.
Functional Units Memory Unit • Instructions and data can be written or read under the control of processor. • A memory in which any memory location can be accessed in a short of fixed amount of time after specifying its address is called RAM. • Memory access time, time required to access one word. • From few to 100 ns – Independent of the location of word being accessed.
Functional Units Cache Memory • Smaller, faster RAM unit, called cache. • Used to hold sections of a program that are currently being executed, along with any associated data. • Tightly coupled with the processor and is usually contained on the same integrated-circuit chip. • Suppose, execution of a number of execution in a program loop.
Functional Units Secondary Storage • Although primary memory is essential, expensive, and volatile. • Thus additional, less expensive, permanent secondary storage is used for large amount of data storage. • Access times are longer than as compare to primary memory. • Wide selection of devices such as • Magnetic disks, optical disks (DVD and CD), and flash memory devices.
Functional Units Arithmetic and Logic Unit • Most computer operations are executed in ALU of the processor. • addition, subtraction, multiplication, division, or comparison of numbers. • When operands are brought into the processor, they are stored in high-speed storage elements called registers. • Access time is shorter as compare to other storage systems.
Functional Units Output Unit • Counterpart of the input unit. • Sends processed results to the outside world such as printer and graphic displays. • Often, looks sometimes comes with dual functionality, I/O units.
Functional Units Control Unit • The coordination of all the above units are handled through CU. • It is like a nerve center that sends control signals to other units and senses their states. • Processing cycle is all managed by control unit.
Basic Operational Concepts • We have learned, • Activity is governed through instructions. • For performing a task, program is loaded into memory. • Individual instructions are brought to the processor for processing. • A typical instruction might be MOV R 2, LOC ADD R 4, R 3 MOV LOC, R 4
Basic Operational Concepts • IR holds the instruction that is currently being executed. • PC contains the memory address of the next instruction to be fetched and executed. • R 0 through Rn-1 are general purpose registers. • The processor-memory interface sends read and write control signals.
Number Representation and Arithmetic Operations • The most natural way to represent a number in a computer system is by a string of bits, called a binary number. • We will have discussion on binary representation for Integers as its arithmetic operations and then floating-point numbers.
Integers • A bit is the most basic unit of information in a computer. • It is a state of “on” or “off” in a digital circuit. • Or “high” or “low” voltage instead of “on” or “off. ” • A byte is a group of eight bits. • A byte is the smallest possible addressable unit of computer storage. • A word is a contiguous group of bytes • Word sizes of 16, 32, or 64 bits are most common. • Usually a word represents a number or instruction.
Integers • Start with the least significant bit (rightmost bit) • Add each pair of bits • Include the carry in the addition, if present carry: 1 0 0 0 1 0 0 (4) 0 0 0 1 1 1 (7) 0 0 1 0 1 1 (11) bit position: 7 6 5 4 3 2 1 0 +
Integers • There are three ways in which signed binary numbers may be expressed: • Signed magnitude, • One’s complement and • Two’s complement. • In an 8 -bit word, signed magnitude representation places the absolute value of the number in the 7 bits to the right of the sign bit.
Integers • Highest bit indicates the sign. 1 = negative, 0 = positive
Integers • Binary addition is as easy as it gets. You need to know only four rules: 0+0= 0 1+0= 1 0+1= 1 1 + 1 = 10 • The simplicity of this system makes it possible for digital circuits to carry out arithmetic operations. • We will describe these circuits in Chapter 3. Let’s see how the addition rules work with signed magnitude numbers. . . 28
Integers • Example: • Using signed magnitude binary arithmetic, find the sum of 75 and 46. • First, convert 75 and 46 to binary, and arrange as a sum, but separate the (positive) sign bits from the magnitude bits. In this example, we were careful to pick two values whose sum would fit into seven bits. If that is not the case, we have a problem. 29
Integers • Example: • Using signed magnitude binary arithmetic, find the sum of 107 and 46. • We see that the carry from the seventh bit overflows and is discarded, giving us the erroneous result: 107 + 46 = 25.
Integers • Signed magnitude representation is easy for people to understand, but it requires complicated computer hardware. • Another disadvantage of signed magnitude is that it allows two different representations for zero: positive zero and negative zero. • For these reasons (among others) computers systems employ complement systems for numeric value representation. 31
Integers • For example, in 8 -bit one’s complement; • + 3 is: 00000011 • - 3 is: 11111100 • In one’s complement, as with signed magnitude, negative values are indicated by a 1 in the high order bit. • Complement systems are useful because they eliminate the need for special circuitry for subtraction. The difference of two values is found by adding the minuend to the complement of the subtrahend.
Integers • With one’s complement addition, the carry bit is “carried around” and added to the sum. • Example: Using one’s complement binary arithmetic, find the sum of 48 and - 19 We note that 19 in one’s complement is 00010011, so -19 in one’s complement is: 11101100.
Integers • Although the “end carry around” adds some complexity, one’s complement is simpler to implement than signed magnitude. • But it still has the disadvantage of having two different representations for zero: positive zero and negative zero. • Two’s complement solves this problem.
Integers • To express a value in two’s complement: • If the number is positive, just convert it to binary and you’re done. • If the number is negative, find the one’s complement of the number and then add 1. • Example: • In 8 -bit one’s complement, positive 3 is: 0 0000011 • Negative 3 in one’s complement is: 1 1 1 0 0 • Adding 1 gives us -3 in two’s complement form: 11111101.
Integers starting value 00100100 = +36 step 1: reverse the bits (1's complement) 11011011 step 2: add 1 to the value from step 1 + sum = 2's complement representation 11011100 = -36 1 Sum of an integer and its 2's complement must be zero: 00100100 + 11011100 = 0000 (8 -bit sum) Ignore Carry The easiest way to obtain the 2's complement of a binary number is by starting at the LSB, leaving all the 0 s unchanged, look for the first occurrence of a 1. Leave this 1 unchanged and complement all the bits after it.
Integers • With two’s complement arithmetic, all we do is add our two binary numbers. Just discard any carries emitting from the high order bit. – Example: Using one’s complement binary arithmetic, find the sum of 48 and - 19. We note that 19 in one’s complement is: 00010011, so -19 in one’s complement is: 11101100, and -19 in two’s complement is: 11101101.
Integers • When we use any finite number of bits to represent a number, we always run the risk of the result of our calculations becoming too large to be stored in the computer. • While we can’t always prevent overflow, we can always detect overflow. • In complement arithmetic, an overflow condition is easy to detect.
Integers • Example: • Using two’s complement binary arithmetic, find the sum of 107 and 46. • We see that the nonzero carry from the seventh bit overflows into the sign bit, giving us the erroneous result: 107 + 46 = -103. Rule for detecting two’s complement overflow: When the “carry in” and the “carry out” of the sign bit differ, overflow has occurred.
Integers • When subtracting A – B, convert B to its 2's complement • Add A to (–B) 00001100 00000010 11111110 – 00001010 + 00001010 (2's complement) (same result) • Carry is ignored, because • Negative number is sign-extended with 1's • You can imagine infinite 1's to the left of a negative number • Adding the carry to the extended 1's produces extended zeros
Character Representation • ASCII is the most common encoding schema for characters. • Alphanumeric characters, operators, punctuation symbols, and control characters are represented by 7 -bit codes. • A byte is used for the representation and storage. • The sequential increasing order of codes (alphabets and numeric) when changed to unsigned binary describes sorting operation. • The low-order four bits of the ASCII describes BCD code. • Code for 0 to 9 decimal digits.
- Slides: 41