Data types. lecture 4


 Johnathan Alexander
 1 years ago
 Views:
Transcription
1 Data types lecture 4
2 Information in digital computers is represented using binary number system. The base, i.e. radix, of the binary system is 2. Other common number systems: octal (base 8), decimal (base 10), hexadecimal (base 16). Binary number system is adopted for computers due to simple physical implementation by electronic components Only two voltage levels are required to represent the two possible numbers: 0 and 1.
3 Example: acceptable TTL input gate voltage levels: 00.8V (LOW or 0) and 25V (HIGH or 1). In computer parlance, one binary digit is called bit, two digits are called a crumb, four digits are called a nibble, and eights digits are called a byte. The magnitude of a number is represented as a weighted sum of the digits. Each weight corresponds to an integer power of number s base, e.g. (1234.5) 10 = 1 x x x x x 101 ( ) 2 = 1 x x x x x x 21 = (22.5) 10 (721) 8 = 7 x x x 8 0 = (465) 10
4 Conversions between number systems, e.g.: ( ) 10 = (?) 2 Integer part = 41 Fraction part = / 2 = 20, remainder = x 2 = 1, fraction = / 2 = 10, remainder = x 2 = 0, fraction = / 2 = 5, remainder = x 2 = 1, fraction = / 2 = 2, remainder = x 2 = 1, fraction = / 2 = 1, remainder = 0 1 / 2 = 0, remainder = 1 => ( ) 10 = ( ) 2
5 To see how the integer part is formed you must recognize that by dividing a binary number (or the corresponding decimal number) by 2 you shift the binary point to the left. As the result, you have an integer part and a fraction part which is.0 (=0x21 in dec.) or.1 (=1x21 in dec.), and which gives you the right most digit: 0 or 1. By repeating the procedure for the integer part you get all the digits. The fraction part is discovered in a similar manner by instead of dividing by two you must multiply by two and check if you get and integer part as a result of multiplication.
6 ( ) 10 = (?) 8 Integer part = 41 Fraction part = / 8 = 5, remainder = x 8 = 5, fraction = / 8 = 0, remainder = x 8 = 4, fraction = 0.0 => ( ) 10 = (51.54) 8 ( ) 10 = (?) / 16 = 2, remainder = x 16 = 11, fraction = / 16 = 0, remainder = 2 => ( ) 10 = (29.B) 16,where B represents number 11. The most important conversions are conversions between decimal and binary systems assemblers and compilers perform these conversions for you in cases you want to work with decimal numbers.
7 Binary to octal/hexadecimal conversion Assume 16bit binary number: ( ) 2 Conversion to octal: ( ) 8 Conversion to hexadecimal: ( A F 6 3 ) 16 e.g. ( ) 2 = 1x2 7 +0x2 6 +0x2 5 +0x x2 3 +1x2 2 +0x2 1 +1x2 0 = (1x2 3 +0x2 2 +0x2 1 +0x2 0 )x2 4 + (1x2 3 +1x2 2 +0x2 1 +1x2 0 )x2 0 = (1x2 3 +0x2 2 +0x2 1 +0x2 0 )x (1x2 3 +1x2 2 +0x2 1 +1x2 0 )x16 0 Why to use octal and/or hexadecimal representations? Straight forward (easy) conversion to/from a binary number: helps a programmer to interpret register values and quickly recognize a value of an individual bit(s) (flag bit, for example).
8 Binarycoded decimal (BCD) BCD is a convention for mapping binary numbers to decimal numbers. Although any mapping could have be used, straight binary assignment is used in BCD for the decimal digits Decimal number Binarycoded decimal
9 ASCII (American Standard for Information Interchange) Uses 7 bits to code 128 characters: upper and lowercase letters, decimal digits, and special characters, e.g.: Character A B C D E F G H = ASCIIcode BCD
10 Complements Complements are used for simplifying arithmetic operations involving negative numbers, and for logical manipulation. There is two types of complements for each radix (base) r: r s complement and (r1) s complement r s complement of a number N is (r n  N) (r1) s complement of a number N is (r n  1)  N, n is the number of digits in N => the most significant digit of r n is 1 followed by n zeros.
11 Forming complements for binary numbers 1 s complement: change 1 s into 0 s and 0 s into 1 s 2 s complement: take 1 s complement and add 1, or leave least significant 0 s and first 1 unchanged, and then swap 1 s and 0 s for the higher significant bits *: = , : = *) 2 n = (n=7), 2 n 1 = By subtracting any 7 bit binary number M from 2 n1 you ll get the logic complement of the number M: e.g = Now by adding one to this number you ll get 2 n1 M + 1 = 2 n M, which is the 2 s complement of the number M. => 2 s complements can be computed rapidly by taking the logic complement (=1 s complement) of a number (easy to implement with a hardware) and by adding one to the result.
12 e.g = ( = 10 s complement of 13250) (end carry => positive 59282; end carry discarded) e.g = ( = 10 s complement of 72532) (no end carry => negative 59282, which is 10 s complement of 40718)
13 e.g = ( = 2 s complement of ) (end carry => positive ; end carry is discarded) e.g = ( = 2 s complement of ) (no end carry => negative , which is 2 s complement of )
14 FixedPoint Representations Positive integers, including zero, can be represented as unsigned numbers. However, to represent both positive and negative integers we need a notation for the sign. In the previous examples of twos complements we did not have a notation of sign: the sign was only recognized from the end carry after the operation, but it couldn t be recognized directly from the operands. It is customary to represent the sign with a bit placed in the leftmost position of the number: 0 for positive, and 1 for negative numbers, respectively. The bits after the sign bit represent the significant bits of the number.
15 Fixedpoint method assumes that the binary point is always fixed in one position. Two positions most widely used: binary point in the extreme left of the register for a fraction part, and binary point in the extreme right of the register for an integer part, e.g.: register 1 register integer part fraction part
16 The sign is represented by 1, and 0 for negative and positive numbers respectively. Rest of the negative number may be represented in one of three possible ways: 1. Signedmagnitude representation e.g. ( => 14) 2. Signed1 s complement representation e.g. ( => 14) 3. Signed2 s complement representation e.g. ( => 14)
17 Signedmagnitude representation is awkward when employed in computer arithmetic: would complicate the hardware. 1 s complement has two representations of 0 (+0, 0), i.e.: and Seldom used for arithmetic operations Useful for logical operations: equivalent to the logical complement. 2 s complement is used in modern computers.
18 The addition of two numbers in the signedmagnitude system follows the rules of ordinary arithmetic. Assume addition Y = N + M if sign(n) == sign(m) then Y = sign(n)( N + M ) if sign(n) ~= sign(m) then Y = sign(max( N, M ))(max( N, M )  min( N, M ) This process requires the comparison of signs and the magnitudes and the performing either addition or subtraction, which makes it complex.
19 The rule for adding numbers in the signed2 s complement system does not require a comparison or subtraction, only addition and complementation: very simple procedure Add the two numbers, including their sign bits, and discard any carry out of the sign (leftmost) bit position. Negative numbers must must initially be in 2 s complement. If the sum is negative, it is in 2 s complement form. Same hardware can be used to add (subtract) unsigned or signed2 s complement numbers: interpretation of results depends on whether it is assumed that the numbers are signed or unsigned.
20 Geometric depiction of twos complement integers
21 E.g.:
22 Overflow is a condition where the result of an arithmetic operation (e.g. a sum of two ndigit numbers) occupies n + 1 digits, where n is the maximum size (in digits) of any number (i.e. register). Overflow is a problem in computers because the width of registers is finite => result that contains n + 1 digits cannot be accommodated in a register with a length of n bits. When computers detect the overflow, a flipflop is set which can be checked by the program.
23 Overflow detection Addition of two unsigned numbers: end carry out of the most significant position indicates overflow, e.g: Addition of two signed numbers: unequal carries into the sign bit position and out of the sign bit position indicates overflow, e.g.: , if the two carries a applied to XORgate, the output is 1 iff overflow occurs <= no overflow in this example.
24 The procedure developed for the signed2 s complement system apply also to the signed10 s complement system for decimal numbers. Addition is done by adding all digits, including the sign digit, and discarding the end carry. Negative numbers are in 10 s complement from. The procedure for decimal numbers are utilized in some cases when it is desirable or convenient to perform arithmetic operations directly with BCD numbers: e.g. in simple pocket calculators.
25 FloatingPoint Representation Floating point representation of a number has two parts: mantissa (m) and exponent (e). Floatingpoint is always interpreted to represent a number in the following form: x = m r e. Mantissa represents the fractional part of the x. Exponent indicates the actual position of the decimal point, e.g. (r = 10): fraction exponent (4) x 10 4 =
26 Only mantissa (m) and exponent (e) a physically represented in the register (with their signs). The radix (r) and the radix point is always assumed (standard). The circuits that manipulate the floating point numbers in registers conform with these two assumptions (standards) in order to provide correct computational results. A floating point binary number (r=2) e.g.: fraction exponent => => +( ) x 2 4 In both parts, m and e, the most significant bit represents the sign: 0 for positive, and 1 for negative.
27 A floating point number is said to be normalized if the most significant digit of the mantissa is non zero. Normalized numbers provide the maximum possible precision for the floating point number This is the main argument for the floating point representation over the fixed point representation.
28 IEEE 754 floating point standard 32bit single precision 64bit double precision The exponent field needs to represent both positive and negative exponents. To do this, a bias is added to the actual exponent in order to get the stored exponent. For IEEE singleprecision floats, this value is 127. Thus, an exponent of zero means that 127 is stored in the exponent field. A stored value of 200 indicates an exponent of ( ), or 73
29 Many CPUs support floatingpoint arithmetic operations. If a CPU hasn t floatingpoint support, a set of subroutines can be use for performing floatingpoint calculations => much slower than the hardware implementation.
30 Other Binary Codes Gray Code: A binary sequence with the property that only one bit changes between any two consecutive elements. The Gray Code originated when digital logic circuits were built from vacuum tubes and electromechanical relays. Counters generated tremendous power demands and noise spikes when many bits changed at once. Using gray code counters, any increment or decrement changed only one bit.
31 Gray code can also be used to convert the angular position of a disk to digital form. A radial line of sensors reads the code off the surface of the disk and if the disk is halfway between two positions each sensor might read its bit from both positions at once but since only one bit differs between the two, the value read is guaranteed to be one of the two valid values rather than some third (invalid) combination.
32 Gray Code (4bit): Binary code Decimal equivalent
33 Various decimal codes: Excess3 gray Excess BCD 8421 Decimal digit
34 2421 and excess3 have a selfcomplementing property 9 s complement is obtained by changing 1 s to 0 s and 0 s to 1 s. Useful property when doing arithmetic operations with signedcomplement representation is a weighted code Decimal equivalent if obtained by multiplying bits by the weights indicated, e.g.: 1101 => 2 x x x x 1 = 7 Assigning weights 8421 for the BCD code makes it a weighted code. The excess3 code is obtained by adding 3 (0011) to the corresponding BCD equivalent binary number.
35 Excess3 gray is a decimal code obtained from the 4bit gray code by selecting the codes for 312 => transition from 10 to 0 involves a change of only one bit. ASCII code is used in transmission of binary information 7bit code, 1parity bit. 128 characters: letters, numbers, punctuation marks, and special codes. 23 formal effectors: functional characters for controlling the layout of printing or display devices, e.g.: carriage return, line feed, tab, back space. EBCDIC (Extended BCD Interchange Code): 8bit characters (all ASCII symbols included).
36 Error Detection Codes Binary codes used to detect errors during data transmission. Parity bit Extra bit to make the total number (sum) of 1 s either odd or even. The parity bit is discarded when the message is received, e.g.: ( ) => P(odd): 1, P(even): 0 ( ) => P(odd): 0, P(even): 1 The message including its parity bit (generated by the parity generator) is sent to receiver.
37 In the receiver, parity checker checks the adopted parity Both transmitter and receiver are configure for the same parity odd, or even. An error is detected if the checked parity does not match the adopted parity. The parity method detects any odd number of errors. E.g. odd parity: Data Data + P Data + P Parity generator Noisy communication channel Parity checker Sum of 1 s is even => error
38 Error detection with odd parity:
The string of digits 101101 in the binary number system represents the quantity
Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for
More informationSystems I: Computer Organization and Architecture
Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems  Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x
More informationLSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology
LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (09) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 101 102 103
More informationOct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8
ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: Our standard number system is base, also
More informationChapter 1: Digital Systems and Binary Numbers
Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching
More information2011, The McGrawHill Companies, Inc. Chapter 3
Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through
More informationEE 261 Introduction to Logic Circuits. Module #2 Number Systems
EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook
More informationNumbering Systems. InThisAppendix...
G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal
More information198:211 Computer Architecture
198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book 1 Computer Architecture What do computers do? Manipulate stored
More informationSigned Binary Arithmetic
Signed Binary Arithmetic In the real world of mathematics, computers must represent both positive and negative binary numbers. For example, even when dealing with positive arguments, mathematical operations
More informationThe Essentials of Computer Organization and Architecture. Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003
The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 2 Instructor's Manual Chapter Objectives Chapter 2, Data Representation,
More informationLevent EREN levent.eren@ieu.edu.tr A306 Office Phone:4889882 INTRODUCTION TO DIGITAL LOGIC
Levent EREN levent.eren@ieu.edu.tr A306 Office Phone:4889882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n
More informationTo convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:
Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE470/570: MicroprocessorBased System Design Fall 2014.
REVIEW OF NUMBER SYSTEMS Notes Unit 2 BINARY NUMBER SYSTEM In the decimal system, a decimal digit can take values from to 9. For the binary system, the counterpart of the decimal digit is the binary digit,
More informationBinary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.
Binary Representation The basis of all digital data is binary representation. Binary  means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems
More informationplc numbers  13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums
plc numbers  3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;
More informationNumber Representation
Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data
More informationToday. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real Time Systems: Binary Arithmetic
Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1
More informationLecture 11: Number Systems
Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number
More informationFractional Numbers. Fractional Number Notations. Fixedpoint Notation. Fixedpoint Notation
2 Fractional Numbers Fractional Number Notations 2010  Claudio Fornaro Ver. 1.4 Fractional numbers have the form: xxxxxxxxx.yyyyyyyyy where the x es constitute the integer part of the value and the y
More informationCSI 333 Lecture 1 Number Systems
CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...
More informationDigital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture  04 Digital Logic II May, I before starting the today s lecture
More informationECE 0142 Computer Organization. Lecture 3 Floating Point Representations
ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floatingpoint arithmetic We often incur floatingpoint programming. Floating point greatly simplifies working with large (e.g.,
More informationComputer Science 281 Binary and Hexadecimal Review
Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two
More informationLecture 2. Binary and Hexadecimal Numbers
Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations
More informationDecimal Numbers: Base 10 Integer Numbers & Arithmetic
Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number
More informationUseful Number Systems
Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2
More informationComputers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer
Computers CMPT 125: Lecture 1: Understanding the Computer Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 A computer performs 2 basic functions: 1.
More informationNumber Systems, Base Conversions, and Computer Data Representation
, Base Conversions, and Computer Data Representation Decimal and Binary Numbers When we write decimal (base 10) numbers, we use a positional notation system. Each digit is multiplied by an appropriate
More informationBase Conversion written by Cathy Saxton
Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,
More informationDivide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1
Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be
More information4 Operations On Data
4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on
More information2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal
2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal
More informationBinary Numbers. Bob Brown Information Technology Department Southern Polytechnic State University
Binary Numbers Bob Brown Information Technology Department Southern Polytechnic State University Positional Number Systems The idea of number is a mathematical abstraction. To use numbers, we must represent
More informationCPEN 214  Digital Logic Design Binary Systems
CPEN 4  Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records
More informationCDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012
CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6311 and Excess3? Data Representation (1/2) Each numbering
More informationSolution for Homework 2
Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of
More informationData Storage 3.1. Foundations of Computer Science Cengage Learning
3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how
More informationBinary Division. Decimal Division. Hardware for Binary Division. Simple 16bit Divider Circuit
Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend 480 4136 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until
More informationBinary. ! You are probably familiar with decimal
Arithmetic operations in assembly language Prof. Gustavo Alonso Computer Science Department ETH Zürich alonso@inf.ethz.ch http://www.inf.ethz.ch/department/is/iks/ Binary! You are probably familiar with
More informationBinary, Hexadecimal, Octal, and BCD Numbers
23CH_PHCalter_TMSETE_949118 23/2/2007 1:37 PM Page 1 Binary, Hexadecimal, Octal, and BCD Numbers OBJECTIVES When you have completed this chapter, you should be able to: Convert between binary and decimal
More informationChapter 4: Computer Codes
Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data
More informationThis 3digit ASCII string could also be calculated as n = (Data[2]0x30) +10*((Data[1]0x30)+10*(Data[0]0x30));
Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]0x30) + 10*(Data[1]0x30) + (Data[2]0x30); This 3digit ASCII string could also be calculated
More informationData Storage. Chapter 3. Objectives. 31 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:
Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how
More informationBinary math. Resources and methods for learning about these subjects (list a few here, in preparation for your research):
Binary math This worksheet and all related files are licensed under the Creative Commons Attribution License, version 1.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/,
More informationBachelors of Computer Application Programming Principle & Algorithm (BCAS102T)
Unit I Introduction to c Language: C is a generalpurpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating
More informationBinary Numbering Systems
Binary Numbering Systems April 1997, ver. 1 Application Note 83 Introduction Binary numbering systems are used in virtually all digital systems, including digital signal processing (DSP), networking, and
More informationSection 1.4 Place Value Systems of Numeration in Other Bases
Section.4 Place Value Systems of Numeration in Other Bases Other Bases The HinduArabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason
More informationHOMEWORK # 2 SOLUTIO
HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to
More informationNUMBER SYSTEMS. William Stallings
NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html
More informationBinary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1
Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1
More informationCS 16: Assembly Language Programming for the IBM PC and Compatibles
CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking
More informationData Representation. Data Representation, Storage, and Retrieval. Data Representation. Data Representation. Data Representation. Data Representation
, Storage, and Retrieval ULM/HHIM Summer Program Project 3, Day 3, Part 3 Digital computers convert the data they process into a digital value. Text Audio Images/Graphics Video Digitizing 00000000... 6/8/20
More informationMACHINE INSTRUCTIONS AND PROGRAMS
CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations
More informationBinary Adders: Half Adders and Full Adders
Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order
More informationFixedPoint Arithmetic
FixedPoint Arithmetic FixedPoint Notation A Kbit fixedpoint number can be interpreted as either: an integer (i.e., 20645) a fractional number (i.e., 0.75) 2 1 Integer FixedPoint Representation Nbit
More informationPROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1
UNIT 22: PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1 This work covers part of outcome 2 of the Edexcel standard module. The material is
More informationActivity 1: Bits and Bytes
ICS3U (Java): Introduction to Computer Science, Grade 11, University Preparation Activity 1: Bits and Bytes The Binary Number System Computers use electrical circuits that include many transistors and
More informationReview 1/2. CS61C Characters and Floating Point. Lecture 8. February 12, Review 2/2 : 12 new instructions Arithmetic:
Review 1/2 CS61C Characters and Floating Point Lecture 8 February 12, 1999 Handling case when number is too big for representation (overflow) Representing negative numbers (2 s complement) Comparing signed
More informationDigital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):
Digital codes This worksheet and all related files are licensed under the Creative Commons Attribution License, version 1.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/,
More information2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:
2 Number Systems 2.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish
More informationThis Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers
This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition
More informationBinary Numbers. Binary Octal Hexadecimal
Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how
More informationDigital Design. Assoc. Prof. Dr. Berna Örs Yalçın
Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 Email: siddika.ors@itu.edu.tr Grading 1st Midterm 
More informationBinary Representation
Binary Representation The basis of all digital data is binary representation. Binary  means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems
More information2 Number Systems 2.1. Foundations of Computer Science Cengage Learning
2 Number Systems 2.1 Foundations of Computer Science Cengage Learning 2.2 Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between
More informationSimulation & Synthesis Using VHDL
Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh  B.E. (Hons.) Electrical & Electronics Shivananda Reddy  B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction
More informationCS321. Introduction to Numerical Methods
CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 405060633 August 7, 05 Number in
More informationDigital Logic Design. Introduction
Digital Logic Design Introduction A digital computer stores data in terms of digits (numbers) and proceeds in discrete steps from one state to the next. The states of a digital computer typically involve
More informationDecimal Number (base 10) Binary Number (base 2)
LECTURE 5. BINARY COUNTER Before starting with counters there is some vital information that needs to be understood. The most important is the fact that since the outputs of a digital chip can only be
More information1. Convert the following base 10 numbers into 8bit 2 s complement notation 0, 1, 12
C5 Solutions 1. Convert the following base 10 numbers into 8bit 2 s complement notation 0, 1, 12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110
More information= Chapter 1. The Binary Number System. 1.1 Why Binary?
Chapter The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base0 system. When you
More informationINTRODUCTION TO FLOWCHARTING
CHAPTER 1 INTRODUCTION TO FLOWCHARTING 1.0 Objectives 1.1 Introduction 1.2 Flowcharts 1.3 Types of Flowcharts 1.3.1 Types of flowchart 1.3.2 System flowcharts 1.4 Flowchart Symbols 1.5 Advantages of Flowcharts
More informationPemrograman Dasar. Basic Elements Of Java
Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle
More informationThe University of Nottingham
The University of Nottingham School of Computer Science A Level 1 Module, Autumn Semester 20072008 Computer Systems Architecture (G51CSA) Time Allowed: TWO Hours Candidates must NOT start writing their
More informationChapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
More informationInteger multiplication
Integer multiplication Suppose we have two unsigned integers, A and B, and we wish to compute their product. Let A be the multiplicand and B the multiplier: A n 1... A 1 A 0 multiplicand B n 1... B 1 B
More informationCHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems
CHAPTER TWO Numbering Systems Chapter one discussed how computers remember numbers using transistors, tiny devices that act like switches with only two positions, on or off. A single transistor, therefore,
More informationNumber Systems and Radix Conversion
Number Systems and Radix Conversion Sanjay Rajopadhye, Colorado State University 1 Introduction These notes for CS 270 describe polynomial number systems. The material is not in the textbook, but will
More information#5. Show and the AND function can be constructed from two NAND gates.
Study Questions for Digital Logic, Processors and Caches G22.0201 Fall 2009 ANSWERS Digital Logic Read: Sections 3.1 3.3 in the textbook. Handwritten digital lecture notes on the course web page. Study
More informationRestoring division. 2. Run the algorithm Let s do 0111/0010 (7/2) unsigned. 3. Find remainder here. 4. Find quotient here.
Binary division Dividend = divisor q quotient + remainder CS/COE447: Computer Organization and Assembly Language Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) Chapter 3 We
More informationCS201: Architecture and Assembly Language
CS201: Architecture and Assembly Language Lecture Three Brendan Burns CS201: Lecture Three p.1/27 Arithmetic for computers Previously we saw how we could represent unsigned numbers in binary and how binary
More informationLet s put together a Manual Processor
Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce
More informationCHAPTER 3 Boolean Algebra and Digital Logic
CHAPTER 3 Boolean Algebra and Digital Logic 3.1 Introduction 121 3.2 Boolean Algebra 122 3.2.1 Boolean Expressions 123 3.2.2 Boolean Identities 124 3.2.3 Simplification of Boolean Expressions 126 3.2.4
More informationCHAPTER 3 Numbers and Numeral Systems
CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,
More informationLecture N 1 PHYS 3330. Microcontrollers
Lecture N 1 PHYS 3330 Microcontrollers If you need more than a handful of logic gates to accomplish the task at hand, you likely should use a microcontroller instead of discrete logic gates 1. Microcontrollers
More informationIntroduction to Programming
Introduction to Programming SS 2012 Adrian Kacso, Univ. Siegen adriana.dkacsoa@dunisiegena.de Tel.: 0271/7403966, Office: HB 8406 Stand: April 25, 2012 Betriebssysteme / verteilte Systeme Introduction
More informationLecture 4 Representing Data on the Computer. Ramani Duraiswami AMSC/CMSC 662 Fall 2009
Lecture 4 Representing Data on the Computer Ramani Duraiswami AMSC/CMSC 662 Fall 2009 x = ±(1+f) 2 e 0 f < 1 f = (integer < 2 52 )/ 2 521022 e 1023 e = integer Effects of floating point Effects of floating
More informationChapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language
Chapter 4 Register Transfer and Microoperations Section 4.1 Register Transfer Language Digital systems are composed of modules that are constructed from digital components, such as registers, decoders,
More informationLecture 8: Binary Multiplication & Division
Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two
More informationCOMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012
Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about
More informationDNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk
DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2valued
More informationLecture 2: Number Representation
Lecture 2: Number Representation CSE 30: Computer Organization and Systems Programming Summer Session II 2011 Dr. Ali Irturk Dept. of Computer Science and Engineering University of California, San Diego
More informationName: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1  Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
More informationTHE BINARY NUMBER SYSTEM
THE BINARY NUMBER SYSTEM Dr. Robert P. Webber, Longwood University Our civilization uses the base 10 or decimal place value system. Each digit in a number represents a power of 10. For example, 365.42
More information> 2. Error and Computer Arithmetic
> 2. Error and Computer Arithmetic Numerical analysis is concerned with how to solve a problem numerically, i.e., how to develop a sequence of numerical calculations to get a satisfactory answer. Part
More informationNUMBER SYSTEMS. 1.1 Introduction
NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.
More informationBorland C++ Compiler: Operators
Introduction Borland C++ Compiler: Operators An operator is a symbol that specifies which operation to perform in a statement or expression. An operand is one of the inputs of an operator. For example,
More information1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:
Exercises 1  number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b)  435 2. For each of
More information