Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software.

Similar presentations


Presentation on theme: "CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software."— Presentation transcript:

1 CS 125 Lecture 2 Martin van Bommel

2 Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software - instructions for hardware –e.g. operating system, compiler, word processor

3 Software Development Early computers - complex coding schemes –machine language - 0’s and 1’s Later on - introduction of system software –assembly language - mnemonics for operations –assembly program  assembler  machine lang Even later - compilers created –high-level languages (HLL) - natural language –HLL program  compiler  machine language

4 High Level Languages 1842 - Ada Agusta - analytical engine 1957 - John Backus - FORTRAN 1958, 60, 64 - ALGOL, COBOL, BASIC 1970 - US Dept. of Defence - Ada 1971 - Nicklaus Wirth - Pascal 1972 - Dennis Ritchie - C 1977 - Nicklaus Wirth - Modula-2 1989 - ANSI C adopted

5 Computer Components CPU - Central Processing Unit –controls operation of entire systems –performs arithmetic and logic operations –stores and retrieves instructions and data contains ALU - Arithmetic-Logic Unit Control Unit

6 Components (con’t) Main memory (internal or primary memory) –RAM - Random Access Memory –stores instructions and data temporarily Secondary memory (external or auxiliary) –magnetic disk (hard disk or floppy) –magnetic tape Peripherals - used for Input/Output –keyboard, printer, monitor, etc.

7 Internal Representation Each unit of memory a two-state device –off or on, 0 or 1 –represent in Binary, two Binary Digits (bits) Organized into groups of 8 bits - bytes –represents single keyboard character Larger grouping of 16 or 32 bits - word –represents single integer value –identified by address for access

8 Memory Sizes Kilobyte (K) = 2^10 = 1,024 bytes Megabyte (Mb) = 2^20 = 1,048,576 bytes Gigabyte (Gb) = 2^30 = 1,073,741,824 bytes

9 Decimal Number Systems Base 10 Digits - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 e.g. 342 10 = = 3 x 10^2 + 4 x 10^1 + 2 x10^0 = 3 x 100 + 4 x 10 + 2 x 1 = 300 + 40 + 2

10 Binary Number System Base 2 Digits 0, 1 e.g. 110 2 = = 1 x 2^2 + 1 x 2^1 + 0 x 2^0 = 1 x 4 + 1 x 2 + 0 x 1 = 4 + 2 + 0 = 6

11 16-bit Memory Word To store number 6, use 0000000000000110 Value 0 is 0000000000000000 Largest value is 1111111111111111 = 65,535 = 2^16 - 1 32-bit word gives largest value > 4 billion

12 Converting Decimal to Binary Repeatedly divide by 2, recording remainders in reverse order e.g. 53 / 2 = 26 R 1 26 / 2 = 13 R 0 13 / 2 = 6 R 1 6 / 2 = 3 R 0 3 / 2 = 1 R 1 1 / 2 = 0 R 1 giving 110101

13 Converting Binary to Decimal Repeatedly multiply by 2 and add next bit e.g. 110101 0 x 2 = 0 + 1 = 1 1 x 2 = 2 + 1 = 3 3 x 2 = 6 + 0 = 6 6 x 2 = 12 + 1 = 13 13 x 2 = 26 + 0 = 26 26 x 2 = 52 + 1 = 53

14 Storing Negative Values Sign Magnitude –use first bit as sign bit, 0 = positive 1 = negative –e.g. 8-bits 00000000 = 010000000 = -0 00000001 = 110000001 = -1… 01111111 = 12711111111 = -127 –problem -0 ????

15 Negatives (2) One’s complement - complement bits if neg –e.g. - 53 = - 00110101 = 11001010 –e.g. 8-bits 00000000 = 011111111 = -0 00000001 = 111111110 = -1… 01111111 = 12710000000 = -127

16 Negatives (3) Two’s complement –if positive, use binary –if negative, complement bits and add one –e.g. - 53 magnitude 00110101 complement11001010 add 111001011

17 8-bit Two’s Compement 00000000 = 0 00000001 = 111111111 = -1 00000010 = 211111110 = -2… 01111111 = 12710000001 = -127 10000000 = -128

18 16-bit two’s complement 8-bit two’s complement range is - 2^7 to 2^7 - 1 - 128 to 127 16-bit two’s complement range is - 2^15 to 2^15 - 1 - 32,768 to 32,767


Download ppt "CS 125 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk drive Software."

Similar presentations


Ads by Google