Comp 1001 Introduction to Information Technology & Computer Architecture Wednesday 12-1Dr. Joe Carthy http://www.cs.ucd.ie/staff/jcarthy/home/
Comp 1001: IT & Architecture - Joe Carthy Course Outline Introduction to Information Technology Hardware and Software I/O and Storage devices CPU RAM Information Representation: ASCII codes Binary and Hexadecimal Numbers Computer Networks Operating Systems Comp 1001: IT & Architecture - Joe Carthy
Course Outline Continued Computer Architecture and Assembly Language CPU structure Introduction to Assembly Language (8086) Instruction Set Basic Assembly Language Programs Fetch-Execute Cycle Pipelining Memory: RAM access and Cache Memory Computer performance evaluation Practicals Comp 1001: IT & Architecture - Joe Carthy
Course Outcomes At the end of this course Students should have a grasp of functional components of a computer system information representation assembly language instructions instruction execution CPU structure and functioning knowledge of performance evaluation Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy Recommended Texts Recommended Texts: Computers (Tools for the Information Age), Brief Edition, H.L. Capron, Prentice Hall Introduction to Assembly Language Programming and Computer Architecture, J. Carthy, ITP Web Notes http://www.cs.ucd.ie/staff/jcarthy/home/ Comp 1001: IT & Architecture - Joe Carthy
Simple Model of a Computer System Hardware Physical components that make up a computer system System: interconnected set of devices that function as a unit Software Computer programs that allow you use a computer Comp 1001: IT & Architecture - Joe Carthy
Simple Model of a Computer System Version 1 Comp 1001: IT & Architecture - Joe Carthy
Simple Model of a Computer System Version 2 Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy System Devices Classified as: Storage devices: store information RAM Disk CD/DVD Input/Output (I/O) devices: carry info to/from Computer Monitor (screen) Printer Mouse/Keyboard Speakers Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy Review Questions What is a computer system ? Explain the difference between hardware and software What are the two major device classes ? What is a peripheral device ? What is the function of the processor ? What is the function of memory (RAM) ? What are the major devices ? What is a bus ? Comp 1001: IT & Architecture - Joe Carthy
Information Representation How is “information” represented in a computer system ? What are the different types of information Text Numbers Images Video Photographic Audio Comp 1001: IT & Architecture - Joe Carthy
Everything is in Binary ! (1’s and 0’s) Computers are digital devices - they can only manipulate information in digital (binary) form. Easy to represent 1 and 0 in electronic, magnetic and optical devices Only need two states High/low On/off Up/down etc All information in a computer system is Processed in binary form Stored in binary form Transmitted in binary form Comp 1001: IT & Architecture - Joe Carthy
How is information converted to Binary form I/O and Storage Devices are digital I/O devices convert information to/from binary A keyboard converts the character “A” you type into a binary code to represent “A” E.g. “A” is represented by the binary code 01000001 Monitor converts 01000001 to the “A” that you read Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy Bits and Bytes One binary digit i.e. 1 or 0 is called a bit A group of 8 bits is one byte Byte is the unit of storage measurement Number of Bytes Unit 1024 bytes (210 bytes) 1 Kilobyte (Kb) 1024 Kb (220 bytes) 1 Megabyte (Mb) 1024 Mb (230 bytes) 1 Gigabyte (Gb) 1024 Gb (240 bytes) 1 Terabyte (Tb) 1024 Tb (250 bytes) 1 Petabyte (Pb) Comp 1001: IT & Architecture - Joe Carthy
Representing Text- ASCII Code Textual information is made up of individual characters e.g. Letters: Lowercase: a,b,c,..z Uppercase: A,B,C..Z Digits: 0,1,2,..9 Punctuation characters: ., :, ; ,, “, ’ Other symbols: -, +, &, %, #, /,\,£, etc.). Comp 1001: IT & Architecture - Joe Carthy
Representing Text- ASCII Code Each character is represented by a unique binary code. ASCII is one international standard that specifies the binary code for each character. American Standard Code for Information Interchange It is a 7-bit code - every character is represented by 7 bits There are other standards such as EBCDIC but these are not widely used. ASCII is being superceded by Unicode of which ASCII is a subset. Unicode is a 16-bit code. Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy Sample ASCII Codes Char ASCII Decimal NUL 000 0000 00 BEL 000 0111 07 LF 000 1010 10 CR 000 1011 13 011 0000 48 SP 010 0000 20 1 011 0001 49 ! 010 0001 21 2 011 0010 50 “ 010 0010 22 9 011 1001 57 A 100 0001 65 a 110 0001 97 B 100 0010 66 b 110 0010 98 C 100 0011 67 c 110 0011 99 Y 101 1001 89 y 111 1001 121 Z 101 1010 90 z 111 1010 122 Comp 1001: IT & Architecture - Joe Carthy
Comments on ASCII Codes Codes for A to Z and a to z form collating sequences A is 65, B is 66, C is 67 and so on A is 97, b is 98, c is 99 and so on Lowercase code is 32 greater than Uppercase equivalent Note that digit ‘0’ is not the same as number 0 ASCII is used for characters Not used to represent numbers (See later) Codes 0 to 30 are typically for Control Characters Bel - causes speaker to beep ! Carriage Return (CR); LineFeed (LF) Others used to control communication between devices SYN, ACK, NAK, DLE etc Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy Review All information stored/transmitted in binary Devices convert to/from binary to other forms that humans understand Bits and Bytes Kb, Mb, Gb, Tb and Pb are storage metrics ASCII code is a 7-bit code to represent text characters Text “numbers” not the same as “maths” numbers Do not add phone numbers or get average of PPS numbers ! Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy Review Questions How is information transmitted inside a computer Why do we use binary in computers What is an ASCII code used for How big is an ASCII code What is the ASCII code for: A, ‘0’, ‘a’ What is a collating sequence What is a control character - give an example What is Unicode and why is it used What is a bit ? A byte ? How many bytes in: Kb, Mb, Gb, Tb, Pb Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Integers Humans use Decimal Number System Computers use Binary Number System Important to understand Decimal system before looking at binary system Decimal Numbers - Base 10 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Positional number system: the position of a digit in a number determines its value Take the number 1649 The 1 is worth 1000 The 9 is worth 9 units Formally, the digits in a decimal number are weighted by increasing powers of 10 i.e. they use the base 10. We can write 1649 in the following form: 1*103 + 6*102 + 4*101 + 9*100 Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Integers weighting: 103 102 101 100 Digits 1 6 4 9 1649 = 1*103 + 6*102 + 4*101 + 9*100 Least Significant Digit: rightmost one - 9 above Lowest power of 10 weighting Digits on the right hand side are called the low-order digits (lower powers of 10). Most Significant Digit: leftmost one - 1 above Highest power of 10 weighting The digits on the left hand side are called the high-order digits (higher powers of 10) Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Decimal Numbers Largest n-digit number ? Made up of n consecutive 9’s (= 10n -1 ) Largest 4-digit number if 9999 9999 is 104 -1 Distinguishing Decimal from other number systems such as Binary, Hexadecimal (base 16) and Octal (base 8) How do we know whether the number 111 is decimal or binary One convention is to use subscripts Decimal: 11110 Binary:1112 Hex: 11116 Octal: 1118 Difficult to write use keyboard Another convention is to append a letter (D, B, H, O) Decimal: 111D Binary:111B Hex: 111H Octal: 111O Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Binary Numbers Binary numbers are Base 2 numbers Only 2 digits: 0 and 1 Formally, the digits in a binary number are weighted by increasing powers of 2 They operate as decimal numbers do in all other respects Consider the binary number 0101 1100 Weight 27 26 25 24 23 22 21 20 bits 0 1 0 1 1 1 0 0 01011100 = 0*27 + 1*26 + 0*25 + 1*24 + 1*23 + 1*22 + 0*21 + 0*20 = 0 + 6410 + 0 + 1610 + 810 + 410 + 0 + 0 = 9210 Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Binary Numbers Leftmost bit is the most significant bit (MSB). The leftmost bits in a binary number are referred to as the high-order bits. Rightmost bit is the least significant bit (LSB). The rightmost bits in a binary number are referred to as the low-order bits. Largest n-bit binary number ? Made up of n consecutive 1’s (= 2n -1) e.g. largest 4-bit number: 1111 = 24 -1 = 15 Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Binary Numbers Exercises Convert the following binary numbers to decimal: (i) 1000 1000 (ii) 1000 1001 (iii) 1000 0111 (iv) 0100 0001 (v) 0111 1111 (vi) 0110 0001 Joe Carthy Formatting Convention In these notes we insert a space after every 4 bits to make the numbers easier to read Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Converting Decimal to Binary To convert from one number base to another: you repeatedly divide the number to be converted by the new base the remainder of the division at each stage becomes a digit in the new base until the result of the division is 0. Example: To convert decimal 35 to binary we do the following: Remainder 35 / 2 1 17 / 2 1 8 / 2 0 4 / 2 0 2 / 2 0 1 / 2 1 The result is read upwards giving 3510 = 1000112. Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Converting Decimal to Binary Exercise: Convert the following decimal numbers to binary (1) 64 (2) 65 (3) 32 (4) 16 (5) 48 Shortcuts To convert any decimal number which is a power of 2, to binary, simply write 1 followed by the number of zeros given by the power of 2. For example, 32 is 25, so we write it as 1 followed by 5 zeros, i.e. 10000; 128 is 27 so we write it as 1 followed by 7 zeros, i.e. 100 0000. Remember that the largest binary number that can be stored in a given number of bits is made up of n 1’s. An easy way to convert this to decimal, is to note that this is 2n - 1. For example, if we are using 4-bit numbers, the largest value we can represent is 1111 which is 24-1, i.e. 15 Comp 1001: IT & Architecture - Joe Carthy
Representing Numbers: Converting Decimal to Binary Binary Numbers that you should remember because they occur so frequently Binary Decimal 111 7 1111 15 0111 1111 127 1111 1111 255 Comp 1001: IT & Architecture - Joe Carthy
Comp 1001: IT & Architecture - Joe Carthy Review Decimal Number System - Base 10 Significant Digits Binary Number System - Base 2 Notation (B,D,H,O) Binary to Decimal Decimal to Binary Shortcuts and Common Binary Numbers Review Questions What is a positional number system ? What is the MSB and the LSB. Give an example of each one. Show how the weights of the bits in an 8-bit binary number 16-bit binary numbe What is the weight of the MSB in (a) 8-bit number (b) 16-bit number (c) 32-bit number Convert 48D, 65D, 31D, 15D to binary Convert 1111 0111B, 1010 1010B and 1110 0111B to decimal Comp 1001: IT & Architecture - Joe Carthy