2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS).
|
|
- Shannon Hensley
- 5 years ago
- Views:
Transcription
1 2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS). 2.. Natural Binary Code (NBC). The positional code with base 2 (B=2), introduced in Exercise, is used to encode the integer numbers without the sign (that means natural numbers). This code is usually called NBC (Natural Binary Code). In the machine representation the length of the code word is constant and depends on internal processor s architecture it s equal to the length of basic machine / ALU word (32 or 64 bits in most of the today s CPUs, for example) or the multiplicity of this basic machine word (for 8 or 6-bit processors, for example). In most of upper-level programming languages the natural numbers are represented as 32-bit NBC codes ( normal natural numbers) and 64-bit NBC codes ( long natural numbers). In the C-language these two types are declared as: unsigned int var; unsigned long int var2; // The variable var is a normal, 32-bit // natural number // The variable var2 is a long, 64-bit // natural number On the other hand, the short version of natural number is also provided in most of languages that means 6-bit NBC value (this type of data was a basic one in 6-bit processors like Intel 886/88 or Motorola 68, for example). In the C-language notation declaration of such a type looks like this: unsigned short int var3; // The variable var3 is a short, 6-bit // natural number, word in assembly language The shortest version of the natural number used in C-language is called char from character. As a matter of fact this type of data stands for 8-bit NBC value: unsigned char var4; // The variable var4 is a tiny 8-bit // natural number, byte in assembly language The natural value which we can encode using 8 bits is from to 255, so it has limited rather application in mathematical calculations (but can be useful as an error code returned by function, for example). In most of cases the char type is used for encoding the ASCII (American Standard Code for Information Interchange) characters. Example. The C-language code shown below uses one unsigned char value (a variable). It shows, that the same binary code can be used for a letter or number, depending on interpretation by the printf() function (with formatted output), this time. #include <stdlib.h> #include <stdio.h> int main() { unsigned char a; } a = 'A'; printf( "a = %d as decimal, %c as character.\n", a, a ); printf( "a = %d as decimal, %c as character.\n", a, a ); The output from the program is: a = 65 as decimal, A as character. a = 66 as decimal, B as character.
2 Knowing the construction of the NBC code we can try some basic mathematical operations, like addition or subtraction. Example 2. Try to add two 8-bit NBC values b and b: Explanation: b = 2Eh = 46d b = 6Dh = 9d b = 9Bh = 55d Adding two binary digits on each i-position (x i and y i ) of the n-bit code, to obtain the sum on this position (s i ) we have to deal with these digits according to this table: x i y i s i = x i y i c i The c i value means carry from current position to the next (upper, left-side) position in the 8- bit number. Only the right-most position in the sum has no potentially non-zero carry value from the lower (right-side) position. So we should modify the table above to include the carry value from the younger bit on each position (c i- ): c i- x i y i s i = x i y i c i- c i Now we can write down the binary addition of two numbers with these comments this way: c 7 c 6 c 5 c 4 c 3 c 2 c 2 c x 7 x 6 x 5 x 4 x 3 x 2 x x y 7 y 6 y 5 y 4 y 3 y 2 y y s 7 s 6 s 5 s 4 s 3 s 2 s s Please notice, that carry value from the most significant position (c n- = c 7 ) is equal to zero, so we have correct 8-bit result (the sum is still 8-bit binary number). More complicated operation is a subtraction of two numbers in any positional system. The borrowing (credit) from the more significant (left-side) position(s) is necessary if the digit on current position in minuend is lower than in subtrahend. Sometimes we have to borrow not 2
3 from the nearest more significant position, because the digit in this position is and can t borrow us any value. Example 3. Decimal subtraction of two numbers: The minuend (22) is greater than the subtrahend (43), so we shouldn t have any problem (the result expected will be still the natural number the sign of the result will not change to negative). How the positional subtraction is performed? Results of borrowing (credits) The binary subtraction is done exactly in the same way, but the values of credit are 2 and respectively. Example 4. Binary subtraction of two 4-bit NBC numbers:. The minuend () is greater than the subtrahend (), the result expected will be still the 4-bit natural number. 2 Results of borrowing (credits) - In general the subtraction is more complicated operation than addition. The implementation of the borrowing in the logic circuits of the ALU is even much more difficult than carry. So the optimal implementation for subtraction is the adding of the subtrahend multiplied by -: A B = A (-B). The two s complement code (see section 2.3.) usually used for encoding integer numbers (with sign) makes it very easy (it s very easy to obtain a -B value from B without many additional operations in the ALU, the adder designed for NBC values works correctly for two s complement values) Sign-modulus (SM) code. The simplest code that can be used for encoding integer numbers with sign uses the most significant (the first from the left side) bit in the binary code word as a sign ( means, means ). So the number -d in 8-bit sign-modulus (SM) code will be written as b. We can try to write down the definition of this code in more mathematical way. Notice, that bit on the most significant position has a value 2 n- (2 7 = 28 for 8-bit code). So the formula for the n-bit SM code of the number x can be written as: x SM = x x, x SM = 2 n- x (or 2 n- x) x. 3
4 It s easy to see that the number d has two codes ( ), b and b encoded in 8-bit SM code for example Two s complement (TC) code. The idea of n-positional, base-complement (BC) code (first time used in XVII century by Blaise Pascal in his mechanical calculator) can be explained with the formula: x BC = x x, x BC = B n x (or B n x) x <. That means the code for negative number x is obtained by subtracting the absolute value of this number from the largest power of base (B n in the code with n positions). The word complement means the difference between the B n and x. The binary (B = 2) code of this kind is called two s complement and can be defined by formula given below: x TC = x x, x TC = 2 n x (or 2 n x) x <. Example 5. In the 4-bit two s complement code the values for negative numbers can be counted from the formula: x TC = 2 4 x (or 2 4 x). Let s calculate these values (2 4 = 6): x d x TC d x TC b The codes for zero and positive numbers will be as follows: x d x TC d x TC b Basic considerations about two s complement code: Most significant bit has the meaning of the sign ( for, for ), like in the signmodulus code. So it s easy to distinguish between positive and negative values. All 2 n code values (6 for n = 4) are used, each of them for a different number. Exactly 2 n / 2 codes (8 for n = 4) are used for encoding negative numbers, one code is used for number, 2 n / 2 codes (7 for n = 4) are used for positive numbers. Example 6. Try to subtract (binary, 4-bit) two numbers 7 3 by adding the ten s compliment and two s complement code for -3 to code of 7, that means calculate 7 (-3): -compliment of 3: -3 C = 3 = C 3 C 2 C C 7d = b -3d = b Carry bits 4
5 The result is correct (b = 4d), but we can notice the non-zero carry value from the last significant bit (c 3 ). The same (carry to the next position) we can see in decimal addition. In the NBC code this was a signal of error the result didn t fit to length of code. This time the error signal (called overflow, V) is detected (in most of processors) in a bit different way: V = c n- c n-2. The operation (exclusive or EXOR) gives positive result () if only one of the arguments is positive: c n- c n-2 V = c n- c n-2 In our example V = c n- c n-2 = c 3 c 2 = =, so the result is really correct. As a matter of fact, the V signal is a useful and effective solution, but it wasn t implemented in Intel 88 CPU for example. So the programmers was forced to detect the overflow in operations with TC numbers from these considerations: Addition: when signs of both arguments are the same but sign of result is different, then result is not correct as TC integer. Subtraction: when signs of both arguments are different and sign of result is different than the sign of first argument, then result is not correct as TC integer. Can you give rules for multiplication and division of the TC integers? 2.4. One s complement (OC) code. The code called one s complement (OC) is made by bitwise NOT operation on the bites of the absolute value of the encoded number. We can show this idea on 4-bit example: Positive numbers (just equal to their absolute values): x d x OC d X OC b Negative numbers (bitwise negations of the absolute values complement to for each bit): x d x OC d X OC b Comparing these codes with negative two s complement codes: x d x TC d x TC b we can notice, that the x TC value for each negative number can be easily calculated from the x OC value by adding. 5
6 The mathematical definition (formula) for the n-bit one s complement code can be written down this way: x OC = x x, x OC = 2 n x (or 2 n x) x. We can also assume, that x TC = x OC x. So we can obtain the two s complement value very easily: Make the bitwise negation on the binary code of the absolute value of the negative number we want to encode (it s very easy for digital hardware too). Add to code obtained in the first step. Example 7. Try to encode the number -5d in 4-bit two s complement code: 5d = b, the bitwise negation is b, plus gives b (to check this see chapter 2.3.) Binary Coded Decimal (BCD) code. In computing and electronic systems, binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit (,, 9) is represented by its own binary (4-bit) sequence. In most of cases BCD stands for a code in which each decimal digit is represented by a 4-bit NBC (weights ) word, used in limited range: Decimal digit BCD digit The NBC codes larger than b are not used as digits in BCD code (6 wasted values). Example 8. The decimal value 984 in the BCD code looks like this:. The purpose for the BCD code is limited not for arithmetical operations in computer programs rather, but for driving specialized digital displays (decimal counters, clocks, digital measuring devices etc.). Typical display device used as output for BCD-encoded numbers is 7-segment LED or LCD display module (see Fig..). In fact special logic circuit (decoder / driver) is connected between BCD-encoded output from measuring system (or computer) and display. A typical 7-segment LED display component, with decimal point (8-segments in fact). 6
7 A widely used variant of this code is called packed BCD (or simply packed decimal), where numbers are stored with two decimal digits packed into one byte each. The last decimal digit (or nibble ) is used as a sign indicator. The preferred sign values are b (Ch) for positive () and b (Dh) for negative ( ). Other allowed signs are b (Ah) and b (Eh) for positive and b (Bh) for negative. Some implementations also provide unsigned BCD values with a sign nibble of b (Fh). Example 9. In packed BCD, the decimal number 27 is represented as two bytes:.. (hex. 2 7C), and 27 as.. (hex. 2 7D). The processors usually don t support BCD-oriented arithmetic operations (like addbcd, for example), upper-level languages don t have the basic types like BCD int. But in most of cases it s possible to write assembly program which can operate on BCDencoded numbers, using special correction for normal binary additions, subtractions etc. when needed. Example. Let s analyze the binary addition of two BCD values: 47d =.b 9d =.b C 7 C 6 C 5 C 4 C 3 C 2 C C 66d =.b Carry bits The result is not correct in BCD code, although both the digits (nibbles) are less than d (b). Please notice, that there was non-zero carry between lower and upper nibble (c 3 ). This carry bit is often called an auxiliary carry. This fact is a signal for us, that the BCD correction should be applied to the result. The second condition can be the value of nibble greater than 9d (b), but this doesn t happen in this example. What kind of correction should be done? We need to subtract d from the lower nibble of the result (like we do in normal decimal adding). How to do it as fast as it s possible? Just add the two s compliment of the d number. Let s count -: d = b, bitwise negation is b, plus is b (6d). So let s do it: 47d =.b 9d =.b C 7 C 6 C 5 C 4 C 3 C 2 C C 66d =.b Carry bits BCD correction plus 6 correction 7
8 This kind of correction is often called a plus 6 correction. Of course, if the result on upper nibble fulfills one of the BCD correction conditions (value of the nibble greater than b or carry bit c 7 set to ) we will have to apply the plus 6 correction to the upper nibble too. The minimum support from the CPU for BCD arithmetic we should count on is checking auxiliary carry (AC = c 3 ) and carry (CY = c 7 ) bits. In fact most of processors have the packed BCD correction implemented as one instruction, so programmers should only remember to make it after each operation on BCD arguments. 8
9 Exercises:. Fill the table below for the sign-module (SM), one s complement (OC) and two s complement (TC) codes. Assume 6-bit code word (n = 6). ZERO Maximum number Minimum number SM OC TC SM OC TC SM OC TC Binary notation Hexadecimal notation 2. Try to draw the diagram for the (discrete) function f(x) = x SM (n=8). 3. Try to draw the diagram for the (discrete) function f(x) = x OC (n=8). 4. Try to draw the diagram for the (discrete) function f(x) = x TC (n=8). Decimal value 5. Using the numbers from your date of birth (day, month, year) write down the following arguments as 6-bit integers: A = mmddd =?h =?b; B = yyyyd =?h =?b. Then perform on binary arguments (two s complement code) the following operations: A B =?; A B =?, B A =? 6. Using the numbers from your date of birth (day, month) write down the following arguments as packed BCD-coded values (one byte, two decimal digits): A = mm; B = dd Try to add these arguments checking conditions for BCD correction ( plus 6 correction ) and apply correction if needed. 9
BINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationET355 Microprocessors Thursday 6:00 pm 10:20 pm
ITT Technical Institute ET355 Microprocessors Thursday 6:00 pm 10:20 pm Unit 4 Chapter 6, pp. 139-174 Chapter 7, pp. 181-188 Unit 4 Objectives Lecture: BCD Programming Examples of the 805x Microprocessor
More informationComputer Organization
Computer Organization Register Transfer Logic Number System Department of Computer Science Missouri University of Science & Technology hurson@mst.edu 1 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5,
More information10.1. Unit 10. Signed Representation Systems Binary Arithmetic
0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationDigital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals CHAPTER 2 Number Systems, Operations, and Codes Decimal Numbers The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 The decimal numbering system has a base of
More informationCHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS Addition of Unsigned Numbers The instruction ADD is used to add two operands Destination operand is always in register A Source operand can be a register,
More informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
More informationSemester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC
1 2 Semester Transition Point EE 109 Unit 11 Binary Arithmetic At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is
More informationCC411: Introduction To Microprocessors
CC411: Introduction To Microprocessors OBJECTIVES this chapter enables the student to: Use number { base 2, base 10, or base 16 }. Add and subtract binary/hex numbers. Represent any binary number in 2
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many
More informationDec Hex Bin ORG ; ZERO. Introduction To Computing
Dec Hex Bin 0 0 00000000 ORG ; ZERO Introduction To Computing OBJECTIVES this chapter enables the student to: Convert any number from base 2, base 10, or base 16 to any of the other two bases. Add and
More information1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1
More informationBinary Representations and Arithmetic
Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,
More informationChapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.
Chapter 3: Number Systems and Codes Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc., 5 th edition Decimal System The radix or base of a number system determines
More informationDIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM
COURSE / CODE DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) NUMBER SYSTEM A considerable subset of digital systems deals with arithmetic operations. To understand the
More informationBinary Addition. Add the binary numbers and and show the equivalent decimal addition.
Binary Addition The rules for binary addition are 0 + 0 = 0 Sum = 0, carry = 0 0 + 1 = 0 Sum = 1, carry = 0 1 + 0 = 0 Sum = 1, carry = 0 1 + 1 = 10 Sum = 0, carry = 1 When an input carry = 1 due to a previous
More informationGoals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers
CSC 2400: Computer Systems Bits, Bytes and Data Types 1 Goals for this Week Binary number system Why binary? Converting between decimal and binary and octal and hexadecimal number systems Finite representations
More informationChapter 1 Preliminaries
Chapter 1 Preliminaries This chapter discusses the major classes of programming languages and the relationship among them. It also discusses the binary and the hexadecimal number systems which are used
More informationComputer Organization and Assembly Language. Lab Session 01
Objective: Lab Session 01 Introduction to Assembly Language Tools and Familiarization with Emu8086 environment To be able to understand Data Representation and perform conversions from one system to another
More informationAgenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010
// EE : INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN Lecture : Introduction /9/ Avinash Kodi, kodi@ohio.edu Agenda Go over the syllabus Introduction ti to Digital it Systems // Why Digital Systems?
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationFinal Labs and Tutors
ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2010 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review, but we will go over it for
More informationPositional Number System
Positional Number System A number is represented by a string of digits where each digit position has an associated weight. The weight is based on the radix of the number system. Some common radices: Decimal.
More informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationGroups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...
Chapter 9 Computer Arithmetic Reading: Section 9.1 on pp. 290-296 Computer Representation of Data Groups of two-state devices are used to represent data in a computer. In general, we say the states are
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit
More informationEE 109 Unit 6 Binary Arithmetic
EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is
More informationThus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.
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 x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language
The x86 Microprocessors Introduction 1.1 Assembly Language Numbering and Coding Systems Human beings use the decimal system (base 10) Decimal digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Computer systems use the
More informationDIGITAL SYSTEM DESIGN
DIGITAL SYSTEM DESIGN UNIT I: Introduction to Number Systems and Boolean Algebra Digital and Analog Basic Concepts, Some history of Digital Systems-Introduction to number systems, Binary numbers, Number
More informationCPS 104 Computer Organization and Programming Lecture-2 : Data representations,
CPS 104 Computer Organization and Programming Lecture-2 : Data representations, Sep. 1, 1999 Dietolf Ramm http://www.cs.duke.edu/~dr/cps104.html CPS104 Lec2.1 GK&DR Fall 1999 Data Representation Computers
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationRepresenting Information. Bit Juggling. - Representing information using bits - Number representations. - Some other bits - Chapters 1 and 2.3,2.
Representing Information 0 1 0 Bit Juggling 1 1 - Representing information using bits - Number representations 1 - Some other bits 0 0 - Chapters 1 and 2.3,2.4 Motivations Computers Process Information
More informationChapter 3: part 3 Binary Subtraction
Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary adder-subtractors Signed binary
More informationLAB WORK NO. 2 THE INTERNAL DATA REPRESENTATION
LAB WORK NO. 2 THE INTERNAL DATA REPRESENTATION 1. Object of lab work The purpose of this work is to understand the internal representation of different types of data in the computer. We will study and
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationThe type of all data used in a C++ program must be specified
The type of all data used in a C++ program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values There are
More informationModule 1: Information Representation I -- Number Systems
Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1305 Intro to Computer Technology 1 Module 1: Information Representation I -- Number Systems Objectives: Learn
More informationNumeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:
Numeral Systems -Numeral System -Positional systems -Decimal -Binary -Octal Subjects: Introduction A numeral system (or system of numeration) is a writing system for expressing numbers, that is a mathematical
More informationDigital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.
Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we
More informationComputer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers
Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Bits and Bytes and Numbers Number Systems Much of this is review, given the 221 prerequisite Question: how high can
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2011 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review for most of you, but we start
More informationIT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1
IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose
More informationPrinciple and Interface Techniques of Microcontroller
Principle and Interface Techniques of Microcontroller --8051 Microcontroller and Embedded Systems Using Assembly and C LI, Guang ( 李光 ) Prof. PhD, DIC, MIET WANG, You ( 王酉 ) PhD, MIET 杭州 浙江大学 2011 Chapter
More informationLecture (02) Operations on numbering systems
Lecture (02) Operations on numbering systems By: Dr. Ahmed ElShafee ١ Dr. Ahmed ElShafee, ACU : Spring 2018, CSE202 Logic Design I Complements of a number Complements are used in digital computers to simplify
More informationCourse Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation
Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep
More informationCO Computer Architecture and Programming Languages CAPL. Lecture 9
CO20-320241 Computer Architecture and Programming Languages CAPL Lecture 9 Dr. Kinga Lipskoch Fall 2017 A Four-bit Number Circle CAPL Fall 2017 2 / 38 Functional Parts of an ALU CAPL Fall 2017 3 / 38 Addition
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationModule 2: Computer Arithmetic
Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N
More informationLING 388: Computers and Language. Lecture 5
LING 388: Computers and Language Lecture 5 Administrivia Homework 3 graded Quick Homework 4 out today I'll be away next two weeks (my apologies) Colton Flowers, a HLT student, will take you through Python
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationLogic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.
Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm Nathan Pihlstrom www.uccs.edu/~npihlstr My Background B.S.E.E. from Colorado State University M.S.E.E. from Colorado State University M.B.A. from UCCS Ford
More informationMACHINE LEVEL REPRESENTATION OF DATA
MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems
More informationCS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29
CS 31: Introduction to Computer Systems 03: Binary Arithmetic January 29 WiCS! Swarthmore Women in Computer Science Slide 2 Today Binary Arithmetic Unsigned addition Subtraction Representation Signed magnitude
More informationChapter 2 Number System
Chapter 2 Number System Embedded Systems with ARM Cortext-M Updated: Tuesday, January 16, 2018 What you should know.. Before coming to this class Decimal Binary Octal Hex 0 0000 00 0x0 1 0001 01 0x1 2
More informationDigital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand
Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary
More informationNumber Systems Base r
King Fahd University of Petroleum & Minerals Computer Engineering Dept COE 2 Fundamentals of Computer Engineering Term 22 Dr. Ashraf S. Hasan Mahmoud Rm 22-44 Ext. 724 Email: ashraf@ccse.kfupm.edu.sa 3/7/23
More informationCOMP2121: Microprocessors and Interfacing. Number Systems
COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting
More informationVariables and Data Representation
You will recall that a computer program is a set of instructions that tell a computer how to transform a given set of input into a specific output. Any program, procedural, event driven or object oriented
More informationCS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq
CS 121 Digital Logic Design Chapter 1 Teacher Assistant Hadeel Al-Ateeq Announcement DON T forgot to SIGN your schedule OR you will not be allowed to attend next lecture. Communication Office hours (8
More information2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)
2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction
More informationData Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8
Data Representation At its most basic level, all digital information must reduce to 0s and 1s, which can be discussed as binary, octal, or hex data. There s no practical limit on how it can be interpreted
More informationDRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.
Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic 0 (0 volts) and one for logic
More informationSigned umbers. Sign/Magnitude otation
Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
More informationEE292: Fundamentals of ECE
EE292: Fundamentals of ECE Fall 2012 TTh 10:00-11:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic
More informationCSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators
CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to
More information8051 Programming: Arithmetic and Logic
8051 Programming: Arithmetic and Logic EE4380 Fall 2002 Class 4 Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas Topics Signed and Unsigned arithmetic Binary
More informationLearning the Binary System
Learning the Binary System www.brainlubeonline.com/counting_on_binary/ Formated to L A TEX: /25/22 Abstract This is a document on the base-2 abstract numerical system, or Binary system. This is a VERY
More informationA complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation
Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers
More informationCHAPTER 2 Data Representation in Computer Systems
CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting
More informationECE 250 / CS 250 Computer Architecture. C to Binary: Memory & Data Representations. Benjamin Lee
ECE 250 / CS 250 Computer Architecture C to Binary: Memory & Data Representations Benjamin Lee Slides based on those from Alvin Lebeck, Daniel Sorin, Andrew Hilton, Amir Roth, Gershon Kedem Administrivia
More informationBinary Addition & Subtraction. Unsigned and Sign & Magnitude numbers
Binary Addition & Subtraction Unsigned and Sign & Magnitude numbers Addition and subtraction of unsigned or sign & magnitude binary numbers by hand proceeds exactly as with decimal numbers. (In fact this
More informationChapter 1. Digital Systems and Binary Numbers
Chapter 1. Digital Systems and Binary Numbers Tong In Oh 1 1.1 Digital Systems Digital age Characteristic of digital system Generality and flexibility Represent and manipulate discrete elements of information
More informationTHE LOGIC OF COMPOUND STATEMENTS
CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS Copyright Cengage Learning. All rights reserved. SECTION 2.5 Application: Number Systems and Circuits for Addition Copyright Cengage Learning. All rights reserved.
More informationT02 Tutorial Slides for Week 2
T02 Tutorial Slides for Week 2 ENEL 353: Digital Circuits Fall 2017 Term Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary 19 September, 2017
More informationSlide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng
Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section
More informationMicrocomputers. Outline. Number Systems and Digital Logic Review
Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded
More informationELEG3923 Microprocessor Ch.6 Arithmetic and Logics
Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch.6 Arithmetic and Logics Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Arithmetic instructions Signed number operations Logic
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationUNIT 7A Data Representation: Numbers and Text. Digital Data
UNIT 7A Data Representation: Numbers and Text 1 Digital Data 10010101011110101010110101001110 What does this binary sequence represent? It could be: an integer a floating point number text encoded with
More informationMore about Binary 9/6/2016
More about Binary 9/6/2016 Unsigned vs. Two s Complement 8-bit example: 1 1 0 0 0 0 1 1 2 7 +2 6 + 2 1 +2 0 = 128+64+2+1 = 195-2 7 +2 6 + 2 1 +2 0 = -128+64+2+1 = -61 Why does two s complement work this
More informationNumbering systems. Dr Abu Arqoub
Numbering systems The decimal numbering system is widely used, because the people Accustomed (معتاد) to use the hand fingers in their counting. But with the development of the computer science another
More informationOctal and Hexadecimal Integers
Octal and Hexadecimal Integers CS 350: Computer Organization & Assembler Language Programming A. Why? Octal and hexadecimal numbers are useful for abbreviating long bitstrings. Some operations on octal
More informationLevel ISA3: Information Representation
Level ISA3: Information Representation 1 Information as electrical current At the lowest level, each storage unit in a computer s memory is equipped to contain either a high or low voltage signal Each
More informationCS 24: INTRODUCTION TO. Spring 2015 Lecture 2 COMPUTING SYSTEMS
CS 24: INTRODUCTION TO Spring 2015 Lecture 2 COMPUTING SYSTEMS LAST TIME! Began exploring the concepts behind a simple programmable computer! Construct the computer using Boolean values (a.k.a. bits )
More informationECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017
ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 Combinational Logic Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke) Last
More informationThe type of all data used in a C (or C++) program must be specified
The type of all data used in a C (or C++) program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values
More information9/23/15. Agenda. Goals of this Lecture. For Your Amusement. Number Systems and Number Representation. The Binary Number System
For Your Amusement Number Systems and Number Representation Jennifer Rexford Question: Why do computer programmers confuse Christmas and Halloween? Answer: Because 25 Dec = 31 Oct -- http://www.electronicsweekly.com
More informationAssembly Language Programming of 8085
Assembly Language Programming of 8085 Topics 1. Introduction 2. Programming model of 8085 3. Instruction set of 8085 4. Example Programs 5. Addressing modes of 8085 6. Instruction & Data Formats of 8085
More informationCS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016
CS 31: Intro to Systems Binary Arithmetic Kevin Webb Swarthmore College January 26, 2016 Reading Quiz Unsigned Integers Suppose we had one byte Can represent 2 8 (256) values If unsigned (strictly non-negative):
More informationChapter 2 Data Representations
Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/2008 1 Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers
More informationCHAPTER 2 (b) : AND CODES
DKT 122 / 3 DIGITAL SYSTEMS 1 CHAPTER 2 (b) : NUMBER SYSTEMS OPERATION AND CODES m.rizal@unimap.edu.my sitizarina@unimap.edu.my DECIMAL VALUE OF SIGNED NUMBERS SIGN-MAGNITUDE: Decimal values of +ve & -ve
More informationRepresenting numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states).
Representing numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states). These states are usually labeled 0 and 1. Each item in memory
More informationCHAPTER 2 Data Representation in Computer Systems
CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.
UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive integer number (powers of ): DIGIT 3 4 5 6 7 8 9 Number:
More informationHexadecimal Numbers. Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those?
9/10/18 1 Binary and Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those? Hexadecimal Numbers Check Homework 3 Binary Numbers A binary (base-two) number
More information