Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 1. Number System and Logic Gates

Similar presentations


Presentation on theme: "Lecture 1. Number System and Logic Gates"— Presentation transcript:

1 Lecture 1. Number System and Logic Gates
COSC3330 Computer Architecture Lecture 1. Number System and Logic Gates Instructor: Weidong Shi (Larry), PhD Computer Science Department University of Houston

2 Today Introduction Numbers Logic gates

3 Architecture Covered x86 MIPS ARM Nvidia GPU TI DSP VLIW ….

4 x86 History (as of 2008) 4

5 x86? What is x86? Generic term referring to processors from Intel, AMD and VIA Derived from the model numbers of the first few generations of processors: 8086, 80286, 80386,  x86 Now it generally refers to processors from Intel, AMD, and VIA x86-16: 16-bit processor x86-32 (aka IA32): 32-bit processor * IA: Intel Architecture x86-64: 64-bit processor Intel takes about 80% of the PC market and AMD takes about 20% Apple also have been introducing Intel-based Mac from Nov. 2006 5

6 x86 History (Cont.) 2009 Core i7 32-bit (i386) 4-bit 8-bit 16-bit

7 8-core Xeon

8 50 Core Xeon Phi

9 ARM ARM Holdings PLC, a technology company headquartered in England.
ARM architecture 32 bit RISC processor Simple design and low power The most widely-used 32-bit microprocessor family in the world ARM headquarters at Cambridge, UK

10 ARM History 1978: Cambridge Processor Unit 1979: Acorn Computer Ltd
Founded in 1978 by Hermann Hauser & Chris Curry First contract was with “ACE Coin Equipment” to develop Fruit Machine hardware! 1979: Acorn Computer Ltd Changed it’s name to “Acorn Computer Ltd” ARM Founded in 1990 Joint venture between Apple, VLSI, and Acorn (IP and engineers)

11 First ARM Chip: 1985 1985: “ARM1” 2005: “ARM7TDMIr4” 3.0μm
25K Transistors 6MHz 120mW 50mm2 2005: “ARM7TDMIr4” 65nm 100K Transistors 350MHz (60x speed) 9mW (1/780thenergy) 0.1mm2(1/500tharea)

12 Retrospective "Steve is one of the brightest guys I've ever worked with - brilliant; but when we decided to do a microprocessor on our own, I made two great decisions - I gave them [Steve Furber and Sophie Wilson] two things which National, Intel and Motorola had never given their design teams: the first was no money; the second was no people. The only way they could do it was to keep it really simple." -- Hermann Hauser The Founder of Acorn Computer Ltd. Steve Furber. Principle designer of ARM. Sophie Wilson. Designer of ARM ISA.

13 ARM Powered Mobile Devices
The ARM was designed to be small and cheap So low power was a happy accident! The need for low power was driven by battery powered mobile consumer electronics 2010 2007 1993 1993 2005 2008 2001 Active Book ARM2aS Newton Message Pad, ARM610 Game Boy Advance ARM7TDMI Nintendo DS ARM946E-S & ARM7TDMI Kindle ARM1136J iPhone3G ARM1176JZ iPad and Droid-X Cortex-A8

14 IP Licensing ARM CPUs Account for over 75% of all 32-bit embedded CPUs. 1.7 billion chips based on ARM design were manufactured in 2005. Use in portable devices, and computer peripherals PDAs, mobile phones, media players, handheld gaming units, and calculators. Hard drives and desktop routers. But none of the chips is manufactured by ARM Holdings PLC Unlike Intel, AMD, etc. ARM only licenses its technology as IP (Intellectual Property)

15 Getting Smaller

16 Getting More Powerful

17 Computer Architecture
How do we architect 10B+ transistors into efficient, cost-effective computing devices The instruction set architecture Contract between the software and the implementation Necessary for Moore’s Law scaling! The microarchitecture An implementation of the instruction set architecture Modern instruction set architectures: 80x86 (aka iA32), PowerPC (e.g. G4, G5) Xscale, ARM, MIPS Intel/HP EPIC (iA64), AMD64, Intel’s EM64T, SPARC, HP PA-RISC, DEC/Compaq/HP Alpha

18 Constantly Changing Definition
50s to 60s: Computer Architecture ~ Computer Arithmetic 70s to mid 80s: Instruction Set Design, especially ISA appropriate for compilers 90s: Speculation: Predict this, predict that; memory system; I/O system; Multiprocessors; Networks 2000s: Power efficiency , Communication, On-die Interconnection Network, Multi-this, Multi-that. 2015 and beyond: Thousand-core processors, Self adapting systems? Self organizing structures? DNA Systems/Quantum Computing?

19 Where We Are Headed Logic gates Combinational logic Sequential logic
Arithmetic and how to build an ALU

20 Where We Are Headed Performance issues Instruction set architecture
Instructions pipelining to improve performance Superscalar processor Memory: caches and virtual memory

21 Where We Are Headed VLIW Vector machine GPU I/O and bus
Storage devices Magnetic disk, flash, solid state drive Virtualization Future trend I will try to cover as much as possible

22 Companies Who Hire Computer Architect

23 Job Description of a Computer Architect
Used to be “Performance, performance, performance” Make trade-off of performance, complexity effectiveness, power, technology, cost, etc. New trends Availability Where you store your photos, s and shared docs today? Cloud computing Reliability Toyota blamed soft errors for the sudden acceleration problem Security Intel acquired McAfee Power management It is about money !

24 Numbers

25 1000 Apples in 10 Boxes How to arrange 1000 apples in 10 boxes so that any number of apples can be picked in terms of boxes? 117 Apples

26 A Computer System What are there inside a computer? CPU North Bridge
Main Memory (DDR2) FSB (Front-Side Bus) North Bridge DMI (Direct Media I/F) South Bridge

27 Bottom Layer of a Computer
Each component inside a computer is basically made based on analog and digital circuits Analog Continuous signal Digital Only knows 1 and 0

28 What Do You Mean by 0 or 1 in Digital Circuit?
In fact, everything in this world is analog For example, sound, light, electric signals are all analog since they are continuous in time Actually, digital circuit is a special case of analog circuit Power supply provides power to the computer system Power supply has several outlets (such as 3.3V, 5V, and 12V)

29 What Do You Mean by 0 or 1 in Digital Circuit?
Digital circuit treats a signal above a certain level as “1” and a signal below a certain level as “0” Different components in a computer have different voltage requirements (Voltage requirements change as the technology advances) CPU (Core 2 Duo): V Chipsets: 1.45 V Peripheral devices: 3.3V, 1.5V 0V 1.325V time “1” Not determined “0”

30 Logic Levels Define a range of voltages to represent 1 and 0
Define different ranges for outputs and inputs to allow for noise in the system Noise is anything that degrades the signal For example, a gate (driver) could output a 5 volt signal but, because of losses in the wire and other noise, the signal could arrive at the receiver with a degraded value, for example, 4.5 volts 30 30

31 Logic Levels Noise Margin NMH = VOH – VIH NML = VIL – VOL 31 31

32 Digital vs. Analog Analog Digital music video wireless signal

33 DSP – Digital Signal Processing
Analog Computer a bit loud Digital Computer ADC DSP DAC OUTPUT 1010 1001

34 Number Systems Analog information (video, sound etc) is converted to a digital format for processing Computer processes information in digital Since digital knows “1” and “0”, we use different number systems in computer Binary and Hexadecimal numbers

35 Number Systems - Decimal
Decimal numbers Most natural to human because we have ten fingers (?) and/or because we are used to it (?) Each column of a decimal number has 10x the weight of the previous column Decimal number has 10 as its base ex) = 5 x x x x 100 N-digit number represents one of 10N possibilities ex) 3-digit number represents one of 1000 possibilities: 0 ~ 999

36 Number Systems - Binary
Binary numbers Bit represents one of 2 values: 0 or 1 Each column of a binary number has 2x the weight of the previous column Binary number has 2 as its base ex) = 1 x x x x x 20 = 2210 N-bit binary number represents one of 2N possibilities ex) 3-bit binary number represents one of 8 possibilities: 0 ~ 7

37 Counting Binary Numbers
1 2 3 4 5 6 7 8 1 10 11 100 101 110 111 1000

38 Power of 2 28 = 29 = 210 = 211 = 212 = 213 = 214 = 215 = 20 = 21 = 22 = 23 = 24 = 25 = 26 = 27 =

39 Power of 2 28 = 256 29 = 512 210 = 1024 211 = 2048 212 = 4096 213 = 8192 214 = 16384 215 = 32768 20 = 1 21 = 2 22 = 4 23 = 8 24 = 16 25 = 32 26 = 64 27 = 128 * Handy to memorize up to 29

40 Number Systems - Hexadecimal
Hexadecimal numbers Writing long binary numbers is tedious and error-prone We group 4 bits to form a hexadecimal (hex) A hex represents one of 16 values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F Each column of a hex number has 16x the weight of the previous column Hexadecimal number has 16 as its base ex) 2ED16 = 2 x E (14) x D (13) x 160 = 74910 N-hexadigit number represents one of 16N possibilities ex) 2-hexadigit number represents one of 162 possibilities: 0 ~ 255

41 Number Systems Hex Number Decimal Equivalent Binary Equivalent 0000 1
0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111

42 Hexadecimal to binary conversion:
Number Conversions Hexadecimal to binary conversion: Convert 4AF16 (also written 0x4AF) to binary number Hexadecimal to decimal conversion: Convert 0x4AF to decimal number 4×162 + A (10)×161 + F (15)×160 =

43 Number Conversions Convert 7510 to binary number 2 75 1 2 37 1 2 18 7510 = 2 1 9 2 4 2 2 2 1 1

44 Bits, Bytes, Nibbles Bits (b) Bytes & Nibbles Byte (B) = 8 bits
Used everyday Nibble (N) = 4 bits Not commonly used

45 KB, MB, GB … In computer, the basic unit is byte (B)
And, we use KB, MB, GB many many many times 210 = 1024 = 220 = 1024 x 1024 = 230 = 1024 x 1024 x 1024 = How about these? 240 = 250 = 260 = 270 = 1KB (kilobyte) 1MB (megabyte) 1GB (gigabyte) 1TB (terabyte) 1PB (petabyte) 1EB (exabyte) 1ZB (zettabyte) Number of atoms in the universe (estimated) ≤ 2266

46 Quick Checks 222 =? How many values can a 32-bit variable represent?
22 × 220 = 4 Mega How many values can a 32-bit variable represent? 22 × 230 = 4 Giga Suppose that you have 2GB main memory in your computer. How many bits you need to address (cover) 2GB? 21 × 230 = 2 GB, so 31 bits

47 How Much Data? Google processes 20 PB a day (2008)
Twitter generates approximately 12 TB of data per day eBay processes 50 PB of data a day

48 All Data in the World

49 Storage Capability

50 Addition Decimal Binary

51 Binary Addition Examples
Add the following 4-bit binary numbers 1110 0001

52 Overflow Digital systems operate on a fixed number of bits
Addition overflows when the result is too big to fit in the available number of bits Example: add 13 and 5 using 4-bit numbers

53 Signed Binary Numbers How does the computer represent positive and negative integer numbers? There are 2 ways Sign/Magnitude Numbers Two’s Complement Numbers

54 Sign/Magnitude Numbers
1 sign bit, N-1 magnitude bits Sign bit is the most significant (left-most) bit Negative number: sign bit = 1 Positive number: sign bit = 0 Example: 4-bit representations of ± 5: +5 = 01012 - 5 = 11012

55 Sign/Magnitude Numbers
Signed Decimal Sign/Magnitude Numbers Unsigned 000 1 001 2 010 3 011 -0 100 4 -1 101 5 -2 110 6 -3 111 7 Range of an N-bit sign/magnitude number: [-(2N-1-1), 2N-1-1] Example N=3, [-(4-1), 4-1] = [-3, 3]

56 Sign/Magnitude Numbers
Problems Addition doesn’t work naturally Example: 5 + (-5) 0101 + 1101 10010 Two representations of 0 (±0) 0000 (+0) 1000 (-0)

57 Two’s Complement Numbers
Ok, so what’s a solution to these problems? 2’s complement numbers! Don’t have same problems as sign/magnitude numbers Addition works fine Single representation for 0 So, hardware designers like it and uses 2’s complement number system when designing CPU

58 History of Two’s Complement in Computers
IBM System/360

59 Von Neumann Architecture

60 How to Make 2’s Complement Numbers?
Reversing the sign of a two’s complement number Method: Flip (Invert) the bits Add 1 Example -7: 2’s complement number of +7 0111 (+7) 1000 (flip all the bits) (add 1) 1001 (-7)

61 Two’s Complement Numbers
The most significant bit still indicates the sign If MSB == 1, a negative number If MSB == 0, a positive number Range of an N-bit two’s complement number [-2N-1, 2N-1-1] Example N=3, [-(4), 4-1] = [-4, 3] Signed Decimal 2’s complement Unsigned 000 1 001 2 010 3 011 -4 100 4 -3 101 5 -2 110 6 -1 111 7

62 Two’s Complement Examples
Take the two’s complement of 01102 1001 (flip all the bits) (add 1) 1010 Take the two’s complement of 11012 0010 (flip all the bits) 0011

63 Two’s Complement Addition
Add 6 + (-6) using two’s complement numbers Add using two’s complement numbers

64 One’s Complement?

65 Increasing Bit Width Sometimes, you need to increase the bit width when you design a computer For example, read a 8-bit data from main memory and store it to a 32-bit ALU A value can be extended from N bits to M bits (where M > N) by using: Sign-extension Zero-extension

66 Sign-Extension Sign bit is copied into most significant bits. Examples
Number value remains the same Examples 4-bit representation of 3 = 0011 8-bit sign-extended value: 4-bit representation of -5 = 1011

67 Zero-Extension Zeros are copied into most significant bits. Examples
Number value may change. Examples 4-bit value = 0011 8-bit zero-extended value: 4-bit value = 1011

68 Number System Comparison
Range Unsigned [0, 2N-1] Sign/Magnitude [-(2N-1-1), 2N-1-1] Two’s Complement [-2N-1, 2N-1-1] For example, 4-bit representation:

69 Online Tools Cisco’s binary teaching game Number converter
Set and reset bits to display a binary representation of specific decimal numbers Number converter And online number converter from binary to hex and decimal and back.

70 Zoom-in a System Component

71 Logic Gates Logic gates perform logic functions such as NOT (inversion), AND, OR, NAND, NOR, etc. Single-input logic gates NOT gate, buffer Two-input logic gates AND, OR, XOR, NAND, NOR, XNOR etc Multiple-input logic gates 71 71

72 Logic Function and Truth Table
Y B C Y 1

73 Single-Input Logic Gates
73 73

74 Two-Input Logic Gates 74 74

75 More Two-Input Logic Gates
2 input XOR (Exclusive OR) is “true” if either A or B (not both) is true 75 75

76 BTW, How Logic Gates Are Built?
What we saw so far are just symbols, right? What are those symbols built from in the real world? Transistors! 76 76

77 Hmmm, what is it really built from?
Transistor Transistor is a three-ported voltage-controlled switch Electronic switch, a path exists when the Switch Control is closed If (Open) OUTPUT = unknown ; Switch is open (OFF) Else OUTPUT = INPUT ; Switch is closed (ON) Analogy — water through a pipe: the gate acts like a valve, allowing/preventing a flow between the source and drain Switch Control INPUT OUTPUT Hmmm, what is it really built from? 77 77

78 Silicon Transistors are built out of silicon.
Silicon is not a conductor Silicon crystal is an insulator -- no free electrons. Doping transforms a silicon crystal from a good insulator into a viable conductor; hence, the name semiconductor. Metal oxide silicon (MOS) transistors: Adding phosphorus produces n-type transistor Adding boron produces p-type transistor Silicon powder 78 78

79 The Analogy of A Transistor
Source Drain Switch Control (Gate) Cross Section An N-Channel Metal-Oxide Semiconductor Field Effect Transistor (MOSFET)

80 MOS Signal Transfer Property
Gate Source Drain Gate Path 0 volts Conduct 2.9 volts Open Transmits 1 well Transmits 0 poorly Transmits 0 well Transmits 1 poorly pMOS Gate Drain Source Gate Path 0 volts Open 2.9 volts Conduct nMOS

81 CMOS = 2.9 volts p-type n-type
In Out 0 volts 2.9 volts n-type CMOS is used to build the vast majority of all transistors fabricated today pMOS transistors pass good 1’s, so connect source to VDD nMOS transistors pass good 0’s, so connect source to GND

82 It is an Inverter (NOT Gate)
P1 N1 Y ON OFF 1 82 82

83 NAND Gate A B P1 P2 N1 N2 Y ON OFF 1 83 83

84 What If Transistor Is Transparent?

85 Extra Credit Question Problem Design and build a mechanical XNOR gate
Free to use any mechanical parts tubes, rods, wheels, valves, pipes No magnets and electronic components allowed Competition rule Send your design by Monday (Jan 25) First five working designs will get 3 points on the final grades 3 additional points if the winner can build it and demonstrate it in class

86 Analytical Engine Another age must be the judge
Charles Babbage’s Analytical Engine Mechanical decimal general purpose computer Steam engine, punchcards, gears CPU complete by death in 1871 The first complete Babbage Engine was completed in London in 2002, 153 years after it was designed.

87 Z1 1938 Konrad Zuse: the Z1 First binary programmable computer, completely mechanical Punchcard input, processing implemented with metal plates


Download ppt "Lecture 1. Number System and Logic Gates"

Similar presentations


Ads by Google