EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
ICS312 Set 2 Representation of Numbers and Characters.
Representing Numbers: Integers
Lecture - 2 Number systems and computer data formats
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Data Representation Computer Organization &
Data Representation COE 205
Connecting with Computer Science, 2e
Level ISA3: Information Representation
Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
Data Representation in Computers
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Data Representation Number Systems.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Computers Organization & Assembly Language
Numbering Systems CS208.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
IT253: Computer Organization
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems Spring Semester 2013Programming and Data Structure1.
ICS312 Set 1 Representation of Numbers and Characters.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Computer Math CPS120: Lecture 3. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits have 0 or.
Data Representation, Number Systems and Base Conversions
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 2: Number Systems & x86 Instructions Constantine D. Polychronopoulos Professor, ECE Office: 463.
1 2.1 Introduction A bit is the most basic unit of information in a computer. –It is a state of “on” or “off” in a digital circuit. –Sometimes these states.
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
Number Representation (Part 1) Computer Architecture (Fall 2006)
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
MECH1500 Chapter 3.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Number Systems. ASCII – American Standard Code for Information Interchange – Standard encoding scheme used to represent characters in binary format on.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Data Representation COE 308 Computer Architecture
Number Systems and Codes
Data Representation ICS 233
Lec 3: Data Representation
Data Representation.
Lecture No. 4 Number Systems
Number Representation
3.1 Denary, Binary and Hexadecimal Number Systems
Data Representation Binary Numbers Binary Addition
Number Systems.
Chapter 3 Data Representation
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
University of Gujrat Department of Computer Science
Number Systems and Codes
Numbering System TODAY AND TOMORROW 11th Edition
Chapter Four Data Representation in Computers By Bezawit E.
Data Representation ICS 233
Networks & I/O Devices.
Data Representation COE 308 Computer Architecture
Presentation transcript:

EEL 3801C EEL 3801 Part I Computing Basics

EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything must be expressed in terms of 0’s & 1’s - Instructions, data, memory locs. 1 = “on”  voltage at output of electronic device is high (saturated). 0 = “off”  voltage at output of electronic device is zero.

EEL 3801C Data Representation The smallest element of information is a “bit” – 0 or 1. But by itself a bit does not convey much information. Therefore: 8 bits in succession make a “byte”, the smallest addressable binary piece of information 2 bytes (16 bits in succession) make a “word”

EEL 3801C Data Representation 2 words (32 bits in succession) make a “double word”. We can easily understand base 10 numbers. So we need to learn how to convert between binary and decimal numbers. Decimal numbers are not useful to the computer: a compromise – base 16 numbers (hexadecimal) and base 8 nos., or “octal”.

EEL 3801C Binary Numbers Each position in a binary number, starting from the right and going left, stands for the power of the number 2 (the base). The rightmost position represents 2 0, which = 1. The second position from the right represents 2 1 = 2. The third position from the right represents 2 2 = 4. The fourth position from the right represents 2 3 = 8.

EEL 3801C Binary Numbers The value of an individual binary bit is multiplied by the corresponding base and power of 2, and all the resulting values for all the digits are added together. For ex = 0* * * * * * * *2 0 = = 41

EEL 3801C Binary Numbers Conversion from decimal to binary - Two methods: –Division by power of 2: Find the value of the largest power of 2 that fits into decimal number. Set 1 for position bit corresponding to that power. Subtract that value from the decimal number. Go to the first step, and re-do procedure until remainder is 0

EEL 3801C Binary Numbers Example: decimal number = 146 Largest value of power of 2 that fits into 146 is 128, or 2 7 Set 8th bit (power of 7) to 1 Subtract 128 from 146 = 18 Largest value that fits into 18 is 16 or 2 4 Set 5th bit (power of 4) to = 2

EEL 3801C Binary Numbers Example (continued): Largest power of 2 that fits into 2 is 2, or 2 1 Set second bit (power of 1) to 1 Remainder is now 0 Set all other bits to zero –The binary equivalent =

EEL 3801C Binary Numbers Second Method –Division by 2 Integer divide the decimal number by 2. Note the remainder (if even, 0; if odd, 1) The remainder represents the bit Integer divide the quotient again by 2 and note remainder. Continue until quotient = 0

EEL 3801C Binary Numbers Example Decimal number = /2 = 73, remainder = 0 73/2 = 36, remainder = 1 36/2 = 18, remainder =0 18/2 = 9, remainder = 0 9/2 = 4, remainder = 1 4/2 = 2, remainder = 0 2/2 = 1, remainder = 0

EEL 3801C Binary Numbers 1/2 = 0, remainder = 1 0/2 = 0, remainder = 0 Starting from the last one, the binary number is now the string of remainders: Since the 0 to the left does not count, we can lop it off

EEL 3801C Hexadecimal Numbers Large binary numbers are cumbersome to read. ==> hexadecimal numbers are used to represent computer memory and instructions. Hexadecimal numbers range from 0 to 15 (total of sixteen). Octal numbers range from 0 to 7 (total of 8)

EEL 3801C Hexadecimal Numbers The letters of the alphabet are used to the numbers represent 10 through 15. –where A=10, B=11, C=12, D=13, E=14, and F=15 But why use hexadecimal numbers? 4 binary digits (half a byte) can have a maximum value of 15 (1111), and a minimum value of 0 (0000).

EEL 3801C Hexadecimal Numbers If we can break up a byte into halves, the upper and lower halves, each half would have 4 bits. A single hexadecimal digit between 0 and F could more concisely represent the binary number represented by those half-bytes. A byte could then be represented by two hexadecimal digits, rather than 8 bits

EEL 3801C Hexadecimal Numbers The advantage becomes more evident for larger binary numbers: D A  DAh

EEL 3801C Numbers A radix is placed after the number to indicate the base of the number. These are always in lower case. If binary, the radix is a “b”; if hexadecimal, “h”, if octal, “o” or “q”. Decimal is the default, so if it has no indication, it is assumed to be decimal. A “d” can also be used.

EEL 3801C Hexadecimal to Decimal Conversion Similarly to binary-to-decimal conversion, each digit (position from right to left) of the hex number represents a power of the base (16), starting with power of 0. –2 F 5 B  2* * * *16 0 = 2* * * *1 – = = 12,123

EEL 3801C Binary Conversion into Hexadecimal Binary to hex is somewhat different, because we in reality, take each 4 bits starting from the right, and convert it to a decimal number. We then take the hexadecimal equivalent of the decimal number (i.e., 10 = A, 11 = B, etc.) and assign it to each 4 bit sequence. Each digit in a hex number = “hexadized” decimal equivalent of 4 binary bits.

EEL 3801C Hexadecimal Conversion into Binary This conversion is also rather simple. Each hex digit represents 4 bits. The corresponding 4-bit binary sequence replaces the hex digit. For example: 26AF 

EEL 3801C Signed and Unsigned Integers Integers are typically represented by one byte (8 bits) or by one word (16 bits). There exist two types of binary integers: signed and unsigned

EEL 3801C Unsigned Integers Unsigned integers are easy – they use all 8 or 16 bits in the byte or word to represent the number. If a byte, the total range is 0 to 255 ( to ). If a word, the total range is 0 to 65,535 ( to ).

EEL 3801C Signed Integers Are slightly more complicated, as they can only use 7 or 15 of the bits to represent the number. The highest bit is used to indicate the sign. A high bit of 0  positive number A high bit of 1  negative number - counter intuitive, but more efficient.

EEL 3801C Signed numbers (cont.) The range of a signed integer in a byte is therefore, -128 to127, remembering that the high bit does not count. The range of a signed integer in a word is – 32,768 to 32,767.

EEL 3801C The One’s Complement The one’s complement of a binary number is when all digits are reversed in value. For example, has a one’s complement of

EEL 3801C Storage of Numbers Unsigned numbers and positive signed numbers are stored as described above. Negatively signed numbers, however, are stored in a format called the “Two’s complement” which allows it to be added to another number as if it was positive.

EEL 3801C Storage of Numbers (cont.) The Two’s Complement of a number is obtained by adding 1 to the lowest bit of the one’s complement of the number. The Two’s Complement is perfectly reversible –TC (TC (number)) = number.

EEL 3801C Storage of Numbers (cont.) Therefore, if the high bit is set (to 1), the number is a negatively signed integer. But, its decimal value can only be obtained by taking the two’s complement, and then converting to decimal. If the high bit is not set (= 0), then the number can be directly converted into decimal.

EEL 3801C Example is a positive number, as the high bit is can be easily converted to 10 decimal in a straightforward fashion = 10 decimal

EEL 3801C Example (cont.) is a negative number because of the high bit being set , however, is not –10, as we first have to determine its two’s complement.

EEL 3801C Example (cont.) One’s Complement of ( )  ( ), add 1  ( )  = -118

EEL 3801C Character Representation – ASCII How do we represent non-numeric characters as well as the symbols for the decimal digits themselves if we want to get an alphanumeric combination? Typically, characters are represented using only one byte minus the high bit (7-bit code).

EEL 3801C Character Representation – ASCII (cont.) Bits 00h to 7Fh represent the possible values. The ASCII table maps the binary number designated to be a character with a specific character. The back inside cover of the textbook contains that mapping. If the eighth bit is used (as is done in the IBM PC to extend the mapping to Greek and graphics symbols), then the hex numbers used are 80h to FFh.

EEL 3801C Character Representation – ASCII (cont.) The programmer has to keep track of what a binary number in a program stands for. –It is not inherent in the hardware or the operating system. High level languages do this by forcing you to declare a variable as being of a certain type. –Different data types have different lengths