Comp Org & Assembly Lang

Slides:



Advertisements
Similar presentations
Bits and Bytes CS 213 Aug. 27, 1998 Topics Why bits? Representing information as bits –Binary/Hexadecimal –Byte representations »numbers »characters and.
Advertisements

Bits and Bytes January 17, 2002 Topics Why bits? Representing information as bits –Binary/Hexadecimal –Byte representations »numbers »characters and strings.
CHAPTER 2: Number Systems
Bits and Bytes Topics Why bits? Representing information as bits Binary/Hexadecimal Byte representations »numbers »characters and strings »Instructions.
+ Binary Numbers. + + Why Binary? The smallest piece of information in a computer is a bit which stands for binary digit. (Portmanteau: smoke+fog = smog)
 Binary Binary  Binary Number System Binary Number System  Binary to Decimal Binary to Decimal  Decimal to Binary Decimal to Binary  Octal and Hexadecimal.
Codes and number systems Introduction to Computer Yung-Yu Chuang with slides by Nisan & Schocken ( ) and Harris & Harris (DDCA)
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Numbering Systems Decimal (Denary) base 10. Clumsy when dealing with computers. Other systems –Binary –Octal –Hexadecimal Convenient when dealing with.
Number Systems.
A-Level Computing Data representation. Objectives Know how data can be represented in a computer system Understand the need for various forms of representation.
Chapter 2 Bits, Data Types & Operations Integer Representation
Supplemental Chapter Number Bases
Number systems Jaana Holvikivi Metropolia. Result AND OR NOT Logical operations Boolean algebra Operations &&AND.
1 DLD Lecture 18 Recap. 2 Recap °Number System/Inter-conversion, Complements °Boolean Algebra °More Logic Functions: NAND, NOR, XOR °Minimization with.
Number Systems 2.1 Information Storage Why not decimal numbers in computers ? Difficult to store ENIAC (1 st electronic computer) used 10 vacuum tubes.
Bits and Bytes Spring, 2015 Topics Why bits? Representing information as bits Binary / Hexadecimal Byte representations »Numbers »Characters and strings.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
CHAPTER 3: Number Systems
Converting From decimal to Binary & Hexadecimal to Binary
CHAPTER 3: Number Systems The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv.
Bits, Bytes, and Integers Topics Representing information as bits Bit-level manipulations Boolean algebra Expressing in C Representations of Integers Basic.
Lecture 1: 8/27/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
Chapter 1: Binary Systems
Number System Base b Use only digits of 0, 1, 2,…., b-1 Positional weights X = a n-1 b n-1 + a n-2 b n-2 + …. + a 0 b = 1x x10 1 +
Cis303a_chapt03_exam1_answer.ppt CIS303A: System Architecture Exam 1: Chapter 3 Answer List the characters (digits) for the following bases. 1) Decimal:
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
CMSC 1041 Binary / Hex Binary and Hex The number systems of Computer Science.
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
Number Systems and Representations Binary Representation Binary Representation Signed numbers Signed numbers Very small and very big numbers Very small.
Computer Science 210 Computer Organization
Lecturer: Santokh Singh
Computer Science 210 Computer Organization
Octal to Decimal Decimal Octal Binary Hexadecimal.
Assembly Language (CSW 353)
COMPUTER ORGANIZATION
Data Representation Binary Numbers Binary Addition
Positional Notation A positional or place-value notation is a numeral system in which each position is related to the next by a constant multiplier, called.
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Bits, Bytes, and Integers CSE 238/2038/2138: Systems Programming
EPSII 59:006 Spring 2004.
ECE 103 Engineering Programming Chapter 3 Numbers
2.0 COMPUTER SYSTEM 2.2 Number System and Representation
Binary Quiz UIN: ____________________
Digital Electronics Ms. Deepa Mehta.
Unit 2.6 Data Representation Lesson 1 ‒ Numbers
Computer Science 210 Computer Organization
Bits and Bytes Topics Representing information as bits
Comp Org & Assembly Lang
Bits and Bytes Topics Representing information as bits
Computer Science 210 Computer Organization
Bits and Bytes Topics Representing information as bits
Bits, Bytes, and Integers 2nd Lectures
Bits and Bytes Topics Representing information as bits
“The Class That Gives CMU Its Zip!”
Digital Electronics and Microprocessors
There are 10 types of people of people in this world…
Bits and Bytes Topics Representing information as bits
Binary Lesson 3 Hexadecimal
Binary Lesson 3 Hexadecimal
Chapter 6: Computer Arithmetic
Binary Lesson 4 Hexadecimal and Binary Practice
GCSE COMPUTER SCIENCE Topic 3 - Data 3.4 Hexadecimal Conversion.
Comp Org & Assembly Lang
“The Class That Gives CMU Its Zip!”
“The Class That Gives CMU Its Zip!”
Presentation transcript:

Comp Org & Assembly Lang Bits and Bytes Topics Why bits? Representing information as bits Binary / Hexadecimal Byte representations Numbers Characters and strings Instructions Bit-level manipulations Boolean algebra Expressing in C

Why Don’t Computers Use Base 10? Base 10 Number Representation That’s why fingers are known as “digits” Natural representation for financial transactions Floating point number cannot exactly represent $1.20 Even carries through in scientific notation 15.213 X 103 (1.5213e4)

Why Don’t Computers Use Base 10? Implementing Electronically Hard to store ENIAC (First electronic computer) used 10 vacuum tubes / digit IBM 650 used 5+2 bits (1958, successor to IBM’s Personal Automatic Computer, PAC from 1956) Hard to transmit Need high precision to encode 10 signal levels on single wire Messy to implement digital logic functions Addition, multiplication, etc.

Binary Representations Base 2 Number Representation Represent 1521310 as 111011011011012 Represent 1.2010 as 1.0011001100110011[0011]…2 Represent 1.5213 X 104 as 1.11011011011012 X 213 Electronic Implementation Easy to store with bistable elements Reliably transmitted on noisy and inaccurate wires 0.0V 0.5V 2.8V 3.3V 1

Encoding Byte Values Byte = 8 bits Binary 000000002 to 111111112 Decimal: 010 to 25510 First digit must not be 0 in C Octal: 0008 to 03778 Use leading 0 in C Hexadecimal 0016 to FF16 Base 16 number representation Use characters ‘0’ to ‘9’ and ‘A’ to ‘F’ Use leading 0x in C, write FA1D37B16 as 0xFA1D37B Or 0xfa1d37b 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 Hex Decimal Binary

Bases Every number system uses a base Decimal numbers use base 10 Other common bases used in computer science: Octal (base 8) Hexadecimal (base 16) Binary (base 2) Do examples of base 10, base 8 numbers, base 16 Show how to translate base 8 to base 10, base 16 to base 10

Decimal 753 7 x 102 + 5 x 101 + 3 x 100

Octal 753 7 x 82 + 5 x 81 + 3 x 80

Counting in octal

Converting Converting octal to decimal: 753 = 7 x 82 + 5 x 81 + 3 x 80 = 448 + 40 + 3 = 491

Translating to octal writing 157 in base 8 157 remainder: 8 19 5 2 3 0 2 2 3 5 2 x 82 + 3 x 81 + 5 x 80 = 128 + 24 + 5 = 157 Divisor

Hexadecimal 753 7 x 162 + 5 x 161 + 3 x 160

Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 10A 10B 10C 10D 10E 10F 120 …

Translating to hex 365 remainder: 16 22 D 1 6 0 1 1 6 D 1 6 0 1 1 6 D 1 x 162 + 6 x 161 + D x 160 = 256 + 96 + 13 = 365

Binary 101 1 x 22 + 0 x 21 + 1 x 20

Counting in binary

Translating to binary 4 remainder: 2 2 0 1 0 0 1 Divisor 1 0 0

Translating to binary 11 remainder: 2 5 1 2 1 1 0 0 1 1 0 1 1

Literary Hex Common 8-byte hex filler: 0xdeadbeef Can you think of other 8-byte fillers?

Relation between hex and binary Hexadecimal: 16 characters, Each represents a number between 0 and 15 Binary: Consider 4 places Represent numbers between 0000 and 1111 Or between 0 and 15 Result: 1 hex digit represents 4 binary digits

Relation between hex and binary Decimal 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 A 1010 11 B 1011 12 C 1100 13 D 1101 14 E 1110 15 F 1111 16