EEE342 Digital Electronics Ian McCrumRoom 5B18, 02890366364 Lecture 2: Codes & Arithmetic.

Slides:



Advertisements
Similar presentations
Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Advertisements

HEXADECIMAL NUMBERS Code
Binary Addition Rules Adding Binary Numbers = = 1
EMB1006 The Binary System There is no 2 Jonathan-Lee Jones.
1 CSE1301 Computer Programming Lecture 29: Number Representation (Part 1)
Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
IT Systems Number Operations EN230-1 Justin Champion C208 –
Chapter 02 Binary Values and Number Systems Nell Dale & John Lewis.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Long multiplication Long division
Lecture 12: Computer Arithmetic Today’s topic –Numerical representations –Addition / Subtraction –Multiplication / Division 1.
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
Simple Data Type Representation and conversion of numbers
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Numeral Systems Subjects: Numeral System Positional systems Decimal
Chapter 7 Arithmetic Operations and Circuits Binary Arithmetic Addition –When the sum exceeds 1, carry a 1 over to the next-more-significant column.
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
Pharmacology I Math Review.
COM342 Networks and Data Communications
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
Number Representation. 10/12/2015CDA31002 Conversion between Representations Now we can represent a quantity in different number representations How can.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Number systems, Operations, and Codes
CSC 221 Computer Organization and Assembly Language
Positional Number Systems
Binary Values and Number Systems
ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.
Positional Notation 642 in base 10 positional notation is:
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Number Systems & Operations
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Addition and Substraction
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
1 4. Computer Maths and Logic 4.1 Number Systems.
Introduction To Number Systems Binary System M. AL-Towaileb1.
IT1004: Data Representation and Organization Negative number representation.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
Integer Operations Computer Organization and Assembly Language: Module 5.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Week 1(Number System) Muhammad Ammad uddin Logic Design Lab I (CEN211)
Digital Logic & Design Adil Waheed Lecture 02.
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
COMPUTING FUNDAMENTALS
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Binary Addition & Subtraction
SCIENTIFIC NOTATION.
Computer Organization and Design
Digital Logic & Design Lecture 02.
Computation in Other Bases
Unit 18: Computational Thinking
Binary to Decimal Conversion
Two’s Complement & Binary Arithmetic
Presentation transcript:

EEE342 Digital Electronics Ian McCrumRoom 5B18, Lecture 2: Codes & Arithmetic

Binary Arithmetic - Addition So which is ‘0’ and carry ‘1’ If you end up adding three ones then you get 11, which is a ‘1’ and a carry ‘1’ Remember to carry when you get a 2, not a ten = =

Binary arithmetic - Subtraction 3 So can’t do so borrow ‘1’ 1 E.G 1010 = = I.e, read this as 1 from 0 won’t go so 1 from 2 is 1 and carry 1, then we have 1 from 1 which is 0 then 1 from 0, can’t go so borrow 1. 1 from 2 is 0 and carry 1, last subtraction is 1 from 1, which is = 5 10

Binary Multiplication *0*1*0 *

Long Binary multiplication As for decimal, you add a zero (equivalent to shifting left one digit position, but since you only multiply by ‘1’ or by zero it becomes an addition problem 10100= = * 101= = = =

Binary Division ÷0÷1÷0 ÷

Binary Long Division Beware the Internet! There are actually two ways of doing “division” described on the net The conventional way A simple way that gives the wrong answer BUT it is consistent. It is used in cryptography to protect binary data - a process known as adding a CRC. This is a strange thing, we will not deal with it here. In calculating CRC and other cryptographic things we throw the answer away – it is only the remainder that is used! (not on course…) COM181 Computer Hardware:IMcC7

For decimal long division we subtract the divisor or a multiple of it, for binary this becomes simpler, we subtract the divisor or all zeroes, / = divide by is 10 rem Binary Long Division

Two’s complement There is NO subtraction in the two’s complement system You “take the two’s complement” of a number to change its sign You then add it (to subtract it!) i.e two numbers 5 and is actually 5 + (-3) so to subtract 3 from 5, take the two’s complement of 3 and add it to 5. 9

in a 4 bit two’s complement system The “weights” are (-8) (+4) (+2) and (+1) Hence 5 is 0101 and 3 is 0011 (-3) is (-8)+(4)+(1) = 1101 Adding 0101= =(-3) = +2 in two’s complement we ignore bits beyond the most significant bit. COM181 Computer Hardware:IMcC10

Alternative way to take the two’s complement E.g to convert 3 to -3. Write 3 in binary, at the correct length (4 bits in our example here, could be bigger) 0011 NOW INVERT THE BITS 1100 THIS GIVES THIS +1 NOW ADD ONE AS BEFORE. (inverting the bits is called taking the one’s complement) 11