cs111 lecture 01
play

CS111 Lecture 01: Computer Concepts Hardware and Software Binary - PDF document

CS111 Lecture 01: Computer Concepts Hardware and Software Binary Representation Programming Languages Aaron Stevens 29 June 2009 1 What is a computer? What is a computer, anyway? Give some examples of computers: 2 2 1 What is a


  1. CS111 Lecture 01: Computer Concepts Hardware and Software Binary Representation Programming Languages Aaron Stevens 29 June 2009 1 What is a computer? What is a computer, anyway? Give some examples of computers: 2 2 1

  2. What is a Computer? Computer Takes an input (some data), applies a process, and produces an output. Examples – Abacus? – Slide rule – Smoke Alarm – Pocket Calculator – Game Console (i.e. Nintendo Wii) – Cell Phone, Blackberry, iPod – Laptop/PC/iMac 3 3 Slide Rule The slide rule is a mechanical calculator. It works by aligning two logarithmic scales. Align the inputs, and read off the output. This slide rule is showing values of 2 X C e.g. 2 X 2 = 4, 2 X 2.8 = 5.6, etc. 4 2

  3. Analog or Digital? Analog Computers Information is processed directly in its indigenous form. Digital Computers Information processing and storage occurs using a symbolic representation of the data. 3 5 Digital Computers Information processing and storage occurs using a symbolic representation of the data – each symbol encoded as a discrete pattern of electrical charges. Input must be converted to electrical signals, processed as electrical signals, and then converted back to analog output for consumption by people. 3 6 3

  4. Hardware and Software Hardware The physical elements of a computing system (chips, circuit boards, monitor, keyboard, disk drives, printer, wires, …) Software The programs that provide the instructions for a computer to execute . 3 7 Hardware Basics Hardware: the machinery of computing. The von Neumann computer architecture. 8 4

  5. Thinking Inside the Box A computer’s internals are typically hidden from the user. They consist of: – Integrated circuit chips such as the central processing unit (CPU), memory circuits, and device controllers. – Integrated devices for storage (e.g. hard disk), communication (e.g. network adapter, Bluetooth). – Greenboard and connecting wires. 9 Thinking Inside the Box A computer motherboard A CPU Chip Some typical components in 1993. 10 5

  6. Thinking Outside the Box The stuff that connects to the computer’s box are called peripherals. These include: – Input devices (e.g. keyboard, mouse) – Output devices (e.g. video displays, printers) – Storage devices (e.g. hard drive, USB key) 11 Moore’s Law 12 6

  7. Moore’s Law The capabilities of computing hardware have improved at an exponential rate. – Computational power has doubled every 2 years (since 1975), and this trend is expected to continue for the foreseeable future. – Other formulations: hard disk capacity, RAM memory, pixels (for digital cameras) Read about Moore’s Law on Wikipedia. 13 30,000 Foot View of Software 14 7

  8. Data Representation Digital computers are made up of electronic circuits, which have exactly 2 states: on and off. Human languages are based on MANY discrete symbols! And what about multimedia stuff? All information processed by a digital computer must be represented in this simple/finite scheme: on and off. 9 15 What Would Pooh Do? 16 8

  9. What Would Pooh Do? Humans have 10 fingers, so a base-10 numbering system makes sense for us. Pooh is a very simple bear – he only has 2 paws, and no fingers! The Pooh Numbering System would count using all the paws he has – 2 of them. 9 17 Binary Numbers Digital computers are made up of electronic circuits, which have exactly 2 states: on and off. Computers use a numbering system which has exactly 2 symbols, representing on and off. 9 18 9

  10. Binary Numbers Decimal is base 10 and has 10 digits: 0,1,2,3,4,5,6,7,8,9 Binary is base 2 and has 2, so we use only 2 symbols: 0,1 For a given base, valid numbers will only contain the digits in that base, which range from 0 up to (but not including) the base. 9 19 Binary Numbers and Computers A binary digit or bit can take on only these two values. Low Voltage = 0 High Voltage = 1 each bit holds 0 or 1 Binary numbers are built by concatenating a string of bits together. Example: 10101010 22 20 10

  11. Positional Notation: Binary Numbers Each column has a value based on its position. Consider this general form: d n * B n-1 + d n-1 * B n-2 + ... + d 1 * B 0 This can be applied to base-2 numbers: 1011(binary) = 1 * 2 3 (1 * 8) + 0 * 2 2 (0 * 4) + 1 * 2 1 (1 * 2) + 1 * 2 0 (1 * 1) 1011(binary) =8 + 0 + 2 + 1 = 11(decimal) 21 Converting Binary to Decimal What is the decimal equivalent of the binary number 01101110? (you try it! Work left-to-right) 13 22 11

  12. Converting Binary to Decimal What is the decimal equivalent of the binary number 01101110? 0 x 2 7 = 0 x 128 = 0 + 1 x 2 6 = 1 x 64 = 64 + 1 x 2 5 = 1 x 32 = 32 + 0 x 2 4 = 0 x 16 = 0 + 1 x 2 3 = 1 x 8 = 8 + 1 x 2 2 = 1 x 4 = 4 + 1 x 2 1 = 1 x 2 = 2 + 0 x 2º = 0 x 1 = 0 = 110 (decimal) 13 23 Converting Binary to Decimal Try another one. What is the decimal equivalent of the binary number 10101010? (you try it! Work left-to-right) 13 24 12

  13. Converting Binary to Decimal Try another one. What is the decimal equivalent of the binary number 10101010? 1 x 2 7 = 1 x 128 = 128 + 0 x 2 6 = 0 x 64 = 0 + 1 x 2 5 = 1 x 32 = 32 + 0 x 2 4 = 0 x 16 = 0 + 1 x 2 3 = 1 x 8 = 8 + 0 x 2 2 = 0 x 4 = 0 + 1 x 2 1 = 1 x 2 = 2 + 0 x 2º = 0 x 1 = 0 = 170 (decimal) 13 25 Converting from Decimal to Other Bases Algorithm (process) for converting number in base 10 to other bases While (the quotient is not zero) Divide the decimal number by the new base* Make the remainder the next digit to the left in the answer Replace the original decimal number with the quotient * Using whole number (integer) division only. Example: 3 / 2 gives us a quotient of 1 and a remainder 1 19 26 13

  14. Converting Decimal to Binary What is the binary equivalent of the decimal number 103? 103 / 2 = 51, remainder 1  rightmost bit 51 / 2 = 25, remainder 1 25 / 2 = 12, remainder 1 12 / 2 = 6, remainder 0 6 / 2 = 3, remainder 0 3 / 2 = 1, remainder 1 1 / 2 = 0, remainder 1  leftmost bit 103 (decimal) = 1 1 0 0 1 1 1 (binary) 27 Converting Decimal to Binary Now you try one. What is the binary equivalent of the decimal number 201? Recall the algorithm: While (the quotient is not zero) Divide the decimal number by the new base* Make the remainder the next digit to the left in the answer Replace the original decimal number with the quotient 28 14

  15. Converting Decimal to Binary What is the binary equivalent of the decimal number 201? 201 / 2 = 100, remainder 1  rightmost bit 100 / 2 = 50, remainder 0 50 / 2 = 25, remainder 0 25 / 2 = 12, remainder 1 12 / 2 = 6, remainder 0 6 / 2 = 3, remainder 0 3 / 2 = 1, remainder 1 1 / 2 = 0, remainder 1  leftmost bit 201 (decimal) = 1 1 0 0 1 0 0 1 (binary) 29 Hexadecimal Number System The hexadecimal number system is a “short-hand” technique for representing binary numbers. Each group of 4 bits is represented by one hex digit. http://www.dewassoc.com/support/msdos/decimal_hexadecimal.htm Typically, we write Hexadecimal numbers with a prefix of 0x, e.g. 0x9400D3 30 15

  16. Representing Text What must be provided to represent text? There are finite number of characters to represent, so list them all and assign each a binary number. Character set A list of characters and the binary codes used to represent each one. Computer manufacturers agreed to standardize in the early 1960s. 31 The ASCII Character Set ASCII stands for American Standard Code for Information Interchange ASCII originally used seven bits to represent each character, allowing for 128 unique characters Later extended ASCII evolved so that all eight bits were used. 32 16

  17. The ASCII Character Set (7 bits) 33 The Extended ASCII Character Set 34 17

  18. The Unicode Character Set Extended ASCII is not enough for international use. Unicode uses 16 bits per character How many characters can UNICODE represent? Unicode is a superset of ASCII. The first 256 characters correspond exactly to the extended ASCII character set 35 The Unicode Character Set Figure 3.6 A few characters in the Unicode character set 36 18

  19. Computer Programming The CPU does some low-level tasks, and each one is specified as a machine-language instruction. – How do we get the CPU to do stuff for us? Computer programming is the process of analyzing a problem, designing a solution, and expressing that solution as a series of computer instructions. Computer programs must be written in the language the computer understands. 37 Machine Language Characteristics of machine language: – Each instruction is an operation code and an operand, expressed in binary. – Every processor type has its own set of specific machine instructions. – The relationship between the processor type and the instructions it can carry out is completely integrated. – Each machine-language instruction does only one very low-level task. 38 19

  20. Machine Language Example 39 Assembly Language Assembly language A language that uses mnemonic codes to represent machine-language instructions. Mnemonic code examples: – LOADA means “load value into accumulator” – ADDA means “add value into accumulator” – STOREA means “store value from accumulator” 40 20

  21. The Assembly Process Assembler A program that reads each of the instructions in mnemonic form and translates it into the machine-language equivalent. 41 Example: Assembly Program 42 21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend