A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Save this PDF as:

Size: px
Start display at page:

Download "A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation"

Transcription

1 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 are represented by two decimal digits: (00) 10c through (99) 10c This is a two digit, tens complement number system If (a) 10c + (b) 10c = 100, then the 2-digit, tens complement numbers (a) 10c and (b) 10c are negatives of one another In a 2-digit tens complement system, the overflow carry digit 1 is discarded Complement Number Systems Consider the examples: Carry Carry Carry By convention 34, 49, and 1 are all positive and represent their working values And, 66, 51, and 99 represent 34, 49, and 1 4-Bit Twos Complement Number System Consider a 4-bit twos complement number system of numbers That is, integers are represented by four bits: (0000) 2c through (1111) 2c 1

2 Complement Number Systems You can draw a graph that shows the relationship between complement numbers and their working decimal definitions Here s the graph of the 4-digit tens complement system decimal values A B C D 14 E 15 F complement numbers In this example, a working decimal value a is represented by the complement number a where { a if 0 a < 8 a = a + 16 if a < 0 Why Use Complement Number Systems? A complement number system make addition and subtraction easy to implement in hardware In fact, there no subtraction, just addition on integers (positive and negative whole numbers) Using the common signed-magnitude notation, computing a b when a b and when a < b requires different logic A good exercise is to write the logic for computing a b under these two conditions Tens Complement Notation Here are two examples of negatives in the tens complement numbers system 1 Let a = (67) 10c and b = (33) 10c be 2 digit, tens complement numbers Since a + b = = 100, (67) 10c and (33) 10c are negatives of each other The convention is (33) 10c = 33 and (67) 10c = 33 2 Let a = (048) 10c and b = (952) 10c be 3 digit, tens complement numbers Since a + b = = 1000, (048) 10c and (952) 10c are negatives of each other The convention is (048) 10c = 48 and (952) 10c = 48 2

3 Tens Complement Notation Using two digits: (00) 10 through (49) 10c are positive and represent their normal values While, (50) 10c through (99) 10c are negative and represent values 50 through 1 Using three digits: (000) 10 through (499) 10c are positive and have their normal values While, (500) 10c through (999) 10c are negative and have values 500 through 1 Tens Complement Notation The length of tens complement numbers can be padded Positive numbers can be padded with 0 s on the left This is because 34 = (34) 10c = (034) 10c = (0034) 10c = (00034) 10c Likewise, negative numbers can be padded with 9 s on the left 21 = (79) 10c = (974) 10c = (9979) 10c = (99979) 10c Twos Complement Notation Twos complement notation is interesting because computers most often store integers in twos complement notation The basic idea is identical to all notations The twos complement numbers (a) 2c and (b) 2c are negatives of one another if they sum to 0 For instance, Carries (a) 2c (b) 2c Sum In an 8-bit word, the last (ninth) overflow carry bit is discarded 3

4 Simple Test of Positive and Negative Twos Complement Numbers The most significant (leftmost) bit indicates if a twos complement number is positive or negative Small numbers, those with a leading 0, are positive and represent their normal values Large numbers, those with a leading 1, are negative and represent a negatively shifted value The amount of the negative shift depend on the size of the representation How to Negate a Twos Complement Number Algorithm 1 (Negating a Twos Complement Number) Given a twos complement number (a) 2c 1 Copy (a) 2c s bits from right-to-left up to and including the first 1 2 Flip the remaining bits in (a) 2c Examples of Negating Twos Complement Numbers Consider the examples: 1 The negative of ( ) 2c is ( ) 2c The least significant bits are copied up to and including the first 1 The remaining bits 100 are flipped to get The negative of ( ) 2c is ( ) 2c The least significant bits 100 are copied The remaining bits are flipped to get Converting a Twos Complement Number to Decimal Algorithm 2 (Conversion of Twos Complement to Decimal) Let (a) 2c be a twos complement number 1 If (a) 2c is not negative (if the most significant [leftmost] bit is 0) use Horner s rule to convert (a) 2c 2 If (a) 2c is not positive (if the most significant [leftmost] bit is 1) either: (a) use Horner s rule to convert (a) 2c and subtract 2 a from the result, or (b) Negate (a) 2c using the Negation Algorithm, use Horner s rule on the negative, and negate the result 4

5 Example: Twos Complement Number to Decimal Let a = ( ) 2c be a twos complement number Since a is positive (leftmost bit is 0) Simply use Horner s rule to convert a to decimal Horner s Rule Example: Twos Complement Number to Decimal Let a = ( ) 2c be a twos complement number Since a is negative (leftmost bit is 1) Negate a to get a = ( ) 2c Convert a using Horner s rule Horner s Rule Therefore, a = ( ) 2c = 36 Converting a Decimal to Twos Complement Algorithm 3 (Conversion of Decimal to Twos Complement) Let (a) 10 be a decimal number 1 If (a) 10 is positive (a) Use repeated remaindering to compute an unsigned binary (b) Append a leftmost 0 to the result 2 If (a) 10 is negative (a) Use repeated remaindering on a to compute an unsigned binary (b) Append a leftmost 0 to the result (c) Use the Negation Algorithm to negate the result 5

6 Example: Decimal to Twos Complement Notation Let a = +37 be decimal number Notice a = +37 is a signed integer You must account for the + sign in the twos complement representation of a First, use repeated remaindering to convert 37 to an unsigned binary 37 2 (18, 1) 37 = (9, 0) 37 = (4, 1) 37 = (2, 0) 37 = (1, 0) 37 = (0, 1) 37 = ( ) 2 Next, prepend a 0 to represent = ( ) 2c Example: Decimal to Twos Complement Notation Let a = 37 be decimal number Notice a = 37 is a signed integer You must account for the sign in the twos complement representation of a First, as in the previous slide, 37 to an unsigned binary: 37 = ( ) 2 Next, prepend a 0 to represent = ( ) 2c Lastly, use the Negation Algorithm do compute: 37 = ( ) 2c 6

4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017

4/8/17 Admin! Assignment 5 BINARY David Kauchak CS 52 Spring 2017 Diving into your computer Normal computer user 1 After intro CS After 5 weeks of cs52 What now One last note on CS52 memory address binary

1010 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

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

Signed Binary Numbers

Signed Binary Numbers Unsigned Binary Numbers We write numbers with as many digits as we need: 0, 99, 65536, 15000, 1979, However, memory locations and CPU registers always hold a constant, fixed number

Digital 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

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

Signed 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,

8/27/2016. ECE 120: Introduction to Computing. Graphical Illustration of Modular Arithmetic. Representations Must be Unambiguous

University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 120: Introduction to Computing Signed Integers and 2 s Complement Strategy: Use Common Hardware for Two Representations

Module 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

9/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

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

IT 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

CS/EE1012 INTRODUCTION TO COMPUTER ENGINEERING SPRING 2013 HOMEWORK I. Solve all homework and exam problems as shown in class and sample solutions

CS/EE2 INTRODUCTION TO COMPUTER ENGINEERING SPRING 23 DUE : February 22, 23 HOMEWORK I READ : Related portions of the following chapters : È Chapter È Chapter 2 È Appendix E ASSIGNMENT : There are eight

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

Computer Architecture and Organization

3-1 Chapter 3 - Arithmetic Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 3 Arithmetic 3-2 Chapter 3 - Arithmetic Chapter Contents 3.1 Fixed Point Addition and Subtraction

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

EE 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

Numbers and Representations

Çetin Kaya Koç http://koclab.cs.ucsb.edu/teaching/cs192 koc@cs.ucsb.edu Çetin Kaya Koç http://koclab.cs.ucsb.edu Fall 2016 1 / 38 Outline Computational Thinking Representations of integers Binary and decimal

COMP 122/L Lecture 2. Kyle Dewey

COMP 122/L Lecture 2 Kyle Dewey Outline Operations on binary values AND, OR, XOR, NOT Bit shifting (left, two forms of right) Addition Subtraction Twos complement Bitwise Operations Bitwise AND Similar

Chapter 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

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4-bit numbers 3 and 5 with the fast shift-add multipler. Use the table below. List the multiplicand (M) and product

Fundamentals of Programming Session 2

Fundamentals of Programming Session 2 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 Sharif University of Technology Outlines Programming Language Binary numbers Addition Subtraction

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

DRAM 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

CHAPTER 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

Chapter (1) Eng. Mai Z. Alyazji

THE ISLAMIC UNIVERSITY OF GAZA ENGINEERING FACULTY DEPARTMENT OF COMPUTER ENGINEERING DIGITAL LOGIC DESIGN DISCUSSION ECOM 2012 Chapter (1) Eng. Mai Z. Alyazji September, 2016 1.1 List the octal and hexadecimal

Principles of Computer Architecture. Chapter 3: Arithmetic

3-1 Chapter 3 - Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 3-2 Chapter 3 - Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition

10.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

C NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0.

C NUMERIC FORMATS Figure C-. Table C-. Listing C-. Overview The DSP supports the 32-bit single-precision floating-point data format defined in the IEEE Standard 754/854. In addition, the DSP supports an

Computer Arithmetic Ch 8

Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen

Arithmetic Operations on Binary Numbers

Arithmetic Operations on Binary Numbers Because of its widespread use, we will concentrate on addition and subtraction for Two's Complement representation. The nice feature with Two's Complement is that

Chapter 5: Computer Arithmetic

Slide 1/29 Learning Objectives Computer Fundamentals: Pradeep K. Sinha & Priti Sinha In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations

CHAPTER 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

Programming Studio #1 ECE 190

Programming Studio #1 ECE 190 Programming Studio #1 Announcements In Studio Assignment Introduction to Linux Command-Line Operations Recitation Floating Point Representation Binary & Hexadecimal 2 s Complement

Data Representation. DRAM 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 ( volts) and one for logic (3.3

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides 1 Boolean Algebra Developed by

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

Floating Point Arithmetic

Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi, Kai Zhao TAs: Annie Lin, Mohit Verma, Neha Mittal, Daniel Griffin, Yuzhe Ma Examination 1 In Class

CS101 Lecture 04: Binary Arithmetic

CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary

Logic, Words, and Integers

Computer Science 52 Logic, Words, and Integers 1 Words and Data The basic unit of information in a computer is the bit; it is simply a quantity that takes one of two values, 0 or 1. A sequence of k bits

CSCI 2212: Intermediate Programming / C Chapter 15

... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations

Arithmetic Operations

Arithmetic Operations Arithmetic Operations addition subtraction multiplication division Each of these operations on the integer representations: unsigned two's complement 1 Addition One bit of binary

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and

Floating Point Numbers

Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides

Five classic components

CS/COE0447: Computer Organization and Assembly Language Chapter 3 modified by Bruce Childers original slides by Sangyeun Cho Dept. of Computer Science Five classic components I am like a control tower

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

University of Wisconsin - Madison ECE/Comp Sci 352 Digital Systems Fundamentals Charles R. Kime Section 2 Fall 2001 Chapter 3 Combinational Logic Design Part 4 Charles Kime & Thomas Kaminski Complements

Octal & Hexadecimal Number Systems. Digital Electronics

Octal & Hexadecimal Number Systems Digital Electronics What, More Number Systems? Why do we need more number systems? Humans understand decimal Check out my ten digits! Digital electronics (computers)

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm Instructions: Show your work. Correct answers with no work will not receive full credit. Whether

CO 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

But first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15

Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?

Basic Arithmetic (adding and subtracting) Digital logic to show add/subtract Boolean algebra abstraction of physical, analog circuit behavior 1 0 CPU components ALU logic circuits logic gates transistors

Arithmetic and Logical Operations

Arithmetic and Logical Operations 2 CMPE2c x +y + sum Or in tabular form Binary Addition Carry Out Sum B A Carry In Binary Addition And as a full adder a b co ci sum 4-bit Ripple-Carry adder: Carry values

Number System (Different Ways To Say How Many) Fall 2016

Number System (Different Ways To Say How Many) Fall 2016 Introduction to Information and Communication Technologies CSD 102 Email: mehwish.fatima@ciitlahore.edu.pk Website: https://sites.google.com/a/ciitlahore.edu.pk/ict/

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

Points ddressed in this Lecture Lecture 6: Signed Numbers rithmetic Circuits Professor Peter Cheung Department of EEE, Imperial College London (Floyd 2.5-2.7, 6.1-6.7) (Tocci 6.1-6.11, 9.1-9.2, 9.4) Representing

CSC201, SECTION 002, Fall 2000: Homework Assignment #2

1 of 7 11/8/2003 7:34 PM CSC201, SECTION 002, Fall 2000: Homework Assignment #2 DUE DATE Monday, October 2, at the start of class. INSTRUCTIONS FOR PREPARATION Neat, in order, answers easy to find. Staple

Computer Arithmetic. L. Liu Department of Computer Science, ETH Zürich Fall semester, Reconfigurable Computing Systems ( L) Fall 2012

Reconfigurable Computing Systems (252-2210-00L) all 2012 Computer Arithmetic L. Liu Department of Computer Science, ETH Zürich all semester, 2012 Source: ixed-point arithmetic slides come from Prof. Jarmo

CPS 104 Computer Organization and Programming

CPS 104 Computer Organization and Programming Lecture 9: Integer Arithmetic. Robert Wagner CPS104 IMD.1 RW Fall 2000 Overview of Today s Lecture: Integer Multiplication and Division. Read Appendix B CPS104

Binary 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

Digital Fundamentals

Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

CODING and INFORMATION We need encodings for data. How many questions must be asked to be certain where the ball is. (cases: avg, worst, best) P( Hit 1st ) = 1/16 P( Hit 2nd ) = P( Hit 2nd Miss 1st )P(

COMP 303 Computer Architecture Lecture 6

COMP 303 Computer Architecture Lecture 6 MULTIPLY (unsigned) Paper and pencil example (unsigned): Multiplicand 1000 = 8 Multiplier x 1001 = 9 1000 0000 0000 1000 Product 01001000 = 72 n bits x n bits =

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

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 Computer Architecture What do computers do? Manipulate stored information

Name: CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1. Question Points I. /34 II. /30 III.

CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1 Name: Question Points I. /34 II. /30 III. /36 TOTAL: /100 Instructions: 1. This is a closed-book, closed-notes exam. 2. You

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems In everyday life, we humans most often count using decimal or base-10 numbers. In computer science, it

CHAPTER 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,

ELEC 326: Class project

ELEC 326: Class project Kartik Mohanram 1 Introduction For this project you will design and test a three-digit binary-coded-decimal (BCD) adder capable of adding positive and negative BCD numbers. In the

E40M. Binary Numbers, Codes. M. Horowitz, J. Plummer, R. Howe 1

E40M Binary Numbers, Codes M. Horowitz, J. Plummer, R. Howe 1 Reading Chapter 5 in the reader A&L 5.6 M. Horowitz, J. Plummer, R. Howe 2 Useless Box Lab Project #2 Adding a computer to the Useless Box

Data Types. Data Types. Integer Types. Signed Integers

Data Types Data Types Dr. TGI Fernando 1 2 The fundamental building blocks of any programming language. What is a data type? A data type is a set of values and a set of operations define on these values.

Floating Point Arithmetic

Floating Point Arithmetic Floating point numbers are frequently used in many applications. Implementation of arithmetic units such as adder, multiplier, etc for Floating point numbers are more complex

Xuan Guo. Lecture XIV: Review of Chapter 3 & 4. CSC 3210 Computer Organization and Programming Georgia State University. March 5, 2015.

CSC 3210 Computer Organization and Programming Georgia State University March 5, 2015 This lecture Plan for the lecture: Binary Hardware Device Converting from Decimal to other number system Converting

8/30/2016. In Binary, We Have A Binary Point. ECE 120: Introduction to Computing. Fixed-Point Representations Support Fractions

University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 120: Introduction to Computing Fixed- and Floating-Point Representations In Binary, We Have A Binary Point Let

UNIT IV: DATA PATH DESIGN

UNIT IV: DATA PATH DESIGN Agenda Introduc/on Fixed Point Arithme/c Addi/on Subtrac/on Mul/plica/on & Serial mul/plier Division & Serial Divider Two s Complement (Addi/on, Subtrac/on) Booth s algorithm

Register Transfer Language and Microoperations (Part 2)

Register Transfer Language and Microoperations (Part 2) Adapted by Dr. Adel Ammar Computer Organization 1 MICROOPERATIONS Computer system microoperations are of four types: Register transfer microoperations

Lesson 1: THE DECIMAL SYSTEM

Lesson 1: THE DECIMAL SYSTEM The word DECIMAL comes from a Latin word, which means "ten. The Decimal system uses the following ten digits to write a number: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each time

Brock Wilcox CS470 Homework Assignment 2

Brock Wilcox CS470 Homework Assignment 2 Please complete the following exercises from Chapter 2 of Patterson & Hennessy, Computer Organization & Design: The Hardware/Software Interface, Fourth Edition,

Arithmetic Logic Unit

Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,

Arithmetic Operators. Portability: Printing Numbers

Arithmetic Operators Normal binary arithmetic operators: + - * / Modulus or remainder operator: % x%y is the remainder when x is divided by y well defined only when x > 0 and y > 0 Unary operators: - +

ENE 334 Microprocessors

Page 1 ENE 334 Microprocessors Lecture 10: MCS-51: Logical and Arithmetic : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS-51 Logical & Arithmetic Page 2 Logical: Objectives

CS311 Lecture: Representing Information in Binary Last revised 8/2707

CS311 Lecture: Representing Information in Binary Last revised 8/2707 Objectives: 1. To review binary representation for unsigned integers 2. To introduce octal and hexadecimal shorthands 3. To review

= 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 base-0 system. When you

Number Systems & Encoding

Number Systems & Encoding Lecturer: Sri Parameswaran Author: Hui Annie Guo Modified: Sri Parameswaran Week2 1 Lecture overview Basics of computing with digital systems Binary numbers Floating point numbers

Lecture 13 Bit Operations

Lecture 13 Bit Operations C is a powerful language as it provides the programmer with many operations for bit manipulation. Data can be accessed at the bit level to make operations more efficient. As you

Electronics Engineering ECE / E & T

STUDENT COPY DIGITAL ELECTRONICS 1 SAMPLE STUDY MATERIAL Electronics Engineering ECE / E & T Postal Correspondence Course GATE, IES & PSUs Digital Electronics 2015 ENGINEERS INSTITUTE OF INDIA. All Rights

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits

Digital Electronics A Practical Approach with VHDL William Kleitz Ninth Edition

Digital Electronics A Practical Approach with VHDL William Kleitz Ninth Edition Pearson Education Limited Edinburgh Gate Harlow Essex CM20 2JE England and Associated Companies throughout the world Visit

Introduction To MIPS Assembly Language Programming

Gettysburg College Open Educational Resources 2015 Introduction To MIPS Assembly Language Programming Charles W. Kann Gettysburg College Follow this and additional works at: http://cupola.gettysburg.edu/oer

3.5 Floating Point: Overview

3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer

ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays

Assembly Programming Arrays Assembly Programming Arrays Array For Loop Example: unsigned short a[]; for(j=; j

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

Bits, Bytes and Integers

Bits, Bytes and Integers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran

IBM 370 Basic Data Types

IBM 370 Basic Data Types This lecture discusses the basic data types used on the IBM 370, 1. Two s complement binary numbers 2. EBCDIC (Extended Binary Coded Decimal Interchange Code) 3. Zoned Decimal

CS 241 Data Organization Binary

CS 241 Data Organization Binary Brooke Chenoweth University of New Mexico Fall 2017 Combinations and Permutations In English we use the word combination loosely, without thinking if the order of things

Floating Point Numbers. Lecture 9 CAP

Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers: