Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Organization By Dr. M. Khamis Mrs. Dua’a Al Sinari.

Similar presentations


Presentation on theme: "Computer Organization By Dr. M. Khamis Mrs. Dua’a Al Sinari."— Presentation transcript:

1 Computer Organization By Dr. M. Khamis Mrs. Dua’a Al Sinari

2 Computer Organization The course is aimed at designing the different computer components (circuits) and connecting these components in a way to achieve the goals of a specific architectures. Computer (hardware) consists of processor, memory and I/O units. Processor itself consists of Arithmetic Logic Unit (ALU) and Control unit. All the above units are designed using primitive logic circuits.

3 Course Objectives Understanding the basic Laws of Boolean algebra. Designing and using the basic logic devices. Understanding the operation of the main computer units and their design. Interconnecting the various computer units to achieve the specific architecture. Presenting the attributes of the different architectures. Programming specific architecture using its instruction set (machine instruction). Explaining the Interaction between Computer hardware and the operating system.

4 Course outline The course will consist of two parts: The first part is Logic design: in which the primitive components, by which the different devices are designed, are presented. The second part is intended for interconnecting the components presented in first part in a way to build a logical system (computer organization).

5 Part 1: Logic Design Introduction to number systems and arithmetic operations in binary system. Combinational circuits: Logic Gates (AND, OR, NOT, NOR, NAND and XOR), in this regards we will give the truth tables and symbols for each. Laws of Boolean algebra, deriving logical expression and simplification. Karnaugh maps and its use for simplification. half and full adders and binary coded decimal adders

6 Part 1: Logic Design devices include: Decoder. Encoder. Multiplexers/ De-multiplexer. Comparator. Sequential circuits include : Flip/Flops and counter Design Mealy and MOORE machines.

7 Part 2: Computer Organization chapter 3: computer system chapter 7: Input/output chapter 8: Operating System Support. chapter 9: Computer Arithmetic chapter 10: Instruction Sets. chapter 11: :Instruction Sets: Addressing Modes and Format. chapter 12: CPU structure chapter 16 : Control Unit chapter 17: Micro Programmed Control Unit.

8 N UMBERS AND B OOLEAN A LGEBRA Author: Abhinav Bhatele Revised By: Dr. M. Khamis FAll 2008

9 N UMBER SYSTEMS To get started, we’ll discuss one of the fundamental concepts underlying digital computer design: Deep down inside, computers work with just 1s and 0s. Computers use voltages to represent information. In modern CPUs the voltage is usually limited to 1.6-1.8V to minimize power consumption. It’s convenient for us to translate these analog voltages into the discrete, or digital, values 1 and 0. But how can binary system be useful for anything? First, we’ll see how to represent numbers with just 1s and 0s. Then we’ll introduce special operations for computing with 1s and 0s, by treating them as the logical values “true” and “false.” Volts 1.8 0 1 0 June 10th, 2008 8 Number Systems and Boolean Algebra

10 T ODAY ’ S LECTURE Number systems Review of binary number representation How to convert between binary and decimal representations Octal and Hex representations Basic boolean operations AND, OR and NOT The idea of “Truth Table” Boolean functions and expressions Truth table for Boolean expressions June 10th, 2008 9 Number Systems and Boolean Algebra

11 D ECIMAL REVIEW Numbers consist of a bunch of digits, each with a weight These weights are all powers of the base, which is 10. We can rewrite this: To find the decimal value of a number, multiply each digit by its weight and sum the products. (1 x 10 2 ) + (6 x 10 1 ) + (2 x 10 0 ) + (3 x 10 -1 ) + (7 x 10 -2 ) + (5 x 10 -3 ) = 162.375 June 10th, 2008 10 Number Systems and Boolean Algebra

12 C ONVERTING BINARY TO DECIMAL We can use the same trick to convert binary, or base 2, numbers to decimal. This time, the weights are powers of 2. Example: 1101.01 in binary The decimal value is: (1 x 2 3 ) + (1 x 2 2 ) + (0 x 2 1 ) + (1 x 2 0 ) + (0 x 2 -1 ) + (1 x 2 -2 ) = 8+ 4+ 0+ 1+ 0+ 0.25= 13.25 June 10th, 2008 11 Number Systems and Boolean Algebra

13 C ONVERTING DECIMAL TO BINARY To convert a decimal integer into binary, keep dividing by 2 until the quotient is 0. Collect the remainders in reverse order. To convert a fraction, keep multiplying the fractional part by 2 until it becomes 0. Collect the integer parts in forward order. Example: 162.375: So, 162.375 10 = 10100010.011 2 162 / 2= 81rem 0 81 / 2= 40rem 1 40 / 2= 20rem 0 20 / 2= 10rem 0 10 / 2= 5rem 0 5 / 2= 2rem 1 2 / 2= 1rem 0 1 / 2= 0rem 1 0.375 x 2 = 0.750 0.750 x 2 = 1.500 0.500 x 2 = 1.000 June 10th, 2008 12 Number Systems and Boolean Algebra

14 W HY DOES THIS WORK ? This works for converting from decimal to any base Why? Think about converting 162.375 from decimal to decimal. Each division strips off the rightmost digit (the remainder). The quotient represents the remaining digits in the number. Similarly, to convert fractions, each multiplication strips off the leftmost digit (the integer part). The fraction represents the remaining digits. 162 / 10= 16rem 2 16 / 10= 1rem 6 1 / 10= 0rem 1 0.375 x 10 = 3.750 0.750 x 10 = 7.500 0.500 x 10 = 5.000 June 10th, 2008 13 Number Systems and Boolean Algebra

15 B ASE 16 IS USEFUL TOO The hexadecimal system uses 16 digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F You can convert between base 10 and base 16 using techniques like the ones we just showed for converting between decimal and binary. For our purposes, base 16 is most useful as a “shorthand” notation for binary numbers. Since 16 = 2 4, one hexadecimal digit is equivalent to 4 binary digits. It’s often easier to work with a number like B4 instead of 10110100. Hex is frequently used to specify things like 32-bit IP addresses and 24-bit colors. June 10th, 2008 14 Number Systems and Boolean Algebra

16 B INARY AND HEXADECIMAL CONVERSIONS Converting from hexadecimal to binary is easy: just replace each hex digit with its equivalent 4-bit binary sequence. To convert from binary to hex, make groups of 4 bits, starting from the binary point. Add 0s to the ends of the number if needed. Then, just convert each bit group to its corresponding hex digit. 261.35 16 = 2 6 1. 3 5 16 =001001100001.00110101 2 10110100.001011 2 =10110100.00101100 2 = B 4. 2 C 16 June 10th, 2008 15 Number Systems and Boolean Algebra

17 2’ s complement Binary number can be represented using sign and magnitude. If N bits are used to represent the number, then the last bit is used to hold the sign of the number while the other (N-1) bits are used to represent the value. 0 is used for +ve sign and 1 is used for -ve sign. To get the 2’s complement for any number follow the following two steps: 1. Convert each bit in the value into its complement (1 to 0 and vice versa) 2. Add 1 to the result of step 1.

18 Binary addition & subtraction If the number is +ve keep it in sign and magnitude form, otherwise represent the number (magnitude only) using its 2’s complement. Add the binary numbers in the ordinary way as the decimal numbers. The addition in decimal makes carry 1 for the next digit for each 10 collected in the sum, and the reset which will be less than 10 is left as result of the addition of the corresponding bits. This operation continues until adding all bits with its corresponding bits in the other number.

19 Binary addition & subtraction (Continued) The addition in binary is exactly the same as decimal with only one difference, which is, carry 1 is taken for the next digit for each 2 collected in the sum, and the reset which is less than 2 is left as result of the addition of the corresponding bit. The addition is continued for all bits including the sign bit, and in order to get correct answer the number must be represented in enough number of bits. Any carry after the sign bit is discarded. The value of the negative result is represented in the 2’s complement (i.e. the actual value is the 2’s complement of the result once again).

20 N UMBER S YSTEMS S UMMARY Computers are binary devices. We’re forced to think in terms of base 2. Today we learned how to convert numbers between binary, decimal and hexadecimal. Also, we have seen: We use 0 and 1 as abstractions for analog voltages. We showed how to represent numbers using just these two signals. Next we’ll introduce special operations for binary values and show how those correspond to circuits. June 10th, 2008 19 Number Systems and Boolean Algebra

21 B OOLEAN O PERATIONS So far, we’ve talked about how arbitrary numbers can be represented using just the two binary values 1 and 0. Now we’ll interpret voltages as the logical values “true” and “false” instead. We’ll show: How logical functions can be defined for expressing computations How to build circuits that implement our functions in hardware June 10th, 2008 20 Number Systems and Boolean Algebra

22 B OOLEAN VALUES Earlier, we used electrical voltages to represent two discrete values 1 and 0, from which binary numbers can be formed. It’s also possible to think of voltages as representing two logical values, true and false. For simplicity, we often still write digits instead: 1 is true 0 is false We will use this interpretation along with special operations to design functions and hardware for doing arbitrary computations. Volts 1.8 0 True False June 10th, 2008 21 Number Systems and Boolean Algebra

23 F UNCTIONS Computers take inputs and produce outputs, just like functions in math! Logical functions can be expressed in two ways: A finite, but non-unique Boolean expression. A truth table, which will turn out to be unique and finite. We can represent logical functions in two analogous ways too: A finite, but non-unique Boolean expression. A truth table, which will turn out to be unique and finite. f(x,y)= 2x + y = x + x + y = 2(x + y/2) =... An expression is finite but not unique A function table is unique but infinite June 10th, 2008 22 Number Systems and Boolean Algebra

24 B ASIC B OOLEAN OPERATIONS There are three basic operations for logical values. AND (product) of two inputs OR (sum) of two inputs NOT (complement) on one input xy, or x  yx + yx’ Operation: Expression: Truth table: June 10th, 2008 23 Number Systems and Boolean Algebra

25 B OOLEAN EXPRESSIONS We can use these basic operations to form more complex expressions: f(x,y,z) = (x + y’)z + x’ Some terminology and notation: f is the name of the function. (x,y,z) are the input variables, each representing 1 or 0. Listing the inputs is optional, but sometimes helpful. A literal is any occurrence of an input variable or its complement. The function above has four literals: x, y’, z, and x’. Precedences are important, but not too difficult. NOT has the highest precedence, followed by AND, and then OR. Fully parenthesized, the function above would be kind of messy: f(x,y,z) = (((x +(y’))z) + x’) June 10th, 2008 24 Number Systems and Boolean Algebra

26 T RUTH TABLES A truth table shows all possible inputs and outputs of a function. Remember that each input variable represents either 1 or 0. Because there are only a finite number of values (1 and 0), truth tables themselves are finite. A function with n variables has 2 n possible combinations of inputs. Inputs are listed in binary order—in this example, from 000 to 111. f(0,0,0)= (0 + 1)0 + 1= 1 f(0,0,1)= (0 + 1)1 + 1= 1 f(0,1,0)= (0 + 0)0 + 1= 1 f(0,1,1)= (0 + 0)1 + 1= 1 f(1,0,0)= (1 + 1)0 + 0= 0 f(1,0,1)= (1 + 1)1 + 0= 1 f(1,1,0)= (1 + 0)0 + 0= 0 f(1,1,1)= (1 + 0)1 + 0= 1 f(x,y,z) = (x + y’)z + x’ June 10th, 2008 25 Number Systems and Boolean Algebra

27 P RIMITIVE LOGIC GATES Each of our basic operations can be implemented in hardware using a primitive logic gate. Symbols for each of the logic gates are shown below. These gates output the product, sum or complement of their inputs. Logic gate: AND (product) of two inputs OR (sum) of two inputs NOT (complement) on one input xy, or x  yx + yx’ Operation: Expression: June 10th, 2008 26 Number Systems and Boolean Algebra

28 E XPRESSIONS AND CIRCUITS Any Boolean expression can be converted into a circuit by combining basic gates in a relatively straightforward way. The diagram below shows the inputs and outputs of each gate. The precedences are explicit in a circuit. Clearly, we have to make sure that the hardware does operations in the right order ! (x + y’)z + x’ June 10th, 2008 27 Number Systems and Boolean Algebra

29 C IRCUIT ANALYSIS SUMMARY After finding the circuit inputs and outputs, you can come up with either an expression or a truth table to describe what the circuit does. You can easily convert between expressions and truth tables. Find the circuit’s inputs and outputs Find a Boolean expression for the circuit Find a truth table for the circuit June 10th, 2008 28 Number Systems and Boolean Algebra

30 B OOLEAN OPERATIONS SUMMARY We can interpret high or low voltage as representing true or false. A variable whose value can be either 1 or 0 is called a Boolean variable. AND, OR, and NOT are the basic Boolean operations. We can express Boolean functions with either an expression or a truth table. Every Boolean expression can be converted to a circuit. Next, we’ll look at how Boolean algebra can help simplify expressions, which in turn will lead to simpler circuits. June 10th, 2008 29 Number Systems and Boolean Algebra

31 B OOLEAN ALGEBRA Last time we talked about Boolean functions, Boolean expressions, and truth tables. Now we’ll learn how to how use Boolean algebra to simplify Booleans expressions. Last time, we saw this expression and converted it to a circuit: (x + y’)z + x’ Can we make this circuit “better”? Cheaper: fewer gates Faster: fewer delays from inputs to outputs June 10th, 2008 30 Number Systems and Boolean Algebra

32 E XPRESSION SIMPLIFICATION Normal mathematical expressions can be simplified using the laws of algebra For binary systems, we can use Boolean algebra, which is superficially similar to regular algebra There are many differences, due to having only two values (0 and 1) to work with having a complement operation the OR operation is not the same as addition June 10th, 2008 31 Number Systems and Boolean Algebra

33 F ORMAL DEFINITION OF B OOLEAN ALGEBRA A Boolean algebra requires A set of elements B, which needs at least two elements (0 and 1) Two binary (two-argument) operations OR and AND A unary (one-argument) operation NOT The axioms below must always be true (textbook, p. 42) The magenta axioms deal with the complement operation Blue axioms (especially 15) are different from regular algebra June 10th, 2008 32 Number Systems and Boolean Algebra

34 C OMMENTS ON THE AXIOMS The associative laws show that there is no ambiguity about a term such as x + y + z or xyz, so we can introduce multiple-input primitive gates: The left and right columns of axioms are duals exchange all ANDs with ORs, and 0s with 1s The dual of any equation is always true June 10th, 2008 33 Number Systems and Boolean Algebra

35 A RE THESE AXIOMS FOR REAL ? We can show that these axioms are valid, given the definitions of AND, OR and NOT The first 11 axioms are easy to see from these truth tables alone. For example, x + x’ = 1 because of the middle two lines below (where y = x’) June 10th, 2008 34 Number Systems and Boolean Algebra

36 P ROVING THE REST OF THE AXIOMS We can make up truth tables to prove (both parts of) DeMorgan’s law For (x + y)’ = x’y’, we can make truth tables for (x + y)’ and for x’y’ In each table, the columns on the left (x and y) are the inputs. The columns on the right are outputs. In this case, we only care about the columns in blue. The other “outputs” are just to help us find the blue columns. Since both of the columns in blue are the same, this shows that (x + y)’ and x’y’ are equivalent June 10th, 2008 35 Number Systems and Boolean Algebra

37 S IMPLIFICATION WITH AXIOMS We can now start doing some simplifications x’y’ + xyz + x’y = x’(y’ + y) + xyz[ Distributive; x’y’ + x’y = x’(y’ + y) ] = x’  1 + xyz[ Axiom 7; y’ + y = 1 ] = x’ + xyz[ Axiom 2; x’  1 = x’ ] = (x’ + x)(x’ + yz)[ Distributive ] = 1  (x’ + yz)[ Axiom 7; x’ + x = 1 ] = x’ + yz[ Axiom 2 ] June 10th, 2008 36 Number Systems and Boolean Algebra

38 L ET ’ S COMPARE THE RESULTING CIRCUITS Here are two different but equivalent circuits. In general the one with fewer gates is “better”: It costs less to build It requires less power But we had to do some work to find the second form June 10th, 2008 37 Number Systems and Boolean Algebra

39 S OME MORE LAWS Here are some more useful laws. Notice the duals again! We can prove these laws by either Making truth tables: Using the axioms: x + x’y= (x + x’)(x + y)[ Distributive ] = 1  (x + y)[ x + x’ = 1 ] = x + y[ Axiom 3 ] June 10th, 2008 38 Number Systems and Boolean Algebra

40 T HE COMPLEMENT OF A FUNCTION The complement of a function always outputs 0 where the original function outputted 1, and 1 where the original produced 0. In a truth table, we can just exchange 0s and 1s in the output column(s) f(x,y,z)= x(y’z’ + yz) June 10th, 2008 39 Number Systems and Boolean Algebra

41 C OMPLEMENTING A FUNCTION ALGEBRAICALLY You can use DeMorgan’s law to keep “pushing” the complements inwards You can also take the dual of the function, and then complement each literal If f(x,y,z) = x(y’z’ + yz)… … the dual of f is x + (y’ + z’)(y + z)… … then complementing each literal gives x’ + (y + z)(y’ + z’)… … so f’(x,y,z) = x’ + (y + z)(y’ + z’) f(x,y,z)= x(y’z’ + yz) f’(x,y,z)= ( x(y’z’ + yz) )’[ complement both sides ] = x’ + (y’z’ + yz)’[ because (xy)’ = x’ + y’ ] = x’ + (y’z’)’ (yz)’[ because (x + y)’ = x’ y’ ] = x’ + (y + z)(y’ + z’)[ because (xy)’ = x’ + y’, twice] June 10th, 2008 40 Number Systems and Boolean Algebra

42 S UMMARY SO FAR So far: A bunch of Boolean algebra trickery for simplifying expressions and circuits The algebra guarantees us that the simplified circuit is equivalent to the original one Next: Introducing some standard forms and terminology An alternative simplification method We’ll start using all this stuff to build and analyze bigger, more useful, circuits June 10th, 2008 41 Number Systems and Boolean Algebra


Download ppt "Computer Organization By Dr. M. Khamis Mrs. Dua’a Al Sinari."

Similar presentations


Ads by Google