1 / 290

Computer Architecture

Computer Architecture. Nguyen Thanh Kien Department of Computer Engineering Faculty of Information Technology Hanoi University of Technology. About. Author: Nguyen Thanh Kien Office: Department of Computer Engineering Faculty of Information Technology Hanoi University of Technology

palti
Download Presentation

Computer Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Architecture Nguyen Thanh KienDepartment of Computer EngineeringFaculty of Information TechnologyHanoi University of Technology

  2. About • Author: Nguyen Thanh Kien • Office: Department of Computer Engineering Faculty of Information Technology Hanoi University of Technology • Mobile: +84983 588 135 • Email: kiennt-fit@mail.hut.edu.vn thanhkien84@yahoo.com

  3. Content 1. Introduction 2. Function Minimization Methods 3. Larger Combinational Systems 4. Sequential Systems 5. Hardware Design Languages

  4. Acknowledge • The following materials are used as reference for this slide: • “Logic Circuits” slide, Dr. Trinh Van Loan. • Introduction to Logic Design, 2nd Ed, Alan B. Marcovitz, Mc. Graw Hill,2005 • Foundation of Digital Logic Design, G.Langholz, A. Kandel, J. Mott, World Scientific, 1998

  5. Reference textbooks • Introduction to Logic Design, 2nd Ed,, Alan B, Marcovitz, Mc. Graw Hill,2005 • Foundation of Digital Logic Design, G.Langholz, A. Kandel, J. Mott, World Scientific, 1998

  6. Grading policy • Homework: 20% • Lab work: 20% • Midterm: 30% • Final Exam (multichoice and writing): 30%

  7. 1. Introduction 1.1. Review of Number Systems 1.2. Switching Algebra and Logic Circuits

  8. Chapter 1. Introduction

  9. 1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes

  10. 1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes

  11. 1.1.1. Number Representation • Numbers are normally written using a positional number system: • Base/radix: b (the number of digits) • Digits: 0..(b-1) • 0 ≤ ai ≤ (b-1) • Binary: b=2, digits:0,1 • Decimal: b=10, digits: 0,1,2,3,4,5,6,7,8,9 • Octal: b=8, digits: 0,1,2,3,4,5,6,7 • Hexadecimal: b=16, digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

  12. 1.1.1. Number Representation 11101.11(2) = 1x24+1x23+1x22+0x21+1x20+1x2-1+1x2-2= 29.75(10)

  13. 1.1.1. Number Representation • Decimal: • b=10 • Digits: 0,1,2,3,4,5,6,7,8,9 • Eg: 539.45(10) = 5x102+3x101+9x100+4x10-1+5x10-2 ai = 0..9

  14. 1.1.1. Number Representation • Binary: • b=2 • Digits: 0,1 • Eg: 1011.011(2) = 1x23 + 0x22 + 1x21 + 1x20 + 0x2-1 + 1x2-2 + 1x2-3 bit – binary digit ai = 0,1

  15. 1.1.1. Number Representation • Binary (cnt’) • n-bit binary number can represent which range? • an-1...a1a0 from 0 to 2n-1 • MSB – Most Significant Bit • LSB – Least Significant Bit 0001 = 1 1001 = 9 0010 = 2 1010 = 10 0011 = 3 1011 = 11 0100 = 4 1100 = 12 0101 = 5 1101 = 13 0110 = 6 1110 = 14 0111 = 7 1111 = 15 1000 = 8

  16. 1.1.1. Number Representation • Octal: • b=8 • Digits: 0,1,2,3,4,5,6,7 • Eg: 503.071(8) = 5x82 + 0x81 + 3x80 + 0x8-1 + 7x8-2 + 1x8-3 ai = 0..7 • Hexadecimal: • b=16 • Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F • Eg: 503.071(16) = 5x162 + 0x161 + 3x160 + 0x16-1 + 7x16-2 + 1x16-3 ai = 0..F

  17. Convert from base b to base 10 • Base b to base 10 conversion • Eg: • 1010.11(2)=? • 1010.11(8)=? • A12(16)=?

  18. Convert from base 10 to base b • Base 10 to base b conversion • For integer part: • Divide integer part by b until the result is 0 • Write remainders in reverse order to get the converted result. • For the odd part after “.” • Multiply by b until the result is 0

  19. Convert from base 10 to base 2 • The odd part after “.” • 0.625 x 2 = 1.25 • 0.25 x 2 = 0.5 • 0.5 x 2 = 1.0 • Eg1: 6.625(10) = ?(2) • The integer part • Eg2: 20.75(10) = ?(2) 6.625(10) = 110.101(2)

  20. Convert from base 2 to base 2n • Group from right to left n-bit groups and replace the equivalent values in base 2n • Eg: • 101011(2) = ?(8) 1010.110(2)=12.6(8) • 101011(2) = ?(16) 1010.110(2)=A.C(16)

  21. Convert from base 2n to base 2 • Each digit in base 2n is replaced by n bit in base 2. • Eg: • 37A.B(16)=?(2)

  22. Convert from base i to base j • If both i and j are powers of 2, use base 2 as an intermediate base: • Eg: base 8  base 2  base 16 • 735.37(8)=?(16) • Else, use base 10 as an intermediate base: • Eg: base 5  base 10  base 2

  23. 1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes

  24. 1.1.2 Binary Addition • Binary long addition similar to decimal long addition. decimalbinary carry 1100 11110 A 2565 10110 B 6754 11011 sum 9319 110001 Eg: 10101(2) + 11011(2) = ? (2)

  25. 1.1.2 Binary Addition • Overflow: • Occur when the result of addition is out of range of representation (the result can not be stored in the predefined number of bits) • In 8-bit computer, the result of addition of two binary numbers 10101010 and 11010011 is 9-bit binary number which can not be stored in 8-bit => overflow

  26. 1.1.2 Binary Addition • n-bit adder in computer:

  27. 1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes

  28. 1.1.3 Signed Numbers • Represent sign and amplitude • Use the most-left-bit to represent sign: • 0: positive, 1: negative • Eg: represent signed numbers using 4 bit: • +5 = 0101, -5 = 1101, -3 = 1011 • Using 3 right bits to represent amplitude, we can represent from -7 to +7. • Drawbacks: • +0 = 0000, -0 = 1000 => complex when calculating => need an other representation

  29. 2’s complement representation • Most left bit is still sign bit • Positive and 0 numbers are expressed in usual binary format. • The largest number can be represented is 2n-1-1 • n=8 => largest signed number: 28-1-1 = 127 • Negative number a is stored as the binary equivalent of 2n-a in a n-bit system. • -3 is stored as 28-3=11111101 in a 8-bit system • The most negative number can be stored is -2n-1

  30. 2’s complement representation • +10 = 0000 1010 • - 10 = 28-10 = 1 0000 0000 – 0000 1010 1111 0110 - 10 = 1111 0110 • +10 + (-10) = ?

  31. 2’s complement representation • Procedure to find binary representation of negative number in 2’s complement: • Find the binary equivalent of the magnitude • Complement each bit (0=>1, 1=>0) • Add 1 • Eg: find representation of -13 in 8-bit signed number system using 2’s complement: • Magnitude: 13 = 0000 1101 • Complement: 1111 0010 • Add 1: 1 • -13 = 1111 0011 +

  32. 2’s complement representation • Range of representation: • Use n bit to represent 2’s complement numbers • Range: -2n-1 => 2n-1-1

  33. 4 bit representation of unsigned and signed (2’s complement)

  34. 2’s complement representation • To find the magnitude of a negative number: • Complement each bit • Add 1 • Eg:

  35. Addition of signed numbers • The reason that 2’s complement is so popular is the simplicity of addition. • To add any two numbers, no matter what the sign of each is, we just do binary addition on their representation.

  36. Addition of signed numbers • Overflow • Occur when? • Add two numbers of the opposite sign? • Add two positive numbers? • Add two negative numbers? maybe • Overflow occurs when adding two numbers with the same sign and the result is in different sign

  37. 1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes

  38. 1.1.4 Binary Subtraction • Find the 2’s complement of the second operand, then add. • a – b = a + (-b) • Eg: 7 – 5 = ?

  39. 1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes

  40. Binary-Coded Decimal - BCD • BCD: • Use four bits (a nibble) to represent each of the decimal digits 0 through 9. • Eg: 375 = 0011 0111 0101(BCD)

  41. 1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes

  42. ASCII • American Standard Code for Information Interchange - ASCII • Use seven bits to represent various characters on the standard keyboard as well as a number of control signal

  43. Problems 1. Convert the following unsigned numbers: • 98.625(10)=?(2) • 11011.011(2)=?(10) • 6A1.1E(16)=?(8) 2. Represent the following signed numbers: a. -74 in 8-bit signed 2’s complement. b. -74 in 16-bit signed 2’s complement.

  44. 1. Introduction 1.1. Review of Number Systems 1.2. Switching Algebra and Logic Circuits

  45. 1.2. Switching Algebra and Logic Circuits 1.2.1 Definition of Switching Algebra 1.2.2 Basic Properties of Switching Algebra 1.2.3 Manipulation of Algebraic Functions 1.2.4 Representations of Algebraic Functions 1.2.5 Implementation of Functions with AND, OR, NOT, NAND, NOR, XOR Gates

  46. 1.2. Switching Algebra and Logic Circuits 1.2.1 Definition of Switching Algebra 1.2.2 Basic Properties of Switching Algebra 1.2.3 Manipulation of Algebraic Functions 1.2.3 Representations of Algebraic Functions 1.2.4 Implementation of Functions with AND, OR, NOT, NAND, NOR, XOR Gates

  47. 1.2.1 Definition of Switching Algebra • Switching algebra is binary: • All variables and constant take on 0 or 1. • Light on/off, switch: up/down, voltage: low/high... • Quantities which are not naturally binary must be coded into binary format. • Three operators: • OR: a+b • AND: a.b • NOT: a’

  48. 1.2. Switching Algebra and Logic Circuits 1.2.1 Definition of Switching Algebra 1.2.2 Basic Properties of Switching Algebra 1.2.3 Manipulation of Algebraic Functions 1.2.3 Representations of Algebraic Functions 1.2.4 Implementation of Functions with AND, OR, NOT, NAND, NOR, XOR Gates

  49. Basic Properties of Switching Algebra • P1: Commutative: • a + b = b + a a.b = b.a • P2: Associative: • a + (b + c) = (a + b) + c a.(b.c) = (a.b).c • P3: • a + 0 = a a . 1 = a • P4: • a + 1 = 1 a . 0 = 0

More Related