Download Fundamentals of Computer Systems and more Lecture notes Algorithms and Programming in PDF only on Docsity! Fundamentals of Computer Systems Thinking Digitally Martha A. Kim Columbia University Fall 2013 1 / 1 The Subject s of this Class 0 1 2 / 1 Engineering Works Because of Abstraction Application Software COMS 3157, 4156, et al. Operating Systems COMS W4118 Architecture Second Half of 3827 Micro-Architecture Second Half of 3827 Logic First Half of 3827 Digital Circuits First Half of 3827 Analog Circuits ELEN 3331 Devices ELEN 3106 Physics ELEN 3106 et al. 3 / 1 Simple information processing system Discrete Information Processing System System State Discrete Inputs Discrete Outputs First half of the course 4 / 1 Simple information processing system Discrete Information Processing System System State Discrete Inputs Discrete Outputs First quarter of the course 4 / 1 Rules and Regulations You may collaborate with classmates on homework. Each assignment turned in must be unique; work must ultimately be your own. List your collaborators on your homework. Do not cheat. Tests will be closed-book with a one-page “cheat sheet” of your own devising. 7 / 1 The Text(s): Alternative #1 No required text. There are two recommended alternatives. É David Harris and Sarah Harris. Digital Design and Computer Architecture. Almost precisely right for the scope of this class: digital logic and computer architecture. 8 / 1 The Text(s): Alternative #2 É M. Morris Mano and Charles Kime. Logic and Computer Design Fundamentals, 4th ed. É Computer Organization and Design, The Hardware/Software Interface, 4th ed. David A. Patterson and John L. Hennessy 9 / 1 Which Numbering System Should We Use? Some Older Choices: Roman: I II III IV V VI VII VIII IX X Mayan: base 20, Shell = 0 Babylonian: base 60 12 / 1 The Decimal Positional Numbering System Ten figures: 0 1 2 3 4 5 6 7 8 9 7× 102 + 3× 101 + 0× 100 = 73010 9× 102 + 9× 101 + 0× 100 = 99010 Why base ten? 13 / 1 Hexadecimal, Decimal, Octal, and Binary Hex Dec Oct Bin 0 0 0 0 1 1 1 1 2 2 2 10 3 3 3 11 4 4 4 100 5 5 5 101 6 6 6 110 7 7 7 111 8 8 10 1000 9 9 11 1001 A 10 12 1010 B 11 13 1011 C 12 14 1100 D 13 15 1101 E 14 16 1110 F 15 17 1111 14 / 1 Computers Rarely Manipulate True Numbers Infinite memory still very expensive Finite-precision numbers typical 32-bit processor: naturally manipulates 32-bit numbers 64-bit processor: naturally manipulates 64-bit numbers How many different numbers can you represent with 5 binary octal decimal hexadecimal digits? 17 / 1 Jargon Bit Binary digit: 0 or 1 Byte Eight bits Word Natural number of bits for the pro- cessor, e.g., 16, 32, 64 LSB Least Significant Bit (“rightmost”) MSB Most Significant Bit (“leftmost”) 18 / 1 Decimal Addition Algorithm 1 1 434 +628 1062 4+ 8 = 12 1+ 3+ 2 = 6 4+ 6 = 10 + 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 11 3 3 4 5 6 7 8 9 10 11 12 4 4 5 6 7 8 9 10 11 12 13 5 5 6 7 8 9 10 11 12 13 14 6 6 7 8 9 10 11 12 13 14 15 7 7 8 9 10 11 12 13 14 15 16 8 8 9 10 11 12 13 14 15 16 17 9 9 10 11 12 13 14 15 16 17 18 10 10 11 12 13 14 15 16 17 18 19 19 / 1 Decimal Addition Algorithm 1 1 434 +628 1 062 4+ 8 = 12 1+ 3+ 2 = 6 4+ 6 = 10 + 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 11 3 3 4 5 6 7 8 9 10 11 12 4 4 5 6 7 8 9 10 11 12 13 5 5 6 7 8 9 10 11 12 13 14 6 6 7 8 9 10 11 12 13 14 15 7 7 8 9 10 11 12 13 14 15 16 8 8 9 10 11 12 13 14 15 16 17 9 9 10 11 12 13 14 15 16 17 18 10 10 11 12 13 14 15 16 17 18 19 19 / 1 Decimal Addition Algorithm 1 1 434 +628 1062 4+ 8 = 12 1+ 3+ 2 = 6 4+ 6 = 10 + 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 11 3 3 4 5 6 7 8 9 10 11 12 4 4 5 6 7 8 9 10 11 12 13 5 5 6 7 8 9 10 11 12 13 14 6 6 7 8 9 10 11 12 13 14 15 7 7 8 9 10 11 12 13 14 15 16 8 8 9 10 11 12 13 14 15 16 17 9 9 10 11 12 13 14 15 16 17 18 10 10 11 12 13 14 15 16 17 18 19 19 / 1 Binary Addition Algorithm 10011 10011 +11001 101100 1+ 1 = 10 1+ 1+ 0 = 10 1+ 0+ 0 = 01 0+ 0+ 1 = 01 0+ 1+ 1 = 10 + 0 1 0 00 01 1 01 10 10 10 11 20 / 1 Binary Addition Algorithm 10 011 10011 +11001 101 100 1+ 1 = 10 1+ 1+ 0 = 10 1+ 0+ 0 = 01 0+ 0+ 1 = 01 0+ 1+ 1 = 10 + 0 1 0 00 01 1 01 10 10 10 11 20 / 1 Binary Addition Algorithm 1 0011 10011 +11001 10 1100 1+ 1 = 10 1+ 1+ 0 = 10 1+ 0+ 0 = 01 0+ 0+ 1 = 01 0+ 1+ 1 = 10 + 0 1 0 00 01 1 01 10 10 10 11 20 / 1 Binary Addition Algorithm 10011 10011 +11001 101100 1+ 1 = 10 1+ 1+ 0 = 10 1+ 0+ 0 = 01 0+ 0+ 1 = 01 0+ 1+ 1 = 10 + 0 1 0 00 01 1 01 10 10 10 11 20 / 1 One’s Complement Numbers Like Signed Magnitude, a leading 1 indicates a negative One’s Complement number. To negate a number, complement (flip) each bit. 00002 = 0 00102 = 2 11012 = −2 10002 = −7 11112 = −0? Addition is nicer: just add the one’s complement numbers as if they were normal binary. Really annoying having a −0: two numbers are equal if their bits are the same or if one is 0 and the other is −0. 23 / 1 24 / 1 Two’s Complement Numbers Really neat trick: make the most significant bit represent a negative number instead of positive: 11012 = −8+ 4+ 1 = −3 11112 = −8+ 4+ 2+ 1 = −1 01112 = 4+ 2+ 1 = 7 10002 = −8 Easy addition: just add in binary and discard any carry. Negation: complement each bit (as in one’s complement) then add 1. Very good property: no −0 Two’s complement numbers are equal if all their bits are the same. 25 / 1